From 92487fe61cddbc791de1215d58ae53e8bef54c5a Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期一, 22 五月 2023 23:55:45 +0800 Subject: [PATCH] 提交基础版本 --- user/guns-admin/src/main/java/com/agentdriving/user/modular/api/AppUserController.java | 567 user/guns-admin/src/main/webapp/static/img/locked.png | 0 user/guns-admin/src/main/webapp/static/js/plugins/pace/pace.min.js | 2 user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/GunsUserFilter.java | 105 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPriceWarpper.java | 67 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/RoleDict.java | 31 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/AbstractTemplateEngine.java | 116 user/guns-admin/src/main/webapp/static/css/plugins/webuploader/webuploader.css | 30 user/guns-admin/src/main/java/com/agentdriving/user/core/common/aspect/ServiceLogAspect.java | 75 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/BizLogType.java | 51 user/guns-admin/src/main/webapp/static/js/common/bootstrap-table-object.js | 134 user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon-ext.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/EvaluateMapper.xml | 15 user/guns-core/src/main/java/com/agentdriving/user/core/cache/BaseCacheFactory.java | 49 user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.svg | 45 user/guns-admin/src/main/webapp/static/js/common/Feng.js | 196 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/TaskUtil.java | 71 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/RechargeRecord.java | 79 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Code2Session.java | 33 user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DynamicDataSource.java | 18 user/guns-core/src/main/java/com/agentdriving/user/core/support/CollectionKit.java | 801 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ServiceConfig.java | 91 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/MenuMapper.xml | 177 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DictMap.java | 24 user/guns-admin/src/main/java/com/agentdriving/user/config/SpringSessionConfig.java | 15 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SystemNoticeWarpper.java | 113 user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/Permission.java | 22 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.css | 28 user/guns-core/src/main/resources/META-INF/spring.factories | 6 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NoticeWrapper.java | 26 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/button.tag | 26 user/guns-admin/src/main/webapp/static/css/plugins/ztree/demo.css | 33 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/YouTuiDriver.java | 70 user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-treetable/bootstrap-treetable.css | 10 user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroDbRealm.java | 78 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ResponseWarpper.java | 49 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveGood.java | 48 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplateKeywords.java | 26 user/guns-admin/src/main/java/com/agentdriving/user/config/datasource/MultiDataSourceConfig.java | 125 user/guns-core/src/main/java/com/agentdriving/user/core/util/MD5Util.java | 39 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RelationServiceImpl.java | 20 user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.ttf | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RoleWarpper.java | 27 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DictWarpper.java | 36 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/OrderMapper.java | 41 user/guns-admin/src/main/java/com/agentdriving/user/core/common/exception/InvalidKaptchaException.java | 10 user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GunsErrorView.java | 26 user/guns-core/src/main/java/com/agentdriving/user/core/util/SqlUtil.java | 35 user/guns-admin/src/main/java/com/agentdriving/user/config/web/ShiroConfig.java | 214 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AppUserServiceImpl.java | 408 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/OperationLogMapper.xml | 46 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ReqEditManager.java | 60 user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/DruidProperties.java | 217 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DictMapper.java | 34 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/base/SystemDict.java | 20 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CouponServiceImpl.java | 11 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSAEncryptGeneration.java | 65 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/loading.gif | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RevenueMapper.java | 11 user/guns-core/src/main/java/com/agentdriving/user/core/cache/ICache.java | 40 user/guns-core/src/main/java/com/agentdriving/user/core/util/NumUtil.java | 89 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CouponMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IMenuService.java | 94 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplatetitles.java | 26 user/guns-admin/src/main/webapp/static/js/jquery.min.js | 4 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/SystemConfig.java | 33 user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role.html | 41 user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.eot | 0 user/guns-admin/src/main/java/com/agentdriving/user/core/aop/GlobalExceptionHandler.java | 121 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Transfer.java | 76 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/DeptController.java | 164 user/guns-core/src/main/java/com/agentdriving/user/core/qr/ImgQrTool.java | 294 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.min.js | 2 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDeptService.java | 33 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BalanceDetailsWarpper.java | 28 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/NameCon.tag | 14 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveUser.java | 27 user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScopeInterceptor.java | 82 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/Menu.java | 203 user/guns-admin/src/main/webapp/static/modular/system/notice/notice_info.js | 127 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/MenuServiceImpl.java | 90 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/StringUtil.java | 23 user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_add.html | 40 user/guns-admin/src/main/webapp/static/modular/system/log/log.js | 97 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/LoginLogServiceImpl.java | 28 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DeptMapper.xml | 37 user/guns-core/src/main/java/com/agentdriving/user/core/support/WafRequestWrapper.java | 149 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LoginWarpper.java | 58 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/base/AbstractDictMap.java | 53 user/guns-admin/src/main/webapp/static/img/girl.gif | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/OBSUtil.java | 43 user/guns-admin/src/main/webapp/static/js/common/select-list-object.js | 36 user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.ttf | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RechargeRecordMapper.xml | 19 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IComplaintService.java | 20 user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-2.gif | 0 user/guns-admin/src/main/java/com/agentdriving/user/core/util/Contrast.java | 211 user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff2 | 0 user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/MutiDataSourceProperties.java | 80 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RechargeRecordServiceImpl.java | 15 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/SqlConfig.java | 194 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/YouTuiDriverMapper.xml | 18 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/BroadcastMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Dict.java | 116 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AppUserMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICouponService.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/INoticeService.java | 23 user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultWebConfig.java | 65 user/guns-admin/src/main/resources/redis.properties | 30 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DeptServiceImpl.java | 47 user/guns-admin/src/main/webapp/static/js/plugins/slimscroll/jquery.slimscroll.min.js | 15 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/GunsTemplateEngine.java | 126 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCosts.java | 30 user/guns-admin/src/main/java/com/agentdriving/user/core/util/KaptchaUtil.java | 16 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/WeatherCityMapper.xml | 12 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IUserToCouponService.java | 61 user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/PermissionCheckFactory.java | 73 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CommercialMapper.java | 20 user/guns-core/src/main/java/com/agentdriving/user/core/aop/BaseControllerExceptionHandler.java | 45 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/EvaluateMapper.java | 11 user/guns-core/src/main/java/com/agentdriving/user/core/util/HttpSessionHolder.java | 26 user/guns-admin/src/main/java/com/agentdriving/user/GunsServletInitializer.java | 18 user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_add.html | 64 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.min.js | 3 user/guns-admin/src/main/webapp/static/modular/system/user/user_info.js | 290 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LogWarpper.java | 44 user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.svg | 640 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/ComplaintMapper.xml | 20 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/UserToCouponMapper.xml | 85 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPayment.java | 20 user/guns-admin/src/main/webapp/WEB-INF/view/system/log/login_log.html | 36 user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-3.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/ComplaintMapper.java | 11 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RegionMapper.xml | 26 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSASignature.java | 118 user/guns-core/src/main/java/com/agentdriving/user/core/support/HttpKit.java | 195 user/guns-admin/src/main/java/com/agentdriving/user/config/EhCacheConfig.java | 39 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DeptMapper.java | 31 user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultFastjsonConfig.java | 81 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXCore.java | 52 user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-table/bootstrap-table.min.css | 1 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CommercialUserEjectServiceImpl.java | 11 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DeptDict.java | 28 user/guns-admin/src/main/webapp/static/css/plugins/ztree/zTreeStyle.css | 97 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BaseWarpper.java | 171 user/guns-admin/src/main/webapp/static/js/plugins/wangEditor/wangEditor.js | 3967 ++ user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserWarpper.java | 29 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NearbyDriverWarpper.java | 21 user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user.html | 85 user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_edit.html | 42 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WeChatUtil.java | 415 user/guns-core/src/main/java/com/agentdriving/user/core/page/PageInfoBT.java | 41 user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsException.java | 36 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CancelOrderMapper.xml | 15 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_close.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Bill.java | 94 user/guns-admin/src/main/java/com/agentdriving/user/modular/api/BroadcastController.java | 57 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/UserDto.java | 153 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/HomeWarpper.java | 115 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/KaptchaController.java | 114 user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-1.gif | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/PlatformRechargeRecordMapper.xml | 16 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/Uploader.swf | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CommercialServiceImpl.java | 57 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/LocationQuery.java | 23 user/guns-admin/src/main/java/com/agentdriving/user/modular/code/service/TableService.java | 29 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PushUtil.java | 240 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/CommercialUserEject.java | 38 user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite.png | 0 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.js | 6502 +++ user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_add.html | 39 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Coupon.java | 95 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CommercialMapper.xml | 42 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml | 39 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Menu.java | 208 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/VersionWarpper.java | 84 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrder.java | 293 user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/BaseController.java | 127 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RevenueServiceImpl.java | 15 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/UserMapper.xml | 77 user/guns-admin/src/main/webapp/WEB-INF/view/common/_container.html | 71 user/guns-generator/src/main/java/com/agentdriving/user/generator/action/model/GenQo.java | 297 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ResultUtil.java | 187 user/guns-admin/src/main/webapp/static/modular/flowable/process/process.js | 77 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ActivityWarpper.java | 38 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/TravelOrder.java | 35 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/YouTuiDriverMapper.java | 7 user/guns-admin/src/main/webapp/static/css/login.css | 93 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/MenuOpenStatus.java | 50 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.min.js | 3 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/HashKit.java | 109 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DeptWarpper.java | 33 user/guns-generator/src/main/resources/gunsTemplate/advanced/page_info.js.btl | 98 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/7.png | 0 user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/WebGeneratorConfig.java | 97 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CouponMapper.xml | 23 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Commercial.java | 88 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PushOrderInfoWarpper.java | 30 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DriverWorkMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRechargeRecordService.java | 11 user/guns-admin/src/main/webapp/static/img/icons.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/User.java | 232 user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.ttf | 0 user/guns-admin/src/test/sql/test.sql | 35 user/guns-admin/src/main/webapp/static/css/plugins/validate/bootstrapValidator.min.css | 12 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/4.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IBroadcastService.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java | 48 user/guns-core/src/main/java/com/agentdriving/user/core/util/ToolUtil.java | 582 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/MainContentServiceImpl.java | 11 user/guns-core/src/main/java/com/agentdriving/user/core/support/StrKit.java | 1370 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/UrlEncoderUtils.java | 44 user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/need/layer.css | 1 user/guns-admin/src/main/java/com/agentdriving/user/core/tag/DictSelectorTag.java | 201 user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense_info.js | 96 user/guns-core/src/main/java/com/agentdriving/user/core/util/SpringContextHolder.java | 46 user/guns-admin/src/main/java/com/agentdriving/user/config/datasource/SingleDataSourceConfig.java | 61 user/guns-admin/src/main/java/com/agentdriving/user/modular/api/HtmlController.java | 105 user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite@2x.png | 0 user/guns-core/src/main/java/com/agentdriving/user/core/exception/ServiceExceptionEnum.java | 20 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/EvaluateServiceImpl.java | 15 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthIntercepter.java | 37 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/LoginLog.java | 128 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ALiSendSms.java | 123 user/guns-admin/src/main/webapp/static/js/plugins/ztree/jquery.ztree.all.min.js | 165 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthService.java | 49 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IYouTuiDriverService.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/AccountChangeDetail.java | 75 user/guns-core/src/main/java/com/agentdriving/user/core/support/exception/ToolBoxException.java | 45 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IEvaluateService.java | 11 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/SHA1.java | 61 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/select.tag | 22 user/guns-admin/src/main/webapp/static/img/bg.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/UUIDUtil.java | 99 user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_add.html | 42 user/guns-admin/src/main/java/com/agentdriving/user/modular/code/controller/CodeController.java | 61 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Revenue.java | 54 user/guns-admin/src/main/webapp/static/css/patterns/shattered.png | 0 user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GlobalController.java | 37 user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/factory/IShiro.java | 50 user/guns-admin/src/main/java/com/agentdriving/user/core/aop/PermissionAop.java | 70 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Order.java | 310 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/PlatformRechargeRecord.java | 58 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AgentServiceImpl.java | 15 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MoneyInfoWarpper.java | 229 user/guns-generator/src/main/resources/gunsTemplate/advanced/page.js.btl | 102 user/guns-admin/src/main/java/com/agentdriving/user/core/log/LogObjectHolder.java | 34 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DriverWorkServiceImpl.java | 17 user/guns-admin/src/main/resources/META-INF/spring-devtools.properties | 1 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ManagerUser.java | 97 user/guns-admin/src/main/java/com/agentdriving/user/GunsApplication.java | 84 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/table.tag | 12 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/tag_tips | 22 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CommercialUserEjectMapper.xml | 12 user/guns-admin/src/main/webapp/static/modular/system/menu/menu.js | 119 user/guns-core/src/main/java/com/agentdriving/user/core/util/ResKit.java | 38 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.min.js | 2 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/LoginLogMapper.xml | 41 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpResult.java | 31 user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_edit.html | 47 user/guns-admin/src/main/webapp/static/modular/system/code/code.js | 18 user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IHtmlService.java | 11 user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.eot | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Category.java | 18 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/6.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AesException.java | 59 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DriverMapper.xml | 55 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/MapConfig.java | 14 user/guns-admin/src/main/webapp/static/js/plugins/validate/additional-methods.min.js | 4 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/MutiStrFactory.java | 96 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/JGPushUtil.java | 92 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CommercialUserEjectMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AES.java | 72 user/guns-admin/src/main/webapp/static/modular/code/gen.js | 93 user/guns-core/src/main/java/com/agentdriving/user/core/node/ZTreeNode.java | 79 user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/ServiceLog.java | 23 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DriverInfoWarpper.java | 359 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IMainContentService.java | 7 user/guns-core/src/main/java/com/agentdriving/user/core/util/PingYinUtil.java | 206 user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_edit.html | 39 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/DaoConfig.java | 55 user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_chpwd.html | 34 user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_assign.html | 75 user/guns-admin/src/main/webapp/static/js/content.js | 98 user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon.png | 0 user/guns-core/src/main/java/com/agentdriving/user/core/cache/EhcacheFactory.java | 86 user/guns-admin/src/main/java/com/agentdriving/user/core/log/factory/LogFactory.java | 47 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/SelectCon.tag | 16 user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense.js | 93 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AgentMapper.java | 11 user/guns-admin/src/main/java/com/agentdriving/user/config/RedisConfig.java | 46 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/RedisUtil.java | 272 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/MenuStatus.java | 50 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/ConstantFactory.java | 335 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.min.js | 2 user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-1.png | 0 user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js | 7 user/guns-admin/src/main/webapp/static/css/style.css | 7897 +++ user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/MenuDict.java | 34 user/guns-core/src/main/java/com/agentdriving/user/core/cache/ILoader.java | 23 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/5.png | 0 user/guns-core/src/main/java/com/agentdriving/user/core/util/Convert.java | 1061 user/guns-admin/src/main/webapp/WEB-INF/view/common/_right.html | 53 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/avatar.tag | 29 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/CacheUtils.java | 39 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WxPKCS7Encoder.java | 63 user/guns-admin/src/main/webapp/WEB-INF/view/common/_theme.html | 84 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DeleteDict.java | 31 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/SystemConfigMapper.xml | 11 user/guns-admin/src/main/webapp/static/js/plugins/laydate/laydate.js | 2 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegister.java | 23 user/guns-core/src/main/java/com/agentdriving/user/core/base/warpper/BaseControllerWarpper.java | 38 user/guns-core/src/main/java/com/agentdriving/user/core/util/RenderUtil.java | 32 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDriverService.java | 23 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/JwtConstants.java | 19 user/guns-admin/src/main/webapp/WEB-INF/view/common/_tab.html | 74 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Complaint.java | 79 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/UserMgrController.java | 373 user/guns-admin/src/main/java/com/agentdriving/user/core/aop/LogAop.java | 105 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/Order.java | 26 user/guns-admin/src/main/java/com/agentdriving/user/core/log/LogManager.java | 33 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DriverServiceImpl.java | 90 user/guns-admin/src/main/webapp/static/modular/system/menu/menu_info.js | 175 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DivisionRecordServiceImpl.java | 15 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXBizMsgCrypt.java | 288 user/guns-admin/src/main/webapp/WEB-INF/view/system/code/code.html | 47 user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsExceptionEnum.java | 59 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RegisteredWarpper.java | 206 user/guns-admin/src/main/java/com/agentdriving/user/config/properties/GunsProperties.java | 103 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LoginLogController.java | 69 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Complete.java | 58 user/guns-core/src/main/java/com/agentdriving/user/core/db/Db.java | 108 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/9.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ISystemConfigService.java | 21 user/guns-admin/src/main/webapp/static/css/font-awesome.css | 2026 + user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/RestApiInteceptor.java | 66 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AgentMapper.xml | 21 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/OrderMapper.xml | 130 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/config/ChannelConfig.java | 60 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfoWarpper.java | 30 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GeodesyUtil.java | 73 user/guns-admin/src/main/webapp/static/js/plugins/validate/zh_CN.js | 370 user/guns-admin/src/main/webapp/static/modular/system/role/role.js | 125 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceResponse.java | 121 user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTime.java | 67 user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_edit.html | 43 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/model/District.java | 36 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/factory/DictFieldWarpperFactory.java | 33 user/guns-core/src/main/java/com/agentdriving/user/core/support/ObjectKit.java | 22 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/AppUser.java | 113 user/guns-admin/src/main/java/com/agentdriving/user/modular/api/ApiController.java | 80 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/Realtime.java | 40 user/guns-core/src/main/java/com/agentdriving/user/core/util/SimpleContrast.java | 58 user/guns-admin/src/main/java/com/agentdriving/user/modular/api/OrderController.java | 619 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/OperationLog.java | 154 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MenuWarpper.java | 28 user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DataSourceContextHolder.java | 35 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Dept.java | 140 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/IConstantFactory.java | 116 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderInfoWarpper.java | 59 user/guns-admin/src/main/webapp/WEB-INF/view/login.html | 70 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/StartPriceWarpper.java | 20 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CancelOrderMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ReqAddManager.java | 76 user/guns-admin/src/main/webapp/WEB-INF/view/index.html | 47 user/guns-admin/src/main/java/com/agentdriving/user/core/log/factory/LogTaskFactory.java | 102 user/guns-admin/src/main/webapp/static/css/bootstrap-rtl.css | 1468 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRoleService.java | 68 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RechargeRecordMapper.java | 11 user/guns-admin/src/main/webapp/static/js/jquery.min.map | 1 user/guns-admin/src/main/webapp/static/img/user.png | 0 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.fis.js | 8083 ++++ user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfo.java | 26 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICommercialUserEjectService.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/XMLParse.java | 71 user/guns-admin/src/main/webapp/static/modular/system/role/role_info.js | 194 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Agent.java | 105 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IWeatherCityService.java | 7 user/guns-admin/src/main/webapp/WEB-INF/view/system/log/log.html | 46 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PriceRulesWarpper.java | 20 user/guns-admin/src/main/java/com/agentdriving/user/config/web/BeetlConfig.java | 45 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/PageFactory.java | 38 user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/BussinessLog.java | 33 user/guns-admin/src/main/webapp/static/img/loading-upload.gif | 0 user/guns-admin/src/main/webapp/static/modular/system/dept/dept.js | 110 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/BillMapper.xml | 35 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderListWarpper.java | 28 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDriverWorkService.java | 7 user/guns-generator/src/main/resources/gunsTemplate/advanced/menu_sql.sql.btl | 3 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/MenuController.java | 244 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/2.png | 0 user/guns-core/src/main/java/com/agentdriving/user/core/support/ClassKit.java | 206 user/guns-admin/src/main/webapp/static/css/font-awesome.min.css | 4 user/guns-generator/src/main/resources/gunsTemplate/advanced/Controller.java.btl | 96 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/OperationLogMapper.java | 26 user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-0.gif | 0 user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/aop/MultiSourceExAop.java | 77 user/guns-admin/src/main/java/com/agentdriving/user/core/util/ApiMenuFilter.java | 36 user/guns-core/src/main/java/com/agentdriving/user/core/support/BasicType.java | 38 user/guns-admin/src/main/webapp/static/js/contabs.js | 339 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Relation.java | 75 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/8.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Driver.java | 255 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.gif | 0 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/line_conn.gif | 0 user/guns-admin/src/main/java/com/agentdriving/user/config/properties/BeetlProperties.java | 103 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/HtmlServiceImpl.java | 16 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceRequest.java | 176 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Html.java | 38 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IBillService.java | 37 user/guns-admin/src/main/webapp/static/js/plugins/validate/bootstrapValidator.min.js | 14 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/PlatformRechargeRecordMapper.java | 11 user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RoleServiceImpl.java | 73 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/UserToCouponServiceImpl.java | 79 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/SystemConfigMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAppUserService.java | 81 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Receive.java | 102 user/guns-admin/src/main/java/com/agentdriving/user/modular/api/MainContentController.java | 59 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/OrderServiceImpl.java | 1726 user/guns-admin/src/main/java/com/agentdriving/user/modular/code/factory/DefaultTemplateFactory.java | 61 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/YouTuiDriverServiceImpl.java | 16 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/BillServiceImpl.java | 81 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/TimeCon.tag | 15 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/KeywordEnum.java | 17 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/cache/Cache.java | 15 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrderGood.java | 48 user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen.css | 423 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/SMSUtil.java | 250 user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept.html | 38 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCostsWarpper.java | 24 user/guns-admin/src/main/webapp/static/modular/system/dict/dict_info.js | 118 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_open.png | 0 user/guns-admin/src/main/resources/logback-spring.xml | 228 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherCityInfo.java | 38 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/Invoicing.java | 30 user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/layer.css | 1 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DriverMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RoleMapper.java | 53 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RoleMapper.xml | 79 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICancelOrderService.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponWarpper.java | 26 user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.woff | 0 user/guns-admin/src/main/webapp/WEB-INF/view/404.html | 41 user/guns-core/src/main/java/com/agentdriving/user/core/support/WafKit.java | 114 user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/PermissionCheckManager.java | 50 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAccountChangeDetailService.java | 34 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/GeoJson.java | 9 user/guns-admin/src/main/java/com/agentdriving/user/config/SwaggerConfig.java | 47 user/guns-admin/src/main/java/com/agentdriving/user/core/beetl/BeetlConfiguration.java | 71 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DivisionRecordMapper.java | 11 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MD5AndKL.java | 112 user/guns-core/src/main/java/com/agentdriving/user/core/util/FileUtil.java | 73 user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/ICheck.java | 32 user/guns-admin/src/main/webapp/static/js/common/ajax-object.js | 66 user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssFilter.java | 42 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/3.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/DriverWork.java | 47 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.js | 8106 ++++ user/pom.xml | 252 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.js | 6030 +++ user/guns-core/src/main/java/com/agentdriving/user/core/support/HexKit.java | 254 user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu.html | 41 user/guns-admin/src/main/webapp/static/css/bootstrap.min.css | 6 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PamentOrderUser.java | 46 user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScope.java | 50 user/guns-admin/src/main/webapp/static/js/plugins/layer/layer.js | 2 user/guns-core/src/main/java/com/agentdriving/user/core/util/IdGenerator.java | 20 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IPlatformRechargeRecordService.java | 11 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IUserService.java | 46 user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.svg | 288 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ILoginLogService.java | 24 user/guns-core/src/main/resources/default-config.properties | 36 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IOrderService.java | 155 user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultMultiConfig.java | 22 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.js | 5026 ++ user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroUser.java | 81 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CancelOrderServiceImpl.java | 16 user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js | 7 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/ExpenseState.java | 52 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Broadcast.java | 45 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpClientUtil.java | 268 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/BroadcastServiceImpl.java | 16 user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_view.html | 75 user/guns-admin/src/main/webapp/static/modular/system/notice/notice.js | 106 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DriverWorkMapper.xml | 14 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherUtil.java | 119 user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/Tip.java | 29 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/LoginLogMapper.java | 27 user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_roleassign.html | 79 user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green@2x.png | 0 user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table.min.js | 8 user/guns-admin/src/main/resources/ehcache.xml | 57 user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff2 | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/MenuMapper.java | 80 user/guns-admin/src/main/webapp/static/img/boy.gif | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DictMapper.xml | 42 user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroKit.java | 290 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/factory/UserFactory.java | 54 user/guns-admin/src/main/webapp/static/js/common/DateUtils.js | 173 user/guns-admin/src/main/java/com/agentdriving/user/core/util/JwtTokenUtil.java | 127 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BillWarpper.java | 26 user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultProperties.java | 25 user/guns-admin/src/main/java/com/agentdriving/user/core/beetl/ShiroExt.java | 186 user/guns-admin/src/main/webapp/static/css/patterns/header-profile.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRevenueService.java | 11 user/guns-generator/src/main/java/com/agentdriving/user/generator/action/GunsCodeGenerator.java | 30 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/PlatformRechargeRecordServiceImpl.java | 15 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RelationMapper.xml | 12 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAgentService.java | 11 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.js | 8012 ++++ user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/factory/ShiroFactroy.java | 98 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/MainContentMapper.java | 7 user/guns-core/src/main/java/com/agentdriving/user/core/util/DateUtil.java | 250 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/NoticeController.java | 138 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RegionMapper.java | 12 user/guns-core/src/main/java/com/agentdriving/user/core/constant/IsMenu.java | 50 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/DateUtil.java | 135 user/guns-admin/src/main/webapp/static/modular/system/log/login_log.js | 113 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NotInvoiceOrder.java | 26 user/guns-admin/src/main/webapp/static/js/common/ztree-object.js | 94 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/NoticeServiceImpl.java | 27 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/UserToCoupon.java | 65 user/guns-admin/src/main/webapp/static/modular/system/dict/dict.js | 104 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Notice.java | 115 user/guns-generator/pom.xml | 35 user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_add.html | 63 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LoginController.java | 133 user/guns-admin/src/main/webapp/static/favicon.ico | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/DivisionRecord.java | 73 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/Configuration.java | 26 user/guns-admin/src/main/webapp/static/js/plugins/iCheck/icheck.min.js | 11 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/UserMapper.java | 45 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/WeatherCity.java | 38 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDictService.java | 48 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/Location.java | 50 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CommercialWarpper.java | 24 user/guns-admin/src/main/webapp/static/modular/system/dept/dept_info.js | 182 user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/SessionHolderInterceptor.java | 34 user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageWriter.java | 122 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/ComplaintServiceImpl.java | 48 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/HMACSHA1.java | 63 user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_edit.html | 60 user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/AbstractGeneratorConfig.java | 109 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/SystemException.java | 18 user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_edit.html | 86 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AccountChangeDetailMapper.java | 27 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PayMoneyUtil.java | 1196 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IOperationLogService.java | 24 user/guns-admin/src/main/webapp/static/css/plugins/iCheck/custom.css | 59 user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/annotion/DataSource.java | 18 user/guns-core/src/main/java/com/agentdriving/user/core/page/PageBT.java | 65 user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/GunsGeneratorConfig.java | 81 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/BroadcastMapper.xml | 13 user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageConfig.java | 62 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Role.java | 127 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/ByteGroup.java | 26 user/guns-admin/src/main/webapp/WEB-INF/view/code/code.html | 101 user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.png | 0 user/guns-admin/src/main/webapp/static/js/common/tree-table-object.js | 136 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/LogSucceed.java | 27 user/guns-admin/src/main/java/com/agentdriving/user/core/listener/ConfigListener.java | 54 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICommercialService.java | 23 user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-treetable/bootstrap-treetable.js | 308 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/WeatherCityServiceImpl.java | 11 user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_add.html | 47 user/guns-admin/src/main/webapp/static/js/plugins/metisMenu/jquery.metisMenu.js | 120 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/PageConfig.java | 74 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/MainContentMapper.xml | 13 user/guns-core/src/main/java/com/agentdriving/user/core/CoreFlag.java | 11 user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/ErrorTip.java | 16 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/NoticeMapper.java | 25 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/WeatherCityMapper.java | 7 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RevenueMapper.xml | 16 user/guns-core/pom.xml | 110 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/NoticeMap.java | 22 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/DatasourceEnum.java | 15 user/guns-core/src/main/java/com/agentdriving/user/core/support/BeanKit.java | 508 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/Const.java | 36 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LogController.java | 84 user/guns-admin/src/main/webapp/static/js/hplus.js | 294 user/guns-admin/src/main/webapp/static/fonts/FontAwesome.otf | 0 user/guns-admin/src/main/java/com/agentdriving/user/config/web/WebConfig.java | 174 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/UserDict.java | 36 user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js | 46 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/BillMapper.java | 25 user/guns-admin/src/main/webapp/static/js/common/web-upload-object.js | 126 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDivisionRecordService.java | 11 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/ManagerStatus.java | 49 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DivisionRecordMapper.xml | 19 user/guns-admin/src/main/webapp/static/js/plugins/chosen/chosen.jquery.js | 1211 user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/layer.js | 2 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/RoleController.java | 230 user/guns-core/src/main/java/com/agentdriving/user/core/cache/CacheKit.java | 59 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/MongoUtils.java | 166 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/BlackboardController.java | 35 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/DictController.java | 142 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/OperationLogServiceImpl.java | 28 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.min.js | 2 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ControllerConfig.java | 70 user/guns-admin/src/main/webapp/WEB-INF/view/blackboard.html | 14 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/UserToCouponMapper.java | 56 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/HtmlMapper.xml | 12 user/guns-admin/src/main/java/com/agentdriving/user/core/common/exception/BizExceptionEnum.java | 100 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/WithdrawalWarpper.java | 101 user/guns-admin/src/main/resources/application.yml | 153 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthenticationKit.java | 232 user/guns-admin/src/main/webapp/static/js/bootstrap.min.js | 7 user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.eot | 0 user/guns-core/src/main/java/com/agentdriving/user/core/qr/QrImage.java | 170 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/MainContent.java | 45 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/UserServiceImpl.java | 48 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/cache/CacheKey.java | 31 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/SystemConfigServiceImpl.java | 93 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/SimpleTemplateEngine.java | 70 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EditOrderEndAddress.java | 22 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRelationService.java | 16 user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green.png | 0 user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ContextConfig.java | 214 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponsWarpper.java | 24 user/guns-generator/src/main/resources/gunsTemplate/advanced/page_edit.html.btl | 41 user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssHttpServletRequestWrapper.java | 87 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.js | 4993 ++ user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RelationMapper.java | 16 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegisterWarpper.java | 20 user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/input.tag | 51 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Base64.java | 288 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.js | 4622 ++ user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/LogType.java | 30 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/MessageTemplate.java | 36 user/guns-generator/src/main/resources/gunsTemplate/advanced/page.html.btl | 38 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderEvaluateWarpper.java | 45 user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.min.js | 2 user/guns-admin/src/main/webapp/static/modular/system/user/user.js | 207 user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/LogDict.java | 22 user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTimeKit.java | 665 user/guns-core/src/main/java/com/agentdriving/user/core/support/PageKit.java | 57 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/HtmlMapper.java | 11 user/guns-admin/pom.xml | 271 user/guns-admin/src/main/webapp/static/css/_fstyle.css | 65 user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/laydate.css | 2 user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/SuccessTip.java | 15 user/guns-core/src/main/java/com/agentdriving/user/core/node/MenuNode.java | 238 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/MapUtil.java | 138 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/CancelOrder.java | 55 user/guns-admin/src/main/java/com/agentdriving/user/modular/api/CommercialController.java | 63 user/guns-admin/src/main/webapp/static/modular/flowable/process/process_info.js | 96 user/guns-generator/src/main/resources/gunsTemplate/advanced/page_add.html.btl | 41 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DictServiceImpl.java | 100 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/TrhRequest.java | 31 user/guns-admin/src/main/webapp/static/css/plugins/images/sprite-skin-flat.png | 0 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Region.java | 104 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Evaluate.java | 54 user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict.html | 38 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AppUserMapper.xml | 27 user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice.html | 38 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/NoticeMapper.xml | 23 user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/PKCS7Encoder.java | 67 659 files changed, 118,868 insertions(+), 0 deletions(-) diff --git a/user/guns-admin/pom.xml b/user/guns-admin/pom.xml new file mode 100644 index 0000000..4d63379 --- /dev/null +++ b/user/guns-admin/pom.xml @@ -0,0 +1,271 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.stylefeng</groupId> + <artifactId>guns-parent</artifactId> + <version>1.0.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>guns-admin</artifactId> + <name>guns-admin</name> + <description>guns 的spring boot版本</description> + + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> + </dependency> + <!--整合hystrix--> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> + </dependency> + <dependency> + <groupId>com.stylefeng</groupId> + <artifactId>guns-core</artifactId> + </dependency> + <dependency> + <groupId>com.stylefeng</groupId> + <artifactId>guns-generator</artifactId> + </dependency> + + <!--spring boot依赖--> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-aop</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-cache</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-validation</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <optional>true</optional> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>2.11.3</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>3.1.0</version> + <scope>provided</scope> + </dependency> + + <!--shiro依赖--> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-core</artifactId> + <exclusions> + <exclusion> + <artifactId>slf4j-api</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-spring</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-ehcache</artifactId> + <exclusions> + <exclusion> + <artifactId>slf4j-api</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.ehcache</groupId> + <artifactId>ehcache</artifactId> + </dependency> + + <dependency> + <groupId>redis.clients</groupId> + <artifactId>jedis</artifactId> + <version>2.9.0</version> + </dependency> + <dependency> + <groupId>com.github.penggle</groupId> + <artifactId>kaptcha</artifactId> + </dependency> + <dependency> + <groupId>com.google.zxing</groupId> + <artifactId>core</artifactId> + </dependency> + <dependency> + <groupId>com.ibeetl</groupId> + <artifactId>beetl</artifactId> + </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger2</artifactId> + </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger-ui</artifactId> + </dependency> + + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt</artifactId> + </dependency> + <dependency> + <groupId>redis.clients</groupId> + <artifactId>jedis</artifactId> + <version>2.9.0</version> + </dependency> + + <dependency> + <groupId>cn.jpush.api</groupId> + <artifactId>jpush-client</artifactId> + <version>3.3.10</version> + </dependency> + + <dependency> + <groupId>dom4j</groupId> + <artifactId>dom4j</artifactId> + <version>1.6.1</version> + </dependency> + + <dependency> + <groupId>com.alipay.sdk</groupId> + <artifactId>alipay-sdk-java</artifactId> + <version>4.8.10.ALL</version> + </dependency> + <!-- obs对象存储 --> + <dependency> + <groupId>com.huaweicloud</groupId> + <artifactId>esdk-obs-java-bundle</artifactId> + <version>[3.21.11,)</version> + </dependency> + <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core --> + <dependency> + <groupId>com.aliyun</groupId> + <artifactId>aliyun-java-sdk-core</artifactId> + <version>4.4.3</version> + </dependency> + + <!-- 计算两坐标间的直线距离 --> + <dependency> + <groupId>org.gavaghan</groupId> + <artifactId>geodesy</artifactId> + <version>1.1.3</version> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.20</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.13</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-mongodb</artifactId> + </dependency> + <dependency> + <groupId>cn.hutool</groupId> + <artifactId>hutool-all</artifactId> + <version>5.7.7</version> + </dependency> + + </dependencies> + + <build> + + <!--打包jar包方式--> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <fork>true</fork><!-- 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart --> + </configuration> + </plugin> + </plugins> + + <!--打包war包引入本地jar的打包方式--> + <!--<plugins>--> + <!--<plugin>--> + <!--<groupId>org.apache.maven.plugins</groupId>--> + <!--<artifactId>maven-war-plugin</artifactId>--> + <!--<configuration>--> + <!--<!– 设置成false,否则检查web.xml是否存在。因为springboot是没有web.xml的 –>--> + <!--<failOnMissingWebXml>false</failOnMissingWebXml>--> + <!--<!–打包后的项目名–>--> + <!--<!–<warName>example</warName>–>--> + <!--<webResources>--> + <!--<resource>--> + <!--<!–把本地lib里面的jar复制到lib–>--> + <!--<directory>${project.basedir}/lib</directory>--> + <!--<targetPath>WEB-INF/lib/</targetPath>--> + <!--<includes>--> + <!--<include>**/*.jar</include>--> + <!--</includes>--> + <!--</resource>--> + <!--</webResources>--> + <!--</configuration>--> + <!--</plugin>--> + <!--</plugins>--> + + + <resources> + <resource> + <directory>lib</directory> + <targetPath>/BOOT-INF/lib/</targetPath> + <includes> + <include>**/*.jar</include> + </includes> + </resource> + <resource> + <directory>src/main/webapp</directory> + </resource> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + <resource> + <directory>src/main/java</directory> + <includes> + <include>**/*.xml</include> + </includes> + </resource> + </resources> + </build> + +</project> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/GunsApplication.java b/user/guns-admin/src/main/java/com/agentdriving/user/GunsApplication.java new file mode 100644 index 0000000..7b442d9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/GunsApplication.java @@ -0,0 +1,84 @@ +package com.agentdriving.user; + +import org.apache.http.client.HttpClient; +import org.apache.http.config.SocketConfig; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.mybatis.spring.annotation.MapperScan; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.context.annotation.Bean; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.web.client.RestTemplate; + +import java.nio.charset.StandardCharsets; + +/** + * SpringBoot方式启动类 + * + * @author stylefeng + * @Date 2017/5/21 12:06 + */ +@EnableEurekaClient//注册为服务提供者 +@SpringBootApplication +@EnableScheduling//开启定时任务 +@EnableTransactionManagement//启动事务功能 +@MapperScan("com.agentdriving.user.modular.system.dao") +public class GunsApplication { + + private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); + + public static void main(String[] args) { + SpringApplication.run(GunsApplication.class, args); + logger.info("GunsApplication is success!"); + } + + + @Bean //SpringCloud内部服务质检使用服务名调用 + @LoadBalanced + public RestTemplate internalRestTemplate() { + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); + connectionManager.setDefaultSocketConfig(SocketConfig.custom().setTcpNoDelay(true).build()); + connectionManager.setDefaultMaxPerRoute(100);//最大并发连接 + connectionManager.setMaxTotal(200); // 总的最大连接数 + HttpClient httpClient = HttpClientBuilder.create().setConnectionManager(connectionManager).build(); + HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); + httpRequestFactory.setConnectionRequestTimeout(30 * 1000); + httpRequestFactory.setConnectTimeout(30 * 3000); + httpRequestFactory.setReadTimeout(30 * 3000); + RestTemplate restTemplate = new RestTemplate(httpRequestFactory); + restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); + return restTemplate; + } + + + + /** + * 向Spring容器中定义RestTemplate对象 + * @return + */ + @Bean //必须new 一个RestTemplate并放入spring容器当中,否则启动时报错 + public RestTemplate restTemplate() { + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); + connectionManager.setDefaultSocketConfig(SocketConfig.custom().setTcpNoDelay(true).build()); + connectionManager.setDefaultMaxPerRoute(100);//最大并发连接 + connectionManager.setMaxTotal(200); // 总的最大连接数 + HttpClient httpClient = HttpClientBuilder.create().setConnectionManager(connectionManager).build(); + HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); + httpRequestFactory.setConnectionRequestTimeout(30 * 1000); + httpRequestFactory.setConnectTimeout(30 * 3000); + httpRequestFactory.setReadTimeout(30 * 3000); + RestTemplate restTemplate = new RestTemplate(httpRequestFactory); + restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); + return restTemplate; + } + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/GunsServletInitializer.java b/user/guns-admin/src/main/java/com/agentdriving/user/GunsServletInitializer.java new file mode 100644 index 0000000..295b405 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/GunsServletInitializer.java @@ -0,0 +1,18 @@ +package com.agentdriving.user; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * Guns Web程序启动类 + * + * @author fengshuonan + * @date 2017-05-21 9:43 + */ +public class GunsServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + return builder.sources(GunsApplication.class); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/EhCacheConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/EhCacheConfig.java new file mode 100644 index 0000000..8d75ada --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/EhCacheConfig.java @@ -0,0 +1,39 @@ +package com.agentdriving.user.config; + +import net.sf.ehcache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.ehcache.EhCacheCacheManager; +import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; + +/** + * ehcache配置 + * + * @author fengshuonan + * @date 2017-05-20 23:11 + */ +@Configuration +@EnableCaching +public class EhCacheConfig { + + /** + * EhCache的配置 + */ + @Bean + public EhCacheCacheManager cacheManager(CacheManager cacheManager) { + return new EhCacheCacheManager(cacheManager); + } + + /** + * EhCache的配置 + */ + @Bean + public EhCacheManagerFactoryBean ehcache() { + EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); + ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml")); + ehCacheManagerFactoryBean.setShared(true);//共享缓存,避免tomcat启动报错 + return ehCacheManagerFactoryBean; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/RedisConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/RedisConfig.java new file mode 100644 index 0000000..b2eed39 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/RedisConfig.java @@ -0,0 +1,46 @@ +package com.agentdriving.user.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import redis.clients.jedis.JedisPool; +import redis.clients.jedis.JedisPoolConfig; + +@Configuration +@PropertySource("classpath:redis.properties") +public class RedisConfig { + @Value("${spring.redis.host}") + private String host; + + @Value("${spring.redis.port}") + private int port; + + @Value("${spring.redis.timeout}") + private int timeout; + + @Value("${spring.redis.jedis.pool.max-idle}") + private int maxIdle; + + @Value("${spring.redis.jedis.pool.max-wait}") + private long maxWaitMillis; + + @Value("${spring.redis.password}") + private String password; + + @Value("${spring.redis.block-when-exhausted}") + private boolean blockWhenExhausted; + + @Bean + public JedisPool redisPoolFactory() throws Exception{ + JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); + jedisPoolConfig.setMaxIdle(maxIdle); + jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); + // 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true + jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted); + // 是否启用pool的jmx管理功能, 默认true + jedisPoolConfig.setJmxEnabled(true); + JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password); + return jedisPool; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/SpringSessionConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/SpringSessionConfig.java new file mode 100644 index 0000000..587905a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/SpringSessionConfig.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.config; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; + +/** + * spring session配置 + * + * @author fengshuonan + * @date 2017-07-13 21:05 + */ +//@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 1800) //session过期时间 如果部署多机环境,需要打开注释 +@ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") +public class SpringSessionConfig { + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/SwaggerConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/SwaggerConfig.java new file mode 100644 index 0000000..c455eda --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/SwaggerConfig.java @@ -0,0 +1,47 @@ +package com.agentdriving.user.config; + +import io.swagger.annotations.ApiOperation; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * swagger配置类 + * + * @author fengshuonan + * @date 2017年6月1日19:42:59 + */ +@Configuration +@EnableSwagger2 +@ConditionalOnProperty(prefix = "guns", name = "swagger-open", havingValue = "true") +public class SwaggerConfig{ + + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) //这里采用包含注解的方式来确定要显示的接口 + //.apis(RequestHandlerSelectors.basePackage("com.agentdriving.user.modular.system.controller")) //这里采用包扫描的方式来确定要显示的接口 + .paths(PathSelectors.any()) + .build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("超省新代驾") + .description("所有接口前需要加 /user 前缀,例如:/user/base/agreement/queryByType <br>所有以 /api/*** 路径的接口需要上传签名参数sign") +// .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") + .contact("stylefeng") + .version("1.0") + .build(); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/datasource/MultiDataSourceConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/datasource/MultiDataSourceConfig.java new file mode 100644 index 0000000..0550f72 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/datasource/MultiDataSourceConfig.java @@ -0,0 +1,125 @@ +package com.agentdriving.user.config.datasource; + +import com.agentdriving.user.core.mutidatasource.aop.MultiSourceExAop; +import com.alibaba.druid.pool.DruidDataSource; +import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; +import com.baomidou.mybatisplus.plugins.PaginationInterceptor; +import com.agentdriving.user.core.config.properties.DruidProperties; +import com.agentdriving.user.core.config.properties.MutiDataSourceProperties; +import com.agentdriving.user.core.datascope.DataScopeInterceptor; +import com.agentdriving.user.core.mutidatasource.DynamicDataSource; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import java.sql.SQLException; +import java.util.HashMap; + +/** + * 多数据源配置<br/> + * <p> + * 注:由于引入多数据源,所以让spring事务的aop要在多数据源切换aop的后面 + * + * @author stylefeng + * @Date 2017/5/20 21:58 + */ +@Configuration +@ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "true") +@EnableTransactionManagement(order = 2) +@MapperScan(basePackages = {"com.agentdriving.user.modular.*.dao","com.agentdriving.user.multi.mapper"}) +public class MultiDataSourceConfig { + + @Bean + @ConfigurationProperties(prefix = "guns.muti-datasource") + public MutiDataSourceProperties mutiDataSourceProperties() { + return new MutiDataSourceProperties(); + } + + @Bean + public MultiSourceExAop multiSourceExAop() { + return new MultiSourceExAop(); + } + + /** + * guns的数据源 + */ + private DruidDataSource dataSource(DruidProperties druidProperties) { + DruidDataSource dataSource = new DruidDataSource(); + druidProperties.config(dataSource); + return dataSource; + } + + /** + * 多数据源,第二个数据源 + */ + private DruidDataSource bizDataSource(DruidProperties druidProperties, MutiDataSourceProperties mutiDataSourceProperties) { + DruidDataSource dataSource = new DruidDataSource(); + druidProperties.config(dataSource); + mutiDataSourceProperties.config(dataSource); + return dataSource; + } + + /** + * 多数据源连接池配置 + */ + @Bean + public DynamicDataSource mutiDataSource(DruidProperties druidProperties, MutiDataSourceProperties mutiDataSourceProperties) { + + DruidDataSource dataSourceGuns = dataSource(druidProperties); + DruidDataSource bizDataSource = bizDataSource(druidProperties, mutiDataSourceProperties); + + try { + dataSourceGuns.init(); + bizDataSource.init(); + } catch (SQLException sql) { + sql.printStackTrace(); + } + + DynamicDataSource dynamicDataSource = new DynamicDataSource(); + HashMap<Object, Object> hashMap = new HashMap<>(); + hashMap.put(mutiDataSourceProperties.getDataSourceNames()[0], dataSourceGuns); + hashMap.put(mutiDataSourceProperties.getDataSourceNames()[1], bizDataSource); + dynamicDataSource.setTargetDataSources(hashMap); + dynamicDataSource.setDefaultTargetDataSource(dataSourceGuns); + return dynamicDataSource; + } + + /** + * mybatis-plus分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } + + /** + * 数据范围mybatis插件 + */ + @Bean + public DataScopeInterceptor dataScopeInterceptor() { + return new DataScopeInterceptor(); + } + + /** + * 乐观锁mybatis插件 + */ + @Bean + public OptimisticLockerInterceptor optimisticLockerInterceptor() { + return new OptimisticLockerInterceptor(); + } + + /** + * 事务配置 + * + * @author stylefeng + * @Date 2018/6/27 23:11 + */ + @Bean + public DataSourceTransactionManager dataSourceTransactionManager(DynamicDataSource mutiDataSource) { + return new DataSourceTransactionManager(mutiDataSource); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/datasource/SingleDataSourceConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/datasource/SingleDataSourceConfig.java new file mode 100644 index 0000000..f53db36 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/datasource/SingleDataSourceConfig.java @@ -0,0 +1,61 @@ +package com.agentdriving.user.config.datasource; + +import com.alibaba.druid.pool.DruidDataSource; +import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; +import com.baomidou.mybatisplus.plugins.PaginationInterceptor; +import com.agentdriving.user.core.config.properties.DruidProperties; +import com.agentdriving.user.core.datascope.DataScopeInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * 多数据源配置 + * + * @author stylefeng + * @Date 2017/5/20 21:58 + */ +@Configuration +@ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "false", matchIfMissing = true) +@EnableTransactionManagement +@MapperScan(basePackages = {"com.agentdriving.user.modular.*.dao"}) +public class SingleDataSourceConfig { + + /** + * 单数据源连接池配置 + */ + @Bean + public DruidDataSource dataSource(DruidProperties druidProperties) { + DruidDataSource dataSource = new DruidDataSource(); + druidProperties.config(dataSource); + return dataSource; + } + + /** + * mybatis-plus分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } + + /** + * 数据范围mybatis插件 + */ + @Bean + public DataScopeInterceptor dataScopeInterceptor() { + return new DataScopeInterceptor(); + } + + /** + * 乐观锁mybatis插件 + */ + @Bean + public OptimisticLockerInterceptor optimisticLockerInterceptor() { + return new OptimisticLockerInterceptor(); + } + +} + diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/properties/BeetlProperties.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/properties/BeetlProperties.java new file mode 100644 index 0000000..12edb56 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/properties/BeetlProperties.java @@ -0,0 +1,103 @@ +package com.agentdriving.user.config.properties; + +import com.agentdriving.user.core.util.ToolUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import java.util.Properties; + +/** + * beetl配置(如果需要配置别的配置可参照这个形式自己添加) + * + * @author fengshuonan + * @date 2017-05-24 20:37 + */ +@Configuration +@ConfigurationProperties(prefix = BeetlProperties.BEETLCONF_PREFIX) +public class BeetlProperties { + + public static final String BEETLCONF_PREFIX = "beetl"; + + private String delimiterStatementStart; + + private String delimiterStatementEnd; + + private String resourceTagroot; + + private String resourceTagsuffix; + + private String resourceAutoCheck; + + @Value("${spring.mvc.view.prefix}") + private String prefix; + + public Properties getProperties(){ + Properties properties = new Properties(); + if(ToolUtil.isNotEmpty(delimiterStatementStart)){ + if(delimiterStatementStart.startsWith("\\")){ + delimiterStatementStart = delimiterStatementStart.substring(1); + } + properties.setProperty("DELIMITER_STATEMENT_START",delimiterStatementStart); + } + if(ToolUtil.isNotEmpty(delimiterStatementEnd)){ + properties.setProperty("DELIMITER_STATEMENT_END",delimiterStatementEnd); + }else{ + properties.setProperty("DELIMITER_STATEMENT_END","null"); + } + if(ToolUtil.isNotEmpty(resourceTagroot)){ + properties.setProperty("RESOURCE.tagRoot",resourceTagroot); + } + if(ToolUtil.isNotEmpty(resourceTagsuffix)){ + properties.setProperty("RESOURCE.tagSuffix",resourceTagsuffix); + } + if(ToolUtil.isNotEmpty(resourceAutoCheck)){ + properties.setProperty("RESOURCE.autoCheck",resourceAutoCheck); + } + return properties; + } + + public String getPrefix() { + return prefix; + } + + public String getDelimiterStatementStart() { + return delimiterStatementStart; + } + + public void setDelimiterStatementStart(String delimiterStatementStart) { + this.delimiterStatementStart = delimiterStatementStart; + } + + public String getDelimiterStatementEnd() { + return delimiterStatementEnd; + } + + public void setDelimiterStatementEnd(String delimiterStatementEnd) { + this.delimiterStatementEnd = delimiterStatementEnd; + } + + public String getResourceTagroot() { + return resourceTagroot; + } + + public void setResourceTagroot(String resourceTagroot) { + this.resourceTagroot = resourceTagroot; + } + + public String getResourceTagsuffix() { + return resourceTagsuffix; + } + + public void setResourceTagsuffix(String resourceTagsuffix) { + this.resourceTagsuffix = resourceTagsuffix; + } + + public String getResourceAutoCheck() { + return resourceAutoCheck; + } + + public void setResourceAutoCheck(String resourceAutoCheck) { + this.resourceAutoCheck = resourceAutoCheck; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/properties/GunsProperties.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/properties/GunsProperties.java new file mode 100644 index 0000000..94c84e8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/properties/GunsProperties.java @@ -0,0 +1,103 @@ +package com.agentdriving.user.config.properties; + +import com.agentdriving.user.core.util.ToolUtil; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.io.File; + +/** + * guns项目配置 + * + * @author stylefeng + * @Date 2017/5/23 22:31 + */ +@Component +@ConfigurationProperties(prefix = GunsProperties.PREFIX) +public class GunsProperties { + + public static final String PREFIX = "guns"; + + private Boolean kaptchaOpen = false; + + private Boolean swaggerOpen = false; + + private String fileUploadPath; + + private Boolean haveCreatePath = false; + + private Boolean springSessionOpen = false; + + /** + * session 失效时间(默认为30分钟 单位:秒) + */ + private Integer sessionInvalidateTime = 30 * 60; + + /** + * session 验证失效时间(默认为15分钟 单位:秒) + */ + private Integer sessionValidationInterval = 15 * 60; + + public String getFileUploadPath() { + //如果没有写文件上传路径,保存到临时目录 + if (ToolUtil.isEmpty(fileUploadPath)) { + return ToolUtil.getTempPath(); + } else { + //判断有没有结尾符,没有得加上 + if (!fileUploadPath.endsWith(File.separator)) { + fileUploadPath = fileUploadPath + File.separator; + } + //判断目录存不存在,不存在得加上 + if (!haveCreatePath) { + File file = new File(fileUploadPath); + file.mkdirs(); + haveCreatePath = true; + } + return fileUploadPath; + } + } + + public void setFileUploadPath(String fileUploadPath) { + this.fileUploadPath = fileUploadPath; + } + + public Boolean getKaptchaOpen() { + return kaptchaOpen; + } + + public void setKaptchaOpen(Boolean kaptchaOpen) { + this.kaptchaOpen = kaptchaOpen; + } + + public Boolean getSwaggerOpen() { + return swaggerOpen; + } + + public void setSwaggerOpen(Boolean swaggerOpen) { + this.swaggerOpen = swaggerOpen; + } + + public Boolean getSpringSessionOpen() { + return springSessionOpen; + } + + public void setSpringSessionOpen(Boolean springSessionOpen) { + this.springSessionOpen = springSessionOpen; + } + + public Integer getSessionInvalidateTime() { + return sessionInvalidateTime; + } + + public void setSessionInvalidateTime(Integer sessionInvalidateTime) { + this.sessionInvalidateTime = sessionInvalidateTime; + } + + public Integer getSessionValidationInterval() { + return sessionValidationInterval; + } + + public void setSessionValidationInterval(Integer sessionValidationInterval) { + this.sessionValidationInterval = sessionValidationInterval; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/web/BeetlConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/web/BeetlConfig.java new file mode 100644 index 0000000..d8c0597 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/web/BeetlConfig.java @@ -0,0 +1,45 @@ +package com.agentdriving.user.config.web; + +import com.agentdriving.user.config.properties.BeetlProperties; +import com.agentdriving.user.core.beetl.BeetlConfiguration; +import org.beetl.core.resource.ClasspathResourceLoader; +import org.beetl.ext.spring.BeetlSpringViewResolver; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * web 配置类 + * + * @author fengshuonan + * @date 2016年11月12日 下午5:03:32 + */ +@Configuration +public class BeetlConfig { + + @Autowired + BeetlProperties beetlProperties; + + /** + * beetl的配置 + */ + @Bean(initMethod = "init") + public BeetlConfiguration beetlConfiguration() { + BeetlConfiguration beetlConfiguration = new BeetlConfiguration(); + beetlConfiguration.setResourceLoader(new ClasspathResourceLoader(BeetlConfig.class.getClassLoader(), beetlProperties.getPrefix())); + beetlConfiguration.setConfigProperties(beetlProperties.getProperties()); + return beetlConfiguration; + } + + /** + * beetl的视图解析器 + */ + @Bean + public BeetlSpringViewResolver beetlViewResolver() { + BeetlSpringViewResolver beetlSpringViewResolver = new BeetlSpringViewResolver(); + beetlSpringViewResolver.setConfig(beetlConfiguration()); + beetlSpringViewResolver.setContentType("text/html;charset=UTF-8"); + beetlSpringViewResolver.setOrder(0); + return beetlSpringViewResolver; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/web/ShiroConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/web/ShiroConfig.java new file mode 100644 index 0000000..b5a6245 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/web/ShiroConfig.java @@ -0,0 +1,214 @@ +package com.agentdriving.user.config.web; + +import com.agentdriving.user.config.properties.GunsProperties; +import com.agentdriving.user.core.intercept.GunsUserFilter; +import com.agentdriving.user.core.shiro.ShiroDbRealm; +import org.apache.shiro.cache.CacheManager; +import org.apache.shiro.cache.ehcache.EhCacheManager; +import org.apache.shiro.codec.Base64; +import org.apache.shiro.session.mgt.SessionManager; +import org.apache.shiro.spring.LifecycleBeanPostProcessor; +import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; +import org.apache.shiro.spring.web.ShiroFilterFactoryBean; +import org.apache.shiro.web.mgt.CookieRememberMeManager; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.shiro.web.servlet.Cookie; +import org.apache.shiro.web.servlet.ShiroHttpSession; +import org.apache.shiro.web.servlet.SimpleCookie; +import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; +import org.apache.shiro.web.session.mgt.ServletContainerSessionManager; +import org.springframework.beans.factory.config.MethodInvokingFactoryBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.Filter; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * shiro权限管理的配置 + * + * @author fengshuonan + * @date 2016年11月14日 下午3:03:44 + */ +@Configuration +public class ShiroConfig { + + /** + * 安全管理器 + */ + @Bean + public DefaultWebSecurityManager securityManager(CookieRememberMeManager rememberMeManager, CacheManager cacheShiroManager, SessionManager sessionManager) { + DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); + securityManager.setRealm(this.shiroDbRealm()); + securityManager.setCacheManager(cacheShiroManager); + securityManager.setRememberMeManager(rememberMeManager); + securityManager.setSessionManager(sessionManager); + return securityManager; + } + + /** + * spring session管理器(多机环境) + */ + @Bean + @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") + public ServletContainerSessionManager servletContainerSessionManager() { + return new ServletContainerSessionManager(); + } + + /** + * session管理器(单机环境) + */ + @Bean + @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "false") + public DefaultWebSessionManager defaultWebSessionManager(CacheManager cacheShiroManager, GunsProperties gunsProperties) { + DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); + sessionManager.setCacheManager(cacheShiroManager); + sessionManager.setSessionValidationInterval(gunsProperties.getSessionValidationInterval() * 1000); + sessionManager.setGlobalSessionTimeout(gunsProperties.getSessionInvalidateTime() * 1000); + sessionManager.setDeleteInvalidSessions(true); + sessionManager.setSessionValidationSchedulerEnabled(true); + Cookie cookie = new SimpleCookie(ShiroHttpSession.DEFAULT_SESSION_ID_NAME); + cookie.setName("shiroCookie"); + cookie.setHttpOnly(true); + sessionManager.setSessionIdCookie(cookie); + return sessionManager; + } + + /** + * 缓存管理器 使用Ehcache实现 + */ + @Bean + public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) { + EhCacheManager ehCacheManager = new EhCacheManager(); + ehCacheManager.setCacheManager(ehcache.getObject()); + return ehCacheManager; + } + + /** + * 项目自定义的Realm + */ + @Bean + public ShiroDbRealm shiroDbRealm() { + return new ShiroDbRealm(); + } + + /** + * rememberMe管理器, cipherKey生成见{@code Base64Test.java} + */ + @Bean + public CookieRememberMeManager rememberMeManager(SimpleCookie rememberMeCookie) { + CookieRememberMeManager manager = new CookieRememberMeManager(); + manager.setCipherKey(Base64.decode("Z3VucwAAAAAAAAAAAAAAAA==")); + manager.setCookie(rememberMeCookie); + return manager; + } + + /** + * 记住密码Cookie + */ + @Bean + public SimpleCookie rememberMeCookie() { + SimpleCookie simpleCookie = new SimpleCookie("rememberMe"); + simpleCookie.setHttpOnly(true); + simpleCookie.setMaxAge(7 * 24 * 60 * 60);//7天 + return simpleCookie; + } + + /** + * Shiro的过滤器链 + */ + @Bean + public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityManager) { + ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean(); + shiroFilter.setSecurityManager(securityManager); + /** + * 默认的登陆访问url + */ + shiroFilter.setLoginUrl("/login"); + /** + * 登陆成功后跳转的url + */ + shiroFilter.setSuccessUrl("/"); + /** + * 没有权限跳转的url + */ + shiroFilter.setUnauthorizedUrl("/global/error"); + + /** + * 覆盖默认的user拦截器(默认拦截器解决不了ajax请求 session超时的问题,若有更好的办法请及时反馈作者) + */ + HashMap<String, Filter> myFilters = new HashMap<>(); + myFilters.put("user", new GunsUserFilter()); + shiroFilter.setFilters(myFilters); + + /** + * 配置shiro拦截器链 + * + * anon 不需要认证 + * authc 需要认证 + * user 验证通过或RememberMe登录的都可以 + * + * 当应用开启了rememberMe时,用户下次访问时可以是一个user,但不会是authc,因为authc是需要重新认证的 + * + * 顺序从上到下,优先级依次降低 + * + * api开头的接口,走rest api鉴权,不走shiro鉴权 + * + */ + Map<String, String> hashMap = new LinkedHashMap<>(); + hashMap.put("/swagger-ui.html", "anon"); + hashMap.put("/swagger-resources/**", "anon"); + hashMap.put("/v2/**", "anon"); + hashMap.put("/webjars/**", "anon"); + hashMap.put("/swagger-resources/configuration/ui/**", "anon"); + hashMap.put("/swagger-resources/configuration/security/**", "anon"); + + hashMap.put("/base/**", "anon"); + hashMap.put("/api/**", "anon"); + hashMap.put("/static/**", "anon"); + hashMap.put("/gunsApi/**", "anon"); + hashMap.put("/login", "anon"); + hashMap.put("/global/sessionError", "anon"); + hashMap.put("/kaptcha", "anon"); + hashMap.put("/**", "user"); + shiroFilter.setFilterChainDefinitionMap(hashMap); + return shiroFilter; + } + + /** + * 在方法中 注入 securityManager,进行代理控制 + */ + @Bean + public MethodInvokingFactoryBean methodInvokingFactoryBean(DefaultWebSecurityManager securityManager) { + MethodInvokingFactoryBean bean = new MethodInvokingFactoryBean(); + bean.setStaticMethod("org.apache.shiro.SecurityUtils.setSecurityManager"); + bean.setArguments(new Object[]{securityManager}); + return bean; + } + + /** + * Shiro生命周期处理器: + * 用于在实现了Initializable接口的Shiro bean初始化时调用Initializable接口回调(例如:UserRealm) + * 在实现了Destroyable接口的Shiro bean销毁时调用 Destroyable接口回调(例如:DefaultSecurityManager) + */ + @Bean + public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { + return new LifecycleBeanPostProcessor(); + } + + /** + * 启用shrio授权注解拦截方式,AOP式方法级权限检查 + */ + @Bean + public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) { + AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = + new AuthorizationAttributeSourceAdvisor(); + authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); + return authorizationAttributeSourceAdvisor; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/config/web/WebConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/config/web/WebConfig.java new file mode 100644 index 0000000..572979a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/config/web/WebConfig.java @@ -0,0 +1,174 @@ +package com.agentdriving.user.config.web; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.support.http.StatViewServlet; +import com.alibaba.druid.support.http.WebStatFilter; +import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator; +import com.alibaba.druid.support.spring.stat.DruidStatInterceptor; +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import com.agentdriving.user.config.properties.GunsProperties; +import com.agentdriving.user.core.intercept.RestApiInteceptor; +import com.agentdriving.user.core.listener.ConfigListener; +import com.agentdriving.user.core.xss.XssFilter; +import org.springframework.aop.Advisor; +import org.springframework.aop.support.DefaultPointcutAdvisor; +import org.springframework.aop.support.JdkRegexpMethodPointcut; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.context.request.RequestContextListener; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +import java.util.Arrays; +import java.util.Properties; + +/** + * web 配置类 + * + * @author fengshuonan + * @date 2016年11月12日 下午5:03:32 + */ +@Configuration +public class WebConfig extends WebMvcConfigurerAdapter { + + @Autowired + private GunsProperties gunsProperties; + + /** + * 增加swagger的支持 + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + if (gunsProperties.getSwaggerOpen()) { + registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + } + } + + /** + * 增加对rest api鉴权的spring mvc拦截器 + */ + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new RestApiInteceptor()).addPathPatterns("/api/**"); + } + + /** + * druidServlet注册 + */ + @Bean + public ServletRegistrationBean druidServletRegistration() { + ServletRegistrationBean registration = new ServletRegistrationBean(new StatViewServlet()); + registration.addUrlMappings("/druid/*"); + return registration; + } + + /** + * druid监控 配置URI拦截策略 + */ + @Bean + public FilterRegistrationBean druidStatFilter() { + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter()); + //添加过滤规则. + filterRegistrationBean.addUrlPatterns("/*"); + //添加不需要忽略的格式信息. + filterRegistrationBean.addInitParameter( + "exclusions", "/static/*,*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid,/druid/*"); + //用于session监控页面的用户名显示 需要登录后主动将username注入到session里 + filterRegistrationBean.addInitParameter("principalSessionName", "username"); + return filterRegistrationBean; + } + + /** + * druid数据库连接池监控 + */ + @Bean + public DruidStatInterceptor druidStatInterceptor() { + return new DruidStatInterceptor(); + } + + @Bean + public JdkRegexpMethodPointcut druidStatPointcut() { + JdkRegexpMethodPointcut druidStatPointcut = new JdkRegexpMethodPointcut(); + String patterns = "com.agentdriving.user.modular.*.service.*"; + //可以set多个 + druidStatPointcut.setPatterns(patterns); + return druidStatPointcut; + } + + /** + * druid数据库连接池监控 + */ + @Bean + public BeanTypeAutoProxyCreator beanTypeAutoProxyCreator() { + BeanTypeAutoProxyCreator beanTypeAutoProxyCreator = new BeanTypeAutoProxyCreator(); + beanTypeAutoProxyCreator.setTargetBeanType(DruidDataSource.class); + beanTypeAutoProxyCreator.setInterceptorNames("druidStatInterceptor"); + return beanTypeAutoProxyCreator; + } + + /** + * druid 为druidStatPointcut添加拦截 + * + * @return + */ + @Bean + public Advisor druidStatAdvisor() { + return new DefaultPointcutAdvisor(druidStatPointcut(), druidStatInterceptor()); + } + + /** + * xssFilter注册 + */ + @Bean + public FilterRegistrationBean xssFilterRegistration() { + XssFilter xssFilter = new XssFilter(); + xssFilter.setUrlExclusion(Arrays.asList("/notice/update", "/notice/add")); + FilterRegistrationBean registration = new FilterRegistrationBean(xssFilter); + registration.addUrlPatterns("/*"); + return registration; + } + + /** + * RequestContextListener注册 + */ + @Bean + public ServletListenerRegistrationBean<RequestContextListener> requestContextListenerRegistration() { + return new ServletListenerRegistrationBean<>(new RequestContextListener()); + } + + /** + * ConfigListener注册 + */ + @Bean + public ServletListenerRegistrationBean<ConfigListener> configListenerRegistration() { + return new ServletListenerRegistrationBean<>(new ConfigListener()); + } + + /** + * 验证码生成相关 + */ + @Bean + public DefaultKaptcha kaptcha() { + Properties properties = new Properties(); + properties.put("kaptcha.border", "no"); + properties.put("kaptcha.border.color", "105,179,90"); + properties.put("kaptcha.textproducer.font.color", "blue"); + properties.put("kaptcha.image.width", "125"); + properties.put("kaptcha.image.height", "45"); + properties.put("kaptcha.textproducer.font.size", "45"); + properties.put("kaptcha.session.key", "code"); + properties.put("kaptcha.textproducer.char.length", "4"); + properties.put("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑"); + Config config = new Config(properties); + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/GlobalExceptionHandler.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/GlobalExceptionHandler.java new file mode 100644 index 0000000..acdde57 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/GlobalExceptionHandler.java @@ -0,0 +1,121 @@ +package com.agentdriving.user.core.aop; + +import com.agentdriving.user.core.base.tips.ErrorTip; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.core.common.exception.InvalidKaptchaException; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.log.LogManager; +import com.agentdriving.user.core.log.factory.LogTaskFactory; +import com.agentdriving.user.core.shiro.ShiroKit; +import com.agentdriving.user.core.support.HttpKit; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.CredentialsException; +import org.apache.shiro.authc.DisabledAccountException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +import java.lang.reflect.UndeclaredThrowableException; + +/** + * 全局的的异常拦截器(拦截所有的控制器)(带有@RequestMapping注解的方法上都会拦截) + * + * @author fengshuonan + * @date 2016年11月12日 下午3:19:56 + */ +@ControllerAdvice +@Order(-1) +public class GlobalExceptionHandler { + + private Logger log = LoggerFactory.getLogger(this.getClass()); + + /** + * 拦截业务异常 + */ + @ExceptionHandler(GunsException.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + @ResponseBody + public ErrorTip notFount(GunsException e) { + LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); + HttpKit.getRequest().setAttribute("tip", e.getMessage()); + log.error("业务异常:", e); + return new ErrorTip(e.getCode(), e.getMessage()); + } + + /** + * 用户未登录异常 + */ + @ExceptionHandler(AuthenticationException.class) + @ResponseStatus(HttpStatus.UNAUTHORIZED) + public String unAuth(AuthenticationException e) { + log.error("用户未登陆:", e); + return "/login.html"; + } + + /** + * 账号被冻结异常 + */ + @ExceptionHandler(DisabledAccountException.class) + @ResponseStatus(HttpStatus.UNAUTHORIZED) + public String accountLocked(DisabledAccountException e, Model model) { + String username = HttpKit.getRequest().getParameter("username"); + LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号被冻结", HttpKit.getIp())); + model.addAttribute("tips", "账号被冻结"); + return "/login.html"; + } + + /** + * 账号密码错误异常 + */ + @ExceptionHandler(CredentialsException.class) + @ResponseStatus(HttpStatus.UNAUTHORIZED) + public String credentials(CredentialsException e, Model model) { + String username = HttpKit.getRequest().getParameter("username"); + LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号密码错误", HttpKit.getIp())); + model.addAttribute("tips", "账号密码错误"); + return "/login.html"; + } + + /** + * 验证码错误异常 + */ + @ExceptionHandler(InvalidKaptchaException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public String credentials(InvalidKaptchaException e, Model model) { + String username = HttpKit.getRequest().getParameter("username"); + LogManager.me().executeLog(LogTaskFactory.loginLog(username, "验证码错误", HttpKit.getIp())); + model.addAttribute("tips", "验证码错误"); + return "/login.html"; + } + + /** + * 无权访问该资源异常 + */ + @ExceptionHandler(UndeclaredThrowableException.class) + @ResponseStatus(HttpStatus.UNAUTHORIZED) + @ResponseBody + public ErrorTip credentials(UndeclaredThrowableException e) { + HttpKit.getRequest().setAttribute("tip", "权限异常"); + log.error("权限异常!", e); + return new ErrorTip(BizExceptionEnum.NO_PERMITION.getCode(), BizExceptionEnum.NO_PERMITION.getMessage()); + } + + /** + * 拦截未知的运行时异常 + */ + @ExceptionHandler(RuntimeException.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + @ResponseBody + public ErrorTip notFount(RuntimeException e) { + LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); + HttpKit.getRequest().setAttribute("tip", "服务器未知运行时异常"); + log.error("运行时异常:", e); + return new ErrorTip(BizExceptionEnum.SERVER_ERROR.getCode(), BizExceptionEnum.SERVER_ERROR.getMessage()); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/LogAop.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/LogAop.java new file mode 100644 index 0000000..9805801 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/LogAop.java @@ -0,0 +1,105 @@ +package com.agentdriving.user.core.aop; + +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; +import com.agentdriving.user.core.log.LogManager; +import com.agentdriving.user.core.log.LogObjectHolder; +import com.agentdriving.user.core.log.factory.LogTaskFactory; +import com.agentdriving.user.core.shiro.ShiroKit; +import com.agentdriving.user.core.shiro.ShiroUser; +import com.agentdriving.user.core.support.HttpKit; +import com.agentdriving.user.core.util.Contrast; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.Signature; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; +import java.util.Map; + +/** + * 日志记录 + * + * @author fengshuonan + * @date 2016年12月6日 下午8:48:30 + */ +@Aspect +@Component +public class LogAop { + + private Logger log = LoggerFactory.getLogger(this.getClass()); + + @Pointcut(value = "@annotation(com.agentdriving.user.core.common.annotion.BussinessLog)") + public void cutService() { + } + + @Around("cutService()") + public Object recordSysLog(ProceedingJoinPoint point) throws Throwable { + + //先执行业务 + Object result = point.proceed(); + + try { + handle(point); + } catch (Exception e) { + log.error("日志记录出错!", e); + } + + return result; + } + + private void handle(ProceedingJoinPoint point) throws Exception { + + //获取拦截的方法名 + Signature sig = point.getSignature(); + MethodSignature msig = null; + if (!(sig instanceof MethodSignature)) { + throw new IllegalArgumentException("该注解只能用于方法"); + } + msig = (MethodSignature) sig; + Object target = point.getTarget(); + Method currentMethod = target.getClass().getMethod(msig.getName(), msig.getParameterTypes()); + String methodName = currentMethod.getName(); + + //如果当前用户未登录,不做日志 + ShiroUser user = ShiroKit.getUser(); + if (null == user) { + return; + } + + //获取拦截方法的参数 + String className = point.getTarget().getClass().getName(); + Object[] params = point.getArgs(); + + //获取操作名称 + BussinessLog annotation = currentMethod.getAnnotation(BussinessLog.class); + String bussinessName = annotation.value(); + String key = annotation.key(); + Class dictClass = annotation.dict(); + + StringBuilder sb = new StringBuilder(); + for (Object param : params) { + sb.append(param); + sb.append(" & "); + } + + //如果涉及到修改,比对变化 + String msg; + if (bussinessName.indexOf("修改") != -1 || bussinessName.indexOf("编辑") != -1) { + Object obj1 = LogObjectHolder.me().get(); + Map<String, String> obj2 = HttpKit.getRequestParameters(); + msg = Contrast.contrastObj(dictClass, key, obj1, obj2); + } else { + Map<String, String> parameters = HttpKit.getRequestParameters(); + AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); + msg = Contrast.parseMutiKey(dictMap,key,parameters); + } + + LogManager.me().executeLog(LogTaskFactory.bussinessLog(user.getId(), bussinessName, className, methodName, msg)); + } +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/PermissionAop.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/PermissionAop.java new file mode 100644 index 0000000..d825cef --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/aop/PermissionAop.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.aop; + +import com.agentdriving.user.core.common.annotion.Permission; +import com.agentdriving.user.core.shiro.check.PermissionCheckManager; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import javax.naming.NoPermissionException; +import java.lang.reflect.Method; + +/** + * AOP 权限自定义检查 + */ +@Aspect +@Component +@Order(200) +public class PermissionAop { + + @Pointcut(value = "@annotation(com.agentdriving.user.core.common.annotion.Permission)") + private void cutPermission() { + + } + + @Around("cutPermission()") + public Object doPermission(ProceedingJoinPoint point) throws Throwable { + MethodSignature ms = (MethodSignature) point.getSignature(); + Method method = ms.getMethod(); + Permission permission = method.getAnnotation(Permission.class); + Object[] permissions = permission.value(); + if (permissions == null || permissions.length == 0) { + //检查全体角色 + boolean result = PermissionCheckManager.checkAll(); + if (result) { + return point.proceed(); + } else { + throw new NoPermissionException(); + } + } else { + //检查指定角色 + boolean result = PermissionCheckManager.check(permissions); + if (result) { + return point.proceed(); + } else { + throw new NoPermissionException(); + } + } + + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/beetl/BeetlConfiguration.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/beetl/BeetlConfiguration.java new file mode 100644 index 0000000..b867ce6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/beetl/BeetlConfiguration.java @@ -0,0 +1,71 @@ +package com.agentdriving.user.core.beetl; + +import com.agentdriving.user.core.tag.DictSelectorTag; +import com.agentdriving.user.core.util.KaptchaUtil; +import com.agentdriving.user.core.util.ToolUtil; +import org.beetl.core.Context; +import org.beetl.core.Function; +import org.beetl.core.Tag; +import org.beetl.core.TagFactory; +import org.beetl.ext.spring.BeetlGroupUtilConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.core.env.Environment; + +import java.io.UnsupportedEncodingException; + +/** + * beetl拓展配置,绑定一些工具类,方便在模板中直接调用 + * + * @author stylefeng + * @Date 2018/2/22 21:03 + */ +public class BeetlConfiguration extends BeetlGroupUtilConfiguration { + + @Autowired + Environment env; + + @Autowired + ApplicationContext applicationContext; + + @Autowired + DictSelectorTag dictSelectorTag; + + + + @Override + public void initOther() { + groupTemplate.registerFunctionPackage("shiro", new ShiroExt()); + groupTemplate.registerFunctionPackage("tool", new ToolUtil()); + groupTemplate.registerFunctionPackage("kaptcha", new KaptchaUtil()); + groupTemplate.registerTagFactory("dictSelector", new TagFactory() { + @Override + public Tag createTag() { + return dictSelectorTag; + } + }); + + groupTemplate.registerFunction("env", new Function() { + @Override + public String call(Object[] paras, Context ctx) { + String key = (String)paras[0]; + String value = env.getProperty(key); + if(value!=null) { + return getStr(value); + } + if(paras.length==2) { + return (String)paras[1]; + } + return null; + } + + protected String getStr(String str) { + try { + return new String(str.getBytes("iso8859-1"),"UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + }); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/beetl/ShiroExt.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/beetl/ShiroExt.java new file mode 100644 index 0000000..895a492 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/beetl/ShiroExt.java @@ -0,0 +1,186 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.beetl; + +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.subject.Subject; +import org.beetl.core.GroupTemplate; + +import com.agentdriving.user.core.shiro.ShiroUser; + +public class ShiroExt { + private static final String NAMES_DELIMETER = ","; + + /** + * 获取当前 Subject + * + * @return Subject + */ + protected static Subject getSubject() { + return SecurityUtils.getSubject(); + } + + /** + * 获取封装的 ShiroUser + * + * @return ShiroUser + */ + public ShiroUser getUser() { + if (isGuest()) { + return null; + } else { + return (ShiroUser) getSubject().getPrincipals().getPrimaryPrincipal(); + } + } + + /** + * 验证当前用户是否属于该角色?,使用时与lacksRole 搭配使用 + * + * @param roleName 角色名 + * @return 属于该角色:true,否则false + */ + public boolean hasRole(String roleName) { + return getSubject() != null && roleName != null + && roleName.length() > 0 && getSubject().hasRole(roleName); + } + + /** + * 与hasRole标签逻辑相反,当用户不属于该角色时验证通过。 + * + * @param roleName 角色名 + * @return 不属于该角色:true,否则false + */ + public boolean lacksRole(String roleName) { + return !hasRole(roleName); + } + + /** + * 验证当前用户是否属于以下任意一个角色。 + * + * @param roleNames 角色列表 + * @return 属于:true,否则false + */ + public boolean hasAnyRoles(String roleNames) { + boolean hasAnyRole = false; + Subject subject = getSubject(); + if (subject != null && roleNames != null && roleNames.length() > 0) { + for (String role : roleNames.split(NAMES_DELIMETER)) { + if (subject.hasRole(role.trim())) { + hasAnyRole = true; + break; + } + } + } + return hasAnyRole; + } + + /** + * 验证当前用户是否属于以下所有角色。 + * + * @param roleNames 角色列表 + * @return 属于:true,否则false + */ + public boolean hasAllRoles(String roleNames) { + boolean hasAllRole = true; + Subject subject = getSubject(); + if (subject != null && roleNames != null && roleNames.length() > 0) { + for (String role : roleNames.split(NAMES_DELIMETER)) { + if (!subject.hasRole(role.trim())) { + hasAllRole = false; + break; + } + } + } + return hasAllRole; + } + + /** + * 验证当前用户是否拥有指定权限,使用时与lacksPermission 搭配使用 + * + * @param permission 权限名 + * @return 拥有权限:true,否则false + */ + public boolean hasPermission(String permission) { + return getSubject() != null && permission != null + && permission.length() > 0 + && getSubject().isPermitted(permission); + } + + /** + * 与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。 + * + * @param permission 权限名 + * @return 拥有权限:true,否则false + */ + public boolean lacksPermission(String permission) { + return !hasPermission(permission); + } + + /** + * 已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。与notAuthenticated搭配使用 + * + * @return 通过身份验证:true,否则false + */ + public boolean authenticated() { + return getSubject() != null && getSubject().isAuthenticated(); + } + + /** + * 未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。。 + * + * @return 没有通过身份验证:true,否则false + */ + public boolean notAuthenticated() { + return !authenticated(); + } + + /** + * 认证通过或已记住的用户。与guset搭配使用。 + * + * @return 用户:true,否则 false + */ + public boolean isUser() { + return getSubject() != null && getSubject().getPrincipal() != null; + } + + /** + * 验证当前用户是否为“访客”,即未认证(包含未记住)的用户。用user搭配使用 + * + * @return 访客:true,否则false + */ + public boolean isGuest() { + return !isUser(); + } + + /** + * 输出当前用户信息,通常为登录帐号信息。 + * + * @return 当前用户信息 + */ + public String principal() { + if (getSubject() != null) { + Object principal = getSubject().getPrincipal(); + return principal.toString(); + } + return ""; + } + + public static void main(String[] args) { + GroupTemplate gt = new GroupTemplate(); + gt.registerFunctionPackage("shiro", new ShiroExt()); + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/BussinessLog.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/BussinessLog.java new file mode 100644 index 0000000..ddb071d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/BussinessLog.java @@ -0,0 +1,33 @@ +package com.agentdriving.user.core.common.annotion; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; +import com.agentdriving.user.core.common.constant.dictmap.base.SystemDict; + +import java.lang.annotation.*; + +/** + * 标记需要做业务日志的方法 + * + * @author fengshuonan + * @date 2017-03-31 12:46 + */ +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface BussinessLog { + + /** + * 业务的名称,例如:"修改菜单" + */ + String value() default ""; + + /** + * 被修改的实体的唯一标识,例如:菜单实体的唯一标识为"id" + */ + String key() default "id"; + + /** + * 字典(用于查找key的中文名称和字段的中文名称) + */ + Class<? extends AbstractDictMap> dict() default SystemDict.class; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/Permission.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/Permission.java new file mode 100644 index 0000000..c4e92cd --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/Permission.java @@ -0,0 +1,22 @@ +package com.agentdriving.user.core.common.annotion; + +import java.lang.annotation.*; + +/** + * 权限注解 用于检查权限 规定访问权限 + * + * @example @Permission({role1,role2}) + * @example @Permission + */ +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface Permission { + + /** + * <p>角色英文名称</p> + * <p>使用注解时加上这个值表示限制只有某个角色的才可以访问对应的资源</p> + * <p>常用在某些资源限制只有超级管理员角色才可访问</p> + */ + String[] value() default {}; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/ServiceLog.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/ServiceLog.java new file mode 100644 index 0000000..d29678e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/annotion/ServiceLog.java @@ -0,0 +1,23 @@ +package com.agentdriving.user.core.common.annotion; + +import java.lang.annotation.*; + +/** + * 接口日志注解 + */ +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface ServiceLog { + /** + * 接口名称 + * @return + */ + String name() default ""; + + /** + * 接口地址 + * @return + */ + String url() default ""; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/aspect/ServiceLogAspect.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/aspect/ServiceLogAspect.java new file mode 100644 index 0000000..6312180 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/aspect/ServiceLogAspect.java @@ -0,0 +1,75 @@ +package com.agentdriving.user.core.common.aspect; + +import com.agentdriving.user.core.common.annotion.ServiceLog; +import com.alibaba.fastjson.JSONObject; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; + +@Aspect +@Component +public class ServiceLogAspect { + + Logger logger = LoggerFactory.getLogger("ServiceLog"); + + /** + * //切面点为标记了@ServiceLog注解的方法 + */ + @Pointcut("@annotation(com.agentdriving.user.core.common.annotion.ServiceLog)") + public void serviceLog(){ + } + + + //环绕通知 + @Around("serviceLog()") + @SuppressWarnings("unchecked") + public Object around(ProceedingJoinPoint joinPoint) throws Throwable { + try { + long starTime = System.currentTimeMillis(); + //通过反射获取被调用方法的Class + Class type = joinPoint.getSignature().getDeclaringType(); + //获取类名 + String typeName = type.getSimpleName(); + //方法名 + String methodName = joinPoint.getSignature().getName(); + //获取参数列表 + Object[] args = joinPoint.getArgs(); + //参数Class的数组 + Class[] clazz = new Class[args.length]; + for (int i = 0; i < args.length; i++) { + clazz[i] = args[i].getClass(); + } + //通过反射获取调用的方法method + Method method = type.getMethod(methodName, clazz); + ServiceLog serviceLog = method.getAnnotation(ServiceLog.class); + //获取方法的参数 + Parameter[] parameters = method.getParameters(); + JSONObject jsonObject = new JSONObject(); + for (int i = 0; i < parameters.length; i++) { + Parameter parameter = parameters[i]; + String name = parameter.getName(); + jsonObject.put(name, args[i]); + } + //执行结果 + //执行目标方法,获取执行结果 + Object res = joinPoint.proceed(); + logger.debug("调用{}.{}方法成功\n" + + "接口名称:{}\n" + + "接口地址:{}\n" + + "耗时:{}ms\n" + + "参数为:{}\n" + + "返回结果:{}", typeName, methodName, serviceLog.name(), serviceLog.url(), + (System.currentTimeMillis() - starTime), jsonObject.toJSONString(), JSONObject.toJSONString(res)); + }catch (Exception e){ + e.printStackTrace(); + } + return joinPoint.proceed(); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/Const.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/Const.java new file mode 100644 index 0000000..71bbfc3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/Const.java @@ -0,0 +1,36 @@ +package com.agentdriving.user.core.common.constant; + +/** + * 系统常量 + * + * @author fengshuonan + * @date 2017年2月12日 下午9:42:53 + */ +public interface Const { + + /** + * 系统默认的管理员密码 + */ + String DEFAULT_PWD = "111111"; + + /** + * 管理员角色的名字 + */ + String ADMIN_NAME = "administrator"; + + /** + * 管理员id + */ + Integer ADMIN_ID = 1; + + /** + * 超级管理员角色id + */ + Integer ADMIN_ROLE_ID = 1; + + /** + * 接口文档的菜单名 + */ + String API_MENU_NAME = "接口文档"; + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/DatasourceEnum.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/DatasourceEnum.java new file mode 100644 index 0000000..b97545a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/DatasourceEnum.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.core.common.constant; + +/** + * + * 多数据源的枚举 + * + * @author fengshuonan + * @date 2017年3月5日 上午10:15:02 + */ +public interface DatasourceEnum { + + String DATA_SOURCE_GUNS = "dataSourceGuns"; //guns数据源 + + String DATA_SOURCE_BIZ = "dataSourceBiz"; //其他业务的数据源 +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/JwtConstants.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/JwtConstants.java new file mode 100644 index 0000000..48e83ac --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/JwtConstants.java @@ -0,0 +1,19 @@ +package com.agentdriving.user.core.common.constant; + +/** + * jwt相关配置 + * + * @author fengshuonan + * @date 2017-08-23 9:23 + */ +public interface JwtConstants { + + String AUTH_HEADER = "Authorization"; + + String SECRET = "defaultSecret"; + + Long EXPIRATION = 604800L; + + String AUTH_PATH = "/gunsApi/auth"; + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/cache/Cache.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/cache/Cache.java new file mode 100644 index 0000000..7eff3f8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/cache/Cache.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.core.common.constant.cache; + +/** + * 所有缓存名称的集合 + * + * @author fengshuonan + * @date 2017-04-24 21:56 + */ +public interface Cache { + + /** + * 常量缓存 + */ + String CONSTANT = "CONSTANT"; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/cache/CacheKey.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/cache/CacheKey.java new file mode 100644 index 0000000..e7f3fd5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/cache/CacheKey.java @@ -0,0 +1,31 @@ +package com.agentdriving.user.core.common.constant.cache; + +/** + * 缓存标识前缀集合,常用在ConstantFactory类中 + * + * @author fengshuonan + * @date 2017-04-25 9:37 + */ +public interface CacheKey { + + /** + * 角色名称(多个) + */ + String ROLES_NAME = "roles_name_"; + + /** + * 角色名称(单个) + */ + String SINGLE_ROLE_NAME = "single_role_name_"; + + /** + * 角色英文名称 + */ + String SINGLE_ROLE_TIP = "single_role_tip_"; + + /** + * 部门名称 + */ + String DEPT_NAME = "dept_name_"; + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DeleteDict.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DeleteDict.java new file mode 100644 index 0000000..468400c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DeleteDict.java @@ -0,0 +1,31 @@ +package com.agentdriving.user.core.common.constant.dictmap; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; + +/** + * 用于删除业务的字典 + * + * @author fengshuonan + * @date 2017-05-06 15:01 + */ +public class DeleteDict extends AbstractDictMap { + + @Override + public void init() { + put("roleId","角色名称"); + put("deptId", "部门名称"); + put("menuId", "菜单名称"); + put("dictId", "字典名称"); + put("noticeId", "标题"); + } + + @Override + protected void initBeWrapped() { + putFieldWrapperMethodName("roleId","getCacheObject"); + putFieldWrapperMethodName("deptId","getCacheObject"); + putFieldWrapperMethodName("menuId","getCacheObject"); + putFieldWrapperMethodName("dictId","getCacheObject"); + putFieldWrapperMethodName("noticeId","getCacheObject"); + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DeptDict.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DeptDict.java new file mode 100644 index 0000000..61a9af5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DeptDict.java @@ -0,0 +1,28 @@ +package com.agentdriving.user.core.common.constant.dictmap; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; + +/** + * 部门的映射 + * + * @author fengshuonan + * @date 2017-05-06 15:01 + */ +public class DeptDict extends AbstractDictMap { + + @Override + public void init() { + put("deptId", "部门名称"); + put("num", "部门排序"); + put("pid", "上级名称"); + put("simplename", "部门简称"); + put("fullname", "部门全称"); + put("tips", "备注"); + } + + @Override + protected void initBeWrapped() { + putFieldWrapperMethodName("deptId", "getDeptName"); + putFieldWrapperMethodName("pid", "getDeptName"); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DictMap.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DictMap.java new file mode 100644 index 0000000..9c927ff --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/DictMap.java @@ -0,0 +1,24 @@ +package com.agentdriving.user.core.common.constant.dictmap; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; + +/** + * 字典map + * + * @author fengshuonan + * @date 2017-05-06 15:43 + */ +public class DictMap extends AbstractDictMap { + + @Override + public void init() { + put("dictId","字典名称"); + put("dictName","字典名称"); + put("dictValues","字典内容"); + } + + @Override + protected void initBeWrapped() { + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/LogDict.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/LogDict.java new file mode 100644 index 0000000..03d0045 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/LogDict.java @@ -0,0 +1,22 @@ +package com.agentdriving.user.core.common.constant.dictmap; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; + +/** + * 日志的字典 + * + * @author fengshuonan + * @date 2017-05-06 15:01 + */ +public class LogDict extends AbstractDictMap { + + @Override + public void init() { + put("tips","备注"); + } + + @Override + protected void initBeWrapped() { + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/MenuDict.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/MenuDict.java new file mode 100644 index 0000000..117adf4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/MenuDict.java @@ -0,0 +1,34 @@ +package com.agentdriving.user.core.common.constant.dictmap; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; + +/** + * 菜单的字典 + * + * @author fengshuonan + * @date 2017-05-06 15:01 + */ +public class MenuDict extends AbstractDictMap { + + @Override + public void init() { + put("menuId","菜单id"); + put("id","菜单id"); + put("code","菜单编号"); + put("pcode","菜单父编号"); + put("name","菜单名称"); + put("icon","菜单图标"); + put("url","url地址"); + put("num","菜单排序号"); + put("levels","菜单层级"); + put("tips","备注"); + put("status","菜单状态"); + put("isopen","是否打开"); + put("",""); + } + + @Override + protected void initBeWrapped() { + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/NoticeMap.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/NoticeMap.java new file mode 100644 index 0000000..e7c7b48 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/NoticeMap.java @@ -0,0 +1,22 @@ +package com.agentdriving.user.core.common.constant.dictmap; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; + +/** + * 通知的映射 + * + * @author fengshuonan + * @date 2017-05-06 15:01 + */ +public class NoticeMap extends AbstractDictMap { + + @Override + public void init() { + put("title", "标题"); + put("content", "内容"); + } + + @Override + protected void initBeWrapped() { + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/RoleDict.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/RoleDict.java new file mode 100644 index 0000000..c937ad2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/RoleDict.java @@ -0,0 +1,31 @@ +package com.agentdriving.user.core.common.constant.dictmap; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; + +/** + * 角色的字典 + * + * @author fengshuonan + * @date 2017-05-06 15:01 + */ +public class RoleDict extends AbstractDictMap { + + @Override + public void init() { + put("roleId","角色名称"); + put("num","角色排序"); + put("pid","角色的父级"); + put("name","角色名称"); + put("deptid","部门名称"); + put("tips","备注"); + put("ids","资源名称"); + } + + @Override + protected void initBeWrapped() { + putFieldWrapperMethodName("pid","getSingleRoleName"); + putFieldWrapperMethodName("deptid","getDeptName"); + putFieldWrapperMethodName("roleId","getSingleRoleName"); + putFieldWrapperMethodName("ids","getMenuNames"); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/UserDict.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/UserDict.java new file mode 100644 index 0000000..d1cff9c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/UserDict.java @@ -0,0 +1,36 @@ +package com.agentdriving.user.core.common.constant.dictmap; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; + +/** + * 用户的字典 + * + * @author fengshuonan + * @date 2017-05-06 15:01 + */ +public class UserDict extends AbstractDictMap { + + @Override + public void init() { + put("userId","账号"); + put("avatar","头像"); + put("account","账号"); + put("name","名字"); + put("birthday","生日"); + put("sex","性别"); + put("email","电子邮件"); + put("phone","电话"); + put("roleid","角色名称"); + put("deptid","部门名称"); + put("roleIds","角色名称集合"); + } + + @Override + protected void initBeWrapped() { + putFieldWrapperMethodName("sex","getSexName"); + putFieldWrapperMethodName("deptid","getDeptName"); + putFieldWrapperMethodName("roleid","getSingleRoleName"); + putFieldWrapperMethodName("userId","getUserAccountById"); + putFieldWrapperMethodName("roleIds","getRoleName"); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/base/AbstractDictMap.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/base/AbstractDictMap.java new file mode 100644 index 0000000..f058c3e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/base/AbstractDictMap.java @@ -0,0 +1,53 @@ +package com.agentdriving.user.core.common.constant.dictmap.base; + +import java.util.HashMap; + +/** + * 字典映射抽象类 + * + * @author fengshuonan + * @date 2017-05-06 14:58 + */ +public abstract class AbstractDictMap { + + protected HashMap<String, String> dictory = new HashMap<>(); + protected HashMap<String, String> fieldWarpperDictory = new HashMap<>(); + + public AbstractDictMap(){ + put("id","主键id"); + init(); + initBeWrapped(); + } + + /** + * 初始化字段英文名称和中文名称对应的字典 + * + * @author stylefeng + * @Date 2017/5/9 19:39 + */ + public abstract void init(); + + /** + * 初始化需要被包装的字段(例如:性别为1:男,2:女,需要被包装为汉字) + * + * @author stylefeng + * @Date 2017/5/9 19:35 + */ + protected abstract void initBeWrapped(); + + public String get(String key) { + return this.dictory.get(key); + } + + public void put(String key, String value) { + this.dictory.put(key, value); + } + + public String getFieldWarpperMethodName(String key){ + return this.fieldWarpperDictory.get(key); + } + + public void putFieldWrapperMethodName(String key,String methodName){ + this.fieldWarpperDictory.put(key,methodName); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/base/SystemDict.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/base/SystemDict.java new file mode 100644 index 0000000..dac6efb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/base/SystemDict.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.core.common.constant.dictmap.base; + +/** + * 系统相关的字典 + * + * @author fengshuonan + * @date 2017-05-06 15:48 + */ +public class SystemDict extends AbstractDictMap { + + @Override + public void init() { + + } + + @Override + protected void initBeWrapped() { + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/factory/DictFieldWarpperFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/factory/DictFieldWarpperFactory.java new file mode 100644 index 0000000..6850f50 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/dictmap/factory/DictFieldWarpperFactory.java @@ -0,0 +1,33 @@ +package com.agentdriving.user.core.common.constant.dictmap.factory; + +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.common.constant.factory.IConstantFactory; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; + +import java.lang.reflect.Method; + +/** + * 字典字段的包装器(从ConstantFactory中获取包装值) + * + * @author fengshuonan + * @date 2017-05-06 15:12 + */ +public class DictFieldWarpperFactory { + + public static Object createFieldWarpper(Object parameter, String methodName) { + IConstantFactory constantFactory = ConstantFactory.me(); + try { + Method method = IConstantFactory.class.getMethod(methodName, parameter.getClass()); + return method.invoke(constantFactory, parameter); + } catch (Exception e) { + try { + Method method = IConstantFactory.class.getMethod(methodName, Integer.class); + return method.invoke(constantFactory, Integer.parseInt(parameter.toString())); + } catch (Exception e1) { + throw new GunsException(BizExceptionEnum.ERROR_WRAPPER_FIELD); + } + } + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/ConstantFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/ConstantFactory.java new file mode 100644 index 0000000..ffeb8ab --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/ConstantFactory.java @@ -0,0 +1,335 @@ +package com.agentdriving.user.core.common.constant.factory; + +import com.agentdriving.user.core.util.Convert; +import com.agentdriving.user.modular.system.dao.*; +import com.agentdriving.user.modular.system.model.*; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.agentdriving.user.core.common.constant.cache.Cache; +import com.agentdriving.user.core.common.constant.cache.CacheKey; +import com.agentdriving.user.core.common.constant.state.ManagerStatus; +import com.agentdriving.user.core.common.constant.state.MenuStatus; +import com.agentdriving.user.modular.system.model.*; +import com.agentdriving.user.core.log.LogObjectHolder; +import com.agentdriving.user.core.support.StrKit; +import com.agentdriving.user.core.util.SpringContextHolder; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.dao.*; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.context.annotation.DependsOn; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * 常量的生产工厂 + * + * @author fengshuonan + * @date 2017年2月13日 下午10:55:21 + */ +@Component +@DependsOn("springContextHolder") +public class ConstantFactory implements IConstantFactory { + + private RoleMapper roleMapper = SpringContextHolder.getBean(RoleMapper.class); + private DeptMapper deptMapper = SpringContextHolder.getBean(DeptMapper.class); + private DictMapper dictMapper = SpringContextHolder.getBean(DictMapper.class); + private UserMapper userMapper = SpringContextHolder.getBean(UserMapper.class); + private MenuMapper menuMapper = SpringContextHolder.getBean(MenuMapper.class); + private NoticeMapper noticeMapper = SpringContextHolder.getBean(NoticeMapper.class); + + public static IConstantFactory me() { + return SpringContextHolder.getBean("constantFactory"); + } + + /** + * 根据用户id获取用户名称 + * + * @author stylefeng + * @Date 2017/5/9 23:41 + */ + @Override + public String getUserNameById(Integer userId) { + User user = userMapper.selectById(userId); + if (user != null) { + return user.getName(); + } else { + return "--"; + } + } + + /** + * 根据用户id获取用户账号 + * + * @author stylefeng + * @date 2017年5月16日21:55:371 + */ + @Override + public String getUserAccountById(Integer userId) { + User user = userMapper.selectById(userId); + if (user != null) { + return user.getAccount(); + } else { + return "--"; + } + } + + /** + * 通过角色ids获取角色名称 + */ + @Override + @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.ROLES_NAME + "'+#roleIds") + public String getRoleName(String roleIds) { + Integer[] roles = Convert.toIntArray(roleIds); + StringBuilder sb = new StringBuilder(); + for (int role : roles) { + Role roleObj = roleMapper.selectById(role); + if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { + sb.append(roleObj.getName()).append(","); + } + } + return StrKit.removeSuffix(sb.toString(), ","); + } + + /** + * 通过角色id获取角色名称 + */ + @Override + @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_NAME + "'+#roleId") + public String getSingleRoleName(Integer roleId) { + if (0 == roleId) { + return "--"; + } + Role roleObj = roleMapper.selectById(roleId); + if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { + return roleObj.getName(); + } + return ""; + } + + /** + * 通过角色id获取角色英文名称 + */ + @Override + @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_TIP + "'+#roleId") + public String getSingleRoleTip(Integer roleId) { + if (0 == roleId) { + return "--"; + } + Role roleObj = roleMapper.selectById(roleId); + if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { + return roleObj.getTips(); + } + return ""; + } + + /** + * 获取部门名称 + */ + @Override + @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.DEPT_NAME + "'+#deptId") + public String getDeptName(Integer deptId) { + Dept dept = deptMapper.selectById(deptId); + if (ToolUtil.isNotEmpty(dept) && ToolUtil.isNotEmpty(dept.getFullname())) { + return dept.getFullname(); + } + return ""; + } + + /** + * 获取菜单的名称们(多个) + */ + @Override + public String getMenuNames(String menuIds) { + Integer[] menus = Convert.toIntArray(menuIds); + StringBuilder sb = new StringBuilder(); + for (int menu : menus) { + Menu menuObj = menuMapper.selectById(menu); + if (ToolUtil.isNotEmpty(menuObj) && ToolUtil.isNotEmpty(menuObj.getName())) { + sb.append(menuObj.getName()).append(","); + } + } + return StrKit.removeSuffix(sb.toString(), ","); + } + + /** + * 获取菜单名称 + */ + @Override + public String getMenuName(Long menuId) { + if (ToolUtil.isEmpty(menuId)) { + return ""; + } else { + Menu menu = menuMapper.selectById(menuId); + if (menu == null) { + return ""; + } else { + return menu.getName(); + } + } + } + + /** + * 获取菜单名称通过编号 + */ + @Override + public String getMenuNameByCode(String code) { + if (ToolUtil.isEmpty(code)) { + return ""; + } else { + Menu param = new Menu(); + param.setCode(code); + Menu menu = menuMapper.selectOne(param); + if (menu == null) { + return ""; + } else { + return menu.getName(); + } + } + } + + /** + * 获取字典名称 + */ + @Override + public String getDictName(Integer dictId) { + if (ToolUtil.isEmpty(dictId)) { + return ""; + } else { + Dict dict = dictMapper.selectById(dictId); + if (dict == null) { + return ""; + } else { + return dict.getName(); + } + } + } + + /** + * 获取通知标题 + */ + @Override + public String getNoticeTitle(Integer dictId) { + if (ToolUtil.isEmpty(dictId)) { + return ""; + } else { + Notice notice = noticeMapper.selectById(dictId); + if (notice == null) { + return ""; + } else { + return notice.getTitle(); + } + } + } + + /** + * 根据字典名称和字典中的值获取对应的名称 + */ + @Override + public String getDictsByName(String name, Integer val) { + Dict temp = new Dict(); + temp.setName(name); + Dict dict = dictMapper.selectOne(temp); + if (dict == null) { + return ""; + } else { + Wrapper<Dict> wrapper = new EntityWrapper<>(); + wrapper = wrapper.eq("pid", dict.getId()); + List<Dict> dicts = dictMapper.selectList(wrapper); + for (Dict item : dicts) { + if (item.getNum() != null && item.getNum().equals(val)) { + return item.getName(); + } + } + return ""; + } + } + + /** + * 获取性别名称 + */ + @Override + public String getSexName(Integer sex) { + return getDictsByName("性别", sex); + } + + /** + * 获取用户登录状态 + */ + @Override + public String getStatusName(Integer status) { + return ManagerStatus.valueOf(status); + } + + /** + * 获取菜单状态 + */ + @Override + public String getMenuStatusName(Integer status) { + return MenuStatus.valueOf(status); + } + + /** + * 查询字典 + */ + @Override + public List<Dict> findInDict(Integer id) { + if (ToolUtil.isEmpty(id)) { + return null; + } else { + EntityWrapper<Dict> wrapper = new EntityWrapper<>(); + List<Dict> dicts = dictMapper.selectList(wrapper.eq("pid", id)); + if (dicts == null || dicts.size() == 0) { + return null; + } else { + return dicts; + } + } + } + + /** + * 获取被缓存的对象(用户删除业务) + */ + @Override + public String getCacheObject(String para) { + return LogObjectHolder.me().get().toString(); + } + + /** + * 获取子部门id + */ + @Override + public List<Integer> getSubDeptId(Integer deptid) { + Wrapper<Dept> wrapper = new EntityWrapper<>(); + wrapper = wrapper.like("pids", "%[" + deptid + "]%"); + List<Dept> depts = this.deptMapper.selectList(wrapper); + + ArrayList<Integer> deptids = new ArrayList<>(); + + if(depts != null && depts.size() > 0){ + for (Dept dept : depts) { + deptids.add(dept.getId()); + } + } + + return deptids; + } + + /** + * 获取所有父部门id + */ + @Override + public List<Integer> getParentDeptIds(Integer deptid) { + Dept dept = deptMapper.selectById(deptid); + String pids = dept.getPids(); + String[] split = pids.split(","); + ArrayList<Integer> parentDeptIds = new ArrayList<>(); + for (String s : split) { + parentDeptIds.add(Integer.valueOf(StrKit.removeSuffix(StrKit.removePrefix(s, "["), "]"))); + } + return parentDeptIds; + } + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/IConstantFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/IConstantFactory.java new file mode 100644 index 0000000..25d6476 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/IConstantFactory.java @@ -0,0 +1,116 @@ +package com.agentdriving.user.core.common.constant.factory; + +import com.agentdriving.user.modular.system.model.Dict; + +import java.util.List; + +/** + * 常量生产工厂的接口 + * + * @author fengshuonan + * @date 2017-06-14 21:12 + */ +public interface IConstantFactory { + + /** + * 根据用户id获取用户名称 + * + * @author stylefeng + * @Date 2017/5/9 23:41 + */ + String getUserNameById(Integer userId); + + /** + * 根据用户id获取用户账号 + * + * @author stylefeng + * @date 2017年5月16日21:55:371 + */ + String getUserAccountById(Integer userId); + + /** + * 通过角色ids获取角色名称 + */ + String getRoleName(String roleIds); + + /** + * 通过角色id获取角色名称 + */ + String getSingleRoleName(Integer roleId); + + /** + * 通过角色id获取角色英文名称 + */ + String getSingleRoleTip(Integer roleId); + + /** + * 获取部门名称 + */ + String getDeptName(Integer deptId); + + /** + * 获取菜单的名称们(多个) + */ + String getMenuNames(String menuIds); + + /** + * 获取菜单名称 + */ + String getMenuName(Long menuId); + + /** + * 获取菜单名称通过编号 + */ + String getMenuNameByCode(String code); + + /** + * 获取字典名称 + */ + String getDictName(Integer dictId); + + /** + * 获取通知标题 + */ + String getNoticeTitle(Integer dictId); + + /** + * 根据字典名称和字典中的值获取对应的名称 + */ + String getDictsByName(String name, Integer val); + + /** + * 获取性别名称 + */ + String getSexName(Integer sex); + + /** + * 获取用户登录状态 + */ + String getStatusName(Integer status); + + /** + * 获取菜单状态 + */ + String getMenuStatusName(Integer status); + + /** + * 查询字典 + */ + List<Dict> findInDict(Integer id); + + /** + * 获取被缓存的对象(用户删除业务) + */ + String getCacheObject(String para); + + /** + * 获取子部门id + */ + List<Integer> getSubDeptId(Integer deptid); + + /** + * 获取所有父部门id + */ + List<Integer> getParentDeptIds(Integer deptid); + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/MutiStrFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/MutiStrFactory.java new file mode 100644 index 0000000..3ecbbe2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/MutiStrFactory.java @@ -0,0 +1,96 @@ +package com.agentdriving.user.core.common.constant.factory; + +import com.agentdriving.user.core.support.StrKit; +import com.agentdriving.user.core.util.ToolUtil; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 组合字符串生产者 + * + * @author fengshuonan + * @date 2017-04-27 16:42 + */ +public class MutiStrFactory { + + /** + * 每个条目之间的分隔符 + */ + public static final String ITEM_SPLIT = ";"; + + /** + * 属性之间的分隔符 + */ + public static final String ATTR_SPLIT = ":"; + + /** + * 拼接字符串的id + */ + public static final String MUTI_STR_ID = "ID"; + + /** + * 拼接字符串的CODE + */ + public static final String MUTI_STR_CODE = "CODE"; + + /** + * 拼接字符串的NAME + */ + public static final String MUTI_STR_NAME = "NAME"; + + /** + * 拼接字符串的NUM + */ + public static final String MUTI_STR_NUM = "NUM"; + + /** + * 解析一个组合字符串(例如: "1:启用;2:禁用;3:冻结" 这样的字符串) + * + * @author fengshuonan + * @Date 2017/4/27 16:44 + */ + public static List<Map<String,String>> parseKeyValue(String mutiString){ + if(ToolUtil.isEmpty(mutiString)){ + return new ArrayList<>(); + }else{ + ArrayList<Map<String,String>> results = new ArrayList<>(); + String[] items = StrKit.split(StrKit.removeSuffix(mutiString, ITEM_SPLIT), ITEM_SPLIT); + for (String item : items) { + String[] attrs = item.split(ATTR_SPLIT); + HashMap<String, String> itemMap = new HashMap<>(); + itemMap.put(MUTI_STR_CODE,attrs[0]); + itemMap.put(MUTI_STR_NAME,attrs[1]); + itemMap.put(MUTI_STR_NUM,attrs[2]); + results.add(itemMap); + } + return results; + } + } + + /** + * 解析id:key:value这样类型的字符串 + * + * @author fengshuonan + * @Date 2017/4/28 11:06 + */ + public static List<Map<String,String>> parseIdKeyValue(String mutiString){ + if(ToolUtil.isEmpty(mutiString)){ + return new ArrayList<>(); + }else{ + ArrayList<Map<String,String>> results = new ArrayList<>(); + String[] items = StrKit.split(StrKit.removeSuffix(mutiString, ITEM_SPLIT), ITEM_SPLIT); + for (String item : items) { + String[] attrs = item.split(ATTR_SPLIT); + HashMap<String, String> itemMap = new HashMap<>(); + itemMap.put(MUTI_STR_CODE,attrs[0]); + itemMap.put(MUTI_STR_NAME,attrs[1]); + itemMap.put(MUTI_STR_NUM,attrs[2]); + results.add(itemMap); + } + return results; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/PageFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/PageFactory.java new file mode 100644 index 0000000..e763db8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/factory/PageFactory.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.core.common.constant.factory; + +import com.baomidou.mybatisplus.plugins.Page; +import com.agentdriving.user.core.common.constant.state.Order; +import com.agentdriving.user.core.support.HttpKit; +import com.agentdriving.user.core.util.ToolUtil; + +import javax.servlet.http.HttpServletRequest; + +/** + * BootStrap Table默认的分页参数创建 + * + * @author fengshuonan + * @date 2017-04-05 22:25 + */ +public class PageFactory<T> { + + public Page<T> defaultPage() { + HttpServletRequest request = HttpKit.getRequest(); + int limit = Integer.valueOf(request.getParameter("limit")); //每页多少条数据 + int offset = Integer.valueOf(request.getParameter("offset")); //每页的偏移量(本页当前有多少条) + String sort = request.getParameter("sort"); //排序字段名称 + String order = request.getParameter("order"); //asc或desc(升序或降序) + if (ToolUtil.isEmpty(sort)) { + Page<T> page = new Page<>((offset / limit + 1), limit); + page.setOpenSort(false); + return page; + } else { + Page<T> page = new Page<>((offset / limit + 1), limit, sort); + if (Order.ASC.getDes().equals(order)) { + page.setAsc(true); + } else { + page.setAsc(false); + } + return page; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/BizLogType.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/BizLogType.java new file mode 100644 index 0000000..9384ffa --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/BizLogType.java @@ -0,0 +1,51 @@ +package com.agentdriving.user.core.common.constant.state; + +/** + * 业务日志类型 + * + * @author fengshuonan + * @Date 2017年1月22日 下午12:14:59 + */ +public enum BizLogType { + + ALL(0, null),//全部日志 + BUSSINESS(1, "业务日志"), + EXCEPTION(2, "异常日志"); + + Integer val; + String message; + + BizLogType(Integer val, String message) { + this.val = val; + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Integer getVal() { + return val; + } + + public void setVal(Integer val) { + this.val = val; + } + + public static String valueOf(Integer value) { + if (value == null) { + return null; + } else { + for (BizLogType bizLogType : BizLogType.values()) { + if (bizLogType.getVal().equals(value)) { + return bizLogType.getMessage(); + } + } + return null; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/ExpenseState.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/ExpenseState.java new file mode 100644 index 0000000..aaa2523 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/ExpenseState.java @@ -0,0 +1,52 @@ +package com.agentdriving.user.core.common.constant.state; + +/** + * 是否是菜单的枚举 + * + * @author fengshuonan + * @date 2017年6月1日22:50:11 + */ +public enum ExpenseState { + + SUBMITING(1, "待提交"), + CHECKING(2, "待审核"), + PASS(3, "审核通过"), + UN_PASS(4, "未通过"); + + int code; + String message; + + ExpenseState(int code, String message) { + this.code = code; + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static String valueOf(Integer status) { + if (status == null) { + return ""; + } else { + for (ExpenseState s : ExpenseState.values()) { + if (s.getCode() == status) { + return s.getMessage(); + } + } + return ""; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/LogSucceed.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/LogSucceed.java new file mode 100644 index 0000000..486d62c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/LogSucceed.java @@ -0,0 +1,27 @@ +package com.agentdriving.user.core.common.constant.state; + +/** + * 业务是否成功的日志记录 + * + * @author fengshuonan + * @Date 2017年1月22日 下午12:14:59 + */ +public enum LogSucceed { + + SUCCESS("成功"), + FAIL("失败"); + + String message; + + LogSucceed(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/LogType.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/LogType.java new file mode 100644 index 0000000..ecb43d5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/LogType.java @@ -0,0 +1,30 @@ +package com.agentdriving.user.core.common.constant.state; + +/** + * 日志类型 + * + * @author fengshuonan + * @Date 2017年1月22日 下午12:14:59 + */ +public enum LogType { + + LOGIN("登录日志"), + LOGIN_FAIL("登录失败日志"), + EXIT("退出日志"), + EXCEPTION("异常日志"), + BUSSINESS("业务日志"); + + String message; + + LogType(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/ManagerStatus.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/ManagerStatus.java new file mode 100644 index 0000000..0eb4cea --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/ManagerStatus.java @@ -0,0 +1,49 @@ +package com.agentdriving.user.core.common.constant.state; + +/** + * 管理员的状态 + * + * @author fengshuonan + * @Date 2017年1月10日 下午9:54:13 + */ +public enum ManagerStatus { + + OK(1, "启用"), FREEZED(2, "冻结"), DELETED(3, "被删除"); + + int code; + String message; + + ManagerStatus(int code, String message) { + this.code = code; + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static String valueOf(Integer value) { + if (value == null) { + return ""; + } else { + for (ManagerStatus ms : ManagerStatus.values()) { + if (ms.getCode() == value) { + return ms.getMessage(); + } + } + return ""; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/MenuOpenStatus.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/MenuOpenStatus.java new file mode 100644 index 0000000..69fd921 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/MenuOpenStatus.java @@ -0,0 +1,50 @@ +package com.agentdriving.user.core.common.constant.state; + +/** + * 菜单是否打开的状态 + * + * @author fengshuonan + * @Date 2017年4月8日10:12:15 + */ +public enum MenuOpenStatus { + + OPEN(1, "打开"), + CLOSE(0, "关闭"); + + int code; + String message; + + MenuOpenStatus(int code, String message) { + this.code = code; + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static String valueOf(Integer status) { + if (status == null) { + return ""; + } else { + for (MenuOpenStatus s : MenuOpenStatus.values()) { + if (s.getCode() == status) { + return s.getMessage(); + } + } + return ""; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/MenuStatus.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/MenuStatus.java new file mode 100644 index 0000000..35aea7c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/MenuStatus.java @@ -0,0 +1,50 @@ +package com.agentdriving.user.core.common.constant.state; + +/** + * 菜单的状态 + * + * @author fengshuonan + * @Date 2017年1月22日 下午12:14:59 + */ +public enum MenuStatus { + + ENABLE(1, "启用"), + DISABLE(0, "禁用"); + + int code; + String message; + + MenuStatus(int code, String message) { + this.code = code; + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static String valueOf(Integer status) { + if (status == null) { + return ""; + } else { + for (MenuStatus s : MenuStatus.values()) { + if (s.getCode() == status) { + return s.getMessage(); + } + } + return ""; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/Order.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/Order.java new file mode 100644 index 0000000..b8c83af --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/constant/state/Order.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.core.common.constant.state; + +/** + * 数据库排序 + * + * @author fengshuonan + * @Date 2017年5月31日20:48:41 + */ +public enum Order { + + ASC("asc"), DESC("desc"); + + private String des; + + Order(String des) { + this.des = des; + } + + public String getDes() { + return des; + } + + public void setDes(String des) { + this.des = des; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/exception/BizExceptionEnum.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/exception/BizExceptionEnum.java new file mode 100644 index 0000000..8b3d5ac --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/exception/BizExceptionEnum.java @@ -0,0 +1,100 @@ +package com.agentdriving.user.core.common.exception; + +import com.agentdriving.user.core.exception.ServiceExceptionEnum; + +/** + * @author fengshuonan + * @Description 所有业务异常的枚举 + * @date 2016年11月12日 下午5:04:51 + */ +public enum BizExceptionEnum implements ServiceExceptionEnum { + + /** + * 字典 + */ + DICT_EXISTED(400, "字典已经存在"), + ERROR_CREATE_DICT(500, "创建字典失败"), + ERROR_WRAPPER_FIELD(500, "包装字典属性失败"), + ERROR_CODE_EMPTY(500, "字典类型不能为空"), + + /** + * 文件上传 + */ + FILE_READING_ERROR(400, "FILE_READING_ERROR!"), + FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"), + UPLOAD_ERROR(500, "上传图片出错"), + + /** + * 权限和数据问题 + */ + DB_RESOURCE_NULL(400, "数据库中没有该资源"), + NO_PERMITION(405, "权限异常"), + REQUEST_INVALIDATE(400, "请求数据格式不正确"), + INVALID_KAPTCHA(400, "验证码不正确"), + CANT_DELETE_ADMIN(600, "不能删除超级管理员"), + CANT_FREEZE_ADMIN(600, "不能冻结超级管理员"), + CANT_CHANGE_ADMIN(600, "不能修改超级管理员角色"), + + /** + * 账户问题 + */ + USER_ALREADY_REG(401, "该用户已经注册"), + NO_THIS_USER(400, "没有此用户"), + USER_NOT_EXISTED(400, "没有此用户"), + ACCOUNT_FREEZED(401, "账号被冻结"), + OLD_PWD_NOT_RIGHT(402, "原密码不正确"), + TWO_PWD_NOT_MATCH(405, "两次输入密码不一致"), + + /** + * 错误的请求 + */ + MENU_PCODE_COINCIDENCE(400, "菜单编号和副编号不能一致"), + EXISTED_THE_MENU(400, "菜单编号重复,不能添加"), + DICT_MUST_BE_NUMBER(400, "字典的值必须为数字"), + REQUEST_NULL(400, "请求有错误"), + SESSION_TIMEOUT(400, "会话超时"), + SERVER_ERROR(500, "服务器异常"), + + /** + * token异常 + */ + TOKEN_EXPIRED(10030, "token过期"), + TOKEN_ERROR(10030, "token验证失败"), + + /** + * 签名异常 + */ + SIGN_ERROR(10040, "签名验证失败"), + + /** + * 其他 + */ + AUTH_REQUEST_ERROR(400, "账号密码错误"); + + BizExceptionEnum(int code, String message) { + this.code = code; + this.message = message; + } + + private Integer code; + + private String message; + + @Override + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + @Override + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/common/exception/InvalidKaptchaException.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/exception/InvalidKaptchaException.java new file mode 100644 index 0000000..a9505c5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/common/exception/InvalidKaptchaException.java @@ -0,0 +1,10 @@ +package com.agentdriving.user.core.common.exception; + +/** + * 验证码错误异常 + * + * @author fengshuonan + * @date 2017-05-05 23:52 + */ +public class InvalidKaptchaException extends RuntimeException { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/GunsUserFilter.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/GunsUserFilter.java new file mode 100644 index 0000000..cab2135 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/GunsUserFilter.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package com.agentdriving.user.core.intercept; + +import com.agentdriving.user.core.shiro.ShiroKit; +import org.apache.shiro.subject.Subject; +import org.apache.shiro.web.filter.AccessControlFilter; +import org.apache.shiro.web.util.WebUtils; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Filter that allows access to resources if the accessor is a known user, which is defined as + * having a known principal. This means that any user who is authenticated or remembered via a + * 'remember me' feature will be allowed access from this filter. + * <p/> + * If the accessor is not a known user, then they will be redirected to the {@link #setLoginUrl(String) loginUrl}</p> + * + * @since 0.9 + */ +public class GunsUserFilter extends AccessControlFilter { + + /** + * Returns <code>true</code> if the request is a + * {@link #isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) loginRequest} or + * if the current {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject} + * is not <code>null</code>, <code>false</code> otherwise. + * + * @return <code>true</code> if the request is a + * {@link #isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) loginRequest} or + * if the current {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject} + * is not <code>null</code>, <code>false</code> otherwise. + */ + protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { + if (isLoginRequest(request, response)) { + return true; + } else { + Subject subject = getSubject(request, response); + // If principal is not null, then the user is known and should be allowed access. + return subject.getPrincipal() != null; + } + } + + /** + * This default implementation simply calls + * {@link #saveRequestAndRedirectToLogin(javax.servlet.ServletRequest, javax.servlet.ServletResponse) saveRequestAndRedirectToLogin} + * and then immediately returns <code>false</code>, thereby preventing the chain from continuing so the redirect may + * execute. + */ + protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { + HttpServletRequest httpServletRequest = WebUtils.toHttp(request); + HttpServletResponse httpServletResponse = WebUtils.toHttp(response); + + /** + * 如果是ajax请求则不进行跳转 + */ + if (httpServletRequest.getHeader("x-requested-with") != null + && httpServletRequest.getHeader("x-requested-with").equalsIgnoreCase("XMLHttpRequest")) { + httpServletResponse.setHeader("sessionstatus", "timeout"); + return false; + } else { + + /** + * 第一次点击页面 + */ + String referer = httpServletRequest.getHeader("Referer"); + if (referer == null) { + saveRequestAndRedirectToLogin(request, response); + return false; + } else { + + /** + * 从别的页面跳转过来的 + */ + if (ShiroKit.getSession().getAttribute("sessionFlag") == null) { + httpServletRequest.setAttribute("tips", "session超时"); + httpServletRequest.getRequestDispatcher("/login").forward(request, response); + return false; + } else { + saveRequestAndRedirectToLogin(request, response); + return false; + } + } + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/RestApiInteceptor.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/RestApiInteceptor.java new file mode 100644 index 0000000..f35b918 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/RestApiInteceptor.java @@ -0,0 +1,66 @@ +package com.agentdriving.user.core.intercept; + +import com.agentdriving.user.core.base.tips.ErrorTip; +import com.agentdriving.user.core.common.constant.JwtConstants; +import com.agentdriving.user.core.util.JwtTokenUtil; +import com.agentdriving.user.core.util.RenderUtil; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.ResponseWarpper; +import io.jsonwebtoken.JwtException; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +/** + * Rest Api接口鉴权 + * + * @author stylefeng + * @Date 2018/7/20 23:11 + */ +public class RestApiInteceptor extends HandlerInterceptorAdapter { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + if (handler instanceof org.springframework.web.servlet.resource.ResourceHttpRequestHandler) { + return true; + } + HandlerMethod handlerMethod = (HandlerMethod) handler; + return check(request, response, handlerMethod); + } + + private boolean check(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) { + if (request.getServletPath().equals(JwtConstants.AUTH_PATH)) { + return true; + } + final String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); + String authToken; + if (requestHeader != null && requestHeader.startsWith("Bearer ")) { + authToken = requestHeader.substring(7); + + //验证token是否过期,包含了验证jwt是否正确 + try { + boolean flag = JwtTokenUtil.isTokenExpired(authToken); + if (flag) { + RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_EXPIRED.getCode(), BizExceptionEnum.TOKEN_EXPIRED.getMessage())); + return false; + } + } catch (JwtException e) { + //有异常就是token解析失败 +// RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); + RenderUtil.renderJson(response, ResponseWarpper.success(ResultUtil.tokenErr())); + return false; + } + } else { + //header没有带Bearer字段 +// RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); + RenderUtil.renderJson(response, ResponseWarpper.success(ResultUtil.tokenErr())); + return false; + } + return true; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/SessionHolderInterceptor.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/SessionHolderInterceptor.java new file mode 100644 index 0000000..d0b46fb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/intercept/SessionHolderInterceptor.java @@ -0,0 +1,34 @@ +package com.agentdriving.user.core.intercept; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.util.HttpSessionHolder; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.stereotype.Component; + +/** + * 静态调用session的拦截器 + * + * @author fengshuonan + * @date 2016年11月13日 下午10:15:42 + */ +@Aspect +@Component +public class SessionHolderInterceptor extends BaseController { + + @Pointcut("execution(* com.agentdriving.user.*..controller.*.*(..))") + public void cutService() { + } + + @Around("cutService()") + public Object sessionKit(ProceedingJoinPoint point) throws Throwable { + HttpSessionHolder.put(super.getHttpServletRequest().getSession()); + try { + return point.proceed(); + } finally { + HttpSessionHolder.remove(); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/listener/ConfigListener.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/listener/ConfigListener.java new file mode 100644 index 0000000..30ad4f8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/listener/ConfigListener.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.listener; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import java.util.HashMap; +import java.util.Map; + +/** + * ServletContext监听器 + * + * @author stylefeng + * @Date 2018/2/22 21:07 + */ +public class ConfigListener implements ServletContextListener { + + private static Map<String, String> conf = new HashMap<>(); + + public static Map<String, String> getConf() { + return conf; + } + + @Override + public void contextDestroyed(ServletContextEvent arg0) { + conf.clear(); + } + + @Override + public void contextInitialized(ServletContextEvent evt) { + ServletContext sc = evt.getServletContext(); + + //项目发布,当前运行环境的绝对路径 + conf.put("realPath", sc.getRealPath("/").replaceFirst("/", "")); + + //servletContextPath,默认"" + conf.put("contextPath", sc.getContextPath()); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/log/LogManager.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/log/LogManager.java new file mode 100644 index 0000000..48681f8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/log/LogManager.java @@ -0,0 +1,33 @@ +package com.agentdriving.user.core.log; + +import java.util.TimerTask; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 日志管理器 + * + * @author fengshuonan + * @date 2017-03-30 16:29 + */ +public class LogManager { + + //日志记录操作延时 + private final int OPERATE_DELAY_TIME = 10; + + //异步操作记录日志的线程池 + private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10); + + private LogManager() { + } + + public static LogManager logManager = new LogManager(); + + public static LogManager me() { + return logManager; + } + + public void executeLog(TimerTask task) { + executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/log/LogObjectHolder.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/log/LogObjectHolder.java new file mode 100644 index 0000000..9973c0a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/log/LogObjectHolder.java @@ -0,0 +1,34 @@ +package com.agentdriving.user.core.log; + +import com.agentdriving.user.core.util.SpringContextHolder; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; +import org.springframework.web.context.WebApplicationContext; + +import java.io.Serializable; + +/** + * 被修改的bean临时存放的地方 + * + * @author fengshuonan + * @date 2017-03-31 11:19 + */ +@Component +@Scope(scopeName = WebApplicationContext.SCOPE_SESSION) +public class LogObjectHolder implements Serializable{ + + private Object object = null; + + public void set(Object obj) { + this.object = obj; + } + + public Object get() { + return object; + } + + public static LogObjectHolder me(){ + LogObjectHolder bean = SpringContextHolder.getBean(LogObjectHolder.class); + return bean; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/log/factory/LogFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/log/factory/LogFactory.java new file mode 100644 index 0000000..14da36a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/log/factory/LogFactory.java @@ -0,0 +1,47 @@ +package com.agentdriving.user.core.log.factory; + +import com.agentdriving.user.core.common.constant.state.LogSucceed; +import com.agentdriving.user.core.common.constant.state.LogType; +import com.agentdriving.user.modular.system.model.LoginLog; +import com.agentdriving.user.modular.system.model.OperationLog; + +import java.util.Date; + +/** + * 日志对象创建工厂 + * + * @author fengshuonan + * @date 2016年12月6日 下午9:18:27 + */ +public class LogFactory { + + /** + * 创建操作日志 + */ + public static OperationLog createOperationLog(LogType logType, Integer userId, String bussinessName, String clazzName, String methodName, String msg, LogSucceed succeed) { + OperationLog operationLog = new OperationLog(); + operationLog.setLogtype(logType.getMessage()); + operationLog.setLogname(bussinessName); + operationLog.setUserid(userId); + operationLog.setClassname(clazzName); + operationLog.setMethod(methodName); + operationLog.setCreatetime(new Date()); + operationLog.setSucceed(succeed.getMessage()); + operationLog.setMessage(msg); + return operationLog; + } + + /** + * 创建登录日志 + */ + public static LoginLog createLoginLog(LogType logType, Integer userId, String msg, String ip) { + LoginLog loginLog = new LoginLog(); + loginLog.setLogname(logType.getMessage()); + loginLog.setUserid(userId); + loginLog.setCreatetime(new Date()); + loginLog.setSucceed(LogSucceed.SUCCESS.getMessage()); + loginLog.setIp(ip); + loginLog.setMessage(msg); + return loginLog; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/log/factory/LogTaskFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/log/factory/LogTaskFactory.java new file mode 100644 index 0000000..0f61657 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/log/factory/LogTaskFactory.java @@ -0,0 +1,102 @@ +package com.agentdriving.user.core.log.factory; + +import com.agentdriving.user.core.common.constant.state.LogSucceed; +import com.agentdriving.user.core.common.constant.state.LogType; +import com.agentdriving.user.core.db.Db; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.dao.LoginLogMapper; +import com.agentdriving.user.modular.system.dao.OperationLogMapper; +import com.agentdriving.user.modular.system.model.LoginLog; +import com.agentdriving.user.modular.system.model.OperationLog; +import com.agentdriving.user.core.log.LogManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.TimerTask; + +/** + * 日志操作任务创建工厂 + * + * @author fengshuonan + * @date 2016年12月6日 下午9:18:27 + */ +public class LogTaskFactory { + + private static Logger logger = LoggerFactory.getLogger(LogManager.class); + private static LoginLogMapper loginLogMapper = Db.getMapper(LoginLogMapper.class); + private static OperationLogMapper operationLogMapper = Db.getMapper(OperationLogMapper.class); + + public static TimerTask loginLog(final Integer userId, final String ip) { + return new TimerTask() { + @Override + public void run() { + try { + LoginLog loginLog = LogFactory.createLoginLog(LogType.LOGIN, userId, null, ip); + loginLogMapper.insert(loginLog); + } catch (Exception e) { + logger.error("创建登录日志异常!", e); + } + } + }; + } + + public static TimerTask loginLog(final String username, final String msg, final String ip) { + return new TimerTask() { + @Override + public void run() { + LoginLog loginLog = LogFactory.createLoginLog( + LogType.LOGIN_FAIL, null, "账号:" + username + "," + msg, ip); + try { + loginLogMapper.insert(loginLog); + } catch (Exception e) { + logger.error("创建登录失败异常!", e); + } + } + }; + } + + public static TimerTask exitLog(final Integer userId, final String ip) { + return new TimerTask() { + @Override + public void run() { + LoginLog loginLog = LogFactory.createLoginLog(LogType.EXIT, userId, null,ip); + try { + loginLogMapper.insert(loginLog); + } catch (Exception e) { + logger.error("创建退出日志异常!", e); + } + } + }; + } + + public static TimerTask bussinessLog(final Integer userId, final String bussinessName, final String clazzName, final String methodName, final String msg) { + return new TimerTask() { + @Override + public void run() { + OperationLog operationLog = LogFactory.createOperationLog( + LogType.BUSSINESS, userId, bussinessName, clazzName, methodName, msg, LogSucceed.SUCCESS); + try { + operationLogMapper.insert(operationLog); + } catch (Exception e) { + logger.error("创建业务日志异常!", e); + } + } + }; + } + + public static TimerTask exceptionLog(final Integer userId, final Exception exception) { + return new TimerTask() { + @Override + public void run() { + String msg = ToolUtil.getExceptionMsg(exception); + OperationLog operationLog = LogFactory.createOperationLog( + LogType.EXCEPTION, userId, "", null, null, msg, LogSucceed.FAIL); + try { + operationLogMapper.insert(operationLog); + } catch (Exception e) { + logger.error("创建异常日志异常!", e); + } + } + }; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroDbRealm.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroDbRealm.java new file mode 100644 index 0000000..d3c1b70 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroDbRealm.java @@ -0,0 +1,78 @@ +package com.agentdriving.user.core.shiro; + +import com.agentdriving.user.core.shiro.factory.IShiro; +import com.agentdriving.user.core.shiro.factory.ShiroFactroy; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.model.User; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.authc.credential.CredentialsMatcher; +import org.apache.shiro.authc.credential.HashedCredentialsMatcher; +import org.apache.shiro.authz.AuthorizationInfo; +import org.apache.shiro.authz.SimpleAuthorizationInfo; +import org.apache.shiro.realm.AuthorizingRealm; +import org.apache.shiro.subject.PrincipalCollection; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class ShiroDbRealm extends AuthorizingRealm { + + /** + * 登录认证 + */ + @Override + protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) + throws AuthenticationException { + IShiro shiroFactory = ShiroFactroy.me(); + UsernamePasswordToken token = (UsernamePasswordToken) authcToken; + User user = shiroFactory.user(token.getUsername()); + ShiroUser shiroUser = shiroFactory.shiroUser(user); + return shiroFactory.info(shiroUser, user, super.getName()); + } + + /** + * 权限认证 + */ + @Override + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { + IShiro shiroFactory = ShiroFactroy.me(); + ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal(); + List<Integer> roleList = shiroUser.getRoleList(); + + Set<String> permissionSet = new HashSet<>(); + Set<String> roleNameSet = new HashSet<>(); + + for (Integer roleId : roleList) { + List<String> permissions = shiroFactory.findPermissionsByRoleId(roleId); + if (permissions != null) { + for (String permission : permissions) { + if (ToolUtil.isNotEmpty(permission)) { + permissionSet.add(permission); + } + } + } + String roleName = shiroFactory.findRoleNameByRoleId(roleId); + roleNameSet.add(roleName); + } + + SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); + info.addStringPermissions(permissionSet); + info.addRoles(roleNameSet); + return info; + } + + /** + * 设置认证加密方式 + */ + @Override + public void setCredentialsMatcher(CredentialsMatcher credentialsMatcher) { + HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); + md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); + md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); + super.setCredentialsMatcher(md5CredentialsMatcher); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroKit.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroKit.java new file mode 100644 index 0000000..0d33a8b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroKit.java @@ -0,0 +1,290 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.shiro; + +import com.agentdriving.user.core.common.constant.Const; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.util.ToolUtil; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.crypto.hash.Md5Hash; +import org.apache.shiro.crypto.hash.SimpleHash; +import org.apache.shiro.session.Session; +import org.apache.shiro.subject.Subject; +import org.apache.shiro.util.ByteSource; + +import java.util.List; + +/** + * shiro工具类 + * + * @author dafei, Chill Zhuang + */ +public class ShiroKit { + + private static final String NAMES_DELIMETER = ","; + + /** + * 加盐参数 + */ + public final static String hashAlgorithmName = "MD5"; + + /** + * 循环次数 + */ + public final static int hashIterations = 1024; + + /** + * shiro密码加密工具类 + * + * @param credentials 密码 + * @param saltSource 密码盐 + * @return + */ + public static String md5(String credentials, String saltSource) { + ByteSource salt = new Md5Hash(saltSource); + return new SimpleHash(hashAlgorithmName, credentials, salt, hashIterations).toString(); + } + + /** + * 获取随机盐值 + * @param length + * @return + */ + public static String getRandomSalt(int length) { + return ToolUtil.getRandomString(length); + } + + /** + * 获取当前 Subject + * + * @return Subject + */ + public static Subject getSubject() { + return SecurityUtils.getSubject(); + } + + /** + * 获取封装的 ShiroUser + * + * @return ShiroUser + */ + public static ShiroUser getUser() { + if (isGuest()) { + return null; + } else { + return (ShiroUser) getSubject().getPrincipals().getPrimaryPrincipal(); + } + } + + /** + * 从shiro获取session + * + */ + public static Session getSession() { + return getSubject().getSession(); + } + + /** + * 获取shiro指定的sessionKey + * + */ + @SuppressWarnings("unchecked") + public static <T> T getSessionAttr(String key) { + Session session = getSession(); + return session != null ? (T) session.getAttribute(key) : null; + } + + /** + * 设置shiro指定的sessionKey + * + */ + public static void setSessionAttr(String key, Object value) { + Session session = getSession(); + session.setAttribute(key, value); + } + + /** + * 移除shiro指定的sessionKey + */ + public static void removeSessionAttr(String key) { + Session session = getSession(); + if (session != null) + session.removeAttribute(key); + } + + /** + * 验证当前用户是否属于该角色?,使用时与lacksRole 搭配使用 + * + * @param roleName + * 角色名 + * @return 属于该角色:true,否则false + */ + public static boolean hasRole(String roleName) { + return getSubject() != null && roleName != null + && roleName.length() > 0 && getSubject().hasRole(roleName); + } + + /** + * 与hasRole标签逻辑相反,当用户不属于该角色时验证通过。 + * + * @param roleName + * 角色名 + * @return 不属于该角色:true,否则false + */ + public static boolean lacksRole(String roleName) { + return !hasRole(roleName); + } + + /** + * 验证当前用户是否属于以下任意一个角色。 + * + * @param roleNames + * 角色列表 + * @return 属于:true,否则false + */ + public static boolean hasAnyRoles(String roleNames) { + boolean hasAnyRole = false; + Subject subject = getSubject(); + if (subject != null && roleNames != null && roleNames.length() > 0) { + for (String role : roleNames.split(NAMES_DELIMETER)) { + if (subject.hasRole(role.trim())) { + hasAnyRole = true; + break; + } + } + } + return hasAnyRole; + } + + /** + * 验证当前用户是否属于以下所有角色。 + * + * @param roleNames + * 角色列表 + * @return 属于:true,否则false + */ + public static boolean hasAllRoles(String roleNames) { + boolean hasAllRole = true; + Subject subject = getSubject(); + if (subject != null && roleNames != null && roleNames.length() > 0) { + for (String role : roleNames.split(NAMES_DELIMETER)) { + if (!subject.hasRole(role.trim())) { + hasAllRole = false; + break; + } + } + } + return hasAllRole; + } + + /** + * 验证当前用户是否拥有指定权限,使用时与lacksPermission 搭配使用 + * + * @param permission + * 权限名 + * @return 拥有权限:true,否则false + */ + public static boolean hasPermission(String permission) { + return getSubject() != null && permission != null + && permission.length() > 0 + && getSubject().isPermitted(permission); + } + + /** + * 与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。 + * + * @param permission + * 权限名 + * @return 拥有权限:true,否则false + */ + public static boolean lacksPermission(String permission) { + return !hasPermission(permission); + } + + /** + * 已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。与notAuthenticated搭配使用 + * + * @return 通过身份验证:true,否则false + */ + public static boolean isAuthenticated() { + return getSubject() != null && getSubject().isAuthenticated(); + } + + /** + * 未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。。 + * + * @return 没有通过身份验证:true,否则false + */ + public static boolean notAuthenticated() { + return !isAuthenticated(); + } + + /** + * 认证通过或已记住的用户。与guset搭配使用。 + * + * @return 用户:true,否则 false + */ + public static boolean isUser() { + return getSubject() != null && getSubject().getPrincipal() != null; + } + + /** + * 验证当前用户是否为“访客”,即未认证(包含未记住)的用户。用user搭配使用 + * + * @return 访客:true,否则false + */ + public static boolean isGuest() { + return !isUser(); + } + + /** + * 输出当前用户信息,通常为登录帐号信息。 + * + * @return 当前用户信息 + */ + public static String principal() { + if (getSubject() != null) { + Object principal = getSubject().getPrincipal(); + return principal.toString(); + } + return ""; + } + + /** + * 获取当前用户的部门数据范围的集合 + */ + public static List<Integer> getDeptDataScope() { + Integer deptId = getUser().getDeptId(); + List<Integer> subDeptIds = ConstantFactory.me().getSubDeptId(deptId); + subDeptIds.add(deptId); + return subDeptIds; + } + + /** + * 判断当前用户是否是超级管理员 + */ + public static boolean isAdmin() { + List<Integer> roleList = ShiroKit.getUser().getRoleList(); + for (Integer integer : roleList) { + String singleRoleTip = ConstantFactory.me().getSingleRoleTip(integer); + if (singleRoleTip.equals(Const.ADMIN_NAME)) { + return true; + } + } + return false; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroUser.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroUser.java new file mode 100644 index 0000000..35727c9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/ShiroUser.java @@ -0,0 +1,81 @@ +package com.agentdriving.user.core.shiro; + +import java.io.Serializable; +import java.util.List; + +/** + * 自定义Authentication对象,使得Subject除了携带用户的登录名外还可以携带更多信息 + * + * @author fengshuonan + * @date 2016年12月5日 上午10:26:43 + */ +public class ShiroUser implements Serializable { + + private static final long serialVersionUID = 1L; + + public Integer id; // 主键ID + public String account; // 账号 + public String name; // 姓名 + public Integer deptId; // 部门id + public List<Integer> roleList; // 角色集 + public String deptName; // 部门名称 + public List<String> roleNames; // 角色名称集 + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getDeptId() { + return deptId; + } + + public void setDeptId(Integer deptId) { + this.deptId = deptId; + } + + public List<Integer> getRoleList() { + return roleList; + } + + public void setRoleList(List<Integer> roleList) { + this.roleList = roleList; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public List<String> getRoleNames() { + return roleNames; + } + + public void setRoleNames(List<String> roleNames) { + this.roleNames = roleNames; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/ICheck.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/ICheck.java new file mode 100644 index 0000000..76fb6e9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/ICheck.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.shiro.check; + +/** + * 检查用接口 + */ +public interface ICheck { + + /** + * 检查当前登录用户是否拥有指定的角色访问当 + */ + boolean check(Object[] permissions); + + /** + * 检查当前登录用户是否拥有当前请求的servlet的权限 + */ + boolean checkAll(); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/PermissionCheckFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/PermissionCheckFactory.java new file mode 100644 index 0000000..e51f20a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/PermissionCheckFactory.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.shiro.check; + +import com.agentdriving.user.core.support.CollectionKit; +import com.agentdriving.user.core.support.HttpKit; +import com.agentdriving.user.core.util.SpringContextHolder; +import com.agentdriving.user.core.listener.ConfigListener; +import com.agentdriving.user.core.shiro.ShiroKit; +import com.agentdriving.user.core.shiro.ShiroUser; +import org.springframework.context.annotation.DependsOn; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletRequest; + +/** + * 权限自定义检查 + */ +@Service +@DependsOn("springContextHolder") +@Transactional(readOnly = true) +public class PermissionCheckFactory implements ICheck { + + public static ICheck me() { + return SpringContextHolder.getBean(ICheck.class); + } + + @Override + public boolean check(Object[] permissions) { + ShiroUser user = ShiroKit.getUser(); + if (null == user) { + return false; + } + String join = CollectionKit.join(permissions, ","); + if (ShiroKit.hasAnyRoles(join)) { + return true; + } + return false; + } + + @Override + public boolean checkAll() { + HttpServletRequest request = HttpKit.getRequest(); + ShiroUser user = ShiroKit.getUser(); + if (null == user) { + return false; + } + String requestURI = request.getRequestURI().replaceFirst(ConfigListener.getConf().get("contextPath"), ""); + String[] str = requestURI.split("/"); + if (str.length > 3) { + requestURI = "/" + str[1] + "/" + str[2]; + } + if (ShiroKit.hasPermission(requestURI)) { + return true; + } + return false; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/PermissionCheckManager.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/PermissionCheckManager.java new file mode 100644 index 0000000..92be0e6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/check/PermissionCheckManager.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.shiro.check; + +import com.agentdriving.user.core.util.SpringContextHolder; + +/** + * 权限检查管理器(入口) + */ +public class PermissionCheckManager { + private final static PermissionCheckManager me = new PermissionCheckManager(); + + private ICheck defaultCheckFactory = SpringContextHolder.getBean(ICheck.class); + + public static PermissionCheckManager me() { + return me; + } + + private PermissionCheckManager() { + } + + public PermissionCheckManager(ICheck checkFactory) { + this.defaultCheckFactory = checkFactory; + } + + public void setDefaultCheckFactory(ICheck defaultCheckFactory) { + this.defaultCheckFactory = defaultCheckFactory; + } + + public static boolean check(Object[] permissions) { + return me.defaultCheckFactory.check(permissions); + } + + public static boolean checkAll() { + return me.defaultCheckFactory.checkAll(); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/factory/IShiro.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/factory/IShiro.java new file mode 100644 index 0000000..9d180c1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/factory/IShiro.java @@ -0,0 +1,50 @@ +package com.agentdriving.user.core.shiro.factory; + +import com.agentdriving.user.core.shiro.ShiroUser; +import com.agentdriving.user.modular.system.model.User; +import org.apache.shiro.authc.SimpleAuthenticationInfo; + +import java.util.List; + +/** + * 定义shirorealm所需数据的接口 + * + * @author fengshuonan + * @date 2016年12月5日 上午10:23:34 + */ +public interface IShiro { + + /** + * 根据账号获取登录用户 + * + * @param account 账号 + */ + User user(String account); + + /** + * 根据系统用户获取Shiro的用户 + * + * @param user 系统用户 + */ + ShiroUser shiroUser(User user); + + /** + * 获取权限列表通过角色id + * + * @param roleId 角色id + */ + List<String> findPermissionsByRoleId(Integer roleId); + + /** + * 根据角色id获取角色名称 + * + * @param roleId 角色id + */ + String findRoleNameByRoleId(Integer roleId); + + /** + * 获取shiro的认证信息 + */ + SimpleAuthenticationInfo info(ShiroUser shiroUser, User user, String realmName); + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/factory/ShiroFactroy.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/factory/ShiroFactroy.java new file mode 100644 index 0000000..853d217 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/shiro/factory/ShiroFactroy.java @@ -0,0 +1,98 @@ +package com.agentdriving.user.core.shiro.factory; + +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.common.constant.state.ManagerStatus; +import com.agentdriving.user.core.shiro.ShiroUser; +import com.agentdriving.user.core.util.Convert; +import com.agentdriving.user.core.util.SpringContextHolder; +import com.agentdriving.user.modular.system.dao.MenuMapper; +import com.agentdriving.user.modular.system.dao.UserMapper; +import com.agentdriving.user.modular.system.model.User; +import org.apache.shiro.authc.CredentialsException; +import org.apache.shiro.authc.LockedAccountException; +import org.apache.shiro.authc.SimpleAuthenticationInfo; +import org.apache.shiro.crypto.hash.Md5Hash; +import org.apache.shiro.util.ByteSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.DependsOn; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +@Service +@DependsOn("springContextHolder") +@Transactional(readOnly = true) +public class ShiroFactroy implements IShiro { + + @Autowired + private UserMapper userMapper; + + @Autowired + private MenuMapper menuMapper; + + public static IShiro me() { + return SpringContextHolder.getBean(IShiro.class); + } + + @Override + public User user(String account) { + + User user = userMapper.getByAccount(account); + + // 账号不存在 + if (null == user) { + throw new CredentialsException(); + } + // 账号被冻结 + if (user.getStatus() != ManagerStatus.OK.getCode()) { + throw new LockedAccountException(); + } + return user; + } + + @Override + public ShiroUser shiroUser(User user) { + ShiroUser shiroUser = new ShiroUser(); + + shiroUser.setId(user.getId()); + shiroUser.setAccount(user.getAccount()); + shiroUser.setDeptId(user.getDeptid()); + shiroUser.setDeptName(ConstantFactory.me().getDeptName(user.getDeptid())); + shiroUser.setName(user.getName()); + + Integer[] roleArray = Convert.toIntArray(user.getRoleid()); + List<Integer> roleList = new ArrayList<Integer>(); + List<String> roleNameList = new ArrayList<String>(); + for (int roleId : roleArray) { + roleList.add(roleId); + roleNameList.add(ConstantFactory.me().getSingleRoleName(roleId)); + } + shiroUser.setRoleList(roleList); + shiroUser.setRoleNames(roleNameList); + + return shiroUser; + } + + @Override + public List<String> findPermissionsByRoleId(Integer roleId) { + return menuMapper.getResUrlsByRoleId(roleId); + } + + @Override + public String findRoleNameByRoleId(Integer roleId) { + return ConstantFactory.me().getSingleRoleTip(roleId); + } + + @Override + public SimpleAuthenticationInfo info(ShiroUser shiroUser, User user, String realmName) { + String credentials = user.getPassword(); + + // 密码加盐处理 + String source = user.getSalt(); + ByteSource credentialsSalt = new Md5Hash(source); + return new SimpleAuthenticationInfo(shiroUser, credentials, credentialsSalt, realmName); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/tag/DictSelectorTag.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/tag/DictSelectorTag.java new file mode 100644 index 0000000..1157a7a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/tag/DictSelectorTag.java @@ -0,0 +1,201 @@ +package com.agentdriving.user.core.tag; + +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.modular.system.model.Dict; +import com.agentdriving.user.modular.system.service.IDictService; +import org.beetl.core.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * 字典标签渲染 + * + * @author zhangjiajia + * @Date 2018年6月4日17:33:32 + */ +@Component +@Scope("prototype") +public class DictSelectorTag extends Tag { + + @Autowired + IDictService iDictService; + + @Override + public void render(){ + //String tagName = (String) this.args[0]; + Map attrs = (Map) args[1]; + if(ToolUtil.isEmpty(attrs.get("code"))){ + throw new GunsException(BizExceptionEnum.ERROR_CODE_EMPTY); + } + + //字典类型编码 + String code = attrs.get("code").toString(); + //控件显示类型select 选择框,radio 单选按钮,checkbox 多选按钮 + String type = ToolUtil.isNotEmpty(attrs.get("type"))?attrs.get("type").toString():"select"; + //开启多选 + String multiple = ToolUtil.isNotEmpty(attrs.get("multiple"))?attrs.get("multiple").toString():""; + //字典名称 + String label = ToolUtil.isNotEmpty(attrs.get("label"))?attrs.get("label").toString():""; + //提示 + String placeholder = (ToolUtil.isNotEmpty(attrs.get("placeholder"))?attrs.get("placeholder").toString():""); + //宽度 + String width = ToolUtil.isNotEmpty(attrs.get("width"))?attrs.get("width").toString():"248"; + //默认值 + String value = ToolUtil.isNotEmpty(attrs.get("value"))?attrs.get("value").toString():""; + //id + String id = ToolUtil.isNotEmpty(attrs.get("id"))?attrs.get("id").toString():""; + //name + String name = ToolUtil.isNotEmpty(attrs.get("name"))?attrs.get("name").toString():""; + //分割线 + String underline = ToolUtil.isNotEmpty(attrs.get("underline"))?attrs.get("underline").toString():""; + //onchange事件 + String onchange = ToolUtil.isNotEmpty(attrs.get("onchange"))?attrs.get("onchange").toString():""; + //readonly属性 + String readonly = ToolUtil.isNotEmpty(attrs.get("readonly"))?attrs.get("readonly").toString():""; + //disabled属性 + String disabled = ToolUtil.isNotEmpty(attrs.get("disabled"))?attrs.get("disabled").toString():""; + //searchnum 下拉选项数量达到多少启用搜索,默认10 + int searchnum = ToolUtil.isNum(attrs.get("searchnum"))?Integer.parseInt(attrs.get("searchnum").toString()):10; + //根据code查询字典数据 + List<Dict> list = iDictService.selectByParentCode(code); + + StringBuffer html = new StringBuffer(); + html.append("<div class=\"form-group\">\r\n"); + html.append("<label class=\"col-sm-3 control-label\">"+label+"</label>\r\n"); + html.append("<div class=\"col-sm-9\">\r\n"); + + //单选按钮 + if("radio".equals(type)) { + + list.forEach(obj->{ + html.append("<label class=\"radio-inline i-checks\">\r\n<input type=\"radio\" "); + //判断控件是否禁用 + if("true".equals(disabled)||"disabled".equals(disabled)) { + html.append("disabled "); + }else{ + if(ToolUtil.isNotEmpty(name)){ + html.append("name=\""+name+"\" "); + } + } + if("true".equals(readonly)||"disabled".equals(readonly)) { + html.append("disabled "); + } + if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ + html.append("checked "); + } + + html.append("value=\""+obj.getCode()+"\" >"+obj.getName()+"</label>\r\n"); + }); + + //多选按钮 + }else if("checkbox".equals(type)){ + list.forEach(obj->{ + html.append("<label class=\"checkbox-inline i-checks\">\r\n<input type=\"checkbox\" "); + //判断控件是否禁用 + if("true".equals(disabled)||"disabled".equals(disabled)) { + html.append("disabled "); + }else{ + if(ToolUtil.isNotEmpty(name)){ + html.append("name=\""+name+"\" "); + } + } + if("true".equals(readonly)||"disabled".equals(readonly)) { + html.append("disabled "); + } + if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ + html.append("checked "); + } + + html.append("value=\""+obj.getCode()+"\" >"+obj.getName()+"</label>\r\n"); + }); + + //默认select + }else{ + //开启多选 + if("true".equals(multiple)){ + if(list.size()>=searchnum) { + html.append("<select multiple "); + }else{ + html.append("<select multiple=\"multiple\" size=\"10\" "); + } + }else{ + html.append("<select "); + } + + //判断控件是否启用提示 + if(ToolUtil.isNotEmpty(placeholder)){ + html.append(" data-placeholder=\""+placeholder+"\" "); + } + + //判断控件是否禁用 + if("true".equals(disabled)||"disabled".equals(disabled)) { + html.append("disabled=\"disabled\" "); + }else{ + //启用 + if(ToolUtil.isNotEmpty(id)){ + html.append("id=\""+id+"\" "); + } + + if(ToolUtil.isNotEmpty(name)){ + html.append("name=\""+name+"\" "); + } + } + + //判断是否启用搜索框 + //判断下拉数据,如果查询出来的条数达到启用搜索的数量就启用 + + + if(list.size()>=searchnum){ + html.append("class=\"form-control chosen-select\" style=\"width:"+width+"px\" tabindex=\"1\" \r\n"); + } else{ + html.append("class=\"form-control\" style=\"width:"+width+"px\" \r\n"); + } + + //判断控件是否只读 + if("true".equals(readonly)||"readonly".equals(readonly)) { + if(list.size()>=searchnum) { + html.append("disabled=\"disabled\" "); + }else{ + html.append("onfocus=\"this.defaultIndex=this.selectedIndex;\" onchange=\"this.selectedIndex=this.defaultIndex;\" "); + } + } + + //判断是否绑定onchange事件 + if(ToolUtil.isNotEmpty(onchange)){ + html.append("onchange=\""+onchange+"($(this).children('option:selected').val())\" "); + } + + html.append(">"); + if(ToolUtil.isNotEmpty(placeholder)){ + html.append("<option value=\"\">"+placeholder+"</option>\r\n"); + } + //将查询出来的数据添加到select中 + list.forEach(obj->{ + if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ + html.append("<option selected value=\""+obj.getCode()+"\">"+obj.getName()+"</option>\r\n"); + }else{ + html.append("<option value=\""+obj.getCode()+"\">"+obj.getName()+"</option>\r\n"); + } + }); + html.append("</select>\r\n"); + } + + html.append("</div>\r\n</div>\r\n"); + //判断是否添加分割线 + if(ToolUtil.isNotEmpty(underline) && "true".equals(underline)) { + html.append("<div class=\"hr-line-dashed\" ></div >\r\n"); + } + + try{ + this.ctx.byteWriter.writeString(html.toString()); + }catch (IOException e){ + throw new RuntimeException("输出字典标签错误"); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/util/ApiMenuFilter.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/util/ApiMenuFilter.java new file mode 100644 index 0000000..7eec2f4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/util/ApiMenuFilter.java @@ -0,0 +1,36 @@ +package com.agentdriving.user.core.util; + +import com.agentdriving.user.config.properties.GunsProperties; +import com.agentdriving.user.core.common.constant.Const; +import com.agentdriving.user.core.node.MenuNode; + +import java.util.ArrayList; +import java.util.List; + +/** + * api接口文档显示过滤 + * + * @author fengshuonan + * @date 2017-08-17 16:55 + */ +public class ApiMenuFilter extends MenuNode { + + public static List<MenuNode> build(List<MenuNode> nodes) { + + //如果关闭了接口文档,则不显示接口文档菜单 + GunsProperties gunsProperties = SpringContextHolder.getBean(GunsProperties.class); + if (!gunsProperties.getSwaggerOpen()) { + List<MenuNode> menuNodesCopy = new ArrayList<>(); + for (MenuNode menuNode : nodes) { + if (Const.API_MENU_NAME.equals(menuNode.getName())) { + continue; + } else { + menuNodesCopy.add(menuNode); + } + } + nodes = menuNodesCopy; + } + + return nodes; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/util/Contrast.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/util/Contrast.java new file mode 100644 index 0000000..bfa4cf5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/util/Contrast.java @@ -0,0 +1,211 @@ +package com.agentdriving.user.core.util; + +import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; +import com.agentdriving.user.core.common.constant.dictmap.factory.DictFieldWarpperFactory; +import com.agentdriving.user.core.support.StrKit; + +import java.beans.PropertyDescriptor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Date; +import java.util.Map; + +/** + * 对比两个对象的变化的工具类 + * + * @author fengshuonan + * @Date 2017/3/31 10:36 + */ +public class Contrast { + + //记录每个修改字段的分隔符 + public static final String separator = ";;;"; + + /** + * 比较两个对象,并返回不一致的信息 + * + * @author stylefeng + * @Date 2017/5/9 19:34 + */ + public static String contrastObj(Object pojo1, Object pojo2) { + String str = ""; + try { + Class clazz = pojo1.getClass(); + Field[] fields = pojo1.getClass().getDeclaredFields(); + int i = 1; + for (Field field : fields) { + if ("serialVersionUID".equals(field.getName())) { + continue; + } + PropertyDescriptor pd = new PropertyDescriptor(field.getName(), clazz); + Method getMethod = pd.getReadMethod(); + Object o1 = getMethod.invoke(pojo1); + Object o2 = getMethod.invoke(pojo2); + if (o1 == null || o2 == null) { + continue; + } + if (o1 instanceof Date) { + o1 = DateUtil.getDay((Date) o1); + } + if (!o1.toString().equals(o2.toString())) { + if (i != 1) { + str += separator; + } + str += "字段名称" + field.getName() + ",旧值:" + o1 + ",新值:" + o2; + i++; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return str; + } + + /** + * 比较两个对象pojo1和pojo2,并输出不一致信息 + * + * @author stylefeng + * @Date 2017/5/9 19:34 + */ + public static String contrastObj(Class dictClass, String key, Object pojo1, Map<String, String> pojo2) throws IllegalAccessException, InstantiationException { + AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); + String str = parseMutiKey(dictMap, key, pojo2) + separator; + try { + Class clazz = pojo1.getClass(); + Field[] fields = pojo1.getClass().getDeclaredFields(); + int i = 1; + for (Field field : fields) { + if ("serialVersionUID".equals(field.getName())) { + continue; + } + PropertyDescriptor pd = new PropertyDescriptor(field.getName(), clazz); + Method getMethod = pd.getReadMethod(); + Object o1 = getMethod.invoke(pojo1); + Object o2 = pojo2.get(StrKit.firstCharToLowerCase(getMethod.getName().substring(3))); + if (o1 == null || o2 == null) { + continue; + } + if (o1 instanceof Date) { + o1 = DateUtil.getDay((Date) o1); + } else if (o1 instanceof Integer) { + o2 = Integer.parseInt(o2.toString()); + } + if (!o1.toString().equals(o2.toString())) { + if (i != 1) { + str += separator; + } + String fieldName = dictMap.get(field.getName()); + String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(field.getName()); + if (fieldWarpperMethodName != null) { + Object o1Warpper = DictFieldWarpperFactory.createFieldWarpper(o1, fieldWarpperMethodName); + Object o2Warpper = DictFieldWarpperFactory.createFieldWarpper(o2, fieldWarpperMethodName); + str += "字段名称:" + fieldName + ",旧值:" + o1Warpper + ",新值:" + o2Warpper; + } else { + str += "字段名称:" + fieldName + ",旧值:" + o1 + ",新值:" + o2; + } + i++; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return str; + } + + /** + * 比较两个对象pojo1和pojo2,并输出不一致信息 + * + * @author stylefeng + * @Date 2017/5/9 19:34 + */ + public static String contrastObjByName(Class dictClass, String key, Object pojo1, Map<String, String> pojo2) throws IllegalAccessException, InstantiationException { + AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); + String str = parseMutiKey(dictMap, key, pojo2) + separator; + try { + Class clazz = pojo1.getClass(); + Field[] fields = pojo1.getClass().getDeclaredFields(); + int i = 1; + for (Field field : fields) { + if ("serialVersionUID".equals(field.getName())) { + continue; + } + String prefix = "get"; + int prefixLength = 3; + if (field.getType().getName().equals("java.lang.Boolean")) { + prefix = "is"; + prefixLength = 2; + } + Method getMethod = null; + try { + getMethod = clazz.getDeclaredMethod(prefix + StrKit.firstCharToUpperCase(field.getName())); + } catch (java.lang.NoSuchMethodException e) { + System.err.println("this className:" + clazz.getName() + " is not methodName: " + e.getMessage()); + continue; + } + Object o1 = getMethod.invoke(pojo1); + Object o2 = pojo2.get(StrKit.firstCharToLowerCase(getMethod.getName().substring(prefixLength))); + if (o1 == null || o2 == null) { + continue; + } + if (o1 instanceof Date) { + o1 = DateUtil.getDay((Date) o1); + } else if (o1 instanceof Integer) { + o2 = Integer.parseInt(o2.toString()); + } + if (!o1.toString().equals(o2.toString())) { + if (i != 1) { + str += separator; + } + String fieldName = dictMap.get(field.getName()); + String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(field.getName()); + if (fieldWarpperMethodName != null) { + Object o1Warpper = DictFieldWarpperFactory.createFieldWarpper(o1, fieldWarpperMethodName); + Object o2Warpper = DictFieldWarpperFactory.createFieldWarpper(o2, fieldWarpperMethodName); + str += "字段名称:" + fieldName + ",旧值:" + o1Warpper + ",新值:" + o2Warpper; + } else { + str += "字段名称:" + fieldName + ",旧值:" + o1 + ",新值:" + o2; + } + i++; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return str; + } + + /** + * 解析多个key(逗号隔开的) + * + * @author stylefeng + * @Date 2017/5/16 22:19 + */ + public static String parseMutiKey(AbstractDictMap dictMap, String key, Map<String, String> requests) { + StringBuilder sb = new StringBuilder(); + if (key.indexOf(",") != -1) { + String[] keys = key.split(","); + for (String item : keys) { + String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(item); + String value = requests.get(item); + if (fieldWarpperMethodName != null) { + Object valueWarpper = DictFieldWarpperFactory.createFieldWarpper(value, fieldWarpperMethodName); + sb.append(dictMap.get(item) + "=" + valueWarpper + ","); + } else { + sb.append(dictMap.get(item) + "=" + value + ","); + } + } + return StrKit.removeSuffix(sb.toString(), ","); + } else { + String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(key); + String value = requests.get(key); + if (fieldWarpperMethodName != null) { + Object valueWarpper = DictFieldWarpperFactory.createFieldWarpper(value, fieldWarpperMethodName); + sb.append(dictMap.get(key) + "=" + valueWarpper); + } else { + sb.append(dictMap.get(key) + "=" + value); + } + return sb.toString(); + } + } + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/util/JwtTokenUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/util/JwtTokenUtil.java new file mode 100644 index 0000000..94c17d1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/util/JwtTokenUtil.java @@ -0,0 +1,127 @@ +package com.agentdriving.user.core.util; + +import com.agentdriving.user.core.common.constant.JwtConstants; +import io.jsonwebtoken.*; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * <p>jwt token工具类</p> + * <pre> + * jwt的claim里一般包含以下几种数据: + * 1. iss -- token的发行者 + * 2. sub -- 该JWT所面向的用户 + * 3. aud -- 接收该JWT的一方 + * 4. exp -- token的失效时间 + * 5. nbf -- 在此时间段之前,不会被处理 + * 6. iat -- jwt发布时间 + * 7. jti -- jwt唯一标识,防止重复使用 + * </pre> + * + * @author fengshuonan + * @Date 2017/8/25 10:59 + */ +@Component +public class JwtTokenUtil { + + /** + * 获取用户名从token中 + */ + public static String getUsernameFromToken(String token) { + return getClaimFromToken(token).getSubject(); + } + + /** + * 获取jwt发布时间 + */ + public static Date getIssuedAtDateFromToken(String token) { + return getClaimFromToken(token).getIssuedAt(); + } + + /** + * 获取jwt失效时间 + */ + public static Date getExpirationDateFromToken(String token) { + return getClaimFromToken(token).getExpiration(); + } + + /** + * 获取jwt接收者 + */ + public static String getAudienceFromToken(String token) { + return getClaimFromToken(token).getAudience(); + } + + /** + * 获取私有的jwt claim + */ + public static String getPrivateClaimFromToken(String token, String key) { + return getClaimFromToken(token).get(key).toString(); + } + + /** + * 获取jwt的payload部分 + */ + public static Claims getClaimFromToken(String token) { + return Jwts.parser() + .setSigningKey(JwtConstants.SECRET) + .parseClaimsJws(token) + .getBody(); + } + + /** + * 解析token是否正确,不正确会报异常<br> + */ + public static void parseToken(String token) throws JwtException { + Jwts.parser().setSigningKey(JwtConstants.SECRET).parseClaimsJws(token).getBody(); + } + + /** + * <pre> + * 验证token是否失效 + * true:过期 false:没过期 + * </pre> + */ + public static Boolean isTokenExpired(String token) { + try { + final Date expiration = getExpirationDateFromToken(token); + return expiration.before(new Date()); + } catch (ExpiredJwtException expiredJwtException) { + return true; + } + } + + /** + * 生成token(通过用户名和签名时候用的随机数) + */ + public static String generateToken(String userId) { + Map<String, Object> claims = new HashMap<>(); + return doGenerateToken(claims, userId); + } + + /** + * 生成token + */ + private static String doGenerateToken(Map<String, Object> claims, String subject) { + final Date createdDate = new Date(); + final Date expirationDate = new Date(createdDate.getTime() + JwtConstants.EXPIRATION * 1000); + + return Jwts.builder() + .setClaims(claims) + .setSubject(subject) + .setIssuedAt(createdDate) + .setExpiration(expirationDate) + .signWith(SignatureAlgorithm.HS512, JwtConstants.SECRET) + .compact(); + } + + /** + * 获取混淆MD5签名用的随机字符串 + */ + public static String getRandomKey() { + return ToolUtil.getRandomString(6); + } +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/core/util/KaptchaUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/core/util/KaptchaUtil.java new file mode 100644 index 0000000..b183719 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/core/util/KaptchaUtil.java @@ -0,0 +1,16 @@ +package com.agentdriving.user.core.util; + +import com.agentdriving.user.config.properties.GunsProperties; + +/** + * 验证码工具类 + */ +public class KaptchaUtil { + + /** + * 获取验证码开关 + */ + public static Boolean getKaptchaOnOff() { + return SpringContextHolder.getBean(GunsProperties.class).getKaptchaOpen(); + } +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/ApiController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/ApiController.java new file mode 100644 index 0000000..e548617 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/ApiController.java @@ -0,0 +1,80 @@ +package com.agentdriving.user.modular.api; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.base.tips.ErrorTip; +import com.agentdriving.user.core.shiro.ShiroKit; +import com.agentdriving.user.core.shiro.ShiroUser; +import com.agentdriving.user.core.util.JwtTokenUtil; +import com.agentdriving.user.modular.system.dao.UserMapper; +import com.agentdriving.user.modular.system.model.User; +import org.apache.shiro.authc.SimpleAuthenticationInfo; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.authc.credential.HashedCredentialsMatcher; +import org.apache.shiro.crypto.hash.Md5Hash; +import org.apache.shiro.util.ByteSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; + +/** + * 接口控制器提供 + * + * @author stylefeng + * @Date 2018/7/20 23:39 + */ +@RestController +@RequestMapping("/gunsApi") +public class ApiController extends BaseController { + + @Autowired + private UserMapper userMapper; + + /** + * api登录接口,通过账号密码获取token + */ + @RequestMapping("/auth") + public Object auth(@RequestParam("username") String username, + @RequestParam("password") String password) { + + //封装请求账号密码为shiro可验证的token + UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password.toCharArray()); + + //获取数据库中的账号密码,准备比对 + User user = userMapper.getByAccount(username); + + String credentials = user.getPassword(); + String salt = user.getSalt(); + ByteSource credentialsSalt = new Md5Hash(salt); + SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( + new ShiroUser(), credentials, credentialsSalt, ""); + + //校验用户账号密码 + HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); + md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); + md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); + boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( + usernamePasswordToken, simpleAuthenticationInfo); + + if (passwordTrueFlag) { + HashMap<String, Object> result = new HashMap<>(); + result.put("token", JwtTokenUtil.generateToken(String.valueOf(user.getId()))); + return result; + } else { + return new ErrorTip(500, "账号密码错误!"); + } + } + + /** + * 测试接口是否走鉴权 + */ + @RequestMapping(value = "/test", method = RequestMethod.POST) + public Object test() { + return SUCCESS_TIP; + } + +} + diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/AppUserController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/AppUserController.java new file mode 100644 index 0000000..fd4fd11 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/AppUserController.java @@ -0,0 +1,567 @@ +package com.agentdriving.user.modular.api; + +import com.agentdriving.user.core.common.annotion.ServiceLog; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.service.*; +import com.agentdriving.user.modular.system.warpper.*; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.agentdriving.user.modular.system.model.AppUser; +import com.agentdriving.user.modular.system.model.SystemConfig; +import com.agentdriving.user.modular.system.service.*; +import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceResponse; +import com.agentdriving.user.modular.system.util.MallBook.util.RSASignature; +import com.agentdriving.user.modular.system.util.PayMoneyUtil; +import com.agentdriving.user.modular.system.util.RedisUtil; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.util.UUIDUtil; +import com.agentdriving.user.modular.system.util.huawei.OBSUtil; +import com.agentdriving.user.modular.system.util.huawei.SMSUtil; +import com.agentdriving.user.modular.system.warpper.*; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.io.PrintWriter; +import java.util.List; + +/** + * 用户控制器 + */ +@RestController +@RequestMapping("") +public class AppUserController { + + @Autowired + private IAppUserService appUserService; + + @Autowired + private IDriverService driverService; + + @Autowired + private ISystemConfigService systemConfigService; + + @Autowired + private PayMoneyUtil payMoneyUtil; + + @Autowired + private IUserToCouponService userToCouponService; + + @Autowired + private IAccountChangeDetailService accountChangeDetailService; + + @Autowired + private IComplaintService complaintService; + + @Autowired + private RedisUtil redisUtil; + + + + + + @ResponseBody + @PostMapping("/base/appUser/appUserLogin") +// @ServiceLog(name = "微信登录", url = "/base/appUser/appUserLogin") + @ApiOperation(value = "微信登录", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "微信jscode", name = "jscode", required = true, dataType = "string"), + }) + public ResponseWarpper appUserLogin(String jscode){ + if(ToolUtil.isEmpty(jscode)){ + return ResponseWarpper.success(ResultUtil.paranErr("jscode")); + } + try { + ResultUtil resultUtil = appUserService.appUserLogin(jscode); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/base/appUser/signInToRegister") +// @ServiceLog(name = "微信手机授权登录", url = "/base/appUser/signInToRegister") + @ApiOperation(value = "微信手机授权登录", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + }) + public ResponseWarpper<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister){ + try { + ResultUtil<SignInToRegisterWarpper> resultUtil = appUserService.signInToRegister(signInToRegister); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/base/appUser/queryNearbyDrivers") + @ServiceLog(name = "获取附近的司机", url = "/base/appUser/queryNearbyDrivers") + @ApiOperation(value = "获取附近的司机", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "经度", name = "lon", required = true, dataType = "string"), + @ApiImplicitParam(value = "纬度", name = "lat", required = true, dataType = "string"), + }) + public ResponseWarpper<List<NearbyDriverWarpper>> queryNearbyDrivers(String lon, String lat){ + if(ToolUtil.isEmpty(lat)){ + return ResponseWarpper.success(ResultUtil.paranErr("lat")); + } + if(ToolUtil.isEmpty(lon)){ + return ResponseWarpper.success(ResultUtil.paranErr("lon")); + } + try { + List<NearbyDriverWarpper> list = driverService.queryDriverPosition(lon, lat, 5D); + return ResponseWarpper.success(list); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/base/appUser/setEmergencyContact") +// @ServiceLog(name = "设置紧急联系人", url = "/base/appUser/queryNearbyDrivers") + @ApiOperation(value = "设置紧急联系人", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "string"), + @ApiImplicitParam(value = "电话", name = "phone", required = true, dataType = "string"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper setEmergencyContact(String name, String phone){ + if(ToolUtil.isEmpty(name)){ + return ResponseWarpper.success(ResultUtil.paranErr("name")); + } + if(ToolUtil.isEmpty(phone)){ + return ResponseWarpper.success(ResultUtil.paranErr("phone")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + AppUser appUser = appUserService.selectById(uid); + appUser.setEmergencyContact(name); + appUser.setEmergencyPhone(phone); + appUserService.updateById(appUser); + return ResponseWarpper.success(); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryUserInfo") +// @ServiceLog(name = "获取个人信息", url = "/api/appUser/queryUserInfo") + @ApiOperation(value = "获取个人信息", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<UserInfoWarpper> queryUserInfo(){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + AppUser appUser = appUserService.selectById(uid); + UserInfoWarpper userInfoWarpper = new UserInfoWarpper(); + BeanUtils.copyProperties(appUser, userInfoWarpper); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7)); + if(null != systemConfig){ + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + userInfoWarpper.setServiceCell(jsonObject.getString("num1")); + } + return ResponseWarpper.success(userInfoWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/uploadImg") +// @ServiceLog(name = "上传头像图片", url = "/api/appUser/uploadImg") + @ApiOperation(value = "上传头像图片", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "图片文件", name = "file", required = true, dataType = "file"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<String> uploadImg(MultipartFile file){ + try { + InputStream inputStream = file.getInputStream(); + String name = file.getOriginalFilename(); + name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf(".")); + String s = OBSUtil.putObjectToBucket(inputStream, name); + return ResponseWarpper.success(s); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/appUser/updateUserInfo") +// @ServiceLog(name = "修改个人信息", url = "/api/appUser/updateUserInfo") + @ApiOperation(value = "修改个人信息", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper updateUserInfo(UserInfo userInfo){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = appUserService.updateUserInfo(uid, userInfo); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + + @ResponseBody + @PostMapping("/api/appUser/queryPriceRules") +// @ServiceLog(name = "获取价格表", url = "/api/appUser/queryPriceRules") + @ApiOperation(value = "获取价格表", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<PriceRulesWarpper> queryPriceRules(){ + try { + PriceRulesWarpper priceRulesWarpper = systemConfigService.queryPriceRules(); + return ResponseWarpper.success(priceRulesWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryTopUpPrompt") +// @ServiceLog(name = "获取充值优惠提示", url = "/api/appUser/queryTopUpPrompt") + @ApiOperation(value = "获取充值优惠提示", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<String> queryTopUpPrompt(){ + try { + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); + if(null != systemConfig){ + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + return ResponseWarpper.success("充值满" + jsonObject.getDouble("num2") + "元,下单享9折优惠!"); + } + return ResponseWarpper.success(); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/rechargeBalance") +// @ServiceLog(name = "充值操作", url = "/api/appUser/rechargeBalance") + @ApiOperation(value = "充值操作", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper rechargeBalance(Double amount){ + if(null == amount){ + return ResponseWarpper.success(ResultUtil.paranErr("amount")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = appUserService.rechargeBalance(uid, amount); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/base/appUser/rechargeBalanceCallback") +// @ServiceLog(name = "余额充值回调", url = "/base/appUser/rechargeBalanceCallback") + public void rechargeBalanceCallback(HttpServletRequest request, HttpServletResponse response){ + try { + String code = request.getParameter("code"); + String version = request.getParameter("version"); + String msg = request.getParameter("msg"); + String date = request.getParameter("date"); + String result = request.getParameter("result"); + String sign = request.getParameter("sign"); + InterfaceResponse interfaceResponse = new InterfaceResponse(); + interfaceResponse.setCode(code); + interfaceResponse.setVersion(version); + interfaceResponse.setMsg(msg); + interfaceResponse.setDate(date); + interfaceResponse.setResult(result); + interfaceResponse.setSign(sign); + // 验签 + boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); + if (verify) {//验签成功业务处理逻辑 + JSONObject jsonObject = JSON.parseObject(result); + String merOrderId = jsonObject.getString("merOrderId"); + String orderId = jsonObject.getString("parameter1"); + appUserService.rechargeBalanceCallback(orderId, merOrderId); + response.setStatus(200); + PrintWriter out = response.getWriter(); + out.print("OK"); + out.flush(); + out.close(); + } else {//验签失败业务处理逻辑 + System.err.println("支付回调验签失败"); + } + +// Map<String, String> map = payMoneyUtil.weixinpayCallback(request); +// if(null != map){ +// String out_trade_no = map.get("out_trade_no"); +// String transaction_id = map.get("transaction_id"); +// String result = map.get("result"); +// String orderId = out_trade_no.substring(17); +// appUserService.rechargeBalanceCallback(out_trade_no, transaction_id); +// PrintWriter out = response.getWriter(); +// out.print(result); +// out.flush(); +// out.close(); +// } + }catch (Exception e){ + e.printStackTrace(); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryMyCoupons") +// @ServiceLog(name = "获取优惠券列表", url = "/api/appUser/queryMyCoupons") + @ApiOperation(value = "获取优惠券列表", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "状态(1=未使用,2=已使用,3=已过期)", name = "state", required = true, dataType = "int"), + @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), + @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<CouponsWarpper>> queryMyCoupons(Integer state, Integer pageNum, Integer pageSize){ + if(null == state){ + return ResponseWarpper.success(ResultUtil.paranErr("state")); + } + if(null == pageNum){ + return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); + } + if(null == pageSize){ + return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<CouponsWarpper> couponsWarppers = userToCouponService.queryMyCoupons(uid, state, pageNum, pageSize); + return ResponseWarpper.success(couponsWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryUsedCouponNum") +// @ServiceLog(name = "获取已使用优惠券数量", url = "/api/appUser/queryUsedCouponNum") + @ApiOperation(value = "获取已使用优惠券数量", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<Integer> queryUsedCouponNum(){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + Integer integer = userToCouponService.queryUsedCouponNum(uid); + return ResponseWarpper.success(integer); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryBalanceDetails") +// @ServiceLog(name = "获取余额明细", url = "/api/appUser/queryBalanceDetails") + @ApiOperation(value = "获取余额明细", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "统计时间", name = "time", required = true, dataType = "string"), + @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), + @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<BalanceDetailsWarpper>> queryBalanceDetails(String time, Integer pageNum, Integer pageSize){ + if(ToolUtil.isEmpty(time)){ + return ResponseWarpper.success(ResultUtil.paranErr("time")); + } + if(null == pageNum){ + return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); + } + if(null == pageSize){ + return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<BalanceDetailsWarpper> balanceDetailsWarppers = accountChangeDetailService.queryBalanceDetails(uid, time, pageNum, pageSize); + return ResponseWarpper.success(balanceDetailsWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/cancelAccount") +// @ServiceLog(name = "注销账号", url = "/api/appUser/cancelAccount") + @ApiOperation(value = "注销账号", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper cancelAccount(){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + AppUser appUser = appUserService.selectById(uid); + appUser.setStatus(3); + appUserService.updateById(appUser); + return ResponseWarpper.success(); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/feedback") +// @ServiceLog(name = "投诉反馈", url = "/api/appUser/feedback") + @ApiOperation(value = "投诉反馈", tags = {"用户端-首页", "用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = false, dataType = "int"), + @ApiImplicitParam(value = "反馈内容", name = "content", required = true, dataType = "string"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper feedback(Integer orderId, String content){ + if(null == content){ + return ResponseWarpper.success(ResultUtil.paranErr("content")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + complaintService.feedback(uid, orderId, content); + return ResponseWarpper.success(); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/base/appUser/getVerificationCode") +// @ServiceLog(name = "获取短信验证码", url = "/base/appUser/getVerificationCode") + @ApiOperation(value = "获取短信验证码", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), + @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "string"), + }) + public ResponseWarpper getVerificationCode(String receiver, String phone){ + if(ToolUtil.isEmpty(receiver)){ + return ResponseWarpper.success(ResultUtil.paranErr("receiver")); + } + if(ToolUtil.isEmpty(phone)){ + return ResponseWarpper.success(ResultUtil.paranErr("phone")); + } + try { + String numberRandom = UUIDUtil.getNumberRandom(5); + SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); + redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 + return ResponseWarpper.success(ResultUtil.success()); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/base/appUser/verifySMSCode") +// @ServiceLog(name = "验证短信验证码", url = "/base/appUser/verifySMSCode") + @ApiOperation(value = "验证短信验证码", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "String"), + @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper verifySMSCode(String phone, String code){ + if(ToolUtil.isEmpty(phone)){ + return ResponseWarpper.success(ResultUtil.paranErr("phone")); + } + if(ToolUtil.isEmpty(phone)){ + return ResponseWarpper.success(ResultUtil.paranErr("code")); + } + try { + ResultUtil resultUtil = ResultUtil.success(); + phone = phone.indexOf("+86") < 0 ? "+86" + phone : phone; + String value = redisUtil.getValue(phone); + if(ToolUtil.isEmpty(value) || !value.equals(code)){ + return ResponseWarpper.success(ResultUtil.error("验证码无效")); + } + redisUtil.remove(phone); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/BroadcastController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/BroadcastController.java new file mode 100644 index 0000000..a9b0d06 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/BroadcastController.java @@ -0,0 +1,57 @@ +package com.agentdriving.user.modular.api; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.agentdriving.user.modular.system.model.Broadcast; +import com.agentdriving.user.modular.system.service.IBroadcastService; +import com.agentdriving.user.modular.system.warpper.ResponseWarpper; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +/** +* 广播 +* @author pzb +* @Date 2023/2/27 17:12 +*/ +@RestController +@RequestMapping("") +public class BroadcastController { + + @Autowired + private IBroadcastService broadcastService; + + + + @ResponseBody + @PostMapping("/base/broadcast/queryBroadcast") +// @ServiceLog(name = "获取广播", url = "/base/broadcast/queryBroadcast") + @ApiOperation(value = "获取广播", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + }) + public ResponseWarpper<List<String>> queryBroadcast(){ + try { + List<Broadcast> broadcasts = broadcastService.selectList(new EntityWrapper<Broadcast>() + .eq("`status`", 1).eq("`show`", 1) + .eq("`upDown`", 1).orderBy("`sort` desc limit 0, 5")); + List<String> list = new ArrayList<>(); + for (Broadcast broadcast : broadcasts) { + list.add(broadcast.getContent()); + } + return ResponseWarpper.success(list); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/CommercialController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/CommercialController.java new file mode 100644 index 0000000..9ce1dc9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/CommercialController.java @@ -0,0 +1,63 @@ +package com.agentdriving.user.modular.api; + +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.service.IAppUserService; +import com.agentdriving.user.modular.system.service.ICommercialService; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.CommercialWarpper; +import com.agentdriving.user.modular.system.warpper.ResponseWarpper; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 广告控制器 + */ +@RestController +@RequestMapping() +public class CommercialController { + + @Autowired + private ICommercialService commercialService; + + @Autowired + private IAppUserService appUserService; + + + + @ResponseBody + @PostMapping("/api/commercial/queryCommercialList") +// @ServiceLog(name = "获取广告列表", url = "/api/driver/queryCommercialList") + @ApiOperation(value = "获取广告列表", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "广告类型(1=弹窗广告,2=底部广告)", name = "type", required = true, dataType = "int"), + @ApiImplicitParam(value = "设备类型(1=小程序,2=司机端)", name = "device", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<CommercialWarpper>> queryCommercialList(Integer type, Integer device){ + if(ToolUtil.isEmpty(type)){ + return ResponseWarpper.success(ResultUtil.paranErr("type")); + } + if(ToolUtil.isEmpty(device)){ + return ResponseWarpper.success(ResultUtil.paranErr("device")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<CommercialWarpper> commercialWarppers = commercialService.queryCommercialList(uid, type, device); + return ResponseWarpper.success(commercialWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/HtmlController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/HtmlController.java new file mode 100644 index 0000000..8e8127c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/HtmlController.java @@ -0,0 +1,105 @@ +package com.agentdriving.user.modular.api; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.agentdriving.user.modular.system.model.Html; +import com.agentdriving.user.modular.system.model.SystemConfig; +import com.agentdriving.user.modular.system.service.IHtmlService; +import com.agentdriving.user.modular.system.service.ISystemConfigService; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.ResponseWarpper; +import com.agentdriving.user.modular.system.warpper.StartPriceWarpper; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 协议控制器 + */ +@RestController +@RequestMapping("") +public class HtmlController { + + @Autowired + private IHtmlService htmlService; + + @Autowired + private ISystemConfigService systemConfigService; + + + + + @ResponseBody + @PostMapping("/base/html/queryHtml") +// @ServiceLog(name = "获取各种协议和说明", url = "/base/html/queryHtml") + @ApiOperation(value = "获取各种协议和说明", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "类型(1=代驾服务协议与隐私政策保护,2=法律条款,3=个人信息处理规则,4=积分说明,5=佣金规则说明,6=行程录音说明,7=预估价格说明,8=加盟基本要求,9=加盟流程,10=起步价说明,11=注销协议,12=关于我们,13=司机消单说明)", name = "type", required = true, dataType = "int"), + }) + public ResponseWarpper<String> queryHtml(Integer type){ + if(null == type){ + return ResponseWarpper.success(ResultUtil.paranErr("type")); + } + try { + Html html = htmlService.selectOne(new EntityWrapper<Html>().eq("type", type)); + return ResponseWarpper.success(null == html ? "" : html.getHtml()); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/base/html/queryStartPrice") +// @ServiceLog(name = "获取起步价和起步价说明", url = "/base/html/queryStartPrice") + @ApiOperation(value = "获取起步价和起步价说明", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + }) + public ResponseWarpper<StartPriceWarpper> queryStartPrice(){ + try { + Html html = htmlService.selectOne(new EntityWrapper<Html>().eq("type",10)); + StartPriceWarpper startPriceWarpper = new StartPriceWarpper(); + //{"ChargeStandard":[{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2}],"ExtraCost":{"num1":1,"num2":1,"num3":1,"num4":1,"num5":1,"num6":1,"num7":1,"num8":1,"num9":1},"description":"这是一段说明文本"} + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); + SimpleDateFormat sdf = new SimpleDateFormat("HHmm"); + Integer integer = Integer.valueOf(sdf.format(new Date())); + for (int i = 0; i < chargeStandard.size(); i++) { + JSONObject jsonObject1 = chargeStandard.getJSONObject(i); + String num1 = jsonObject1.getString("num1"); + String num2 = jsonObject1.getString("num2"); + num1 = num1.replaceAll(":", ""); + num2 = num2.replaceAll(":", ""); + + Double num3 = jsonObject1.getDouble("num3"); + Double num4 = jsonObject1.getDouble("num4"); + Double num5 = jsonObject1.getDouble("num5"); + Double num6 = jsonObject1.getDouble("num6"); + if(integer >= Integer.valueOf(num1) && integer < Integer.valueOf(num2)){ + startPriceWarpper.setStartPrice(num4); + startPriceWarpper.setStartDistance(num3); + startPriceWarpper.setExcessMileageUnitPrice(num6); + startPriceWarpper.setOvermileage(num5); + break; + } + } + startPriceWarpper.setDescription(null == html ? "" : html.getHtml()); + return ResponseWarpper.success(startPriceWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/MainContentController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/MainContentController.java new file mode 100644 index 0000000..d4c3257 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/MainContentController.java @@ -0,0 +1,59 @@ +package com.agentdriving.user.modular.api; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.agentdriving.user.modular.system.model.MainContent; +import com.agentdriving.user.modular.system.service.IMainContentService; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.ResponseWarpper; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +/** +* 事由控制器 +* @author pzb +* @Date 2023/2/27 12:02 +*/ +@RestController +@RequestMapping("") +public class MainContentController { + + @Autowired + private IMainContentService mainContentService; + + + + @ResponseBody + @PostMapping("/base/mainContent/queryMainContent") +// @ServiceLog(name = "获取系统事由", url = "/base/mainContent/queryMainContent") + @ApiOperation(value = "获取系统事由", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "数据类型(1=转单,2=司机消单,3=用户取消订单)", name = "type", required = true, dataType = "int"), + }) + public ResponseWarpper<List<String>> queryMainContent(Integer type){ + if(null == type){ + return ResponseWarpper.success(ResultUtil.paranErr("type")); + } + try { + List<MainContent> mainContents = mainContentService.selectList(new EntityWrapper<MainContent>().eq("type", type) + .eq("status", 1).orderBy("createTime")); + List<String> list = new ArrayList<>(); + for (MainContent mainContent : mainContents) { + list.add(mainContent.getContent()); + } + return ResponseWarpper.success(list); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/OrderController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/OrderController.java new file mode 100644 index 0000000..d920b43 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/api/OrderController.java @@ -0,0 +1,619 @@ +package com.agentdriving.user.modular.api; + +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.model.Driver; +import com.agentdriving.user.modular.system.service.*; +import com.agentdriving.user.modular.system.warpper.*; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.agentdriving.user.modular.system.model.AppUser; +import com.agentdriving.user.modular.system.model.Order; +import com.agentdriving.user.modular.system.model.Revenue; +import com.agentdriving.user.modular.system.service.*; +import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceResponse; +import com.agentdriving.user.modular.system.util.MallBook.model.Receive; +import com.agentdriving.user.modular.system.util.MallBook.model.ReceiveUser; +import com.agentdriving.user.modular.system.util.MallBook.util.RSASignature; +import com.agentdriving.user.modular.system.util.MallBook.util.TrhRequest; +import com.agentdriving.user.modular.system.util.PayMoneyUtil; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.*; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.util.*; +import java.util.stream.Collectors; + +/** +* 订单控制器 +* @author pzb +* @Date 2023/2/28 11:24 +*/ +@RestController +@RequestMapping("") +public class OrderController { + + @Autowired + private IOrderService orderService; + + @Autowired + private IAppUserService appUserService; + + @Autowired + private PayMoneyUtil payMoneyUtil; + + @Autowired + private IBillService billService; + + @Autowired + private IRevenueService revenueService; + + @Autowired + private IDriverService driverService; + + + + + + @ResponseBody + @PostMapping("/api/order/queryServerOrder") +// @ServiceLog(name = "获取正在进行中的订单id", url = "/api/order/queryServerOrder") + @ApiOperation(value = "获取正在进行中的订单id", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<Long>> queryServerOrder(){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + AppUser appUser = appUserService.selectById(uid); + List<Integer> list = Arrays.asList(101, 102, 103, 104, 105, 106, 107, 201, 401); + List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("userPhone", appUser.getPhone()).eq("status", 1).in("state", list)); + List<Long> collect = orders.stream().map(Order::getId).collect(Collectors.toList()); + return ResponseWarpper.success(collect); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/getEstimatedCosts") +// @ServiceLog(name = "获取预估费用", url = "/api/order/getEstimatedCosts") + @ApiOperation(value = "获取预估费用", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<EstimatedCostsWarpper> getEstimatedCosts(EstimatedCosts estimatedCosts){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil<EstimatedCostsWarpper> estimatedCosts1 = orderService.getEstimatedCosts(uid, estimatedCosts); + return ResponseWarpper.success(estimatedCosts1); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/travelOrder") +// @ServiceLog(name = "用户下单/扫码下单", url = "/api/order/travelOrder") + @ApiOperation(value = "用户下单/扫码下单", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper travelOrder(TravelOrder travelOrder){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = orderService.travelOrder(uid, travelOrder); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + + @ResponseBody + @PostMapping("/api/order/cancelOrder") +// @ServiceLog(name = "用户取消订单", url = "/api/order/cancelOrder") + @ApiOperation(value = "用户取消订单", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), + @ApiImplicitParam(value = "取消原因", name = "cause", required = true, dataType = "string"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper cancelOrder(Long orderId, String cause){ + if(null == orderId){ + return ResponseWarpper.success(ResultUtil.paranErr("orderId")); + } + if(ToolUtil.isEmpty(cause)){ + return ResponseWarpper.success(ResultUtil.paranErr("cause")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = orderService.cancelOrder(uid, orderId, cause); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/queryOrderInfo") +// @ServiceLog(name = "获取订单详情", url = "/api/order/queryOrderInfo") + @ApiOperation(value = "获取订单详情", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<OrderInfoWarpper> queryOrderInfo(Long orderId){ + if(null == orderId){ + return ResponseWarpper.success(ResultUtil.paranErr("orderId")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(uid, orderId); + return ResponseWarpper.success(orderInfoWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/base/order/queryShareOrderInfo") +// @ServiceLog(name = "获取订单详情", url = "/base/order/queryShareOrderInfo") + @ApiOperation(value = "获取订单详情", tags = {"用户端-分享"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), + }) + public ResponseWarpper<OrderInfoWarpper> queryOrderInfo1(Long orderId){ + if(null == orderId){ + return ResponseWarpper.success(ResultUtil.paranErr("orderId")); + } + try { + OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(null, orderId); + return ResponseWarpper.success(orderInfoWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/editOrderEndAddress") +// @ServiceLog(name = "修改终点", url = "/api/order/editOrderEndAddress") + @ApiOperation(value = "修改终点", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper editOrderEndAddress(EditOrderEndAddress editOrderEndAddress){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = orderService.editOrderEndAddress(uid, editOrderEndAddress); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/order/queryOrderPrice") +// @ServiceLog(name = "获取订单费用明细", url = "/api/order/queryOrderPrice") + @ApiOperation(value = "获取订单费用明细", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<OrderPriceWarpper> queryOrderPrice(Long orderId){ + if(null == orderId){ + return ResponseWarpper.success(ResultUtil.paranErr("orderId")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + OrderPriceWarpper orderPriceWarpper = orderService.queryOrderPrice(uid, orderId); + return ResponseWarpper.success(orderPriceWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/calculationOfExpenses") +// @ServiceLog(name = "重新计算待支付页面订单费用明细", url = "/api/order/calculationOfExpenses") + @ApiOperation(value = "重新计算待支付页面订单费用明细", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), + @ApiImplicitParam(value = "优惠券id", name = "couponId", required = true, dataType = "int"), + @ApiImplicitParam(value = "是否使用余额抵扣(0=否,1=是)", name = "payType", required = true, dataType = "int"), + @ApiImplicitParam(value = "抵扣金额", name = "balance", required = true, dataType = "double"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<OrderPriceWarpper> calculationOfExpenses(Long orderId, Integer couponId, Integer payType, Double balance){ + if(null == orderId){ + return ResponseWarpper.success(ResultUtil.paranErr("orderId")); + } + if(null == payType){ + return ResponseWarpper.success(ResultUtil.paranErr("payType")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + OrderPriceWarpper orderPriceWarpper = orderService.calculationOfExpenses(uid, orderId, couponId, payType, balance); + return ResponseWarpper.success(orderPriceWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/queryPayCouponList") +// @ServiceLog(name = "获取支付页面优惠券选择列表", url = "/api/order/queryPayCouponList") + @ApiOperation(value = "获取支付页面优惠券选择列表", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<CouponWarpper>> queryPayCouponList(Long orderId){ + if(null == orderId){ + return ResponseWarpper.success(ResultUtil.paranErr("orderId")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<CouponWarpper> list = orderService.queryPayCouponList(uid, orderId); + return ResponseWarpper.success(list); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/order/orderPayment") +// @ServiceLog(name = "订单完成后的支付操作", url = "/api/order/orderPayment") + @ApiOperation(value = "订单完成后的支付操作", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper orderPayment(OrderPayment orderPayment){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = orderService.orderPayment(uid, orderPayment); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + /** + * 订单微信支付回调处理 + * @param request + * @param response + */ + @ResponseBody + @PostMapping("/base/order/orderPayCallback") + public void orderPayCallback(HttpServletRequest request, HttpServletResponse response){ + try { + String code = request.getParameter("code"); + String version = request.getParameter("version"); + String msg = request.getParameter("msg"); + String date = request.getParameter("date"); + String result = request.getParameter("result"); + String sign = request.getParameter("sign"); + InterfaceResponse interfaceResponse = new InterfaceResponse(); + interfaceResponse.setCode(code); + interfaceResponse.setVersion(version); + interfaceResponse.setMsg(msg); + interfaceResponse.setDate(date); + interfaceResponse.setResult(result); + interfaceResponse.setSign(sign); + // 验签 + boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); + if (verify) {//验签成功业务处理逻辑 + JSONObject jsonObject = JSON.parseObject(result); + String merOrderId = jsonObject.getString("merOrderId"); + String orderId = jsonObject.getString("parameter1"); + ResultUtil resultUtil = orderService.orderPayCallback(orderId, merOrderId); + if(resultUtil.getCode() == 10000){ + response.setStatus(200); + PrintWriter out = response.getWriter(); + out.print("OK"); + out.flush(); + out.close(); + } + } else {//验签失败业务处理逻辑 + System.err.println("支付回调验签失败"); + } + + +// Map<String, String> map = payMoneyUtil.weixinpayCallback(request); +// if(null != map){ +// String out_trade_no = map.get("out_trade_no"); +// String transaction_id = map.get("transaction_id"); +// String result = map.get("result"); +// String orderId = out_trade_no.substring(17); +// ResultUtil resultUtil = orderService.orderPayCallback(orderId, transaction_id); +// if(resultUtil.getCode() == 10000){ +// PrintWriter out = response.getWriter(); +// out.print(result); +// out.flush(); +// out.close(); +// } +// } + }catch (Exception e){ + e.printStackTrace(); + } + } + + + /** + * 异步分账回调 + */ + @ResponseBody + @PostMapping("/base/order/ledgerCallback") + public void ledgerCallback(HttpServletRequest request, HttpServletResponse response){ + try{ + String code = request.getParameter("code"); + String version = request.getParameter("version"); + String msg = request.getParameter("msg"); + String date = request.getParameter("date"); + String result = request.getParameter("result"); + String sign = request.getParameter("sign"); + InterfaceResponse interfaceResponse = new InterfaceResponse(); + interfaceResponse.setCode(code); + interfaceResponse.setVersion(version); + interfaceResponse.setMsg(msg); + interfaceResponse.setDate(date); + interfaceResponse.setResult(result); + interfaceResponse.setSign(sign); + // 验签 + boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); + if (verify) {//验签成功业务处理逻辑 + JSONObject jsonObject = JSON.parseObject(result); + String merOrderId = jsonObject.getString("merOrderId"); + String orderId = jsonObject.getString("parameter1"); + //确认收货 + new Timer().schedule(new TimerTask() { + @Override + public void run() { + Order order = orderService.selectById(orderId); + List<Revenue> revenues = revenueService.selectList(new EntityWrapper<Revenue>().eq("userType", 2).eq("orderId", order.getId())); + Receive receive = new Receive();//确认收货 + receive.setOriginalMerOrderId(merOrderId); + receive.setRcvAmount(String.valueOf(order.getPayMoney() * 100)); + List<ReceiveUser> splitList = new ArrayList<>(); + for (Revenue revenue : revenues) { + Driver driver = driverService.selectById(revenue.getUserId()); + ReceiveUser receiveUser = new ReceiveUser(); + receiveUser.setSplitUserId(driver.getMerchantNumber()); + receiveUser.setRcvSplitAmount(revenue.getAmount().toString()); + splitList.add(receiveUser); + } + receive.setSplitList(splitList); + TrhRequest<Receive> request1 = new TrhRequest(); + InterfaceResponse execute = request1.execute(receive, Receive.SERVICE_CODE); + if(!"0000".equals(execute.getResult())){ + System.err.println("确认收货" + execute.getMsg()); + } + JSONObject jsonObject = JSON.parseObject(execute.getResult()); + String status = jsonObject.getString("status"); + if("2".equals(status)){ + System.err.println("确认收货失败"); + } + if("0".equals(status)){ + System.err.println("确认收货处理中"); + } + } + }, 30000); + response.setStatus(200); + PrintWriter out = response.getWriter(); + out.print("OK"); + out.flush(); + out.close(); + } else {//验签失败业务处理逻辑 + System.err.println("支付回调验签失败"); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + + + + + @ResponseBody + @PostMapping("/api/order/orderAppraise") +// @ServiceLog(name = "订单评价操作", url = "/api/order/orderAppraise") + @ApiOperation(value = "订单评价操作", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), + @ApiImplicitParam(value = "评分", name = "score", required = true, dataType = "int"), + @ApiImplicitParam(value = "评价内容", name = "content", required = true, dataType = "string"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper orderAppraise(Long orderId, Integer score, String content){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = orderService.orderAppraise(uid, orderId, score, content); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + @ResponseBody + @PostMapping("/api/order/queryMyOrder") +// @ServiceLog(name = "获取我的行程", url = "/api/order/queryMyOrder") + @ApiOperation(value = "获取我的行程", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), + @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<OrderListWarpper>> queryMyOrder(Integer pageNum, Integer pageSize){ + if(null == pageNum){ + return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); + } + if(null == pageSize){ + return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<OrderListWarpper> orderListWarppers = orderService.queryMyOrder(uid, pageNum, pageSize); + return ResponseWarpper.success(orderListWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/order/queryNotInvoiceOrder") +// @ServiceLog(name = "获取未开票订单列表", url = "/api/order/queryNotInvoiceOrder") + @ApiOperation(value = "获取未开票订单列表", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<OrderListWarpper>> queryNotInvoiceOrder(NotInvoiceOrder notInvoiceOrder){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<OrderListWarpper> orderListWarppers = orderService.queryNotInvoiceOrder(uid, notInvoiceOrder); + return ResponseWarpper.success(orderListWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/invoicing") +// @ServiceLog(name = "开票操作", url = "/api/order/invoicing") + @ApiOperation(value = "开票操作", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper invoicing(Invoicing invoicing){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil invoicing1 = billService.invoicing(uid, invoicing); + return ResponseWarpper.success(invoicing1); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/queryBillList") +// @ServiceLog(name = "获取开票历史", url = "/api/order/queryBillList") + @ApiOperation(value = "获取开票历史", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), + @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<BillWarpper>> queryBillList(Integer pageNum, Integer pageSize){ + if(null == pageNum){ + return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); + } + if(null == pageSize){ + return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<BillWarpper> billWarppers = billService.queryBillList(uid, pageNum, pageSize); + return ResponseWarpper.success(billWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/controller/CodeController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/controller/CodeController.java new file mode 100644 index 0000000..f44b716 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/controller/CodeController.java @@ -0,0 +1,61 @@ +package com.agentdriving.user.modular.code.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.config.properties.DruidProperties; +import com.agentdriving.user.generator.action.config.WebGeneratorConfig; +import com.agentdriving.user.generator.action.model.GenQo; +import com.agentdriving.user.modular.code.factory.DefaultTemplateFactory; +import com.agentdriving.user.modular.code.service.TableService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +/** + * 代码生成控制器 + * + * @author fengshuonan + * @Date 2017年11月30日16:39:19 + */ +@Controller +@RequestMapping("/code") +public class CodeController extends BaseController { + + private static String PREFIX = "/code"; + + @Autowired + private TableService tableService; + + @Autowired + private DruidProperties druidProperties; + + /** + * 跳转到代码生成主页 + */ + @RequestMapping("") + public String blackboard(Model model) { + model.addAttribute("tables", tableService.getAllTables()); + model.addAttribute("params", DefaultTemplateFactory.getDefaultParams()); + model.addAttribute("templates", DefaultTemplateFactory.getDefaultTemplates()); + return PREFIX + "/code.html"; + } + + /** + * 生成代码 + */ + @ApiOperation("生成代码") + @RequestMapping(value = "/generate", method = RequestMethod.POST) + @ResponseBody + public Object generate(GenQo genQo) { + genQo.setUrl(druidProperties.getUrl()); + genQo.setUserName(druidProperties.getUsername()); + genQo.setPassword(druidProperties.getPassword()); + WebGeneratorConfig webGeneratorConfig = new WebGeneratorConfig(genQo); + webGeneratorConfig.doMpGeneration(); + webGeneratorConfig.doGunsGeneration(); + return SUCCESS_TIP; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/factory/DefaultTemplateFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/factory/DefaultTemplateFactory.java new file mode 100644 index 0000000..22aefeb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/factory/DefaultTemplateFactory.java @@ -0,0 +1,61 @@ +package com.agentdriving.user.modular.code.factory; + + +import com.agentdriving.user.GunsApplication; +import com.agentdriving.user.core.CoreFlag; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.generator.action.model.GenQo; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 模板种类构建器 + * + * @author fengshuonan + * @date 2017-12-04-下午2:59 + */ +public class DefaultTemplateFactory { + + /** + * 获取所有的模板种类 + */ + public static List<Map<String,Object>> getDefaultTemplates(){ + ArrayList<Map<String, Object>> templates = new ArrayList<>(); + templates.add(create("controllerSwitch","controller-控制器模板")); + templates.add(create("entitySwitch","entity-实体模板")); + templates.add(create("serviceSwitch","service-service模板")); + templates.add(create("daoSwitch","dao-dao模板")); + templates.add(create("indexPageSwitch","indexPage-首页模板")); + templates.add(create("addPageSwitch","addPage-添加页面模板")); + templates.add(create("editPageSwitch","editPage-编辑页面模板")); + templates.add(create("jsSwitch","indexJs-主页js模板")); + templates.add(create("infoJsSwitch","infoJs-详情页js模板")); + templates.add(create("sqlSwitch","sql-sql语句模板")); + return templates; + } + + /** + * 获取默认的参数 + */ + public static GenQo getDefaultParams(){ + GenQo genQo = new GenQo(); + genQo.setProjectPath(ToolUtil.getWebRootPath(null)); + genQo.setAuthor("stylefeng"); + genQo.setProjectPackage(GunsApplication.class.getPackage().getName()); + genQo.setCorePackage(CoreFlag.class.getPackage().getName()); + genQo.setIgnoreTabelPrefix("sys_"); + genQo.setModuleName("system"); + genQo.setParentMenuName("系统管理"); + return genQo; + } + + private static Map<String,Object> create(String key,String desc){ + HashMap<String, Object> template = new HashMap<>(); + template.put("key",key); + template.put("desc",desc); + return template; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/service/TableService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/service/TableService.java new file mode 100644 index 0000000..ae0ff1e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/code/service/TableService.java @@ -0,0 +1,29 @@ +package com.agentdriving.user.modular.code.service; + +import com.baomidou.mybatisplus.mapper.SqlRunner; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * 获取数据库所有的表 + * + * @author fengshuonan + * @date 2017-12-04-下午1:37 + */ +@Service +public class TableService { + + @Value("${spring.datasource.db-name}") + private String dbName; + + /** + * 获取当前数据库所有的表信息 + */ + public List<Map<String, Object>> getAllTables() { + String sql = "select TABLE_NAME as tableName,TABLE_COMMENT as tableComment from information_schema.`TABLES` where TABLE_SCHEMA = '" + dbName + "'"; + return SqlRunner.db().selectList(sql); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthIntercepter.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthIntercepter.java new file mode 100644 index 0000000..c9eddfd --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthIntercepter.java @@ -0,0 +1,37 @@ +package com.agentdriving.user.modular.system.auth; + +import com.alibaba.fastjson.JSON; +import com.agentdriving.user.modular.system.util.ResultUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Component +public class AuthIntercepter implements HandlerInterceptor { + private final static Logger log = LoggerFactory.getLogger(AuthIntercepter.class); + + @Autowired + AuthService authService; + + @Override + public boolean preHandle(HttpServletRequest req, HttpServletResponse res, Object handler) throws IOException { + String appid = req.getParameter("appid"); + String sign = req.getParameter("sign"); + ResultUtil resultUtil = authService.checkSyncAuth(appid, sign, req); + if (resultUtil.getCode() != 200) { + res.setStatus(HttpStatus.OK.value()); + res.setHeader("Content-type", "text/html;charset=UTF-8"); + res.getWriter().print(JSON.toJSONString(resultUtil));//Res.Failure("req timeout, please try again") + return false; + } + return true; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthService.java new file mode 100644 index 0000000..add2d75 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthService.java @@ -0,0 +1,49 @@ +package com.agentdriving.user.modular.system.auth; + + +import com.agentdriving.user.modular.system.util.ResultUtil; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; + +@Service +public class AuthService { + + private final static Logger log = LoggerFactory.getLogger(AuthService.class); + + public static final AuthService me = new AuthService(); + + /** + * 鉴权 + * @param appid + * @param sign + * @param requset + * @return + */ + public ResultUtil checkSyncAuth(String appid, String sign, HttpServletRequest requset) { + try { + if (StringUtils.isBlank(sign)) { + return ResultUtil.sign(); + } + // 1.鉴权 + String signUrl = AuthenticationKit.getSignUrl(requset, "sign"); + signUrl = signUrl.replaceAll("& #40;", "\\("); + signUrl = signUrl.replaceAll("& #41;", "\\)"); + String signUrlEncode = AuthenticationKit.signUrlEncode(signUrl, appid); + if(sign.indexOf(" ") != -1 && signUrlEncode.indexOf("+") != -1){//处理前后端加密差异 + signUrlEncode = signUrlEncode.replaceAll("\\+", " "); + } + // 签名无 + if (StringUtils.isBlank(sign) || !sign.equals(signUrlEncode)) { + return ResultUtil.sign(); + } + } catch (Exception e) { + e.printStackTrace(); + return ResultUtil.runErr(); + } + return ResultUtil.success(); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthenticationKit.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthenticationKit.java new file mode 100644 index 0000000..2718074 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/AuthenticationKit.java @@ -0,0 +1,232 @@ +package com.agentdriving.user.modular.system.auth; + +import org.apache.tomcat.util.codec.binary.Base64; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +/** + * + * 接口鉴权工具类 + * + * @author gwx 2017-12-23 + * + */ +public class AuthenticationKit { + public static final String utf8="UTF-8"; + + /** + * 返回64 位 token + * + * @param key 自定义安全字符 + * @return + * @throws Exception + */ + public static String getToken(String key) throws Exception { + // 随机生成 32位字符 + String salt = HashKit.generateSaltForSha256(); + // 获取当前时间 + long cur = System.currentTimeMillis(); + // 生成64位token + String access_token = getToken256(key, salt, cur); + return access_token; + } + + /** + * 返回64 位 token + * + * @param key + * @return + * @throws Exception + */ + public static String getToken256(String key, String salt, long cur) throws Exception { + // 生成64位token + String access_token = HashKit.sha256(salt + cur + key); + return access_token; + } + + /** + * 返回到秒 + * + * @return + */ + public static String createTimestamp() { + long l = System.currentTimeMillis(); + return Long.toString(l / 1000); + } + + /** + * 返回noce 不带 短杠"-" + * + * @return + */ + public static String createNonceStr() { + return getUUID(); + } + + public static String getUUID() { + UUID uuid = UUID.randomUUID(); + String str = uuid.toString(); + str = str.replaceAll("-", ""); + return str; + } + + /** + * 组装路径 + * + * @param params + * @return + */ + public static String localSignParam(Map<String, String> params) { + return localSignUrl(null, params, false); + } + + + /** + * 组装签名路径 + * @param url + * @param params + * @return + */ + public static String localSignUrl(String url, Map<String, String> params, boolean urlEncode) { + StringBuilder strBuilder = new StringBuilder(); +// if(StringUtils.isNotBlank(url) && url.lastIndexOf("?")==-1){ +// strBuilder.append(url).append("?"); +// } + + Set es = params.entrySet();//所有参与传参的参数按照accsii排序(升序) + Iterator it = es.iterator(); + while(it.hasNext()) { + Map.Entry entry = (Map.Entry)it.next(); + String k = (String)entry.getKey(); + Object v = entry.getValue(); + if(null != v && !"".equals(v)) { + strBuilder.append(k + "=" + v + "&"); + } + } + return strBuilder.substring(0, strBuilder.length() - 1); + +// for (String key : params.keySet()) { +// if (params.get(key) != null) { +// String lowerKey = key.toLowerCase(); +// String encodeKey = lowerKey; +// String encodedValue = params.get(key); +// if (urlEncode){ +// encodeKey = UrlEncoderUtils.encode(lowerKey); +// encodedValue = UrlEncoderUtils.encode(encodedValue); +// } +// if (!seeOne) { +// seeOne = true; +// } else { +// strBuilder.append("&"); +// } +// strBuilder.append(encodeKey).append("=").append(encodedValue); +// } +// } +// return strBuilder.toString(); + } + + + /** + * 加密签名路径生成签名 + * + * @param signUrl + * /token?appid=12345×tamp=1512440267&nonce=12345 + * @param encryptKey + * @return + * @throws Exception + */ + public static String signUrlEncode(String signUrl, String encryptKey) throws Exception { + byte[] signByte = HMACSHA1.HmacSHA1Encrypt(signUrl, encryptKey); + String localSign = Base64.encodeBase64String(signByte); + return localSign; + } + + /** + * 返回鉴权 签名路径 + * + * @param req + * @return + */ + public static String getSignUrl(HttpServletRequest req) { + return getSignUrl(req,""); + } + + /** + * 服务端 获取 客户端请求 组装验证签名 + * @param req + * @param delParams 移除不相关 的签名参数 + * @return + */ + public static String getSignUrl(HttpServletRequest req, String... delParams) { + // 获取相对的访问路径 + String url = req.getServletPath(); + Map<String, String> paramMap = packageRequestGetParams(req); + if (paramMap.size() > 0) { + // 删除 + for (int i = 0, len = delParams.length; i < len; i++) { + paramMap.remove(delParams[i]); + } + return localSignUrl(url, paramMap, false); + } + return null; + } + + + /** + * 组装签名路径 客户端测试用 + * @param url api访问地址 "/apid" + * @param appid + * @return + */ + public static String getSignUrl(String url, String appid, Map<String, String> queryParas) { + Map<String, String> params = new TreeMap<String, String>(); + params.put("appid", appid); + params.put("nonce", createNonceStr()); + params.put("timestamp", createTimestamp()); + if(queryParas!=null && queryParas.size()>0){ + params.putAll(queryParas); + } + return localSignUrl(url, params, false); + } + + /** + * 组装签名路径 客户端测试用 + * @param url api访问地址 "/apid" + * @param appid + * @return + */ + public static String getSignUrl(String url, String appid) { + return getSignUrl(url, appid, ""); + } + + /** + * + * @param url + * @param appid + * @param params + * @return + */ + public static String getSignUrl(String url, String appid, String params) { + String urlTmp = getSignUrl(url, appid, new HashMap<String,String>()); + return urlTmp + UrlEncoderUtils.encode(params); + } + + /** + * 解析get参数返回treemap + * @param req + * @return + */ + public static Map<String, String> packageRequestGetParams( + HttpServletRequest req) { + Map<String, String> paramMap = new TreeMap<String, String>(); + Enumeration pNames = req.getParameterNames(); + while (pNames.hasMoreElements()) { + String key = (String) pNames.nextElement(); + String value = req.getParameter(key); + paramMap.put(key, value); + } + return paramMap; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/Configuration.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/Configuration.java new file mode 100644 index 0000000..0e3db63 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/Configuration.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.auth; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + + +@Component +public class Configuration implements WebMvcConfigurer { + + @Autowired + private AuthIntercepter authIntercepter; + + /** + * 重写添加拦截器方法并添加配置拦截器 + * + * @param registry + */ + @Override + public void addInterceptors(InterceptorRegistry registry) { +// registry.addInterceptor(authIntercepter).addPathPatterns("/api/**") +// .excludePathPatterns("/base/**"); + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/HMACSHA1.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/HMACSHA1.java new file mode 100644 index 0000000..76fbf72 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/HMACSHA1.java @@ -0,0 +1,63 @@ +package com.agentdriving.user.modular.system.auth; + +import org.apache.commons.codec.binary.Base64; + +import javax.crypto.Mac; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + +public class HMACSHA1 { + + private static final String MAC_NAME = "HmacSHA1"; + private static final String ENCODING = "UTF-8"; + + /* + * 展示了一个生成指定算法密钥的过程 初始化HMAC密钥 + * + * @return + * + * @throws Exception + * + * public static String initMacKey() throws Exception { //得到一个 指定算法密钥的密钥生成器 + * KeyGenerator KeyGenerator keyGenerator + * =KeyGenerator.getInstance(MAC_NAME); //生成一个密钥 SecretKey secretKey + * =keyGenerator.generateKey(); return null; } + */ + + /** + * 使用 HMAC-SHA1 签名方法对对encryptText进行签名 + * + * @param encryptText + * 被签名的字符串 + * @param encryptKey + * 密钥 + * @return + * @throws Exception + */ + public static byte[] HmacSHA1Encrypt(String encryptText, String encryptKey) throws Exception { + byte[] data = encryptKey.getBytes(ENCODING); + // 根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称 + Mac mac = Mac.getInstance(MAC_NAME); + SecretKey secretKey = new SecretKeySpec(data, MAC_NAME); + // 生成一个指定 Mac 算法 的 Mac 对象 + // 用给定密钥初始化 Mac 对象 + mac.init(secretKey); + + byte[] text = encryptText.getBytes(ENCODING); + // 完成 Mac 操作 + return mac.doFinal(text); + } + + public static void main(String[] args) { + + String encryptText = "123"; + String encryptKey = "adc"; + try { + byte[] b = HmacSHA1Encrypt(encryptText, encryptKey); + String str = HashKit.toHex(b); + String str2 = new String(Base64.encodeBase64(b)); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/HashKit.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/HashKit.java new file mode 100644 index 0000000..2993ba8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/HashKit.java @@ -0,0 +1,109 @@ +package com.agentdriving.user.modular.system.auth; +/** + * Copyright (c) 2011-2017, James Zhan 詹波 (jfinal@126.com). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.security.MessageDigest; + +public class HashKit { + + public static final long FNV_OFFSET_BASIS_64 = 0xcbf29ce484222325L; + public static final long FNV_PRIME_64 = 0x100000001b3L; + + private static final java.security.SecureRandom random = new java.security.SecureRandom(); + private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray(); + private static final char[] CHAR_ARRAY = "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + .toCharArray(); + + public static long fnv1a64(String key) { + long hash = FNV_OFFSET_BASIS_64; + for (int i = 0, size = key.length(); i < size; i++) { + hash ^= key.charAt(i); + hash *= FNV_PRIME_64; + } + return hash; + } + + public static String md5(String srcStr) { + return hash("MD5", srcStr); + } + + public static String sha1(String srcStr) { + return hash("SHA-1", srcStr); + } + + public static String sha256(String srcStr) { + return hash("SHA-256", srcStr); + } + + public static String sha384(String srcStr) { + return hash("SHA-384", srcStr); + } + + public static String sha512(String srcStr) { + return hash("SHA-512", srcStr); + } + + public static String hash(String algorithm, String srcStr) { + try { + MessageDigest md = MessageDigest.getInstance(algorithm); + byte[] bytes = md.digest(srcStr.getBytes("utf-8")); + return toHex(bytes); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static String toHex(byte[] bytes) { + StringBuilder ret = new StringBuilder(bytes.length * 2); + for (int i = 0; i < bytes.length; i++) { + ret.append(HEX_DIGITS[(bytes[i] >> 4) & 0x0f]); + ret.append(HEX_DIGITS[bytes[i] & 0x0f]); + } + return ret.toString(); + } + + /** + * md5 128bit 16bytes sha1 160bit 20bytes sha256 256bit 32bytes sha384 + * 384bit 48bytes sha512 512bit 64bytes + */ + public static String generateSalt(int saltLength) { + StringBuilder salt = new StringBuilder(saltLength); + for (int i = 0; i < saltLength; i++) { + salt.append(CHAR_ARRAY[random.nextInt(CHAR_ARRAY.length)]); + } + return salt.toString(); + } + + public static String generateSaltForSha256() { + return generateSalt(32); + } + + public static String generateSaltForSha512() { + return generateSalt(64); + } + + public static boolean slowEquals(byte[] a, byte[] b) { + if (a == null || b == null) { + return false; + } + + int diff = a.length ^ b.length; + for (int i = 0; i < a.length && i < b.length; i++) { + diff |= a[i] ^ b[i]; + } + return diff == 0; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/UrlEncoderUtils.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/UrlEncoderUtils.java new file mode 100644 index 0000000..3a736aa --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/auth/UrlEncoderUtils.java @@ -0,0 +1,44 @@ +package com.agentdriving.user.modular.system.auth; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +public class UrlEncoderUtils { + + private static final String PATH_DELIMITER = "/"; + private static final Logger log = LoggerFactory.getLogger(UrlEncoderUtils.class); + + public static String encode(String originUrl) { + try { + return URLEncoder.encode(originUrl, "UTF-8").replace("+", "%20").replace("*", "%2A") + .replace("%7E", "~"); + } catch (UnsupportedEncodingException e) { + log.error("URLEncoder error, encode utf8, exception: {}", e); + } + return null; + } + + // encode路径, 不包括分隔符 + public static String encodeEscapeDelimiter(String urlPath) { + StringBuilder pathBuilder = new StringBuilder(); + String[] pathSegmentsArr = urlPath.split(PATH_DELIMITER); + + boolean isFirstSegMent = true; + for (String pathSegment : pathSegmentsArr) { + if (isFirstSegMent) { + pathBuilder.append(encode(pathSegment)); + isFirstSegMent = false; + } else { + pathBuilder.append(PATH_DELIMITER).append(encode(pathSegment)); + } + } + if (urlPath.endsWith(PATH_DELIMITER)) { + pathBuilder.append(PATH_DELIMITER); + } + return pathBuilder.toString(); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/BlackboardController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/BlackboardController.java new file mode 100644 index 0000000..3e101fa --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/BlackboardController.java @@ -0,0 +1,35 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.modular.system.service.INoticeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.util.List; +import java.util.Map; + +/** + * 总览信息 + * + * @author fengshuonan + * @Date 2017年3月4日23:05:54 + */ +@Controller +@RequestMapping("/blackboard") +public class BlackboardController extends BaseController { + + @Autowired + private INoticeService noticeService; + + /** + * 跳转到黑板 + */ + @RequestMapping("") + public String blackboard(Model model) { + List<Map<String, Object>> notices = noticeService.list(null); + model.addAttribute("noticeList", notices); + return "/blackboard.html"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/DeptController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/DeptController.java new file mode 100644 index 0000000..473a314 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/DeptController.java @@ -0,0 +1,164 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.annotion.Permission; +import com.agentdriving.user.core.common.constant.dictmap.DeptDict; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.log.LogObjectHolder; +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.model.Dept; +import com.agentdriving.user.modular.system.service.IDeptService; +import com.agentdriving.user.modular.system.warpper.DeptWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; +import java.util.Map; + +/** + * 部门控制器 + * + * @author fengshuonan + * @Date 2017年2月17日20:27:22 + */ +@Controller +@RequestMapping("/dept") +public class DeptController extends BaseController { + + private String PREFIX = "/system/dept/"; + + @Autowired + private IDeptService deptService; + + /** + * 跳转到部门管理首页 + */ + @RequestMapping("") + public String index() { + return PREFIX + "dept.html"; + } + + /** + * 跳转到添加部门 + */ + @RequestMapping("/dept_add") + public String deptAdd() { + return PREFIX + "dept_add.html"; + } + + /** + * 跳转到修改部门 + */ + @Permission + @RequestMapping("/dept_update/{deptId}") + public String deptUpdate(@PathVariable Integer deptId, Model model) { + Dept dept = deptService.selectById(deptId); + model.addAttribute(dept); + model.addAttribute("pName", ConstantFactory.me().getDeptName(dept.getPid())); + LogObjectHolder.me().set(dept); + return PREFIX + "dept_edit.html"; + } + + /** + * 获取部门的tree列表 + */ + @RequestMapping(value = "/tree") + @ResponseBody + public List<ZTreeNode> tree() { + List<ZTreeNode> tree = this.deptService.tree(); + tree.add(ZTreeNode.createParent()); + return tree; + } + + /** + * 新增部门 + */ + @BussinessLog(value = "添加部门", key = "simplename", dict = DeptDict.class) + @RequestMapping(value = "/add") + @Permission + @ResponseBody + public Object add(Dept dept) { + if (ToolUtil.isOneEmpty(dept, dept.getSimplename())) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + //完善pids,根据pid拿到pid的pids + deptSetPids(dept); + return this.deptService.insert(dept); + } + + /** + * 获取所有部门列表 + */ + @RequestMapping(value = "/list") + @Permission + @ResponseBody + public Object list(String condition) { + List<Map<String, Object>> list = this.deptService.list(condition); + return super.warpObject(new DeptWarpper(list)); + } + + /** + * 部门详情 + */ + @RequestMapping(value = "/detail/{deptId}") + @Permission + @ResponseBody + public Object detail(@PathVariable("deptId") Integer deptId) { + return deptService.selectById(deptId); + } + + /** + * 修改部门 + */ + @BussinessLog(value = "修改部门", key = "simplename", dict = DeptDict.class) + @RequestMapping(value = "/update") + @Permission + @ResponseBody + public Object update(Dept dept) { + if (ToolUtil.isEmpty(dept) || dept.getId() == null) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + deptSetPids(dept); + deptService.updateById(dept); + return SUCCESS_TIP; + } + + /** + * 删除部门 + */ + @BussinessLog(value = "删除部门", key = "deptId", dict = DeptDict.class) + @RequestMapping(value = "/delete") + @Permission + @ResponseBody + public Object delete(@RequestParam Integer deptId) { + + //缓存被删除的部门名称 + LogObjectHolder.me().set(ConstantFactory.me().getDeptName(deptId)); + + deptService.deleteDept(deptId); + + return SUCCESS_TIP; + } + + private void deptSetPids(Dept dept) { + if (ToolUtil.isEmpty(dept.getPid()) || dept.getPid().equals(0)) { + dept.setPid(0); + dept.setPids("[0],"); + } else { + int pid = dept.getPid(); + Dept temp = deptService.selectById(pid); + String pids = temp.getPids(); + dept.setPid(pid); + dept.setPids(pids + "[" + pid + "],"); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/DictController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/DictController.java new file mode 100644 index 0000000..aa34e66 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/DictController.java @@ -0,0 +1,142 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.annotion.Permission; +import com.agentdriving.user.core.common.constant.Const; +import com.agentdriving.user.core.common.constant.dictmap.DictMap; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.log.LogObjectHolder; +import com.agentdriving.user.core.util.ToolUtil; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.agentdriving.user.modular.system.model.Dict; +import com.agentdriving.user.modular.system.service.IDictService; +import com.agentdriving.user.modular.system.warpper.DictWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; +import java.util.Map; + +/** + * 字典控制器 + * + * @author fengshuonan + * @Date 2017年4月26日 12:55:31 + */ +@Controller +@RequestMapping("/dict") +public class DictController extends BaseController { + + private String PREFIX = "/system/dict/"; + + @Autowired + private IDictService dictService; + + /** + * 跳转到字典管理首页 + */ + @RequestMapping("") + public String index() { + return PREFIX + "dict.html"; + } + + /** + * 跳转到添加字典 + */ + @RequestMapping("/dict_add") + public String deptAdd() { + return PREFIX + "dict_add.html"; + } + + /** + * 跳转到修改字典 + */ + @Permission(Const.ADMIN_NAME) + @RequestMapping("/dict_edit/{dictId}") + public String deptUpdate(@PathVariable Integer dictId, Model model) { + Dict dict = dictService.selectById(dictId); + model.addAttribute("dict", dict); + List<Dict> subDicts = dictService.selectList(new EntityWrapper<Dict>().eq("pid", dictId)); + model.addAttribute("subDicts", subDicts); + LogObjectHolder.me().set(dict); + return PREFIX + "dict_edit.html"; + } + + /** + * 新增字典 + * + * @param dictValues 格式例如 "1:启用;2:禁用;3:冻结" + */ + @BussinessLog(value = "添加字典记录", key = "dictName,dictValues", dict = DictMap.class) + @RequestMapping(value = "/add") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object add(String dictCode,String dictTips,String dictName, String dictValues) { + if (ToolUtil.isOneEmpty(dictCode,dictName, dictValues)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + this.dictService.addDict(dictCode,dictName,dictTips,dictValues); + return SUCCESS_TIP; + } + + /** + * 获取所有字典列表 + */ + @RequestMapping(value = "/list") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object list(String condition) { + List<Map<String, Object>> list = this.dictService.list(condition); + return super.warpObject(new DictWarpper(list)); + } + + /** + * 字典详情 + */ + @RequestMapping(value = "/detail/{dictId}") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object detail(@PathVariable("dictId") Integer dictId) { + return dictService.selectById(dictId); + } + + /** + * 修改字典 + */ + @BussinessLog(value = "修改字典", key = "dictName,dictValues", dict = DictMap.class) + @RequestMapping(value = "/update") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object update(Integer dictId,String dictCode,String dictName, String dictTips,String dictValues) { + if (ToolUtil.isOneEmpty(dictId, dictCode, dictName, dictValues)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + dictService.editDict(dictId, dictCode,dictName, dictTips,dictValues); + return SUCCESS_TIP; + } + + /** + * 删除字典记录 + */ + @BussinessLog(value = "删除字典记录", key = "dictId", dict = DictMap.class) + @RequestMapping(value = "/delete") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object delete(@RequestParam Integer dictId) { + + //缓存被删除的名称 + LogObjectHolder.me().set(ConstantFactory.me().getDictName(dictId)); + + this.dictService.delteDict(dictId); + return SUCCESS_TIP; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/KaptchaController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/KaptchaController.java new file mode 100644 index 0000000..416b54e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/KaptchaController.java @@ -0,0 +1,114 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.config.properties.GunsProperties; +import com.agentdriving.user.core.util.FileUtil; +import com.google.code.kaptcha.Constants; +import com.google.code.kaptcha.Producer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.imageio.ImageIO; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.awt.image.BufferedImage; +import java.io.IOException; + +/** + * 验证码生成 + * + * @author fengshuonan + * @date 2017-05-05 23:10 + */ +@Controller +@RequestMapping("/kaptcha") +public class KaptchaController { + + @Autowired + private GunsProperties gunsProperties; + + @Autowired + private Producer producer; + + /** + * 生成验证码 + */ + @RequestMapping("") + public void index(HttpServletRequest request, HttpServletResponse response) { + HttpSession session = request.getSession(); + + response.setDateHeader("Expires", 0); + + // Set standard HTTP/1.1 no-cache headers. + response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); + + // Set IE extended HTTP/1.1 no-cache headers (use addHeader). + response.addHeader("Cache-Control", "post-check=0, pre-check=0"); + + // Set standard HTTP/1.0 no-cache header. + response.setHeader("Pragma", "no-cache"); + + // return a jpeg + response.setContentType("image/jpeg"); + + // create the text for the image + String capText = producer.createText(); + + // store the text in the session + session.setAttribute(Constants.KAPTCHA_SESSION_KEY, capText); + + // create the image with the text + BufferedImage bi = producer.createImage(capText); + ServletOutputStream out = null; + try { + out = response.getOutputStream(); + } catch (IOException e) { + e.printStackTrace(); + } + + // write the data out + try { + ImageIO.write(bi, "jpg", out); + } catch (IOException e) { + e.printStackTrace(); + } + try { + try { + out.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + } finally { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 返回图片 + * + * @author stylefeng + * @Date 2017/5/24 23:00 + */ + @RequestMapping("/{pictureId}") + public void renderPicture(@PathVariable("pictureId") String pictureId, HttpServletResponse response) { + String path = gunsProperties.getFileUploadPath() + pictureId; + try { + byte[] bytes = FileUtil.toByteArray(path); + response.getOutputStream().write(bytes); + } catch (Exception e) { + //如果找不到图片就返回一个默认图片 + try { + response.sendRedirect("/static/img/girl.gif"); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LogController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LogController.java new file mode 100644 index 0000000..1145c6d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LogController.java @@ -0,0 +1,84 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.annotion.Permission; +import com.agentdriving.user.core.common.constant.Const; +import com.agentdriving.user.core.common.constant.factory.PageFactory; +import com.agentdriving.user.core.common.constant.state.BizLogType; +import com.agentdriving.user.core.support.BeanKit; +import com.baomidou.mybatisplus.mapper.SqlRunner; +import com.baomidou.mybatisplus.plugins.Page; +import com.agentdriving.user.modular.system.model.OperationLog; +import com.agentdriving.user.modular.system.service.IOperationLogService; +import com.agentdriving.user.modular.system.warpper.LogWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; +import java.util.Map; + +/** + * 日志管理的控制器 + * + * @author fengshuonan + * @Date 2017年4月5日 19:45:36 + */ +@Controller +@RequestMapping("/log") +public class LogController extends BaseController { + + private static String PREFIX = "/system/log/"; + + @Autowired + private IOperationLogService operationLogService; + + /** + * 跳转到日志管理的首页 + */ + @RequestMapping("") + public String index() { + return PREFIX + "log.html"; + } + + /** + * 查询操作日志列表 + */ + @RequestMapping("/list") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName, @RequestParam(required = false) Integer logType) { + Page<OperationLog> page = new PageFactory<OperationLog>().defaultPage(); + List<Map<String, Object>> result = operationLogService.getOperationLogs(page, beginTime, endTime, logName, BizLogType.valueOf(logType), page.getOrderByField(), page.isAsc()); + page.setRecords((List<OperationLog>) new LogWarpper(result).warp()); + return super.packForBT(page); + } + + /** + * 查询操作日志详情 + */ + @RequestMapping("/detail/{id}") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object detail(@PathVariable Integer id) { + OperationLog operationLog = operationLogService.selectById(id); + Map<String, Object> stringObjectMap = BeanKit.beanToMap(operationLog); + return super.warpObject(new LogWarpper(stringObjectMap)); + } + + /** + * 清空日志 + */ + @BussinessLog(value = "清空业务日志") + @RequestMapping("/delLog") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object delLog() { + SqlRunner.db().delete("delete from sys_operation_log"); + return SUCCESS_TIP; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LoginController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LoginController.java new file mode 100644 index 0000000..fb2358a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LoginController.java @@ -0,0 +1,133 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.common.exception.InvalidKaptchaException; +import com.agentdriving.user.core.log.LogManager; +import com.agentdriving.user.core.log.factory.LogTaskFactory; +import com.agentdriving.user.core.node.MenuNode; +import com.agentdriving.user.core.shiro.ShiroKit; +import com.agentdriving.user.core.shiro.ShiroUser; +import com.agentdriving.user.core.support.HttpKit; +import com.agentdriving.user.core.util.ApiMenuFilter; +import com.agentdriving.user.core.util.KaptchaUtil; +import com.agentdriving.user.core.util.ToolUtil; +import com.google.code.kaptcha.Constants; +import com.agentdriving.user.modular.system.model.User; +import com.agentdriving.user.modular.system.service.IMenuService; +import com.agentdriving.user.modular.system.service.IUserService; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.subject.Subject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import java.util.List; + +/** + * 登录控制器 + * + * @author fengshuonan + * @Date 2017年1月10日 下午8:25:24 + */ +@Controller +public class LoginController extends BaseController { + + @Autowired + private IMenuService menuService; + + @Autowired + private IUserService userService; + + /** + * 跳转到主页 + */ + @RequestMapping(value = "/", method = RequestMethod.GET) + public String index(Model model) { + //获取菜单列表 + List<Integer> roleList = ShiroKit.getUser().getRoleList(); + if (roleList == null || roleList.size() == 0) { + ShiroKit.getSubject().logout(); + model.addAttribute("tips", "该用户没有角色,无法登陆"); + return "/login.html"; + } + List<MenuNode> menus = menuService.getMenusByRoleIds(roleList); + List<MenuNode> titles = MenuNode.buildTitle(menus); + titles = ApiMenuFilter.build(titles); + + model.addAttribute("titles", titles); + + //获取用户头像 + Integer id = ShiroKit.getUser().getId(); + User user = userService.selectById(id); + String avatar = user.getAvatar(); + model.addAttribute("avatar", avatar); + + return "/index.html"; + } + + /** + * 跳转到登录页面 + */ + @RequestMapping(value = "/login", method = RequestMethod.GET) + public String login() { + if (ShiroKit.isAuthenticated() || ShiroKit.getUser() != null) { + return REDIRECT + "/"; + } else { + return "/login.html"; + } + } + + /** + * 点击登录执行的动作 + */ + @RequestMapping(value = "/login", method = RequestMethod.POST) + public String loginVali() { + + String username = super.getPara("username").trim(); + String password = super.getPara("password").trim(); + String remember = super.getPara("remember"); + + //验证验证码是否正确 + if (KaptchaUtil.getKaptchaOnOff()) { + String kaptcha = super.getPara("kaptcha").trim(); + String code = (String) super.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY); + if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) { + throw new InvalidKaptchaException(); + } + } + + Subject currentUser = ShiroKit.getSubject(); + UsernamePasswordToken token = new UsernamePasswordToken(username, password.toCharArray()); + + if ("on".equals(remember)) { + token.setRememberMe(true); + } else { + token.setRememberMe(false); + } + + currentUser.login(token); + + ShiroUser shiroUser = ShiroKit.getUser(); + super.getSession().setAttribute("shiroUser", shiroUser); + super.getSession().setAttribute("username", shiroUser.getAccount()); + + LogManager.me().executeLog(LogTaskFactory.loginLog(shiroUser.getId(), HttpKit.getIp())); + + ShiroKit.getSession().setAttribute("sessionFlag", true); + + return REDIRECT + "/"; + } + + /** + * 退出登录 + */ + @RequestMapping(value = "/logout", method = RequestMethod.GET) + public String logOut() { + LogManager.me().executeLog(LogTaskFactory.exitLog(ShiroKit.getUser().getId(), HttpKit.getIp())); + ShiroKit.getSubject().logout(); + deleteAllCookie(); + return REDIRECT + "/login"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LoginLogController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LoginLogController.java new file mode 100644 index 0000000..90851f6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/LoginLogController.java @@ -0,0 +1,69 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.annotion.Permission; +import com.agentdriving.user.core.common.constant.Const; +import com.agentdriving.user.core.common.constant.factory.PageFactory; +import com.baomidou.mybatisplus.mapper.SqlRunner; +import com.baomidou.mybatisplus.plugins.Page; +import com.agentdriving.user.modular.system.model.LoginLog; +import com.agentdriving.user.modular.system.service.ILoginLogService; +import com.agentdriving.user.modular.system.warpper.LogWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; +import java.util.Map; + +/** + * 日志管理的控制器 + * + * @author fengshuonan + * @Date 2017年4月5日 19:45:36 + */ +@Controller +@RequestMapping("/loginLog") +public class LoginLogController extends BaseController { + + private static String PREFIX = "/system/log/"; + + @Autowired + private ILoginLogService loginLogService; + + /** + * 跳转到日志管理的首页 + */ + @RequestMapping("") + public String index() { + return PREFIX + "login_log.html"; + } + + /** + * 查询登录日志列表 + */ + @RequestMapping("/list") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName) { + Page<LoginLog> page = new PageFactory<LoginLog>().defaultPage(); + List<Map<String, Object>> result = loginLogService.getLoginLogs(page, beginTime, endTime, logName, page.getOrderByField(), page.isAsc()); + page.setRecords((List<LoginLog>) new LogWarpper(result).warp()); + return super.packForBT(page); + } + + /** + * 清空日志 + */ + @BussinessLog("清空登录日志") + @RequestMapping("/delLoginLog") + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Object delLog() { + SqlRunner.db().delete("delete from sys_login_log"); + return SUCCESS_TIP; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/MenuController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/MenuController.java new file mode 100644 index 0000000..103fc07 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/MenuController.java @@ -0,0 +1,244 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.base.tips.Tip; +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.annotion.Permission; +import com.agentdriving.user.core.common.constant.Const; +import com.agentdriving.user.core.common.constant.dictmap.MenuDict; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.common.constant.state.MenuStatus; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.log.LogObjectHolder; +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.core.support.BeanKit; +import com.agentdriving.user.core.util.ToolUtil; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.agentdriving.user.modular.system.model.Menu; +import com.agentdriving.user.modular.system.service.IMenuService; +import com.agentdriving.user.modular.system.warpper.MenuWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; + +/** + * 菜单控制器 + * + * @author fengshuonan + * @Date 2017年2月12日21:59:14 + */ +@Controller +@RequestMapping("/menu") +public class MenuController extends BaseController { + + private static String PREFIX = "/system/menu/"; + + @Autowired + private IMenuService menuService; + + /** + * 跳转到菜单列表列表页面 + */ + @RequestMapping("") + public String index() { + return PREFIX + "menu.html"; + } + + /** + * 跳转到菜单列表列表页面 + */ + @RequestMapping(value = "/menu_add") + public String menuAdd() { + return PREFIX + "menu_add.html"; + } + + /** + * 跳转到菜单详情列表页面 + */ + @Permission(Const.ADMIN_NAME) + @RequestMapping(value = "/menu_edit/{menuId}") + public String menuEdit(@PathVariable Long menuId, Model model) { + if (ToolUtil.isEmpty(menuId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + Menu menu = this.menuService.selectById(menuId); + + //获取父级菜单的id + Menu temp = new Menu(); + temp.setCode(menu.getPcode()); + Menu pMenu = this.menuService.selectOne(new EntityWrapper<>(temp)); + + //如果父级是顶级菜单 + if (pMenu == null) { + menu.setPcode("0"); + } else { + //设置父级菜单的code为父级菜单的id + menu.setPcode(String.valueOf(pMenu.getId())); + } + + Map<String, Object> menuMap = BeanKit.beanToMap(menu); + menuMap.put("pcodeName", ConstantFactory.me().getMenuNameByCode(temp.getCode())); + model.addAttribute("menu", menuMap); + LogObjectHolder.me().set(menu); + return PREFIX + "menu_edit.html"; + } + + /** + * 修该菜单 + */ + @Permission(Const.ADMIN_NAME) + @RequestMapping(value = "/edit") + @BussinessLog(value = "修改菜单", key = "name", dict = MenuDict.class) + @ResponseBody + public Tip edit(@Valid Menu menu, BindingResult result) { + if (result.hasErrors()) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + //设置父级菜单编号 + menuSetPcode(menu); + + this.menuService.updateById(menu); + return SUCCESS_TIP; + } + + /** + * 获取菜单列表 + */ + @Permission(Const.ADMIN_NAME) + @RequestMapping(value = "/list") + @ResponseBody + public Object list(@RequestParam(required = false) String menuName, @RequestParam(required = false) String level) { + List<Map<String, Object>> menus = this.menuService.selectMenus(menuName, level); + return super.warpObject(new MenuWarpper(menus)); + } + + /** + * 新增菜单 + */ + @Permission(Const.ADMIN_NAME) + @RequestMapping(value = "/add") + @BussinessLog(value = "菜单新增", key = "name", dict = MenuDict.class) + @ResponseBody + public Tip add(@Valid Menu menu, BindingResult result) { + if (result.hasErrors()) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + + //判断是否存在该编号 + String existedMenuName = ConstantFactory.me().getMenuNameByCode(menu.getCode()); + if (ToolUtil.isNotEmpty(existedMenuName)) { + throw new GunsException(BizExceptionEnum.EXISTED_THE_MENU); + } + + //设置父级菜单编号 + menuSetPcode(menu); + + menu.setStatus(MenuStatus.ENABLE.getCode()); + this.menuService.insert(menu); + return SUCCESS_TIP; + } + + /** + * 删除菜单 + */ + @Permission(Const.ADMIN_NAME) + @RequestMapping(value = "/remove") + @BussinessLog(value = "删除菜单", key = "menuId", dict = MenuDict.class) + @ResponseBody + public Tip remove(@RequestParam Long menuId) { + if (ToolUtil.isEmpty(menuId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + + //缓存菜单的名称 + LogObjectHolder.me().set(ConstantFactory.me().getMenuName(menuId)); + + this.menuService.delMenuContainSubMenus(menuId); + return SUCCESS_TIP; + } + + /** + * 查看菜单 + */ + @RequestMapping(value = "/view/{menuId}") + @ResponseBody + public Tip view(@PathVariable Long menuId) { + if (ToolUtil.isEmpty(menuId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + this.menuService.selectById(menuId); + return SUCCESS_TIP; + } + + /** + * 获取菜单列表(首页用) + */ + @RequestMapping(value = "/menuTreeList") + @ResponseBody + public List<ZTreeNode> menuTreeList() { + List<ZTreeNode> roleTreeList = this.menuService.menuTreeList(); + return roleTreeList; + } + + /** + * 获取菜单列表(选择父级菜单用) + */ + @RequestMapping(value = "/selectMenuTreeList") + @ResponseBody + public List<ZTreeNode> selectMenuTreeList() { + List<ZTreeNode> roleTreeList = this.menuService.menuTreeList(); + roleTreeList.add(ZTreeNode.createParent()); + return roleTreeList; + } + + /** + * 获取角色列表 + */ + @RequestMapping(value = "/menuTreeListByRoleId/{roleId}") + @ResponseBody + public List<ZTreeNode> menuTreeListByRoleId(@PathVariable Integer roleId) { + List<Long> menuIds = this.menuService.getMenuIdsByRoleId(roleId); + if (ToolUtil.isEmpty(menuIds)) { + List<ZTreeNode> roleTreeList = this.menuService.menuTreeList(); + return roleTreeList; + } else { + List<ZTreeNode> roleTreeListByUserId = this.menuService.menuTreeListByMenuIds(menuIds); + return roleTreeListByUserId; + } + } + + /** + * 根据请求的父级菜单编号设置pcode和层级 + */ + private void menuSetPcode(@Valid Menu menu) { + if (ToolUtil.isEmpty(menu.getPcode()) || menu.getPcode().equals("0")) { + menu.setPcode("0"); + menu.setPcodes("[0],"); + menu.setLevels(1); + } else { + long code = Long.parseLong(menu.getPcode()); + Menu pMenu = menuService.selectById(code); + Integer pLevels = pMenu.getLevels(); + menu.setPcode(pMenu.getCode()); + + //如果编号和父编号一致会导致无限递归 + if (menu.getCode().equals(menu.getPcode())) { + throw new GunsException(BizExceptionEnum.MENU_PCODE_COINCIDENCE); + } + + menu.setLevels(pLevels + 1); + menu.setPcodes(pMenu.getPcodes() + "[" + pMenu.getCode() + "],"); + } + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/NoticeController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/NoticeController.java new file mode 100644 index 0000000..6f5bed2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/NoticeController.java @@ -0,0 +1,138 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.constant.dictmap.NoticeMap; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.log.LogObjectHolder; +import com.agentdriving.user.core.shiro.ShiroKit; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.model.Notice; +import com.agentdriving.user.modular.system.service.INoticeService; +import com.agentdriving.user.modular.system.warpper.NoticeWrapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 通知控制器 + * + * @author fengshuonan + * @Date 2017-05-09 23:02:21 + */ +@Controller +@RequestMapping("/notice") +public class NoticeController extends BaseController { + + private String PREFIX = "/system/notice/"; + + @Autowired + private INoticeService noticeService; + + /** + * 跳转到通知列表首页 + */ + @RequestMapping("") + public String index() { + return PREFIX + "notice.html"; + } + + /** + * 跳转到添加通知 + */ + @RequestMapping("/notice_add") + public String noticeAdd() { + return PREFIX + "notice_add.html"; + } + + /** + * 跳转到修改通知 + */ + @RequestMapping("/notice_update/{noticeId}") + public String noticeUpdate(@PathVariable Integer noticeId, Model model) { + Notice notice = this.noticeService.selectById(noticeId); + model.addAttribute("notice",notice); + LogObjectHolder.me().set(notice); + return PREFIX + "notice_edit.html"; + } + + /** + * 跳转到首页通知 + */ + @RequestMapping("/hello") + public String hello() { + List<Map<String, Object>> notices = noticeService.list(null); + super.setAttr("noticeList",notices); + return "/blackboard.html"; + } + + /** + * 获取通知列表 + */ + @RequestMapping(value = "/list") + @ResponseBody + public Object list(String condition) { + List<Map<String, Object>> list = this.noticeService.list(condition); + return super.warpObject(new NoticeWrapper(list)); + } + + /** + * 新增通知 + */ + @RequestMapping(value = "/add") + @ResponseBody + @BussinessLog(value = "新增通知",key = "title",dict = NoticeMap.class) + public Object add(Notice notice) { + if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + notice.setCreater(ShiroKit.getUser().getId()); + notice.setCreatetime(new Date()); + notice.insert(); + return SUCCESS_TIP; + } + + /** + * 删除通知 + */ + @RequestMapping(value = "/delete") + @ResponseBody + @BussinessLog(value = "删除通知",key = "noticeId",dict = NoticeMap.class) + public Object delete(@RequestParam Integer noticeId) { + + //缓存通知名称 + LogObjectHolder.me().set(ConstantFactory.me().getNoticeTitle(noticeId)); + + this.noticeService.deleteById(noticeId); + + return SUCCESS_TIP; + } + + /** + * 修改通知 + */ + @RequestMapping(value = "/update") + @ResponseBody + @BussinessLog(value = "修改通知",key = "title",dict = NoticeMap.class) + public Object update(Notice notice) { + if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + Notice old = this.noticeService.selectById(notice.getId()); + old.setTitle(notice.getTitle()); + old.setContent(notice.getContent()); + old.updateById(); + return SUCCESS_TIP; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/RoleController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/RoleController.java new file mode 100644 index 0000000..74c2794 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/RoleController.java @@ -0,0 +1,230 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.base.tips.Tip; +import com.agentdriving.user.core.cache.CacheKit; +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.annotion.Permission; +import com.agentdriving.user.core.common.constant.Const; +import com.agentdriving.user.core.common.constant.cache.Cache; +import com.agentdriving.user.core.common.constant.dictmap.RoleDict; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.log.LogObjectHolder; +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.core.util.Convert; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.model.Role; +import com.agentdriving.user.modular.system.model.User; +import com.agentdriving.user.modular.system.service.IRoleService; +import com.agentdriving.user.modular.system.service.IUserService; +import com.agentdriving.user.modular.system.warpper.RoleWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; + +/** + * 角色控制器 + * + * @author fengshuonan + * @Date 2017年2月12日21:59:14 + */ +@Controller +@RequestMapping("/role") +public class RoleController extends BaseController { + + private static String PREFIX = "/system/role"; + + @Autowired + private IUserService userService; + + @Autowired + private IRoleService roleService; + + /** + * 跳转到角色列表页面 + */ + @RequestMapping("") + public String index() { + return PREFIX + "/role.html"; + } + + /** + * 跳转到添加角色 + */ + @RequestMapping(value = "/role_add") + public String roleAdd() { + return PREFIX + "/role_add.html"; + } + + /** + * 跳转到修改角色 + */ + @Permission + @RequestMapping(value = "/role_edit/{roleId}") + public String roleEdit(@PathVariable Integer roleId, Model model) { + if (ToolUtil.isEmpty(roleId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + Role role = this.roleService.selectById(roleId); + model.addAttribute(role); + model.addAttribute("pName", ConstantFactory.me().getSingleRoleName(role.getPid())); + model.addAttribute("deptName", ConstantFactory.me().getDeptName(role.getDeptid())); + LogObjectHolder.me().set(role); + return PREFIX + "/role_edit.html"; + } + + /** + * 跳转到角色分配 + */ + @Permission + @RequestMapping(value = "/role_assign/{roleId}") + public String roleAssign(@PathVariable("roleId") Integer roleId, Model model) { + if (ToolUtil.isEmpty(roleId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + model.addAttribute("roleId", roleId); + model.addAttribute("roleName", ConstantFactory.me().getSingleRoleName(roleId)); + return PREFIX + "/role_assign.html"; + } + + /** + * 获取角色列表 + */ + @Permission + @RequestMapping(value = "/list") + @ResponseBody + public Object list(@RequestParam(required = false) String roleName) { + List<Map<String, Object>> roles = this.roleService.selectRoles(super.getPara("roleName")); + return super.warpObject(new RoleWarpper(roles)); + } + + /** + * 角色新增 + */ + @RequestMapping(value = "/add") + @BussinessLog(value = "添加角色", key = "name", dict = RoleDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip add(@Valid Role role, BindingResult result) { + if (result.hasErrors()) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + role.setId(null); + this.roleService.insert(role); + return SUCCESS_TIP; + } + + /** + * 角色修改 + */ + @RequestMapping(value = "/edit") + @BussinessLog(value = "修改角色", key = "name", dict = RoleDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip edit(@Valid Role role, BindingResult result) { + if (result.hasErrors()) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + this.roleService.updateById(role); + + //删除缓存 + CacheKit.removeAll(Cache.CONSTANT); + return SUCCESS_TIP; + } + + /** + * 删除角色 + */ + @RequestMapping(value = "/remove") + @BussinessLog(value = "删除角色", key = "roleId", dict = RoleDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip remove(@RequestParam Integer roleId) { + if (ToolUtil.isEmpty(roleId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + + //不能删除超级管理员角色 + if (roleId.equals(Const.ADMIN_ROLE_ID)) { + throw new GunsException(BizExceptionEnum.CANT_DELETE_ADMIN); + } + + //缓存被删除的角色名称 + LogObjectHolder.me().set(ConstantFactory.me().getSingleRoleName(roleId)); + + this.roleService.delRoleById(roleId); + + //删除缓存 + CacheKit.removeAll(Cache.CONSTANT); + return SUCCESS_TIP; + } + + /** + * 查看角色 + */ + @RequestMapping(value = "/view/{roleId}") + @ResponseBody + public Tip view(@PathVariable Integer roleId) { + if (ToolUtil.isEmpty(roleId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + this.roleService.selectById(roleId); + return SUCCESS_TIP; + } + + /** + * 配置权限 + */ + @RequestMapping("/setAuthority") + @BussinessLog(value = "配置权限", key = "roleId,ids", dict = RoleDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip setAuthority(@RequestParam("roleId") Integer roleId, @RequestParam("ids") String ids) { + if (ToolUtil.isOneEmpty(roleId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + this.roleService.setAuthority(roleId, ids); + return SUCCESS_TIP; + } + + /** + * 获取角色列表 + */ + @RequestMapping(value = "/roleTreeList") + @ResponseBody + public List<ZTreeNode> roleTreeList() { + List<ZTreeNode> roleTreeList = this.roleService.roleTreeList(); + roleTreeList.add(ZTreeNode.createParent()); + return roleTreeList; + } + + /** + * 获取角色列表 + */ + @RequestMapping(value = "/roleTreeListByUserId/{userId}") + @ResponseBody + public List<ZTreeNode> roleTreeListByUserId(@PathVariable Integer userId) { + User theUser = this.userService.selectById(userId); + String roleid = theUser.getRoleid(); + if (ToolUtil.isEmpty(roleid)) { + List<ZTreeNode> roleTreeList = this.roleService.roleTreeList(); + return roleTreeList; + } else { + String[] strArray = Convert.toStrArray(",", roleid); + List<ZTreeNode> roleTreeListByUserId = this.roleService.roleTreeListByRoleId(strArray); + return roleTreeListByUserId; + } + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/UserMgrController.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/UserMgrController.java new file mode 100644 index 0000000..c241e94 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/controller/UserMgrController.java @@ -0,0 +1,373 @@ +package com.agentdriving.user.modular.system.controller; + +import com.agentdriving.user.config.properties.GunsProperties; +import com.agentdriving.user.core.base.controller.BaseController; +import com.agentdriving.user.core.base.tips.Tip; +import com.agentdriving.user.core.common.annotion.BussinessLog; +import com.agentdriving.user.core.common.annotion.Permission; +import com.agentdriving.user.core.common.constant.Const; +import com.agentdriving.user.core.common.constant.dictmap.UserDict; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.common.constant.state.ManagerStatus; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.core.datascope.DataScope; +import com.agentdriving.user.core.db.Db; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.log.LogObjectHolder; +import com.agentdriving.user.core.shiro.ShiroKit; +import com.agentdriving.user.core.shiro.ShiroUser; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.dao.UserMapper; +import com.agentdriving.user.modular.system.factory.UserFactory; +import com.agentdriving.user.modular.system.model.User; +import com.agentdriving.user.modular.system.service.IUserService; +import com.agentdriving.user.modular.system.transfer.UserDto; +import com.agentdriving.user.modular.system.warpper.UserWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.naming.NoPermissionException; +import javax.validation.Valid; +import java.io.File; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * 系统管理员控制器 + * + * @author fengshuonan + * @Date 2017年1月11日 下午1:08:17 + */ +@Controller +@RequestMapping("/mgr") +public class UserMgrController extends BaseController { + + private static String PREFIX = "/system/user/"; + + @Autowired + private GunsProperties gunsProperties; + + @Autowired + private IUserService userService; + + /** + * 跳转到查看管理员列表的页面 + */ + @RequestMapping("") + public String index() { + return PREFIX + "user.html"; + } + + /** + * 跳转到查看管理员列表的页面 + */ + @RequestMapping("/user_add") + public String addView() { + return PREFIX + "user_add.html"; + } + + /** + * 跳转到角色分配页面 + */ + //@RequiresPermissions("/mgr/role_assign") //利用shiro自带的权限检查 + @Permission + @RequestMapping("/role_assign/{userId}") + public String roleAssign(@PathVariable Integer userId, Model model) { + if (ToolUtil.isEmpty(userId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + User user = (User) Db.create(UserMapper.class).selectOneByCon("id", userId); + model.addAttribute("userId", userId); + model.addAttribute("userAccount", user.getAccount()); + return PREFIX + "user_roleassign.html"; + } + + /** + * 跳转到编辑管理员页面 + */ + @Permission + @RequestMapping("/user_edit/{userId}") + public String userEdit(@PathVariable Integer userId, Model model) { + if (ToolUtil.isEmpty(userId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + assertAuth(userId); + User user = this.userService.selectById(userId); + model.addAttribute(user); + model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid())); + model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid())); + LogObjectHolder.me().set(user); + return PREFIX + "user_edit.html"; + } + + /** + * 跳转到查看用户详情页面 + */ + @RequestMapping("/user_info") + public String userInfo(Model model) { + Integer userId = ShiroKit.getUser().getId(); + if (ToolUtil.isEmpty(userId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + User user = this.userService.selectById(userId); + model.addAttribute(user); + model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid())); + model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid())); + LogObjectHolder.me().set(user); + return PREFIX + "user_view.html"; + } + + /** + * 跳转到修改密码界面 + */ + @RequestMapping("/user_chpwd") + public String chPwd() { + return PREFIX + "user_chpwd.html"; + } + + /** + * 修改当前用户的密码 + */ + @RequestMapping("/changePwd") + @ResponseBody + public Object changePwd(@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) { + if (!newPwd.equals(rePwd)) { + throw new GunsException(BizExceptionEnum.TWO_PWD_NOT_MATCH); + } + Integer userId = ShiroKit.getUser().getId(); + User user = userService.selectById(userId); + String oldMd5 = ShiroKit.md5(oldPwd, user.getSalt()); + if (user.getPassword().equals(oldMd5)) { + String newMd5 = ShiroKit.md5(newPwd, user.getSalt()); + user.setPassword(newMd5); + user.updateById(); + return SUCCESS_TIP; + } else { + throw new GunsException(BizExceptionEnum.OLD_PWD_NOT_RIGHT); + } + } + + /** + * 查询管理员列表 + */ + @RequestMapping("/list") + @Permission + @ResponseBody + public Object list(@RequestParam(required = false) String name, @RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) Integer deptid) { + if (ShiroKit.isAdmin()) { + List<Map<String, Object>> users = userService.selectUsers(null, name, beginTime, endTime, deptid); + return new UserWarpper(users).warp(); + } else { + DataScope dataScope = new DataScope(ShiroKit.getDeptDataScope()); + List<Map<String, Object>> users = userService.selectUsers(dataScope, name, beginTime, endTime, deptid); + return new UserWarpper(users).warp(); + } + } + + /** + * 添加管理员 + */ + @RequestMapping("/add") + @BussinessLog(value = "添加管理员", key = "account", dict = UserDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip add(@Valid UserDto user, BindingResult result) { + if (result.hasErrors()) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + + // 判断账号是否重复 + User theUser = userService.getByAccount(user.getAccount()); + if (theUser != null) { + throw new GunsException(BizExceptionEnum.USER_ALREADY_REG); + } + + // 完善账号信息 + user.setSalt(ShiroKit.getRandomSalt(5)); + user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt())); + user.setStatus(ManagerStatus.OK.getCode()); + user.setCreatetime(new Date()); + + this.userService.insert(UserFactory.createUser(user)); + return SUCCESS_TIP; + } + + /** + * 修改管理员 + * + * @throws NoPermissionException + */ + @RequestMapping("/edit") + @BussinessLog(value = "修改管理员", key = "account", dict = UserDict.class) + @ResponseBody + public Tip edit(@Valid UserDto user, BindingResult result) throws NoPermissionException { + if (result.hasErrors()) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + + User oldUser = userService.selectById(user.getId()); + + if (ShiroKit.hasRole(Const.ADMIN_NAME)) { + this.userService.updateById(UserFactory.editUser(user, oldUser)); + return SUCCESS_TIP; + } else { + assertAuth(user.getId()); + ShiroUser shiroUser = ShiroKit.getUser(); + if (shiroUser.getId().equals(user.getId())) { + this.userService.updateById(UserFactory.editUser(user, oldUser)); + return SUCCESS_TIP; + } else { + throw new GunsException(BizExceptionEnum.NO_PERMITION); + } + } + } + + /** + * 删除管理员(逻辑删除) + */ + @RequestMapping("/delete") + @BussinessLog(value = "删除管理员", key = "userId", dict = UserDict.class) + @Permission + @ResponseBody + public Tip delete(@RequestParam Integer userId) { + if (ToolUtil.isEmpty(userId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + //不能删除超级管理员 + if (userId.equals(Const.ADMIN_ID)) { + throw new GunsException(BizExceptionEnum.CANT_DELETE_ADMIN); + } + assertAuth(userId); + this.userService.setStatus(userId, ManagerStatus.DELETED.getCode()); + return SUCCESS_TIP; + } + + /** + * 查看管理员详情 + */ + @RequestMapping("/view/{userId}") + @ResponseBody + public User view(@PathVariable Integer userId) { + if (ToolUtil.isEmpty(userId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + assertAuth(userId); + return this.userService.selectById(userId); + } + + /** + * 重置管理员的密码 + */ + @RequestMapping("/reset") + @BussinessLog(value = "重置管理员密码", key = "userId", dict = UserDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip reset(@RequestParam Integer userId) { + if (ToolUtil.isEmpty(userId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + assertAuth(userId); + User user = this.userService.selectById(userId); + user.setSalt(ShiroKit.getRandomSalt(5)); + user.setPassword(ShiroKit.md5(Const.DEFAULT_PWD, user.getSalt())); + this.userService.updateById(user); + return SUCCESS_TIP; + } + + /** + * 冻结用户 + */ + @RequestMapping("/freeze") + @BussinessLog(value = "冻结用户", key = "userId", dict = UserDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip freeze(@RequestParam Integer userId) { + if (ToolUtil.isEmpty(userId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + //不能冻结超级管理员 + if (userId.equals(Const.ADMIN_ID)) { + throw new GunsException(BizExceptionEnum.CANT_FREEZE_ADMIN); + } + assertAuth(userId); + this.userService.setStatus(userId, ManagerStatus.FREEZED.getCode()); + return SUCCESS_TIP; + } + + /** + * 解除冻结用户 + */ + @RequestMapping("/unfreeze") + @BussinessLog(value = "解除冻结用户", key = "userId", dict = UserDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip unfreeze(@RequestParam Integer userId) { + if (ToolUtil.isEmpty(userId)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + assertAuth(userId); + this.userService.setStatus(userId, ManagerStatus.OK.getCode()); + return SUCCESS_TIP; + } + + /** + * 分配角色 + */ + @RequestMapping("/setRole") + @BussinessLog(value = "分配角色", key = "userId,roleIds", dict = UserDict.class) + @Permission(Const.ADMIN_NAME) + @ResponseBody + public Tip setRole(@RequestParam("userId") Integer userId, @RequestParam("roleIds") String roleIds) { + if (ToolUtil.isOneEmpty(userId, roleIds)) { + throw new GunsException(BizExceptionEnum.REQUEST_NULL); + } + //不能修改超级管理员 + if (userId.equals(Const.ADMIN_ID)) { + throw new GunsException(BizExceptionEnum.CANT_CHANGE_ADMIN); + } + assertAuth(userId); + this.userService.setRoles(userId, roleIds); + return SUCCESS_TIP; + } + + /** + * 上传图片 + */ + @RequestMapping(method = RequestMethod.POST, path = "/upload") + @ResponseBody + public String upload(@RequestPart("file") MultipartFile picture) { + + String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(picture.getOriginalFilename()); + try { + String fileSavePath = gunsProperties.getFileUploadPath(); + picture.transferTo(new File(fileSavePath + pictureName)); + } catch (Exception e) { + throw new GunsException(BizExceptionEnum.UPLOAD_ERROR); + } + return pictureName; + } + + /** + * 判断当前登录的用户是否有操作这个用户的权限 + */ + private void assertAuth(Integer userId) { + if (ShiroKit.isAdmin()) { + return; + } + List<Integer> deptDataScope = ShiroKit.getDeptDataScope(); + User user = this.userService.selectById(userId); + Integer deptid = user.getDeptid(); + if (deptDataScope.contains(deptid)) { + return; + } else { + throw new GunsException(BizExceptionEnum.NO_PERMITION); + } + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AccountChangeDetailMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AccountChangeDetailMapper.java new file mode 100644 index 0000000..abb4c5d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AccountChangeDetailMapper.java @@ -0,0 +1,27 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.AccountChangeDetail; +import com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/4 11:33 + */ +public interface AccountChangeDetailMapper extends BaseMapper<AccountChangeDetail> { + + + /** + * 获取余额明细 + * @param uid + * @param time + * @param pageNum + * @param pageSize + * @return + */ + List<BalanceDetailsWarpper> queryBalanceDetails(@Param("uid") Integer uid, @Param("time") String time, + @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AgentMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AgentMapper.java new file mode 100644 index 0000000..53ceb71 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AgentMapper.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Agent; + +/** + * @author zhibing.pu + * @date 2023/5/6 11:52 + */ +public interface AgentMapper extends BaseMapper<Agent> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AppUserMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AppUserMapper.java new file mode 100644 index 0000000..fa2498e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/AppUserMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.AppUser; + +public interface AppUserMapper extends BaseMapper<AppUser> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/BillMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/BillMapper.java new file mode 100644 index 0000000..162ee07 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/BillMapper.java @@ -0,0 +1,25 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Bill; +import com.agentdriving.user.modular.system.warpper.BillWarpper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:04 + */ +public interface BillMapper extends BaseMapper<Bill> { + + + /** + * 获取开票记录 + * @param uid + * @param pageNum + * @param pageSize + * @return + */ + List<BillWarpper> queryBillList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/BroadcastMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/BroadcastMapper.java new file mode 100644 index 0000000..6c2758c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/BroadcastMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Broadcast; + +public interface BroadcastMapper extends BaseMapper<Broadcast> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CancelOrderMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CancelOrderMapper.java new file mode 100644 index 0000000..f049f94 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CancelOrderMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.CancelOrder; + +public interface CancelOrderMapper extends BaseMapper<CancelOrder> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CommercialMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CommercialMapper.java new file mode 100644 index 0000000..1d9129c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CommercialMapper.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Commercial; +import com.agentdriving.user.modular.system.warpper.CommercialWarpper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface CommercialMapper extends BaseMapper<Commercial> { + + + /** + * 获取广告列表 + * @param type 广告类型(1=弹窗广告) + * @param device 设备(1=小程序,2=司机端) + * @return + */ + List<CommercialWarpper> queryCommercialList(@Param("type") Integer type, @Param("device") Integer device); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CommercialUserEjectMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CommercialUserEjectMapper.java new file mode 100644 index 0000000..678dd1a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CommercialUserEjectMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.CommercialUserEject; + +public interface CommercialUserEjectMapper extends BaseMapper<CommercialUserEject> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/ComplaintMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/ComplaintMapper.java new file mode 100644 index 0000000..6778ecb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/ComplaintMapper.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Complaint; + +/** + * @author zhibing.pu + * @date 2023/3/24 16:05 + */ +public interface ComplaintMapper extends BaseMapper<Complaint> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CouponMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CouponMapper.java new file mode 100644 index 0000000..8f0d744 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/CouponMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Coupon; + +public interface CouponMapper extends BaseMapper<Coupon> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DeptMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DeptMapper.java new file mode 100644 index 0000000..6546aff --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DeptMapper.java @@ -0,0 +1,31 @@ +package com.agentdriving.user.modular.system.dao; + +import com.agentdriving.user.core.node.ZTreeNode; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Dept; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 部门表 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface DeptMapper extends BaseMapper<Dept> { + + /** + * 获取ztree的节点列表 + */ + List<ZTreeNode> tree(); + + /** + * 获取所有部门列表 + */ + List<Map<String, Object>> list(@Param("condition") String condition); + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DictMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DictMapper.java new file mode 100644 index 0000000..6b9c357 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DictMapper.java @@ -0,0 +1,34 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Dict; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 字典表 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface DictMapper extends BaseMapper<Dict> { + + /** + * 根据编码获取词典列表 + */ + List<Dict> selectByCode(@Param("code") String code); + + /** + * 查询字典列表 + */ + List<Map<String, Object>> list(@Param("condition") String conditiion); + + /** + * 根据父类编码获取词典列表 + */ + List<Dict> selectByParentCode(@Param("code") String code); +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DivisionRecordMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DivisionRecordMapper.java new file mode 100644 index 0000000..49687b2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DivisionRecordMapper.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.DivisionRecord; + +/** + * @author zhibing.pu + * @date 2023/5/6 16:41 + */ +public interface DivisionRecordMapper extends BaseMapper<DivisionRecord> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DriverMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DriverMapper.java new file mode 100644 index 0000000..889341b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DriverMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.agentdriving.user.modular.system.model.Driver; +import com.baomidou.mybatisplus.mapper.BaseMapper; + +public interface DriverMapper extends BaseMapper<Driver> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DriverWorkMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DriverWorkMapper.java new file mode 100644 index 0000000..eb0090d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/DriverWorkMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.DriverWork; + +public interface DriverWorkMapper extends BaseMapper<DriverWork> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/EvaluateMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/EvaluateMapper.java new file mode 100644 index 0000000..2b170ad --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/EvaluateMapper.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Evaluate; + +/** + * @author zhibing.pu + * @date 2023/3/11 16:58 + */ +public interface EvaluateMapper extends BaseMapper<Evaluate> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/HtmlMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/HtmlMapper.java new file mode 100644 index 0000000..cc2fadb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/HtmlMapper.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Html; + +/** + * @author 39373 + * @date 2023/2/26 17:29 + */ +public interface HtmlMapper extends BaseMapper<Html> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/LoginLogMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/LoginLogMapper.java new file mode 100644 index 0000000..bebbd6e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/LoginLogMapper.java @@ -0,0 +1,27 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.agentdriving.user.modular.system.model.LoginLog; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 登录记录 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface LoginLogMapper extends BaseMapper<LoginLog> { + + /** + * 获取登录日志 + */ + List<Map<String, Object>> getLoginLogs(@Param("page") Page<LoginLog> page, @Param("beginTime") String beginTime, + @Param("endTime") String endTime, @Param("logName") String logName, @Param("orderByField") String orderByField, @Param("isAsc") boolean isAsc); + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/MainContentMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/MainContentMapper.java new file mode 100644 index 0000000..13f08a9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/MainContentMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.MainContent; + +public interface MainContentMapper extends BaseMapper<MainContent> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/MenuMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/MenuMapper.java new file mode 100644 index 0000000..a169f77 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/MenuMapper.java @@ -0,0 +1,80 @@ +package com.agentdriving.user.modular.system.dao; + +import com.agentdriving.user.core.node.MenuNode; +import com.agentdriving.user.core.node.ZTreeNode; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Menu; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 菜单表 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface MenuMapper extends BaseMapper<Menu> { + + /** + * 根据条件查询菜单 + * + * @return + * @date 2017年2月12日 下午9:14:34 + */ + List<Map<String, Object>> selectMenus(@Param("condition") String condition, @Param("level") String level); + + /** + * 根据条件查询菜单 + * + * @return + * @date 2017年2月12日 下午9:14:34 + */ + List<Long> getMenuIdsByRoleId(@Param("roleId") Integer roleId); + + /** + * 获取菜单列表树 + * + * @return + * @date 2017年2月19日 下午1:33:51 + */ + List<ZTreeNode> menuTreeList(); + + /** + * 获取菜单列表树 + * + * @return + * @date 2017年2月19日 下午1:33:51 + */ + List<ZTreeNode> menuTreeListByMenuIds(List<Long> menuIds); + + /** + * 删除menu关联的relation + * + * @param menuId + * @return + * @date 2017年2月19日 下午4:10:59 + */ + int deleteRelationByMenu(Long menuId); + + /** + * 获取资源url通过角色id + * + * @param roleId + * @return + * @date 2017年2月19日 下午7:12:38 + */ + List<String> getResUrlsByRoleId(Integer roleId); + + /** + * 根据角色获取菜单 + * + * @param roleIds + * @return + * @date 2017年2月19日 下午10:35:40 + */ + List<MenuNode> getMenusByRoleIds(List<Integer> roleIds); +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/NoticeMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/NoticeMapper.java new file mode 100644 index 0000000..fc1d085 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/NoticeMapper.java @@ -0,0 +1,25 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Notice; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 通知表 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface NoticeMapper extends BaseMapper<Notice> { + + /** + * 获取通知列表 + */ + List<Map<String, Object>> list(@Param("condition") String condition); + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/OperationLogMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/OperationLogMapper.java new file mode 100644 index 0000000..5ea0c92 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/OperationLogMapper.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.agentdriving.user.modular.system.model.OperationLog; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 操作日志 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface OperationLogMapper extends BaseMapper<OperationLog> { + + /** + * 获取操作日志 + */ + List<Map<String, Object>> getOperationLogs(@Param("page") Page<OperationLog> page, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("logName") String logName, @Param("logType") String logType, @Param("orderByField") String orderByField, @Param("isAsc") boolean isAsc); + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/OrderMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/OrderMapper.java new file mode 100644 index 0000000..149e319 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/OrderMapper.java @@ -0,0 +1,41 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Order; +import com.agentdriving.user.modular.system.warpper.NotInvoiceOrder; +import com.agentdriving.user.modular.system.warpper.OrderInfoWarpper; +import com.agentdriving.user.modular.system.warpper.OrderListWarpper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface OrderMapper extends BaseMapper<Order> { + + + /** + * 获取订单详情 + * @param uid + * @param orderId + * @return + */ + OrderInfoWarpper queryOrderInfo(@Param("uid") Integer uid, @Param("orderId") Long orderId); + + + /** + * 获取乘客行程订单 + * @param uid + * @param pageNum + * @param pageSize + * @return + */ + List<OrderListWarpper> queryMyOrder(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, + @Param("pageSize") Integer pageSize); + + + /** + * 获取未开票订单 + * @param uid + * @return + */ + List<OrderListWarpper> queryNotInvoiceOrder(@Param("uid") Integer uid, @Param("notInvoiceOrder") NotInvoiceOrder notInvoiceOrder); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/PlatformRechargeRecordMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/PlatformRechargeRecordMapper.java new file mode 100644 index 0000000..2946403 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/PlatformRechargeRecordMapper.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.PlatformRechargeRecord; + +/** + * @author zhibing.pu + * @date 2023/5/6 14:09 + */ +public interface PlatformRechargeRecordMapper extends BaseMapper<PlatformRechargeRecord> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RechargeRecordMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RechargeRecordMapper.java new file mode 100644 index 0000000..76e1ce2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RechargeRecordMapper.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.RechargeRecord; + +/** + * @author zhibing.pu + * @date 2023/3/23 14:55 + */ +public interface RechargeRecordMapper extends BaseMapper<RechargeRecord> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RegionMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RegionMapper.java new file mode 100644 index 0000000..e7ed3d7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RegionMapper.java @@ -0,0 +1,12 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Region; +import org.apache.ibatis.annotations.Param; + +public interface RegionMapper extends BaseMapper<Region> { + + + + Region query(@Param("code") String code); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RelationMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RelationMapper.java new file mode 100644 index 0000000..b4cb80b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RelationMapper.java @@ -0,0 +1,16 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Relation; + +/** + * <p> + * 角色和菜单关联表 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface RelationMapper extends BaseMapper<Relation> { + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RevenueMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RevenueMapper.java new file mode 100644 index 0000000..972c2f7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RevenueMapper.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Revenue; + +/** + * @author zhibing.pu + * @date 2023/3/13 10:03 + */ +public interface RevenueMapper extends BaseMapper<Revenue> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RoleMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RoleMapper.java new file mode 100644 index 0000000..46309f7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/RoleMapper.java @@ -0,0 +1,53 @@ +package com.agentdriving.user.modular.system.dao; + +import com.agentdriving.user.core.node.ZTreeNode; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Role; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 角色表 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface RoleMapper extends BaseMapper<Role> { + + /** + * 根据条件查询角色列表 + * + * @return + * @date 2017年2月12日 下午9:14:34 + */ + List<Map<String, Object>> selectRoles(@Param("condition") String condition); + + /** + * 删除某个角色的所有权限 + * + * @param roleId 角色id + * @return + * @date 2017年2月13日 下午7:57:51 + */ + int deleteRolesById(@Param("roleId") Integer roleId); + + /** + * 获取角色列表树 + * + * @return + * @date 2017年2月18日 上午10:32:04 + */ + List<ZTreeNode> roleTreeList(); + + /** + * 获取角色列表树 + * + * @return + * @date 2017年2月18日 上午10:32:04 + */ + List<ZTreeNode> roleTreeListByRoleId(String[] roleId); +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/SystemConfigMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/SystemConfigMapper.java new file mode 100644 index 0000000..87be012 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/SystemConfigMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.SystemConfig; + +public interface SystemConfigMapper extends BaseMapper<SystemConfig> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/UserMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/UserMapper.java new file mode 100644 index 0000000..3a005d5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/UserMapper.java @@ -0,0 +1,45 @@ +package com.agentdriving.user.modular.system.dao; + +import com.agentdriving.user.core.datascope.DataScope; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.User; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 管理员表 Mapper 接口 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public interface UserMapper extends BaseMapper<User> { + + /** + * 修改用户状态 + */ + int setStatus(@Param("userId") Integer userId, @Param("status") int status); + + /** + * 修改密码 + */ + int changePwd(@Param("userId") Integer userId, @Param("pwd") String pwd); + + /** + * 根据条件查询用户列表 + */ + List<Map<String, Object>> selectUsers(@Param("dataScope") DataScope dataScope, @Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("deptid") Integer deptid); + + /** + * 设置用户的角色 + */ + int setRoles(@Param("userId") Integer userId, @Param("roleIds") String roleIds); + + /** + * 通过账号获取用户 + */ + User getByAccount(@Param("account") String account); +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/UserToCouponMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/UserToCouponMapper.java new file mode 100644 index 0000000..ffd6b06 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/UserToCouponMapper.java @@ -0,0 +1,56 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.Coupon; +import com.agentdriving.user.modular.system.model.UserToCoupon; +import com.agentdriving.user.modular.system.warpper.CouponWarpper; +import com.agentdriving.user.modular.system.warpper.CouponsWarpper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户优惠券 + * @author zhibing.pu + * @date 2023/3/2 11:44 + */ +public interface UserToCouponMapper extends BaseMapper<UserToCoupon> { + + + /** + * 获取可用优惠券 + * @param uid + * @param price + * @return + */ + Coupon queryCoupon(@Param("uid") Integer uid, @Param("price") Double price); + + + /** + * 获取订单支付页面的可用优惠券列表 + * @param uid + * @param price + * @return + */ + List<CouponWarpper> queryPayCouponList(@Param("uid") Integer uid, @Param("price") Double price); + + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + */ + List<CouponsWarpper> queryMyCoupons(@Param("uid") Integer uid, @Param("state") Integer state, + @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); + + + /** + * 获取已使用优惠券数量 + * @param uid + * @return + */ + Integer queryUsedCouponNum(@Param("uid") Integer uid); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/WeatherCityMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/WeatherCityMapper.java new file mode 100644 index 0000000..3cd6da8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/WeatherCityMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.WeatherCity; + +public interface WeatherCityMapper extends BaseMapper<WeatherCity> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/YouTuiDriverMapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/YouTuiDriverMapper.java new file mode 100644 index 0000000..9a8d778 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/YouTuiDriverMapper.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.modular.system.model.YouTuiDriver; + +public interface YouTuiDriverMapper extends BaseMapper<YouTuiDriver> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml new file mode 100644 index 0000000..22dd2da --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.AccountChangeDetailMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.AccountChangeDetail"> + <id column="id" property="id"/> + <result column="code" property="code"/> + <result column="userType" property="userType"/> + <result column="userId" property="userId"/> + <result column="type" property="type"/> + <result column="changeType" property="changeType"/> + <result column="oldData" property="oldData"/> + <result column="newData" property="newData"/> + <result column="orderId" property="orderId"/> + <result column="explain" property="explain"/> + <result column="createTime" property="createTime"/> + </resultMap> + + + + <select id="queryBalanceDetails" resultType="com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper"> + select + a.changeType as type, + a.`explain`, + b.startAddress, + b.endAddress, + UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, + (a.newData - a.oldData) as amount, + a.newData as balance + from t_account_change_detail a + left join t_order b on (a.orderId = b.id) + where a.userType = 1 and a.userId = #{uid} + <if test="null != time and '' != time"> + and DATE_FORMAT(a.createTime, '%Y年%m月') = #{time} + </if> + order by a.createTime desc limit #{pageNum}, #{pageSize} + </select> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AgentMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AgentMapper.xml new file mode 100644 index 0000000..6789d9f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AgentMapper.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.AgentMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Agent"> + <id column="id" property="id"/> + <result column="principal" property="principal"/> + <result column="principalPhone" property="principalPhone"/> + <result column="email" property="email"/> + <result column="provinceName" property="provinceName"/> + <result column="provinceCode" property="provinceCode"/> + <result column="cityCode" property="cityCode"/> + <result column="cityName" property="cityName"/> + <result column="status" property="status"/> + <result column="createTime" property="createTime"/> + <result column="bankDeposit" property="bankDeposit"/> + <result column="bankAccount" property="bankAccount"/> + <result column="serviceCalls" property="serviceCalls"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AppUserMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AppUserMapper.xml new file mode 100644 index 0000000..d5b92cc --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/AppUserMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.AppUserMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.AppUser"> + <id column="id" property="id"/> + <result column="nickname" property="nickname"/> + <result column="phone" property="phone"/> + <result column="sex" property="sex"/> + <result column="avatar" property="avatar"/> + <result column="openid" property="openid"/> + <result column="unionid" property="unionid"/> + <result column="emergencyContact" property="emergencyContact"/> + <result column="emergencyPhone" property="emergencyPhone"/> + <result column="accountBalance" property="accountBalance"/> + <result column="userTagId" property="userTagId"/> + <result column="status" property="status"/> + <result column="createTime" property="createTime"/> + <result column="is_exception" property="isException"/> + <result column="remark" property="remark"/> + <result column="inviterType" property="inviterType"/> + <result column="inviterId" property="inviterId"/> + <result column="cancelCount" property="cancelCount"/> + <result column="havDiscount" property="havDiscount"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/BillMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/BillMapper.xml new file mode 100644 index 0000000..4203da8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/BillMapper.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.BillMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Bill"> + <id column="id" property="id"/> + <result column="userId" property="userId"/> + <result column="orderId" property="orderId"/> + <result column="billType" property="billType"/> + <result column="billHeaderType" property="billHeaderType"/> + <result column="companyName" property="companyName"/> + <result column="companyTaxNumber" property="companyTaxNumber"/> + <result column="billContent" property="billContent"/> + <result column="moreContent" property="moreContent"/> + <result column="billAmount" property="billAmount"/> + <result column="addresseeName" property="addresseeName"/> + <result column="addresseePhone" property="addresseePhone"/> + <result column="addresseeEmail" property="addresseeEmail"/> + <result column="state" property="state"/> + <result column="createTime" property="createTime"/> + </resultMap> + + + <select id="queryBillList" resultType="com.agentdriving.user.modular.system.warpper.BillWarpper"> + select + id, + billType, + billContent, + billAmount, + state, + UNIX_TIMESTAMP(createTime) * 1000 as createTime + from t_bill where userId = #{uid} order by createTime desc limit #{pageNum}, #{pageSize} + </select> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/BroadcastMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/BroadcastMapper.xml new file mode 100644 index 0000000..5fcaaa6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/BroadcastMapper.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.BroadcastMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Broadcast"> + <id column="id" property="id"/> + <result column="content" property="content"/> + <result column="sort" property="sort"/> + <result column="status" property="status"/> + <result column="createTime" property="createTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CancelOrderMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CancelOrderMapper.xml new file mode 100644 index 0000000..322bca6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CancelOrderMapper.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.CancelOrderMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.CancelOrder"> + <id column="id" property="id"/> + <result column="orderId" property="orderId"/> + <result column="userType" property="userType"/> + <result column="userId" property="userId"/> + <result column="cause" property="cause"/> + <result column="status" property="status"/> + <result column="createTime" property="createTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CommercialMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CommercialMapper.xml new file mode 100644 index 0000000..886ef82 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CommercialMapper.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.CommercialMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Commercial"> + <id column="id" property="id"/> + <result column="type" property="type"/> + <result column="name" property="name"/> + <result column="device" property="device"/> + <result column="isJump" property="isJump"/> + <result column="jumpType" property="jumpType"/> + <result column="jumpUrl" property="jumpUrl"/> + <result column="html" property="html"/> + <result column="sort" property="sort"/> + <result column="status" property="status"/> + <result column="createUserId" property="createUserId"/> + <result column="createTime" property="createTime"/> + <result column="updateUserId" property="updateUserId"/> + <result column="updateTime" property="updateTime"/> + </resultMap> + + + <select id="queryCommercialList" resultType="com.agentdriving.user.modular.system.warpper.CommercialWarpper"> + select + `name`, + url, + `type`, + isJump, + jumpType, + jumpUrl, + html + from t_commercial where status = 1 and onOffLine = 1 + <if test="null != type"> + and `type` = #{type} + </if> + <if test="null != device"> + and device = #{device} + </if> + order by sort limit 0, 3 + </select> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CommercialUserEjectMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CommercialUserEjectMapper.xml new file mode 100644 index 0000000..136ab8a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CommercialUserEjectMapper.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.CommercialUserEjectMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.CommercialUserEject"> + <id column="id" property="id"/> + <result column="userType" property="userType"/> + <result column="userId" property="userId"/> + <result column="lastDate" property="lastDate"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/ComplaintMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/ComplaintMapper.xml new file mode 100644 index 0000000..9141572 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/ComplaintMapper.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.ComplaintMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Complaint"> + <id column="id" property="id"/> + <result column="userId" property="userId"/> + <result column="orderId" property="orderId"/> + <result column="driverId" property="driverId"/> + <result column="reason" property="reason"/> + <result column="notes" property="notes"/> + <result column="state" property="state"/> + <result column="status" property="status"/> + <result column="createTime" property="createTime"/> + <result column="auditId" property="auditId"/> + <result column="auditPersonName" property="auditPersonName"/> + <result column="auditTime" property="auditTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CouponMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CouponMapper.xml new file mode 100644 index 0000000..5bca824 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/CouponMapper.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.CouponMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Coupon"> + <id column="id" property="id"/> + <result column="agent_id" property="agentId"/> + <result column="branch_office_id" property="branchOfficeId"/> + <result column="create_time" property="createTime"/> + <result column="coupon_name" property="couponName"/> + <result column="coupon_type" property="couponType"/> + <result column="coupon_code" property="couponCode"/> + <result column="coupon_service_type" property="couponServiceType"/> + <result column="coupon_conditional_amount" property="couponConditionalAmount"/> + <result column="coupon_preferential_amount" property="couponPreferentialAmount"/> + <result column="coupon_validity" property="couponValidity"/> + <result column="coupon_send_quantity" property="couponSendQuantity"/> + <result column="coupon_state" property="couponState"/> + <result column="coupon_count" property="couponCount"/> + <result column="remaining_quantity" property="remainingQuantity"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DeptMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DeptMapper.xml new file mode 100644 index 0000000..121b18a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DeptMapper.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.DeptMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Dept"> + <id column="id" property="id"/> + <result column="num" property="num"/> + <result column="pid" property="pid"/> + <result column="pids" property="pids"/> + <result column="simplename" property="simplename"/> + <result column="fullname" property="fullname"/> + <result column="tips" property="tips"/> + <result column="version" property="version"/> + </resultMap> + + <select id="tree" resultType="com.agentdriving.user.core.node.ZTreeNode"> + select id,pid as pId,simplename as name, + ( + CASE + WHEN (pId = 0 OR pId IS NULL) THEN + 'true' + ELSE + 'false' + END + ) as isOpen from sys_dept + </select> + + <select id="list" resultType="map"> + select * from sys_dept + <if test="condition != null and condition != ''"> + where simplename like CONCAT('%',#{condition},'%') or fullname like CONCAT('%',#{condition},'%') + </if> + order by num ASC + </select> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DictMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DictMapper.xml new file mode 100644 index 0000000..84df683 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DictMapper.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.DictMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Dict"> + <id column="id" property="id"/> + <result column="num" property="num"/> + <result column="pid" property="pid"/> + <result column="name" property="name"/> + <result column="code" property="code"/> + <result column="tips" property="tips"/> + </resultMap> + + <sql id="Base_Column_List"> + id, num, pid, name,code,tips + </sql> + + <select id="selectByCode" resultType="dict"> + select + <include refid="Base_Column_List"/> + from sys_dict + where code = #{code} + </select> + + <select id="selectByParentCode" resultType="dict"> + select + <include refid="Base_Column_List"/> + from sys_dict + where pid in(select id from sys_dict where code = #{code}) order by num asc + </select> + + <select id="list" resultType="map"> + select * from sys_dict + where pid = 0 + <if test="condition != null and condition != ''"> + AND name like CONCAT('%',#{condition},'%') + </if> + order by id ASC + </select> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DivisionRecordMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DivisionRecordMapper.xml new file mode 100644 index 0000000..02bc055 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DivisionRecordMapper.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.DivisionRecordMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.DivisionRecord"> + <id column="id" property="id"/> + <result column="userType" property="userType"/> + <result column="userId" property="userId"/> + <result column="orderId" property="orderId"/> + <result column="merOrderId" property="merOrderId"/> + <result column="sourceType" property="sourceType"/> + <result column="amount" property="amount"/> + <result column="merchantNumber" property="merchantNumber"/> + <result column="state" property="state"/> + <result column="payTime" property="payTime"/> + <result column="createTime" property="createTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DriverMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DriverMapper.xml new file mode 100644 index 0000000..86b3387 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DriverMapper.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.DriverMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Driver"> + <id column="id" property="id"/> + <result column="code" property="code"/> + <result column="name" property="name"/> + <result column="avatar" property="avatar"/> + <result column="phone" property="phone"/> + <result column="password" property="password"/> + <result column="sex" property="sex"/> + <result column="source" property="source"/> + <result column="emergencyContact" property="emergencyContact"/> + <result column="emergencyPhone" property="emergencyPhone"/> + <result column="driverLicenseNumber" property="driverLicenseNumber"/> + <result column="driverLicense" property="driverLicense"/> + <result column="firstCertificateTime" property="firstCertificateTime"/> + <result column="idcard" property="idcard"/> + <result column="idcardFront" property="idcardFront"/> + <result column="idcardBack" property="idcardBack"/> + <result column="inviterType" property="inviterType"/> + <result column="inviterId" property="inviterId"/> + <result column="agentId" property="agentId"/> + <result column="branchOfficeId" property="branchOfficeId"/> + <result column="balance" property="balance"/> + <result column="backgroundBalance" property="backgroundBalance"/> + <result column="couponBalance" property="couponBalance"/> + <result column="approvalStatus" property="approvalStatus"/> + <result column="approvalNotes" property="approvalNotes"/> + <result column="approvalUserId" property="approvalUserId"/> + <result column="approvalTime" property="approvalTime"/> + <result column="serverStatus" property="serverStatus"/> + <result column="integral" property="integral"/> + <result column="score" property="score"/> + <result column="status" property="status"/> + <result column="remark" property="remark"/> + <result column="isException" property="isException"/> + <result column="createTime" property="createTime"/> + <result column="provinceCode" property="provinceCode"/> + <result column="provinceName" property="provinceName"/> + <result column="cityCode" property="cityCode"/> + <result column="cityName" property="cityName"/> + <result column="areaCode" property="areaCode"/> + <result column="areaName" property="areaName"/> + <result column="commission" property="commission"/> + <result column="wxCollectionCode" property="wxCollectionCode"/> + <result column="zfbCollectionCode" property="zfbCollectionCode"/> + <result column="merchantNumber" property="merchantNumber"/> + <result column="merchantName" property="merchantName"/> + <result column="merchantPhone" property="merchantPhone"/> + <result column="merchantIDCode" property="merchantIDCode"/> + </resultMap> +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DriverWorkMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DriverWorkMapper.xml new file mode 100644 index 0000000..0158bbe --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/DriverWorkMapper.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.DriverWorkMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.DriverWork"> + <id column="id" property="id"/> + <result column="driverId" property="driverId"/> + <result column="workTime" property="workTime"/> + <result column="offWorkTime" property="offWorkTime"/> + <result column="onlineTime" property="onlineTime"/> + <result column="status" property="status"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/EvaluateMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/EvaluateMapper.xml new file mode 100644 index 0000000..6c0771a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/EvaluateMapper.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.EvaluateMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Evaluate"> + <id column="id" property="id"/> + <result column="orderId" property="orderId"/> + <result column="userId" property="userId"/> + <result column="score" property="score"/> + <result column="evaluate" property="evaluate"/> + <result column="status" property="status"/> + <result column="createTime" property="createTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/HtmlMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/HtmlMapper.xml new file mode 100644 index 0000000..7e4ae81 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/HtmlMapper.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.HtmlMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Html"> + <id column="id" property="id"/> + <result column="type" property="type"/> + <result column="html" property="html"/> + <result column="createTime" property="createTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/LoginLogMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/LoginLogMapper.xml new file mode 100644 index 0000000..ea7ce92 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/LoginLogMapper.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.LoginLogMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.LoginLog"> + <id column="id" property="id" /> + <result column="logname" property="logname" /> + <result column="userid" property="userid" /> + <result column="createtime" property="createtime" /> + <result column="succeed" property="succeed" /> + <result column="message" property="message" /> + <result column="ip" property="ip" /> + </resultMap> + + <select id="getLoginLogs" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> + select * from sys_login_log where 1 = 1 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + <if test="logName != null and logName !=''"> + and logname like CONCAT('%',#{logName},'%') + </if> + <choose> + <when test="orderByField != null and orderByField !=''"> + <choose> + <when test="isAsc == true"> + order by ${orderByField} ASC + </when> + <otherwise> + order by ${orderByField} DESC + </otherwise> + </choose> + </when> + <otherwise> + order by createtime DESC + </otherwise> + </choose> + </select> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/MainContentMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/MainContentMapper.xml new file mode 100644 index 0000000..e38915b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/MainContentMapper.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.MainContentMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.MainContent"> + <id column="id" property="id" /> + <result column="type" property="type" /> + <result column="content" property="content" /> + <result column="status" property="status" /> + <result column="createTime" property="createTime" /> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/MenuMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/MenuMapper.xml new file mode 100644 index 0000000..4444f13 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/MenuMapper.xml @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.MenuMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Menu"> + <id column="id" property="id" /> + <result column="code" property="code" /> + <result column="pcode" property="pcode" /> + <result column="pcodes" property="pcodes" /> + <result column="name" property="name" /> + <result column="icon" property="icon" /> + <result column="url" property="url" /> + <result column="num" property="num" /> + <result column="levels" property="levels" /> + <result column="ismenu" property="ismenu" /> + <result column="tips" property="tips" /> + <result column="status" property="status" /> + <result column="isopen" property="isopen" /> + </resultMap> + + <sql id="Base_Column_List"> + id, code, pcode, name, icon, url, num, levels,pcodes, + tips, status,isopen,ismenu + </sql> + + <select id="selectMenus" resultType="map"> + select + <include refid="Base_Column_List" /> + from sys_menu + where status = 1 + <if test="condition != null and condition != ''"> + and (name like CONCAT('%',#{condition},'%') or code like CONCAT('%',#{condition},'%')) + </if> + <if test="level != null and level != ''"> + and levels = #{level} + </if> + </select> + + <select id="getMenuIdsByRoleId" resultType="long"> + select menuid from + sys_relation where roleid = #{roleId} + </select> + + <select id="menuTreeList" resultType="com.agentdriving.user.core.node.ZTreeNode"> + SELECT + m1.id AS id, + ( + CASE + WHEN (m2.id = 0 OR m2.id IS NULL) THEN + 0 + ELSE + m2.id + END + ) AS pId, + m1. NAME + AS NAME, + ( + CASE + WHEN (m2.id = 0 OR m2.id IS NULL) THEN + 'true' + ELSE + 'false' + END + ) as isOpen + FROM + sys_menu m1 + LEFT join sys_menu m2 ON m1.pcode = m2. CODE + ORDER BY + m1.id ASC + </select> + + <select id="menuTreeListByMenuIds" resultType="com.agentdriving.user.core.node.ZTreeNode"> + SELECT + m1.id AS id, + ( + CASE + WHEN (m2.id = 0 OR m2.id IS NULL) THEN + 0 + ELSE + m2.id + END + ) AS pId, + m1. NAME AS NAME, + ( + CASE + WHEN (m2.id = 0 OR m2.id IS + NULL) THEN + 'true' + ELSE + 'false' + END + ) as isOpen, + ( + CASE + WHEN (m3.ID = 0 OR m3.ID + IS NULL) THEN + 'false' + ELSE + 'true' + END + ) "checked" + FROM + sys_menu m1 + LEFT JOIN + sys_menu m2 + ON m1.pcode = m2. CODE + left join ( + SELECT + ID + FROM + sys_menu + WHERE + ID IN + <foreach collection="list" index="index" item="i" open="(" + separator="," close=")"> + #{i} + </foreach> + ) m3 on m1.id = m3.id + ORDER BY + m1.id ASC + </select> + + <delete id="deleteRelationByMenu"> + delete from sys_relation where menuid = #{menuId} + </delete> + + <select id="getResUrlsByRoleId" resultType="string"> + select url from + sys_relation rel + inner join sys_menu m on rel.menuid = m.id + where rel.roleid = #{roleId} + </select> + + <select id="getMenusByRoleIds" resultType="com.agentdriving.user.core.node.MenuNode"> + SELECT + m1.id AS id, + m1.icon AS icon, + ( + CASE + WHEN (m2.id = 0 OR m2.id IS NULL) THEN + 0 + ELSE + m2.id + END + ) AS parentId, + m1.NAME as name, + m1.url as url, + m1.levels as levels, + m1.ismenu as ismenu, + m1.num as num + FROM + sys_menu m1 + LEFT join sys_menu m2 ON m1.pcode = m2. CODE + INNER JOIN ( + SELECT + ID + FROM + sys_menu + WHERE + ID IN ( + SELECT + menuid + FROM + sys_relation rela + WHERE + rela.roleid IN + <foreach collection="list" index="index" item="i" open="(" separator="," close=")"> + #{i} + </foreach> + ) + ) m3 ON m1.id = m3.id + where m1.ismenu = 1 + order by levels,num asc + </select> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/NoticeMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/NoticeMapper.xml new file mode 100644 index 0000000..3b4abff --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/NoticeMapper.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.NoticeMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Notice"> + <id column="id" property="id"/> + <result column="title" property="title"/> + <result column="type" property="type"/> + <result column="content" property="content"/> + <result column="createtime" property="createtime"/> + <result column="creater" property="creater"/> + </resultMap> + + <select id="list" resultType="map"> + select * from sys_notice + <if test="condition != null and condition != ''"> + where title like CONCAT('%',#{condition},'%') or content like CONCAT('%',#{condition},'%') + </if> + order by createtime DESC + </select> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/OperationLogMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/OperationLogMapper.xml new file mode 100644 index 0000000..b60562a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/OperationLogMapper.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.OperationLogMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.OperationLog"> + <id column="id" property="id" /> + <result column="logtype" property="logtype" /> + <result column="logname" property="logname" /> + <result column="userid" property="userid" /> + <result column="classname" property="classname" /> + <result column="method" property="method" /> + <result column="createtime" property="createtime" /> + <result column="succeed" property="succeed" /> + <result column="message" property="message" /> + </resultMap> + + <select id="getOperationLogs" resultType="map"> + select * from sys_operation_log where 1 = 1 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + <if test="logName != null and logName !=''"> + and logname like CONCAT('%',#{logName},'%') + </if> + <if test="logType != null and logType !=''"> + and logtype like CONCAT('%',#{logType},'%') + </if> + <choose> + <when test="orderByField != null and orderByField !=''"> + <choose> + <when test="isAsc == true"> + order by ${orderByField} ASC + </when> + <otherwise> + order by ${orderByField} DESC + </otherwise> + </choose> + </when> + <otherwise> + order by createtime DESC + </otherwise> + </choose> + </select> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/OrderMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/OrderMapper.xml new file mode 100644 index 0000000..1a1c265 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/OrderMapper.xml @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.OrderMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Order"> + <id column="id" property="id" /> + <result column="code" property="code" /> + <result column="userId" property="userId" /> + <result column="userPhone" property="userPhone" /> + <result column="userName" property="userName" /> + <result column="driverId" property="driverId" /> + <result column="source" property="source" /> + <result column="agentId" property="agentId" /> + <result column="branchOfficeId" property="branchOfficeId" /> + <result column="orderTakingTime" property="orderTakingTime"/> + <result column="goToAppointmentPointTime" property="goToAppointmentPointTime"/> + <result column="arrivalTimeAtTheAppointmentPoint" property="arrivalTimeAtTheAppointmentPoint"/> + <result column="startTime" property="startTime" /> + <result column="startAddress" property="startAddress" /> + <result column="startLat" property="startLat" /> + <result column="startLng" property="startLng" /> + <result column="endAddress" property="endAddress" /> + <result column="endLat" property="endLat" /> + <result column="endLng" property="endLng" /> + <result column="boardingTime" property="boardingTime" /> + <result column="getoffTime" property="getoffTime" /> + <result column="startDistance" property="startDistance" /> + <result column="startPrice" property="startPrice" /> + <result column="overDriveDistance" property="overDriveDistance" /> + <result column="overDrivePrice" property="overDrivePrice" /> + <result column="longDistance" property="longDistance" /> + <result column="longDistancePrice" property="longDistancePrice" /> + <result column="overLongDistance" property="overLongDistance" /> + <result column="overLongDistancePrice" property="overLongDistancePrice" /> + <result column="waitTime" property="waitTime" /> + <result column="waitTimePrice" property="waitTimePrice" /> + <result column="outWaitTime" property="outWaitTime" /> + <result column="outWaitTimePrice" property="outWaitTimePrice" /> + <result column="badWeatherDistance" property="badWeatherDistance" /> + <result column="badWeatherPrice" property="badWeatherPrice" /> + <result column="overBadWeatherDistance" property="overBadWeatherDistance" /> + <result column="overBadWeatherPrice" property="overBadWeatherPrice" /> + <result column="weather" property="weather"/> + <result column="estimatedPrice" property="estimatedPrice" /> + <result column="estimatedMileage" property="estimatedMileage"/> + <result column="orderMoney" property="orderMoney" /> + <result column="actualMileage" property="actualMileage"/> + <result column="payMoney" property="payMoney" /> + <result column="discountedPrice" property="discountedPrice" /> + <result column="couponId" property="couponId" /> + <result column="discountAmount" property="discountAmount"/> + <result column="discount" property="discount"/> + <result column="payType" property="payType" /> + <result column="payTime" property="payTime" /> + <result column="orderNo" property="orderNo"/> + <result column="hallOrder" property="hallOrder"/> + <result column="startWaitTime" property="startWaitTime"/> + <result column="state" property="state" /> + <result column="oldState" property="oldState"/> + <result column="isInvoice" property="isInvoice"/> + <result column="status" property="status" /> + <result column="createTime" property="createTime" /> + </resultMap> + + + + <select id="queryOrderInfo" resultType="com.agentdriving.user.modular.system.warpper.OrderInfoWarpper"> + select + a.id as orderId, + a.`code`, + a.startAddress, + a.startLat, + a.startLng, + a.endAddress, + a.endLat, + a.endLng, + b.id as driverId, + b.avatar as driverAvatar, + b.`name` as driverName, + b.phone as driverPhone, + b.`code` as driverCode, + ifnull(DATE_FORMAT(now(), '%Y') - DATE_FORMAT(b.firstCertificateTime, '%Y'), 0) as driverAge, + (select count(1) from t_order where driverId = b.id and `status` = 1 and state in (107, 108, 109)) as driverNumber, + b.score as driverScore, + a.state, + UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, + c.score as evaluationScore, + c.evaluate as evaluationContent + from t_order a + left join t_driver b on (a.driverId = b.id) + left join t_evaluate c on (a.id = c.orderId) + where a.id = #{orderId} + </select> + + + <select id="queryMyOrder" resultType="com.agentdriving.user.modular.system.warpper.OrderListWarpper"> + select + id, + '超省新代驾订单' as title, + startAddress, + endAddress, + state, + UNIX_TIMESTAMP(createTime) * 1000 as createTime + from t_order + where `status` = 1 and userId = #{uid} order by createTime desc limit #{pageNum}, #{pageSize} + </select> + + + + <select id="queryNotInvoiceOrder" resultType="com.agentdriving.user.modular.system.warpper.OrderListWarpper"> + select + id, + '超省新代驾' as title, + startAddress, + endAddress, + state, + UNIX_TIMESTAMP(createTime) * 1000 as createTime, + payMoney as amount + from t_order + where `status` = 1 and isInvoice != 1 and state in (108, 109) and userId = #{uid} + <if test="null != notInvoiceOrder.startTime and '' != notInvoiceOrder.startTime and null != notInvoiceOrder.endTime and '' != notInvoiceOrder.endTime"> + and DATE_FORMAT(createTime, '%Y-%m-%d') between #{notInvoiceOrder.startTime} and #{notInvoiceOrder.endTime} + </if> + <if test="null != notInvoiceOrder.startAmount and null != notInvoiceOrder.endAmount"> + and payMoney between #{notInvoiceOrder.startAmount} and #{notInvoiceOrder.endAmount} + </if> + order by createTime desc limit #{notInvoiceOrder.pageNum}, #{notInvoiceOrder.pageSize} + </select> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/PlatformRechargeRecordMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/PlatformRechargeRecordMapper.xml new file mode 100644 index 0000000..a6b5e85 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/PlatformRechargeRecordMapper.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.PlatformRechargeRecordMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.PlatformRechargeRecord"> + <id column="id" property="id"/> + <result column="orderId" property="orderId"/> + <result column="price" property="price"/> + <result column="orderNumber" property="orderNumber"/> + <result column="balance" property="balance"/> + <result column="state" property="state"/> + <result column="payTime" property="payTime"/> + <result column="createTime" property="createTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RechargeRecordMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RechargeRecordMapper.xml new file mode 100644 index 0000000..3cf10d7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RechargeRecordMapper.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.RechargeRecordMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.RechargeRecord"> + <id column="id" property="id" /> + <result column="type" property="type" /> + <result column="userId" property="userId" /> + <result column="code" property="code" /> + <result column="amount" property="amount"/> + <result column="payType" property="payType" /> + <result column="payTime" property="payTime" /> + <result column="payStatus" property="payStatus" /> + <result column="orderNumber" property="orderNumber" /> + <result column="createTime" property="createTime" /> + <result column="agentId" property="agentId" /> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RegionMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RegionMapper.xml new file mode 100644 index 0000000..2b6af64 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RegionMapper.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.RegionMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Region"> + <id column="id" property="id" /> + <result column="name" property="name" /> + <result column="code" property="code" /> + <result column="citycode" property="citycode" /> + <result column="parent_id" property="parentId" /> + <result column="english" property="english" /> + </resultMap> + + + <select id="query" resultType="Region"> + select + id as id, + name as name, + code as code, + citycode as citycode, + parent_id as parentId, + english as english + from t_region where code = #{code} + </select> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RelationMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RelationMapper.xml new file mode 100644 index 0000000..0d39177 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RelationMapper.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.RelationMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Relation"> + <id column="id" property="id" /> + <result column="menuid" property="menuid" /> + <result column="roleid" property="roleid" /> + </resultMap> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RevenueMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RevenueMapper.xml new file mode 100644 index 0000000..579ff03 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RevenueMapper.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.RevenueMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Revenue"> + <id column="id" property="id"/> + <result column="type" property="type"/> + <result column="userType" property="userType"/> + <result column="userId" property="userId"/> + <result column="orderId" property="orderId"/> + <result column="amount" property="amount"/> + <result column="createTime" property="createTime"/> + </resultMap> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RoleMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RoleMapper.xml new file mode 100644 index 0000000..b761eb1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/RoleMapper.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.RoleMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Role"> + <id column="id" property="id" /> + <result column="num" property="num" /> + <result column="pid" property="pid" /> + <result column="name" property="name" /> + <result column="deptid" property="deptid" /> + <result column="tips" property="tips" /> + <result column="version" property="version" /> + </resultMap> + + <sql id="Base_Column_List"> + id, num, pid, name, deptid, tips, version + </sql> + + <select id="selectRoles" resultType="map"> + select + <include refid="Base_Column_List" /> + from sys_role + <if test="condition != null"> + where name like CONCAT('%',#{condition},'%') + </if> + </select> + + <delete id="deleteRolesById"> + delete from sys_relation where roleid = #{roleId} + </delete> + + <select id="roleTreeList" resultType="com.agentdriving.user.core.node.ZTreeNode"> + select id "id",pId + "pId",name as "name",(case when (pId=0 or pId is null) then 'true' + else 'false' end) "open" from sys_role + </select> + + <select id="roleTreeListByRoleId" resultType="com.agentdriving.user.core.node.ZTreeNode"> + SELECT + r.id "id", + pId "pId", + NAME AS "name", + ( + CASE + WHEN (pId = 0 OR pId IS NULL) THEN + 'true' + ELSE + 'false' + END + ) "open", + ( + CASE + WHEN (r1.ID = 0 OR r1.ID IS NULL) THEN + 'false' + ELSE + 'true' + END + ) "checked" + FROM + sys_role r + LEFT JOIN ( + SELECT + ID + FROM + sys_role + WHERE + ID IN + + <foreach collection="array" index="index" item="i" open="(" separator="," close=")"> + #{i} + </foreach> + + ) r1 ON r.ID = r1.ID + ORDER BY + pId, + num ASC + </select> +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/SystemConfigMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/SystemConfigMapper.xml new file mode 100644 index 0000000..dd008b6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/SystemConfigMapper.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.SystemConfigMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.SystemConfig"> + <id column="id" property="id"/> + <result column="type" property="type"/> + <result column="content" property="content"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/UserMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/UserMapper.xml new file mode 100644 index 0000000..d72213e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/UserMapper.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.UserMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.User"> + <id column="id" property="id" /> + <result column="avatar" property="avatar" /> + <result column="account" property="account" /> + <result column="password" property="password" /> + <result column="salt" property="salt" /> + <result column="name" property="name" /> + <result column="birthday" property="birthday" /> + <result column="sex" property="sex" /> + <result column="email" property="email" /> + <result column="phone" property="phone" /> + <result column="roleid" property="roleid" /> + <result column="deptid" property="deptid" /> + <result column="status" property="status" /> + <result column="createtime" property="createtime" /> + <result column="version" property="version" /> + </resultMap> + + <sql id="Base_Column_List"> + id, account, name, birthday, sex, email, avatar, + phone, roleid, + deptid, status, + createtime, version + </sql> + + <sql id="Base_Column_List_With_Pwd"> + id, account, name, birthday,password, sex, email, avatar, + phone, roleid,salt, + deptid, status, + createtime, version + </sql> + + <select id="selectUsers" resultType="map"> + select + <include refid="Base_Column_List" /> + from sys_user + where status != 3 + <if test="name != null and name != ''"> + and (phone like CONCAT('%',#{name},'%') + or account like CONCAT('%',#{name},'%') + or name like CONCAT('%',#{name},'%')) + </if> + <if test="deptid != null and deptid != 0"> + and (deptid = #{deptid} or deptid in ( select id from sys_dept where pids like CONCAT('%[', #{deptid}, ']%') )) + </if> + <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> + and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + </select> + + <update id="setStatus"> + update sys_user set status = #{status} where id = + #{userId} + </update> + + <update id="changePwd"> + update sys_user set password = #{pwd} where id = + #{userId} + </update> + + <update id="setRoles"> + update sys_user set roleid = #{roleIds} where id = + #{userId} + </update> + + <select id="getByAccount" resultType="user"> + select + <include refid="Base_Column_List_With_Pwd" /> + from sys_user where account = #{account} and status != 3 + </select> + +</mapper> diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/UserToCouponMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/UserToCouponMapper.xml new file mode 100644 index 0000000..c5f9364 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/UserToCouponMapper.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.UserToCouponMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.UserToCoupon"> + <id column="id" property="id" /> + <result column="userId" property="userId" /> + <result column="couponId" property="couponId" /> + <result column="couponTotal" property="couponTotal" /> + <result column="validCount" property="validCount" /> + <result column="expireCount" property="expireCount" /> + <result column="expireTime" property="expireTime" /> + <result column="createTime" property="createTime" /> + <result column="status" property="status" /> + </resultMap> + + + <select id="queryCoupon" resultType="com.agentdriving.user.modular.system.model.Coupon"> + select + b.id, + a.agent_id as agentId, + a.branch_office_id as branchOfficeId, + a.create_time as createTime, + a.coupon_name as couponName, + a.coupon_type as couponType, + a.coupon_code as couponCode, + a.coupon_service_type as couponServiceType, + a.coupon_conditional_amount as couponConditionalAmount, + a.coupon_preferential_amount as couponPreferentialAmount, + a.coupon_validity as couponValidity, + a.coupon_send_quantity as couponSendQuantity, + a.coupon_state as couponState, + a.coupon_count as couponCount, + a.remaining_quantity as remainingQuantity + from t_coupon a + left join t_user_to_coupon b on (a.id = b.couponId) + where b.status = 1 and b.expireTime > now() and b.validCount > 0 + and b.userId = #{uid} and a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} + order by a.coupon_preferential_amount desc limit 0, 1 + </select> + + + <select id="queryPayCouponList" resultType="com.agentdriving.user.modular.system.warpper.CouponWarpper"> + select + b.id, + a.coupon_conditional_amount as couponConditionalAmount, + a.coupon_preferential_amount as couponPreferentialAmount, + a.coupon_name as couponName, + UNIX_TIMESTAMP(b.expireTime) * 1000 as expirationDate, + b.validCount as number + from t_coupon a + left join t_user_to_coupon b on (a.id = b.couponId) + where b.userId = #{uid} and b.validCount > 0 and b.expireTime > now() and + a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} order by b.createTime + </select> + + + <select id="queryMyCoupons" resultType="com.agentdriving.user.modular.system.warpper.CouponsWarpper"> + select + a.id, + b.coupon_name as `name`, + b.coupon_conditional_amount as preferentialTerms, + b.coupon_preferential_amount as discountAmount, + UNIX_TIMESTAMP(a.expireTime) * 1000 as endTime + from t_user_to_coupon a + left join t_coupon b on (a.couponId = b.id) + where a.`status` = 1 and a.userId = #{uid} + <if test="null != state and 1 == state"> + and a.couponTotal = a.validCount and now() < a.expireTime + </if> + <if test="null != state and 2 == state"> + and a.couponTotal != a.validCount and now() < a.expireTime + </if> + <if test="null != state and 3 == state"> + and now() >= a.expireTime + </if> + order by a.createTime desc limit #{pageNum}, #{pageSize} + </select> + + + <select id="queryUsedCouponNum" resultType="int"> + select sum(couponTotal - validCount) from t_user_to_coupon where `status` = 1 and userId = #{uid} + </select> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/WeatherCityMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/WeatherCityMapper.xml new file mode 100644 index 0000000..cdade4d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/WeatherCityMapper.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.WeatherCityMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.WeatherCity"> + <id column="id" property="id" /> + <result column="province" property="province" /> + <result column="city" property="city" /> + <result column="district" property="district" /> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/YouTuiDriverMapper.xml b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/YouTuiDriverMapper.xml new file mode 100644 index 0000000..47ceb43 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/dao/mapping/YouTuiDriverMapper.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.agentdriving.user.modular.system.dao.YouTuiDriverMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.YouTuiDriver"> + <id column="id" property="id" /> + <result column="driverId" property="driverId" /> + <result column="youTuiId" property="youTuiId" /> + <result column="integral" property="integral" /> + <result column="type" property="type"/> + <result column="surplusQuantity" property="surplusQuantity"/> + <result column="endTime" property="endTime"/> + <result column="state" property="state"/> + <result column="failureTime" property="failureTime" /> + <result column="createTime" property="createTime" /> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/factory/UserFactory.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/factory/UserFactory.java new file mode 100644 index 0000000..03f5a64 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/factory/UserFactory.java @@ -0,0 +1,54 @@ +package com.agentdriving.user.modular.system.factory; + +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.model.User; +import com.agentdriving.user.modular.system.transfer.UserDto; +import org.springframework.beans.BeanUtils; + +/** + * 用户创建工厂 + * + * @author fengshuonan + * @date 2017-05-05 22:43 + */ +public class UserFactory { + + public static User createUser(UserDto userDto) { + if (userDto == null) { + return null; + } else { + User user = new User(); + BeanUtils.copyProperties(userDto, user); + return user; + } + } + + public static User editUser(UserDto newUser, User oldUser) { + if (newUser == null || oldUser == null) { + return oldUser; + } else { + if (ToolUtil.isNotEmpty(newUser.getAvatar())) { + oldUser.setAvatar(newUser.getAvatar()); + } + if (ToolUtil.isNotEmpty(newUser.getName())) { + oldUser.setName(newUser.getName()); + } + if (ToolUtil.isNotEmpty(newUser.getBirthday())) { + oldUser.setBirthday(newUser.getBirthday()); + } + if (ToolUtil.isNotEmpty(newUser.getDeptid())) { + oldUser.setDeptid(newUser.getDeptid()); + } + if (ToolUtil.isNotEmpty(newUser.getSex())) { + oldUser.setSex(newUser.getSex()); + } + if (ToolUtil.isNotEmpty(newUser.getEmail())) { + oldUser.setEmail(newUser.getEmail()); + } + if (ToolUtil.isNotEmpty(newUser.getPhone())) { + oldUser.setPhone(newUser.getPhone()); + } + return oldUser; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/AccountChangeDetail.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/AccountChangeDetail.java new file mode 100644 index 0000000..502ed13 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/AccountChangeDetail.java @@ -0,0 +1,75 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * 账户变动记录 + * @author zhibing.pu + * @date 2023/3/4 11:30 + */ +@Data +@TableName("t_account_change_detail") +public class AccountChangeDetail { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 编号 + */ + @TableField("code") + private String code; + /** + * 用户类型(1=用户,2=司机) + */ + @TableField("userType") + private Integer userType; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 类型(1=余额,2=积分) + */ + @TableField("type") + private Integer type; + /** + * 变动类型(1=订单收入,2=订单支出,3=充值,4=提现,5=佣金收入,6=佣金提现,7=优惠券收入,8=保险支付) + */ + @TableField("changeType") + private Integer changeType; + /** + * 历史数据 + */ + @TableField("oldData") + private Double oldData; + /** + * 新数据 + */ + @TableField("newData") + private Double newData; + /** + * 订单id + */ + @TableField("orderId") + private Long orderId; + /** + * 变动说明 + */ + @TableField("explain") + private String explain; + /** + * 变动时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Agent.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Agent.java new file mode 100644 index 0000000..094ce1b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Agent.java @@ -0,0 +1,105 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * 代理商 + * @author zhibing.pu + * @date 2023/3/22 22:29 + */ +@Data +@TableName("t_agent") +public class Agent { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 负责人姓名 + */ + @TableField("principal") + private String principal; + /** + * 负责人电话 + */ + @TableField("principalPhone") + private String principalPhone; + /** + * 邮箱 + */ + @TableField("email") + private String email; + /** + * 代理区域省名称 + */ + @TableField("provinceName") + private String provinceName; + /** + * 代理区域省编号 + */ + @TableField("provinceCode") + private String provinceCode; + /** + * 代理区域市编号 + */ + @TableField("cityCode") + private String cityCode; + /** + * 代理区域市名称 + */ + @TableField("cityName") + private String cityName; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 开户银行 + */ + @TableField("bankDeposit") + private String bankDeposit; + /** + * 银行账号 + */ + @TableField("bankAccount") + private String bankAccount; + /** + * 客服电话 + */ + @TableField("serviceCalls") + private String serviceCalls; + /** + * 商户号 + */ + @TableField("merchantNumber") + private String merchantNumber; + /** + * 商户姓名 + */ + @TableField("merchantName") + private String merchantName; + /** + * 商户电话 + */ + @TableField("merchantPhone") + private String merchantPhone; + /** + * 商户身份证号码 + */ + @TableField("merchantIDCode") + private String merchantIDCode; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/AppUser.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/AppUser.java new file mode 100644 index 0000000..0fb3912 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/AppUser.java @@ -0,0 +1,113 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * 用户 + */ +@Data +@TableName("t_app_user") +public class AppUser { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 昵称 + */ + @TableField("nickname") + private String nickname; + /** + * 电话 + */ + @TableField("phone") + private String phone; + /** + * 性别(1=男,2=女) + */ + @TableField("sex") + private Integer sex; + /** + * 头像 + */ + @TableField("avatar") + private String avatar; + /** + * 微信openid + */ + @TableField("openid") + private String openid; + /** + * 微信unionid + */ + @TableField("unionid") + private String unionid; + /** + * 紧急联系人 + */ + @TableField("emergencyContact") + private String emergencyContact; + /** + * 紧急联系人电话 + */ + @TableField("emergencyPhone") + private String emergencyPhone; + /** + * 账户余额 + */ + @TableField("accountBalance") + private Double accountBalance; + /** + * 用户标签id + */ + @TableField("userTagId") + private Integer userTagId; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 是否异常 1正常 2异常 + */ + @TableField("is_exception") + private Integer isException; + /** + * 启动冻结理由 + */ + @TableField("remark") + private String remark; + /** + * 邀约人类型(1=用户,2=司机) + */ + @TableField("inviterType") + private Integer inviterType; + /** + * 邀约人id + */ + @TableField("inviterId") + private Integer inviterId; + /** + * 取消订单次数,取消一次加一,若成功接单清零 + */ + @TableField("cancelCount") + private Integer cancelCount; + /** + * 是否拥有9折优惠 1是 0否 + */ + @TableField("havDiscount") + private Integer havDiscount; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Bill.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Bill.java new file mode 100644 index 0000000..baf57f1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Bill.java @@ -0,0 +1,94 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/24 9:59 + */ +@Data +@TableName("t_bill") +public class Bill { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 订单id + */ + @TableField("orderId") + private Integer orderId; + /** + * 发票类型 1电子发票 + */ + @TableField("billType") + private Integer billType; + /** + * 发票抬头 1公司 2个人 + */ + @TableField("billHeaderType") + private Integer billHeaderType; + /** + * 公司名称/个人抬头名称 + */ + @TableField("companyName") + private String companyName; + /** + * 公司税号 + */ + @TableField("companyTaxNumber") + private String companyTaxNumber; + /** + * 发票内容 + */ + @TableField("billContent") + private String billContent; + /** + * 更多内容 + */ + @TableField("moreContent") + private String moreContent; + /** + * 发票金额 + */ + @TableField("billAmount") + private Double billAmount; + /** + * 收件人姓名 + */ + @TableField("addresseeName") + private String addresseeName; + /** + * 收件人电话 + */ + @TableField("addresseePhone") + private String addresseePhone; + /** + * 收件人邮箱 + */ + @TableField("addresseeEmail") + private String addresseeEmail; + /** + * 开票状态 1待开票 2已开票 3开票失败 + */ + @TableField("state") + private Integer state; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Broadcast.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Broadcast.java new file mode 100644 index 0000000..7342992 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Broadcast.java @@ -0,0 +1,45 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** +* 广播 +* @author pzb +* @Date 2023/2/27 17:05 +*/ +@Data +@TableName("t_broadcast") +public class Broadcast { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 消息内容 + */ + @TableField("content") + private String content; + /** + * 排序 + */ + @TableField("sort") + private Integer sort; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/CancelOrder.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/CancelOrder.java new file mode 100644 index 0000000..a6d6aba --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/CancelOrder.java @@ -0,0 +1,55 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** +* 订单取消记录 +* @author pzb +* @Date 2023/2/25 14:37 +*/ +@Data +@TableName("t_cancel_order") +public class CancelOrder { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 订单id + */ + @TableField("orderId") + private Long orderId; + /** + * 用户类型(1=用户,2=司机) + */ + @TableField("userType") + private Integer userType; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 取消原因 + */ + @TableField("cause") + private String cause; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Commercial.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Commercial.java new file mode 100644 index 0000000..c1da7a9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Commercial.java @@ -0,0 +1,88 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * 广告实体类 + */ +@Data +@TableName("t_commercial") +public class Commercial { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 类型(1=弹窗广告,2=底部广告) + */ + @TableField("type") + private Integer type; + /** + * 广告名称 + */ + @TableField("name") + private String name; + /** + * 设备(1=小程序,2=司机端) + */ + @TableField("device") + private Integer device; + /** + * 是否跳转(0=否,1=是) + */ + @TableField("isJump") + private Integer isJump; + /** + * 跳转类型(1=内部跳转,2=外部跳转) + */ + @TableField("jumpType") + private Integer jumpType; + /** + * 跳转链接 + */ + @TableField("jumpUrl") + private String jumpUrl; + /** + * 富文本内容 + */ + @TableField("html") + private String html; + /** + * 排序 + */ + @TableField("sort") + private Integer sort; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加人员id + */ + @TableField("createUserId") + private Integer createUserId; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 修改人员id + */ + @TableField("updateUserId") + private Integer updateUserId; + /** + * 修改时间 + */ + @TableField("updateTime") + private Date updateTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/CommercialUserEject.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/CommercialUserEject.java new file mode 100644 index 0000000..1d21a7b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/CommercialUserEject.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * 用户弹框广告记录 + */ +@Data +@TableName("t_commercial_user_eject") +public class CommercialUserEject { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.INPUT) + @TableField("id") + private Long id; + /** + * 用户类型(1=用户,2=司机) + */ + @TableField("userType") + private Integer userType; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 最后弹出日期 + */ + @TableField("lastDate") + private Date lastDate; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Complaint.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Complaint.java new file mode 100644 index 0000000..ff93dc7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Complaint.java @@ -0,0 +1,79 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/24 11:58 + */ +@Data +@TableName("t_complaint") +public class Complaint { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 订单id + */ + @TableField("orderId") + private Integer orderId; + /** + * 司机id + */ + @TableField("driverId") + private Integer driverId; + /** + * 投诉原因 + */ + @TableField("reason") + private String reason; + /** + * 注释 + */ + @TableField("notes") + private String notes; + /** + * 处理状态(1=待处理,2=已处理) + */ + @TableField("state") + private Integer state; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 处理人id + */ + @TableField("auditId") + private Integer auditId; + /** + * 处理人名称 + */ + @TableField("auditPersonName") + private String auditPersonName; + /** + * 处理时间 + */ + @TableField("auditTime") + private Date auditTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Coupon.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Coupon.java new file mode 100644 index 0000000..84b3087 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Coupon.java @@ -0,0 +1,95 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** +* 优惠券 +* @author pzb +* @Date 2023/2/28 11:57 +*/ +@Data +@TableName("t_coupon") +public class Coupon { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 代理商id + */ + @TableField("agent_id") + private Integer agentId; + /** + * 分公司id + */ + @TableField("branch_office_id") + private Integer branchOfficeId; + /** + * 创建时间 + */ + @TableField("create_time") + private Date createTime; + /** + * 优惠券名称 + */ + @TableField("coupon_name") + private String couponName; + /** + * 优惠券类型 1活动券 2新人券 + */ + @TableField("coupon_type") + private Integer couponType; + /** + * 优惠券码 + */ + @TableField("coupon_code") + private String couponCode; + /** + * 服务类型 1通用券 + */ + @TableField("coupon_service_type") + private Integer couponServiceType; + /** + * 条件金额 + */ + @TableField("coupon_conditional_amount") + private Double couponConditionalAmount; + /** + * 优惠金额 + */ + @TableField("coupon_preferential_amount") + private Double couponPreferentialAmount; + /** + * 有效期 + */ + @TableField("coupon_validity") + private Integer couponValidity; + /** + * 赠送数量 + */ + @TableField("coupon_send_quantity") + private Integer couponSendQuantity; + /** + * 是否冻结 1正常 2冻结 + */ + @TableField("coupon_state") + private Integer couponState; + /** + * 优惠券数量 + */ + @TableField("coupon_count") + private Integer couponCount; + /** + * 剩余数量 + */ + @TableField("remaining_quantity") + private Integer remainingQuantity; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Dept.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Dept.java new file mode 100644 index 0000000..2f180b3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Dept.java @@ -0,0 +1,140 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +import java.io.Serializable; + +/** + * <p> + * 部门表 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_dept") +public class Dept extends Model<Dept> { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value="id", type= IdType.AUTO) + private Integer id; + /** + * 排序 + */ + private Integer num; + /** + * 父部门id + */ + private Integer pid; + /** + * 父级ids + */ + private String pids; + /** + * 简称 + */ + private String simplename; + /** + * 全称 + */ + private String fullname; + /** + * 提示 + */ + private String tips; + /** + * 版本(乐观锁保留字段) + */ + private Integer version; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Integer getPid() { + return pid; + } + + public void setPid(Integer pid) { + this.pid = pid; + } + + public String getPids() { + return pids; + } + + public void setPids(String pids) { + this.pids = pids; + } + + public String getSimplename() { + return simplename; + } + + public void setSimplename(String simplename) { + this.simplename = simplename; + } + + public String getFullname() { + return fullname; + } + + public void setFullname(String fullname) { + this.fullname = fullname; + } + + public String getTips() { + return tips; + } + + public void setTips(String tips) { + this.tips = tips; + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "Dept{" + + "id=" + id + + ", num=" + num + + ", pid=" + pid + + ", pids=" + pids + + ", simplename=" + simplename + + ", fullname=" + fullname + + ", tips=" + tips + + ", version=" + version + + "}"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Dict.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Dict.java new file mode 100644 index 0000000..0f7d31a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Dict.java @@ -0,0 +1,116 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + + +import java.io.Serializable; + +/** + * <p> + * 字典表 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_dict") +public class Dict extends Model<Dict> { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value="id", type= IdType.AUTO) + private Integer id; + /** + * 排序 + */ + private Integer num; + /** + * 父级字典 + */ + private Integer pid; + /** + * 名称 + */ + private String name; + + /** + * 编码 + */ + private String code; + /** + * 提示 + */ + private String tips; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Integer getPid() { + return pid; + } + + public void setPid(Integer pid) { + this.pid = pid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTips() { + return tips; + } + + public void setTips(String tips) { + this.tips = tips; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + @Override + public String toString() { + return "Dict{" + + "id=" + id + + ", num=" + num + + ", pid=" + pid + + ", name='" + name + '\'' + + ", code='" + code + '\'' + + ", tips='" + tips + '\'' + + '}'; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/DivisionRecord.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/DivisionRecord.java new file mode 100644 index 0000000..cd3d591 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/DivisionRecord.java @@ -0,0 +1,73 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/5/6 15:54 + */ +@Data +@TableName("t_division_record") +public class DivisionRecord { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + /** + * 用户类型(1=司机,2=代理商,3=平台) + */ + @TableField("userType") + private Integer userType; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 分账业务订单id + */ + @TableField("orderId") + private Long orderId; + /** + * 第三方分账业务订单id + */ + @TableField("merOrderId") + private String merOrderId; + /** + * 业务来源(1=订单业务,2=平台充值) + */ + @TableField("sourceType") + private Integer sourceType; + /** + * 分账金额 + */ + @TableField("amount") + private Double amount; + /** + * 收款商户号 + */ + @TableField("merchantNumber") + private String merchantNumber; + /** + * 分账状态(1=分账中,2=分账成功) + */ + @TableField("state") + private Integer state; + /** + * 分账时间 + */ + @TableField("payTime") + private Date payTime; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Driver.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Driver.java new file mode 100644 index 0000000..7fdc3b6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Driver.java @@ -0,0 +1,255 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** +* 司机基础信息 +* @author pzb +* @Date 2023/2/8 18:33 +*/ +@Data +@TableName("t_driver") +public class Driver { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 编号 + */ + @TableField("code") + private String code; + /** + * 名称 + */ + @TableField("name") + private String name; + /** + * 头像 + */ + @TableField("avatar") + private String avatar; + /** + * 手机号 + */ + @TableField("phone") + private String phone; + /** + * 密码 + */ + @TableField("password") + private String password; + /** + * 性别(1=男,2=女) + */ + @TableField("sex") + private Integer sex; + /** + * 来源 + */ + @TableField("source") + private Integer source; + /** + * 紧急联系人 + */ + @TableField("emergencyContact") + private String emergencyContact; + /** + * 紧急联系电话 + */ + @TableField("emergencyPhone") + private String emergencyPhone; + /** + * 驾驶证号码 + */ + @TableField("driverLicenseNumber") + private String driverLicenseNumber; + /** + * 驾驶证照片 + */ + @TableField("driverLicense") + private String driverLicense; + /** + * 驾驶证初次领证时间 + */ + @TableField("firstCertificateTime") + private Date firstCertificateTime; + /** + * 身份证号码 + */ + @TableField("idcard") + private String idcard; + /** + * 身份证正面照 + */ + @TableField("idcardFront") + private String idcardFront; + /** + * 身份证背面照 + */ + @TableField("idcardBack") + private String idcardBack; + /** + * 邀约人类型(1=用户,2=司机) + */ + @TableField("inviterType") + private Integer inviterType; + /** + * 邀约人id + */ + @TableField("inviterId") + private Integer inviterId; + /** + * 代理商id + */ + @TableField("agentId") + private Integer agentId; + /** + * 分公司id + */ + @TableField("branchOfficeId") + private Integer branchOfficeId; + /** + * 账户余额 + */ + @TableField("balance") + private Double balance; + /** + * 后台充值余额 + */ + @TableField("backgroundBalance") + private Double backgroundBalance; + /** + * 优惠券余额(订单优惠券支付的金额) + */ + @TableField("couponBalance") + private Double couponBalance; + /** + * 审核状态(1=待审核,2=已同意,3=已拒绝) + */ + @TableField("approvalStatus") + private Integer approvalStatus; + /** + * 审核注释 + */ + @TableField("approvalNotes") + private String approvalNotes; + /** + * 审核用户id + */ + @TableField("approvalUserId") + private Integer approvalUserId; + /** + * 审核时间 + */ + @TableField("approvalTime") + private Date approvalTime; + /** + * 服务状态(1=空闲中,2=服务中) + */ + @TableField("serverStatus") + private Integer serverStatus; + /** + * 剩余积分 + */ + @TableField("integral") + private Integer integral; + /** + * 评分 + */ + @TableField("score") + private Double score; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 启用冻结理由 + */ + @TableField("remark") + private String remark; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 加盟区域省编号 + */ + @TableField("provinceCode") + private String provinceCode; + /** + * 加盟区域省名称 + */ + @TableField("provinceName") + private String provinceName; + /** + * 加盟区域市编号 + */ + @TableField("cityCode") + private String cityCode; + /** + * 加盟区域市名称 + */ + @TableField("cityName") + private String cityName; + /** + * 加盟区域区编号 + */ + @TableField("areaCode") + private String areaCode; + /** + * 加盟区域区名称 + */ + @TableField("areaName") + private String areaName; + /** + * 佣金 + */ + @TableField("commission") + private Double commission; + /** + * 微信收款码 + */ + @TableField("wxCollectionCode") + private String wxCollectionCode; + /** + * 支付宝收款码 + */ + @TableField("zfbCollectionCode") + private String zfbCollectionCode; + /** + * 商户号 + */ + @TableField("merchantNumber") + private String merchantNumber; + /** + * 商户姓名 + */ + @TableField("merchantName") + private String merchantName; + /** + * 商户电话 + */ + @TableField("merchantPhone") + private String merchantPhone; + /** + * 商户身份证号码 + */ + @TableField("merchantIDCode") + private String merchantIDCode; + /** + * 是否打开下单二维码 + */ + @TableField("openOrderQRCode") + private Integer openOrderQRCode; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/DriverWork.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/DriverWork.java new file mode 100644 index 0000000..408d7bb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/DriverWork.java @@ -0,0 +1,47 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * 司机上下班记录 + */ +@Data +@TableName("t_driver_work") +public class DriverWork { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + /** + * 司机id + */ + @TableField("driverId") + private Integer driverId; + /** + * 上班时间 + */ + @TableField("workTime") + private Date workTime; + /** + * 下班时间 + */ + @TableField("offWorkTime") + private Date offWorkTime; + /** + * 在线时长(秒) + */ + @TableField("onlineTime") + private Long onlineTime; + /** + * 状态(1=上班,2=下班) + */ + @TableField("status") + private Integer status; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Evaluate.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Evaluate.java new file mode 100644 index 0000000..81d6a97 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Evaluate.java @@ -0,0 +1,54 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/11 16:51 + */ +@Data +@TableName("t_evaluate") +public class Evaluate { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 订单id + */ + @TableField("orderId") + private Integer orderId; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 评分 + */ + @TableField("score") + private Integer score; + /** + * 评价内容 + */ + @TableField("evaluate") + private String evaluate; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Html.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Html.java new file mode 100644 index 0000000..8cb0b35 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Html.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * 协议 + */ +@Data +@TableName("t_html") +public class Html { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 类型(1=代驾服务协议与隐私政策保护,2=法律条款,3=个人信息处理规则,4=积分说明,5=佣金规则说明,6=行程录音说明,7=预估价格说明,8=加盟基本要求,9=加盟流程,10=起步价说明,11=注销协议,12=关于我们,13=司机消单说明) + */ + @TableField("type") + private Integer type; + /** + * H5内容 + */ + @TableField("html") + private String html; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/LoginLog.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/LoginLog.java new file mode 100644 index 0000000..0d870d6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/LoginLog.java @@ -0,0 +1,128 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p> + * 登录记录 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_login_log") +public class LoginLog extends Model<LoginLog> { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value="id", type= IdType.AUTO) + private Integer id; + /** + * 日志名称 + */ + private String logname; + /** + * 管理员id + */ + private Integer userid; + /** + * 创建时间 + */ + private Date createtime; + /** + * 是否执行成功 + */ + private String succeed; + /** + * 具体消息 + */ + private String message; + /** + * 登录ip + */ + private String ip; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLogname() { + return logname; + } + + public void setLogname(String logname) { + this.logname = logname; + } + + public Integer getUserid() { + return userid; + } + + public void setUserid(Integer userid) { + this.userid = userid; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public String getSucceed() { + return succeed; + } + + public void setSucceed(String succeed) { + this.succeed = succeed; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "LoginLog{" + + "id=" + id + + ", logname=" + logname + + ", userid=" + userid + + ", createtime=" + createtime + + ", succeed=" + succeed + + ", message=" + message + + ", ip=" + ip + + "}"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/MainContent.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/MainContent.java new file mode 100644 index 0000000..302abaf --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/MainContent.java @@ -0,0 +1,45 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** +* 事由管理 +* @author pzb +* @Date 2023/2/27 11:34 +*/ +@Data +@TableName("t_main_content") +public class MainContent { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 数据类型(1=转单,2=司机消单,3=用户取消订单) + */ + @TableField("type") + private Integer type; + /** + * 内容 + */ + @TableField("content") + private String content; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Menu.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Menu.java new file mode 100644 index 0000000..87fd169 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Menu.java @@ -0,0 +1,208 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import org.hibernate.validator.constraints.NotBlank; + +import java.io.Serializable; + +/** + * <p> + * 菜单表 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_menu") +public class Menu extends Model<Menu> { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + /** + * 菜单编号 + */ + private String code; + /** + * 菜单父编号 + */ + private String pcode; + /** + * 当前菜单的所有父菜单编号 + */ + private String pcodes; + /** + * 菜单名称 + */ + @NotBlank + private String name; + /** + * 菜单图标 + */ + private String icon; + /** + * url地址 + */ + @NotBlank + private String url; + /** + * 菜单排序号 + */ + private Integer num; + /** + * 菜单层级 + */ + private Integer levels; + /** + * 是否是菜单(1:是 0:不是) + */ + private Integer ismenu; + /** + * 备注 + */ + private String tips; + /** + * 菜单状态 : 1:启用 0:不启用 + */ + private Integer status; + /** + * 是否打开: 1:打开 0:不打开 + */ + private Integer isopen; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getPcode() { + return pcode; + } + + public void setPcode(String pcode) { + this.pcode = pcode; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Integer getLevels() { + return levels; + } + + public void setLevels(Integer levels) { + this.levels = levels; + } + + public Integer getIsmenu() { + return ismenu; + } + + public void setIsmenu(Integer ismenu) { + this.ismenu = ismenu; + } + + public String getTips() { + return tips; + } + + public void setTips(String tips) { + this.tips = tips; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Integer getIsopen() { + return isopen; + } + + public void setIsopen(Integer isopen) { + this.isopen = isopen; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "Menu{" + + "id=" + id + + ", code=" + code + + ", pcode=" + pcode + + ", pcodes=" + pcodes + + ", name=" + name + + ", icon=" + icon + + ", url=" + url + + ", num=" + num + + ", levels=" + levels + + ", ismenu=" + ismenu + + ", tips=" + tips + + ", status=" + status + + ", isopen=" + isopen + + "}"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Notice.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Notice.java new file mode 100644 index 0000000..38266f6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Notice.java @@ -0,0 +1,115 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p> + * 通知表 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_notice") +public class Notice extends Model<Notice> { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value="id", type= IdType.AUTO) + private Integer id; + /** + * 标题 + */ + private String title; + /** + * 类型 + */ + private Integer type; + /** + * 内容 + */ + private String content; + /** + * 创建时间 + */ + private Date createtime; + /** + * 创建人 + */ + private Integer creater; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Integer getCreater() { + return creater; + } + + public void setCreater(Integer creater) { + this.creater = creater; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "Notice{" + + "id=" + id + + ", title=" + title + + ", type=" + type + + ", content=" + content + + ", createtime=" + createtime + + ", creater=" + creater + + "}"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/OperationLog.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/OperationLog.java new file mode 100644 index 0000000..8ba8b5a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/OperationLog.java @@ -0,0 +1,154 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p> + * 操作日志 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_operation_log") +public class OperationLog extends Model<OperationLog> { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value="id", type= IdType.AUTO) + private Integer id; + /** + * 日志类型 + */ + private String logtype; + /** + * 日志名称 + */ + private String logname; + /** + * 用户id + */ + private Integer userid; + /** + * 类名称 + */ + private String classname; + /** + * 方法名称 + */ + private String method; + /** + * 创建时间 + */ + private Date createtime; + /** + * 是否成功 + */ + private String succeed; + /** + * 备注 + */ + private String message; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLogtype() { + return logtype; + } + + public void setLogtype(String logtype) { + this.logtype = logtype; + } + + public String getLogname() { + return logname; + } + + public void setLogname(String logname) { + this.logname = logname; + } + + public Integer getUserid() { + return userid; + } + + public void setUserid(Integer userid) { + this.userid = userid; + } + + public String getClassname() { + return classname; + } + + public void setClassname(String classname) { + this.classname = classname; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public String getSucceed() { + return succeed; + } + + public void setSucceed(String succeed) { + this.succeed = succeed; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "OperationLog{" + + "id=" + id + + ", logtype=" + logtype + + ", logname=" + logname + + ", userid=" + userid + + ", classname=" + classname + + ", method=" + method + + ", createtime=" + createtime + + ", succeed=" + succeed + + ", message=" + message + + "}"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Order.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Order.java new file mode 100644 index 0000000..728da6c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Order.java @@ -0,0 +1,310 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** +* 订单 +* @author pzb +* @Date 2023/2/15 16:59 +*/ +@Data +@TableName("t_order") +public class Order { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Long id; + /** + * 订单编号 + */ + @TableField("code") + private String code; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 乘车人电话 + */ + @TableField("userPhone") + private String userPhone; + /** + * 乘车人姓名 + */ + @TableField("userName") + private String userName; + /** + * 司机id + */ + @TableField("driverId") + private Integer driverId; + /** + * 订单来源(1=小程序,2=APP) + */ + @TableField("source") + private Integer source; + /** + * 代理商id + */ + @TableField("agentId") + private Integer agentId; + /** + * 分公司id + */ + @TableField("branchOfficeId") + private Integer branchOfficeId; + /** + * 接单时间 + */ + @TableField("orderTakingTime") + private Date orderTakingTime; + /** + * 前往预约点时间 + */ + @TableField("goToAppointmentPointTime") + private Date goToAppointmentPointTime; + /** + * 到达预约点时间 + */ + @TableField("arrivalTimeAtTheAppointmentPoint") + private Date arrivalTimeAtTheAppointmentPoint; + /** + * 开始服务时间 + */ + @TableField("startTime") + private Date startTime; + /** + * 起点地址 + */ + @TableField("startAddress") + private String startAddress; + /** + * 起点纬度 + */ + @TableField("startLat") + private String startLat; + /** + * 起点经度 + */ + @TableField("startLng") + private String startLng; + /** + * 终点地址 + */ + @TableField("endAddress") + private String endAddress; + /** + * 终点纬度 + */ + @TableField("endLat") + private String endLat; + /** + * 终点经度 + */ + @TableField("endLng") + private String endLng; + /** + * 上车时间 + */ + @TableField("boardingTime") + private Date boardingTime; + /** + * 下车时间 + */ + @TableField("getoffTime") + private Date getoffTime; + /** + * 起步里程 + */ + @TableField("startDistance") + private Double startDistance; + /** + * 起步价 + */ + @TableField("startPrice") + private Double startPrice; + /** + * 超出起步里程 + */ + @TableField("overDriveDistance") + private Double overDriveDistance; + /** + * 超出起步里程费 + */ + @TableField("overDrivePrice") + private Double overDrivePrice; + /** + * 长途里程 + */ + @TableField("longDistance") + private String longDistance; + /** + * 长途里程费 + */ + @TableField("longDistancePrice") + private Double longDistancePrice; + /** + * 超出长途里程 + */ + @TableField("overLongDistance") + private Double overLongDistance; + /** + * 超出长途里程费 + */ + @TableField("overLongDistancePrice") + private Double overLongDistancePrice; + /** + * 等待时长(分钟) + */ + @TableField("waitTime") + private Integer waitTime; + /** + * 等待费 + */ + @TableField("waitTimePrice") + private Double waitTimePrice; + /** + * 超出等待时长(分钟) + */ + @TableField("outWaitTime") + private Integer outWaitTime; + /** + * 超出等待时长费 + */ + @TableField("outWaitTimePrice") + private Double outWaitTimePrice; + /** + * 恶劣天气里程 + */ + @TableField("badWeatherDistance") + private Double badWeatherDistance; + /** + * 恶劣天气里程费 + */ + @TableField("badWeatherPrice") + private Double badWeatherPrice; + /** + * 恶劣天气超出里程 + */ + @TableField("overBadWeatherDistance") + private Double overBadWeatherDistance; + /** + * 恶劣天气超出里程费 + */ + @TableField("overBadWeatherPrice") + private Double overBadWeatherPrice; + /** + * 天气 + */ + @TableField("weather") + private String weather; + /** + * 预估价 + */ + @TableField("estimatedPrice") + private Double estimatedPrice; + /** + * 预估里程 + */ + @TableField("estimatedMileage") + private Double estimatedMileage; + /** + * 预估时间 + */ + @TableField("estimatedTime") + private Integer estimatedTime; + /** + * 订单金额 + */ + @TableField("orderMoney") + private Double orderMoney; + /** + * 实际里程 + */ + @TableField("actualMileage") + private Integer actualMileage; + /** + * 支付金额 + */ + @TableField("payMoney") + private Double payMoney; + /** + * 优惠金额 + */ + @TableField("discountedPrice") + private Double discountedPrice; + /** + * 优惠券id + */ + @TableField("couponId") + private Integer couponId; + /** + * 折扣优惠金额 + */ + @TableField("discountAmount") + private Double discountAmount; + /** + * 折扣0.01 + */ + @TableField("discount") + private Double discount; + /** + * 支付类型(1=微信支付,2=余额支付,3=线下支付) + */ + @TableField("payType") + private Integer payType; + /** + * 支付时间 + */ + @TableField("payTime") + private Date payTime; + /** + * 第三方支付流水号 + */ + @TableField("orderNo") + private String orderNo; + /** + * 大厅订单(0=否,1=是) + */ + @TableField("hallOrder") + private Integer hallOrder; + /** + * 订单开始进入等待状态时间 + */ + @TableField("startWaitTime") + private Date startWaitTime; + /** + * 订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中) + */ + @TableField("state") + private Integer state; + /** + * 历史订单状态(用于还原之前状态) + */ + @TableField("oldState") + private Integer oldState; + /** + * 是否已开发票(0=否,1=是) + */ + @TableField("isInvoice") + private Integer isInvoice; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/PlatformRechargeRecord.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/PlatformRechargeRecord.java new file mode 100644 index 0000000..29917ba --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/PlatformRechargeRecord.java @@ -0,0 +1,58 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/5/6 14:05 + */ +@Data +@TableName("t_platform_recharge_record") +public class PlatformRechargeRecord { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + /** + * 订单号 + */ + @TableField("orderId") + private String orderId; + /** + * 充值金额 + */ + @TableField("price") + private Double price; + /** + * 第三方支付流水号 + */ + @TableField("orderNumber") + private String orderNumber; + /** + * 余额 + */ + @TableField("balance") + private Double balance; + /** + * 支付状态(1=待支付,2=已支付,3=已取消) + */ + @TableField("state") + private Integer state; + /** + * 支付时间 + */ + @TableField("payTime") + private Date payTime; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/RechargeRecord.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/RechargeRecord.java new file mode 100644 index 0000000..2c337f3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/RechargeRecord.java @@ -0,0 +1,79 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/21 23:08 + */ +@Data +@TableName("t_recharge_record") +public class RechargeRecord { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 数据类型(1=用户,2=司机,3=代理商) + */ + @TableField("type") + private Integer type; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 流水号 + */ + @TableField("code") + private String code; + /** + * 充值金额 + */ + @TableField("amount") + private Double amount; + /** + * 未分配金额 + */ + @TableField("unallocatedAmount") + private Double unallocatedAmount; + /** + * 支付方式(1=微信,2=系统充值) + */ + @TableField("payType") + private Integer payType; + /** + * 完成支付时间 + */ + @TableField("payTime") + private Date payTime; + /** + * 支付状态(1=待支付,2=已完成) + */ + @TableField("payStatus") + private Integer payStatus; + /** + * 第三方流水号 + */ + @TableField("orderNumber") + private String orderNumber; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 代理商id + */ + @TableField("agentId") + private Integer agentId; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Region.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Region.java new file mode 100644 index 0000000..1327680 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Region.java @@ -0,0 +1,104 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * 省市区 + */ +@TableName("t_region") +public class Region { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 城市名称 + */ + @TableField("name") + private String name; + /** + * 城市行政code + */ + @TableField("code") + private String code; + /** + * 区号code + */ + @TableField("citycode") + private String citycode; + /** + * 父级id + */ + @TableField("parent_id") + private Integer parentId; + /** + * 英文 + */ + @TableField("english") + private String english; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getCitycode() { + return citycode; + } + + public void setCitycode(String citycode) { + this.citycode = citycode; + } + + public Integer getParentId() { + return parentId; + } + + public void setParentId(Integer parentId) { + this.parentId = parentId; + } + + public String getEnglish() { + return english; + } + + public void setEnglish(String english) { + this.english = english; + } + + @Override + public String toString() { + return "Region{" + + "id=" + id + + ", name='" + name + '\'' + + ", code='" + code + '\'' + + ", citycode='" + citycode + '\'' + + ", parentId=" + parentId + + ", english='" + english + '\'' + + '}'; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Relation.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Relation.java new file mode 100644 index 0000000..fc59cc9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Relation.java @@ -0,0 +1,75 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +import java.io.Serializable; + +/** + * <p> + * 角色和菜单关联表 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_relation") +public class Relation extends Model<Relation> { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + /** + * 菜单id + */ + private Long menuid; + /** + * 角色id + */ + private Integer roleid; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Long getMenuid() { + return menuid; + } + + public void setMenuid(Long menuid) { + this.menuid = menuid; + } + + public Integer getRoleid() { + return roleid; + } + + public void setRoleid(Integer roleid) { + this.roleid = roleid; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "Relation{" + + "id=" + id + + ", menuid=" + menuid + + ", roleid=" + roleid + + "}"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Revenue.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Revenue.java new file mode 100644 index 0000000..57f6d6a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Revenue.java @@ -0,0 +1,54 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/13 9:58 + */ +@Data +@TableName("t_revenue") +public class Revenue { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 收入类型(1=订单收入,2=分佣收入) + */ + @TableField("type") + private Integer type; + /** + * 用户类型(1=用户,2=司机,3=代理商) + */ + @TableField("userType") + private Integer userType; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 订单id + */ + @TableField("orderId") + private Long orderId; + /** + * 收入金额 + */ + @TableField("amount") + private Double amount; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Role.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Role.java new file mode 100644 index 0000000..3cedab4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/Role.java @@ -0,0 +1,127 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +import java.io.Serializable; + +/** + * <p> + * 角色表 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_role") +public class Role extends Model<Role> { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value="id", type= IdType.AUTO) + private Integer id; + /** + * 序号 + */ + private Integer num; + /** + * 父角色id + */ + private Integer pid; + /** + * 角色名称 + */ + private String name; + /** + * 部门名称 + */ + private Integer deptid; + /** + * 提示 + */ + private String tips; + /** + * 保留字段(暂时没用) + */ + private Integer version; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Integer getPid() { + return pid; + } + + public void setPid(Integer pid) { + this.pid = pid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getDeptid() { + return deptid; + } + + public void setDeptid(Integer deptid) { + this.deptid = deptid; + } + + public String getTips() { + return tips; + } + + public void setTips(String tips) { + this.tips = tips; + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "Role{" + + "id=" + id + + ", num=" + num + + ", pid=" + pid + + ", name=" + name + + ", deptid=" + deptid + + ", tips=" + tips + + ", version=" + version + + "}"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/SystemConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/SystemConfig.java new file mode 100644 index 0000000..588010c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/SystemConfig.java @@ -0,0 +1,33 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +/** +* 系统配置 +* @author pzb +* @Date 2023/2/15 16:22 +*/ +@Data +@TableName("t_system_config") +public class SystemConfig { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 类型(1=派单规则,2=佣金分成规则,3=抽成规则,4=积分规则,5=价格规则,6=余额规则,7=客服管理) + */ + @TableField("type") + private Integer type; + /** + * 内容 + */ + @TableField("content") + private String content; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/User.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/User.java new file mode 100644 index 0000000..b61f1c3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/User.java @@ -0,0 +1,232 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p> + * 管理员表 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +@TableName("sys_user") +public class User extends Model<User> { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value="id", type= IdType.AUTO) + private Integer id; + /** + * 头像 + */ + private String avatar; + /** + * 账号 + */ + private String account; + /** + * 密码 + */ + private String password; + /** + * md5密码盐 + */ + private String salt; + /** + * 名字 + */ + private String name; + /** + * 生日 + */ + private Date birthday; + /** + * 性别(1:男 2:女) + */ + private Integer sex; + /** + * 电子邮件 + */ + private String email; + /** + * 电话 + */ + private String phone; + /** + * 角色id + */ + private String roleid; + /** + * 部门id + */ + private Integer deptid; + /** + * 状态(1:启用 2:冻结 3:删除) + */ + private Integer status; + /** + * 创建时间 + */ + private Date createtime; + /** + * 保留字段 + */ + private Integer version; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Date getBirthday() { + return birthday; + } + + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getRoleid() { + return roleid; + } + + public void setRoleid(String roleid) { + this.roleid = roleid; + } + + public Integer getDeptid() { + return deptid; + } + + public void setDeptid(Integer deptid) { + this.deptid = deptid; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "User{" + + "id=" + id + + ", avatar=" + avatar + + ", account=" + account + + ", password=" + password + + ", salt=" + salt + + ", name=" + name + + ", birthday=" + birthday + + ", sex=" + sex + + ", email=" + email + + ", phone=" + phone + + ", roleid=" + roleid + + ", deptid=" + deptid + + ", status=" + status + + ", createtime=" + createtime + + ", version=" + version + + "}"; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/UserToCoupon.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/UserToCoupon.java new file mode 100644 index 0000000..4622652 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/UserToCoupon.java @@ -0,0 +1,65 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** +* 用户优惠券关系 +* @author pzb +* @Date 2023/3/2 11:04 +*/ +@Data +@TableName("t_user_to_coupon") +public class UserToCoupon { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 优惠券id + */ + @TableField("couponId") + private Integer couponId; + /** + * 领取总数 + */ + @TableField("couponTotal") + private Integer couponTotal; + /** + * 有效数据 + */ + @TableField("validCount") + private Integer validCount; + /** + * 过期数量 + */ + @TableField("expireCount") + private Integer expireCount; + /** + * 过期时间 + */ + @TableField("expireTime") + private Date expireTime; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 状态 1正常 2冻结 3删除 + */ + @TableField("status") + private Integer status; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/WeatherCity.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/WeatherCity.java new file mode 100644 index 0000000..fa2a1e3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/WeatherCity.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +/** +* 天气相关城市 +* @author pzb +* @Date 2023/2/25 10:56 +*/ +@Data +@TableName("t_weather_city") +public class WeatherCity { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.INPUT) + @TableField("id") + private Integer id; + /** + * 省 + */ + @TableField("province") + private String province; + /** + * 市 + */ + @TableField("city") + private String city; + /** + * 区 + */ + @TableField("district") + private String district; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/YouTuiDriver.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/YouTuiDriver.java new file mode 100644 index 0000000..452a810 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/model/YouTuiDriver.java @@ -0,0 +1,70 @@ +package com.agentdriving.user.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** +* 司机优推数据 +* @author pzb +* @Date 2023/2/22 14:01 +*/ +@Data +@TableName("t_you_tui_driver") +public class YouTuiDriver { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 司机id + */ + @TableField("driverId") + private Integer driverId; + /** + * 优推id + */ + @TableField("youTuiId") + private Integer youTuiId; + /** + * 积分 + */ + @TableField("integral") + private Integer integral; + /** + * 优推类型(1=次数,2=小时) + */ + @TableField("type") + private Integer type; + /** + * 优推剩余数量 + */ + @TableField("surplusQuantity") + private Integer surplusQuantity; + /** + * 优推结束时间 + */ + @TableField("endTime") + private Date endTime; + /** + * 状态(1=未使用,2=使用中,3=已结束) + */ + @TableField("state") + private Integer state; + /** + * 失效时间 + */ + @TableField("failureTime") + private Date failureTime; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAccountChangeDetailService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAccountChangeDetailService.java new file mode 100644 index 0000000..911e255 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAccountChangeDetailService.java @@ -0,0 +1,34 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.AccountChangeDetail; +import com.baomidou.mybatisplus.service.IService; +import com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/4 11:34 + */ +public interface IAccountChangeDetailService extends IService<AccountChangeDetail> { + + + /** + * 保存数据 + * @param accountChangeDetail + * @throws Exception + */ + void saveData(AccountChangeDetail accountChangeDetail) throws Exception; + + + /** + * 获取余额明细 + * @param uid + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<BalanceDetailsWarpper> queryBalanceDetails(Integer uid, String time, Integer pageNum, Integer pageSize) throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAgentService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAgentService.java new file mode 100644 index 0000000..c65592a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAgentService.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Agent; +import com.baomidou.mybatisplus.service.IService; + +/** + * @author zhibing.pu + * @date 2023/5/6 11:53 + */ +public interface IAgentService extends IService<Agent> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAppUserService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAppUserService.java new file mode 100644 index 0000000..81e4024 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IAppUserService.java @@ -0,0 +1,81 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.AppUser; +import com.baomidou.mybatisplus.service.IService; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.CouponsWarpper; +import com.agentdriving.user.modular.system.warpper.SignInToRegister; +import com.agentdriving.user.modular.system.warpper.SignInToRegisterWarpper; +import com.agentdriving.user.modular.system.warpper.UserInfo; + +import java.util.List; + +public interface IAppUserService extends IService<AppUser> { + + + /** + * 用户登录 + * @param jscode + * @return + * @throws Exception + */ + ResultUtil appUserLogin(String jscode) throws Exception; + + + /** + * 微信授权注册登录 + * @param signInToRegister + * @return + * @throws Exception + */ + ResultUtil<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister) throws Exception; + + + + /** + * 校验token获取用户信息 + * @return + */ + Integer getUserByRequest() throws Exception; + + + /** + * 修改个人信息 + * @param userInfo + * @return + * @throws Exception + */ + ResultUtil updateUserInfo(Integer uid, UserInfo userInfo) throws Exception; + + + /** + * 余额充值 + * @param uid + * @param amount + * @return + * @throws Exception + */ + ResultUtil rechargeBalance(Integer uid, Double amount) throws Exception; + + + /** + * 余额充值回调处理 + * @param out_trade_no + * @param transaction_id + * @return + * @throws Exception + */ + void rechargeBalanceCallback(String out_trade_no, String transaction_id) throws Exception; + + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IBillService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IBillService.java new file mode 100644 index 0000000..fef266c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IBillService.java @@ -0,0 +1,37 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Bill; +import com.baomidou.mybatisplus.service.IService; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.BillWarpper; +import com.agentdriving.user.modular.system.warpper.Invoicing; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:07 + */ +public interface IBillService extends IService<Bill> { + + + /** + * 开票操作 + * @param uid + * @param invoicing + * @return + * @throws Exception + */ + ResultUtil invoicing(Integer uid, Invoicing invoicing) throws Exception; + + + /** + * 获取开票记录 + * @param uid + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<BillWarpper> queryBillList(Integer uid, Integer pageNum, Integer pageSize) throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IBroadcastService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IBroadcastService.java new file mode 100644 index 0000000..a7d5a6b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IBroadcastService.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Broadcast; +import com.baomidou.mybatisplus.service.IService; + +public interface IBroadcastService extends IService<Broadcast> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICancelOrderService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICancelOrderService.java new file mode 100644 index 0000000..8f118ba --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICancelOrderService.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.CancelOrder; +import com.baomidou.mybatisplus.service.IService; + +public interface ICancelOrderService extends IService<CancelOrder> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICommercialService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICommercialService.java new file mode 100644 index 0000000..2b03e06 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICommercialService.java @@ -0,0 +1,23 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Commercial; +import com.baomidou.mybatisplus.service.IService; +import com.agentdriving.user.modular.system.warpper.CommercialWarpper; + +import java.util.List; + +/** + * 广告接口 + */ +public interface ICommercialService extends IService<Commercial> { + + + /** + * 获取广告列表数据 + * @param type 广告类型(1=弹窗广告) + * @param device 设备(1=小程序,2=司机端) + * @return + * @throws Exception + */ + List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICommercialUserEjectService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICommercialUserEjectService.java new file mode 100644 index 0000000..2b6af03 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICommercialUserEjectService.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.CommercialUserEject; +import com.baomidou.mybatisplus.service.IService; + +public interface ICommercialUserEjectService extends IService<CommercialUserEject> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IComplaintService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IComplaintService.java new file mode 100644 index 0000000..0ce30c2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IComplaintService.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Complaint; +import com.baomidou.mybatisplus.service.IService; + +/** + * @author zhibing.pu + * @date 2023/3/24 16:07 + */ +public interface IComplaintService extends IService<Complaint> { + + + /** + * 投诉反馈 + * @param orderId + * @param content + * @throws Exception + */ + void feedback(Integer uid, Integer orderId, String content) throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICouponService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICouponService.java new file mode 100644 index 0000000..753dd82 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ICouponService.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Coupon; +import com.baomidou.mybatisplus.service.IService; + +public interface ICouponService extends IService<Coupon> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDeptService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDeptService.java new file mode 100644 index 0000000..dff5952 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDeptService.java @@ -0,0 +1,33 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.modular.system.model.Dept; +import com.baomidou.mybatisplus.service.IService; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 部门服务 + * + * @author fengshuonan + * @date 2017-04-27 17:00 + */ +public interface IDeptService extends IService<Dept> { + + /** + * 删除部门 + */ + void deleteDept(Integer deptId); + + /** + * 获取ztree的节点列表 + */ + List<ZTreeNode> tree(); + + /** + * 获取所有部门列表 + */ + List<Map<String, Object>> list(@Param("condition") String condition); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDictService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDictService.java new file mode 100644 index 0000000..48e064d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDictService.java @@ -0,0 +1,48 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Dict; +import com.baomidou.mybatisplus.service.IService; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 字典服务 + * + * @author fengshuonan + * @date 2017-04-27 17:00 + */ +public interface IDictService extends IService<Dict> { + + /** + * 添加字典 + */ + void addDict(String dictCode,String dictName,String dictTips, String dictValues); + + /** + * 编辑字典 + */ + void editDict(Integer dictId,String dictCode, String dictName,String dictTips, String dicts); + + /** + * 删除字典 + */ + void delteDict(Integer dictId); + + /** + * 根据编码获取词典列表 + */ + List<Dict> selectByCode(@Param("code") String code); + + /** + * 根据父类编码获取词典列表 + */ + List<Dict> selectByParentCode(@Param("code") String code); + + /** + * 查询字典列表 + */ + List<Map<String, Object>> list(@Param("condition") String conditiion); + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDivisionRecordService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDivisionRecordService.java new file mode 100644 index 0000000..b4c60e5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDivisionRecordService.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.DivisionRecord; +import com.baomidou.mybatisplus.service.IService; + +/** + * @author zhibing.pu + * @date 2023/5/6 16:42 + */ +public interface IDivisionRecordService extends IService<DivisionRecord> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDriverService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDriverService.java new file mode 100644 index 0000000..77f8104 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDriverService.java @@ -0,0 +1,23 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Driver; +import com.baomidou.mybatisplus.service.IService; +import com.agentdriving.user.modular.system.warpper.NearbyDriverWarpper; + +import java.util.List; + +/** +* 司机 +* @author pzb +* @Date 2023/2/8 18:52 +*/ +public interface IDriverService extends IService<Driver> { + + + /** + * 获取5公里范围内的司机坐标 + * @return + * @throws Exception + */ + List<NearbyDriverWarpper> queryDriverPosition(String lon, String lat, Double scope) throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDriverWorkService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDriverWorkService.java new file mode 100644 index 0000000..120c7f2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IDriverWorkService.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.DriverWork; +import com.baomidou.mybatisplus.service.IService; + +public interface IDriverWorkService extends IService<DriverWork> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IEvaluateService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IEvaluateService.java new file mode 100644 index 0000000..10e71b7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IEvaluateService.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Evaluate; +import com.baomidou.mybatisplus.service.IService; + +/** + * @author zhibing.pu + * @date 2023/3/11 16:59 + */ +public interface IEvaluateService extends IService<Evaluate> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IHtmlService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IHtmlService.java new file mode 100644 index 0000000..6062587 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IHtmlService.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Html; +import com.baomidou.mybatisplus.service.IService; + +/** + * @author 39373 + * @date 2023/2/26 17:30 + */ +public interface IHtmlService extends IService<Html> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ILoginLogService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ILoginLogService.java new file mode 100644 index 0000000..2159c72 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ILoginLogService.java @@ -0,0 +1,24 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.LoginLog; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.IService; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 登录记录 服务类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +public interface ILoginLogService extends IService<LoginLog> { + + /** + * 获取登录日志列表 + */ + List<Map<String, Object>> getLoginLogs(Page<LoginLog> page, String beginTime, String endTime, String logName, String orderByField, boolean asc); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IMainContentService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IMainContentService.java new file mode 100644 index 0000000..0c7daac --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IMainContentService.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.MainContent; +import com.baomidou.mybatisplus.service.IService; + +public interface IMainContentService extends IService<MainContent> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IMenuService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IMenuService.java new file mode 100644 index 0000000..b588a8b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IMenuService.java @@ -0,0 +1,94 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.core.node.MenuNode; +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.modular.system.model.Menu; +import com.baomidou.mybatisplus.service.IService; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 菜单服务 + * + * @author fengshuonan + * @date 2017-05-05 22:19 + */ +public interface IMenuService extends IService<Menu> { + + /** + * 删除菜单 + * + * @author stylefeng + * @Date 2017/5/5 22:20 + */ + void delMenu(Long menuId); + + /** + * 删除菜单包含所有子菜单 + * + * @author stylefeng + * @Date 2017/6/13 22:02 + */ + void delMenuContainSubMenus(Long menuId); + + /** + * 根据条件查询菜单 + * + * @return + * @date 2017年2月12日 下午9:14:34 + */ + List<Map<String, Object>> selectMenus(@Param("condition") String condition, @Param("level") String level); + + /** + * 根据条件查询菜单 + * + * @return + * @date 2017年2月12日 下午9:14:34 + */ + List<Long> getMenuIdsByRoleId(@Param("roleId") Integer roleId); + + /** + * 获取菜单列表树 + * + * @return + * @date 2017年2月19日 下午1:33:51 + */ + List<ZTreeNode> menuTreeList(); + + /** + * 获取菜单列表树 + * + * @return + * @date 2017年2月19日 下午1:33:51 + */ + List<ZTreeNode> menuTreeListByMenuIds(List<Long> menuIds); + + /** + * 删除menu关联的relation + * + * @param menuId + * @return + * @date 2017年2月19日 下午4:10:59 + */ + int deleteRelationByMenu(Long menuId); + + /** + * 获取资源url通过角色id + * + * @param roleId + * @return + * @date 2017年2月19日 下午7:12:38 + */ + List<String> getResUrlsByRoleId(Integer roleId); + + /** + * 根据角色获取菜单 + * + * @param roleIds + * @return + * @date 2017年2月19日 下午10:35:40 + */ + List<MenuNode> getMenusByRoleIds(List<Integer> roleIds); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/INoticeService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/INoticeService.java new file mode 100644 index 0000000..81ac357 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/INoticeService.java @@ -0,0 +1,23 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Notice; +import com.baomidou.mybatisplus.service.IService; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 通知表 服务类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +public interface INoticeService extends IService<Notice> { + + /** + * 获取通知列表 + */ + List<Map<String, Object>> list(String condition); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IOperationLogService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IOperationLogService.java new file mode 100644 index 0000000..02a2beb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IOperationLogService.java @@ -0,0 +1,24 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.OperationLog; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.IService; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 操作日志 服务类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +public interface IOperationLogService extends IService<OperationLog> { + + /** + * 获取操作日志列表 + */ + List<Map<String, Object>> getOperationLogs(Page<OperationLog> page, String beginTime, String endTime, String logName, String s, String orderByField, boolean asc); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IOrderService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IOrderService.java new file mode 100644 index 0000000..9e4a477 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IOrderService.java @@ -0,0 +1,155 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Order; +import com.agentdriving.user.modular.system.warpper.*; +import com.baomidou.mybatisplus.service.IService; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.*; + +import java.util.List; + + +/** +* 订单 +* @author pzb +* @Date 2023/2/16 15:47 +*/ +public interface IOrderService extends IService<Order> { + + + /** + * 获取预估费用 + * @param uid + * @param estimatedCosts + * @return + * @throws Exception + */ + ResultUtil<EstimatedCostsWarpper> getEstimatedCosts(Integer uid, EstimatedCosts estimatedCosts) throws Exception; + + + /** + * 下单操作 + * @param uid + * @param travelOrder + * @return + * @throws Exception + */ + ResultUtil travelOrder(Integer uid, TravelOrder travelOrder) throws Exception; + + + /** + * 取消订单 + * @param uid + * @param orderId + * @param cause + * @return + * @throws Exception + */ + ResultUtil cancelOrder(Integer uid, Long orderId, String cause) throws Exception; + + + /** + * 获取订单详情 + * @param uid + * @param orderId + * @return + * @throws Exception + */ + OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception; + + + /** + * 修改订单终点 + * @param uid + * @param editOrderEndAddress + * @return + * @throws Exception + */ + ResultUtil editOrderEndAddress(Integer uid, EditOrderEndAddress editOrderEndAddress) throws Exception; + + + /** + * 获取订单费用明细 + * @param uid + * @param orderId + * @return + * @throws Exception + */ + OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception; + + + /** + * 重新计算费用明细 + * @param orderId + * @param couponId + * @param payType + * @param balance + * @return + * @throws Exception + */ + OrderPriceWarpper calculationOfExpenses(Integer uid, Long orderId, Integer couponId, Integer payType, Double balance) throws Exception; + + + + /** + * 获取支付页面的可用优惠券列表 + * @param uid + * @param orderId + * @return + * @throws Exception + */ + List<CouponWarpper> queryPayCouponList(Integer uid, Long orderId) throws Exception; + + + /** + * 支付订单操作 + * @param uid + * @param orderPayment + * @return + * @throws Exception + */ + ResultUtil orderPayment(Integer uid, OrderPayment orderPayment) throws Exception; + + + /** + * 订单微信支付回调 + * @param orderId + * @return + * @throws Exception + */ + ResultUtil orderPayCallback(String orderId, String transaction_id) throws Exception; + + + /** + * 订单评价 + * @param uid + * @param orderId + * @param score + * @param content + * @return + * @throws Exception + */ + ResultUtil orderAppraise(Integer uid, Long orderId, Integer score, String content) throws Exception; + + + /** + * 获取用户行程记录 + * @param uid + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<OrderListWarpper> queryMyOrder(Integer uid, Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 获取未开票订单 + * @param uid + * @return + * @throws Exception + */ + List<OrderListWarpper> queryNotInvoiceOrder(Integer uid, NotInvoiceOrder notInvoiceOrder) throws Exception; + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IPlatformRechargeRecordService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IPlatformRechargeRecordService.java new file mode 100644 index 0000000..263204b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IPlatformRechargeRecordService.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.PlatformRechargeRecord; +import com.baomidou.mybatisplus.service.IService; + +/** + * @author zhibing.pu + * @date 2023/5/6 14:10 + */ +public interface IPlatformRechargeRecordService extends IService<PlatformRechargeRecord> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRechargeRecordService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRechargeRecordService.java new file mode 100644 index 0000000..c32b6c1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRechargeRecordService.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.RechargeRecord; +import com.baomidou.mybatisplus.service.IService; + +/** + * @author zhibing.pu + * @date 2023/3/23 14:56 + */ +public interface IRechargeRecordService extends IService<RechargeRecord> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRelationService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRelationService.java new file mode 100644 index 0000000..44a9d07 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRelationService.java @@ -0,0 +1,16 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Relation; +import com.baomidou.mybatisplus.service.IService; + +/** + * <p> + * 角色和菜单关联表 服务类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +public interface IRelationService extends IService<Relation> { + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRevenueService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRevenueService.java new file mode 100644 index 0000000..909881a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRevenueService.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Revenue; +import com.baomidou.mybatisplus.service.IService; + +/** + * @author zhibing.pu + * @date 2023/3/13 10:09 + */ +public interface IRevenueService extends IService<Revenue> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRoleService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRoleService.java new file mode 100644 index 0000000..72040f4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IRoleService.java @@ -0,0 +1,68 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.modular.system.model.Role; +import com.baomidou.mybatisplus.service.IService; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 角色相关业务 + * + * @author fengshuonan + * @Date 2017年1月10日 下午9:11:57 + */ +public interface IRoleService extends IService<Role> { + + /** + * 设置某个角色的权限 + * + * @param roleId 角色id + * @param ids 权限的id + * @date 2017年2月13日 下午8:26:53 + */ + void setAuthority(Integer roleId, String ids); + + /** + * 删除角色 + * + * @author stylefeng + * @Date 2017/5/5 22:24 + */ + void delRoleById(Integer roleId); + + /** + * 根据条件查询角色列表 + * + * @return + * @date 2017年2月12日 下午9:14:34 + */ + List<Map<String, Object>> selectRoles(@Param("condition") String condition); + + /** + * 删除某个角色的所有权限 + * + * @param roleId 角色id + * @return + * @date 2017年2月13日 下午7:57:51 + */ + int deleteRolesById(@Param("roleId") Integer roleId); + + /** + * 获取角色列表树 + * + * @return + * @date 2017年2月18日 上午10:32:04 + */ + List<ZTreeNode> roleTreeList(); + + /** + * 获取角色列表树 + * + * @return + * @date 2017年2月18日 上午10:32:04 + */ + List<ZTreeNode> roleTreeListByRoleId(String[] roleId); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ISystemConfigService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ISystemConfigService.java new file mode 100644 index 0000000..cede830 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/ISystemConfigService.java @@ -0,0 +1,21 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.SystemConfig; +import com.baomidou.mybatisplus.service.IService; +import com.agentdriving.user.modular.system.warpper.PriceRulesWarpper; + +/** +* 系统配置 +* @author pzb +* @Date 2023/2/15 16:26 +*/ +public interface ISystemConfigService extends IService<SystemConfig> { + + + /** + * 获取价格表 + * @return + * @throws Exception + */ + PriceRulesWarpper queryPriceRules() throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IUserService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IUserService.java new file mode 100644 index 0000000..1e3e10d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IUserService.java @@ -0,0 +1,46 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.core.datascope.DataScope; +import com.agentdriving.user.modular.system.model.User; +import com.baomidou.mybatisplus.service.IService; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 管理员表 服务类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +public interface IUserService extends IService<User> { + + /** + * 修改用户状态 + */ + int setStatus(@Param("userId") Integer userId, @Param("status") int status); + + /** + * 修改密码 + */ + int changePwd(@Param("userId") Integer userId, @Param("pwd") String pwd); + + /** + * 根据条件查询用户列表 + */ + List<Map<String, Object>> selectUsers(@Param("dataScope") DataScope dataScope, @Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("deptid") Integer deptid); + + /** + * 设置用户的角色 + */ + int setRoles(@Param("userId") Integer userId, @Param("roleIds") String roleIds); + + /** + * 通过账号获取用户 + */ + User getByAccount(@Param("account") String account); + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IUserToCouponService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IUserToCouponService.java new file mode 100644 index 0000000..112d331 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IUserToCouponService.java @@ -0,0 +1,61 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.Coupon; +import com.agentdriving.user.modular.system.model.UserToCoupon; +import com.baomidou.mybatisplus.service.IService; +import com.agentdriving.user.modular.system.warpper.CouponWarpper; +import com.agentdriving.user.modular.system.warpper.CouponsWarpper; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/2 14:21 + */ +public interface IUserToCouponService extends IService<UserToCoupon> { + + + /** + * 获取可用优惠券 + * @param uid + * @param price + * @return + * @throws Exception + */ + Coupon queryCoupon(Integer uid, Double price) throws Exception; + + + /** + * 获取订单支付页面的可用优惠券列表 + * @param uid + * @return + * @throws Exception + */ + List<CouponWarpper> queryPayCouponList(Integer uid, Double price) throws Exception; + + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 获取已使用优惠券数量 + * @param uid + * @return + */ + Integer queryUsedCouponNum(Integer uid); + + + /** + * 删除优惠券数据 + */ + void delUserCoupon(); +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IWeatherCityService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IWeatherCityService.java new file mode 100644 index 0000000..c3d8df9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IWeatherCityService.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.WeatherCity; +import com.baomidou.mybatisplus.service.IService; + +public interface IWeatherCityService extends IService<WeatherCity> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IYouTuiDriverService.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IYouTuiDriverService.java new file mode 100644 index 0000000..f25f2fd --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/IYouTuiDriverService.java @@ -0,0 +1,7 @@ +package com.agentdriving.user.modular.system.service; + +import com.agentdriving.user.modular.system.model.YouTuiDriver; +import com.baomidou.mybatisplus.service.IService; + +public interface IYouTuiDriverService extends IService<YouTuiDriver> { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java new file mode 100644 index 0000000..ff8ba0c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java @@ -0,0 +1,48 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.AccountChangeDetailMapper; +import com.agentdriving.user.modular.system.model.AccountChangeDetail; +import com.agentdriving.user.modular.system.service.IAccountChangeDetailService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 账户变动 + * @author zhibing.pu + * @date 2023/3/4 11:34 + */ +@Service +public class AccountChangeDetailServiceImpl extends ServiceImpl<AccountChangeDetailMapper, AccountChangeDetail> implements IAccountChangeDetailService { + + + /** + * 保存数据 + * @param accountChangeDetail + * @throws Exception + */ + @Override + public void saveData(AccountChangeDetail accountChangeDetail) throws Exception { + accountChangeDetail.setCreateTime(new Date()); + this.baseMapper.insert(accountChangeDetail); + } + + + /** + * 获取余额明细 + * @param uid + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<BalanceDetailsWarpper> queryBalanceDetails(Integer uid, String time, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryBalanceDetails(uid, time, pageNum, pageSize); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AgentServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AgentServiceImpl.java new file mode 100644 index 0000000..bcdfac6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AgentServiceImpl.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.AgentMapper; +import com.agentdriving.user.modular.system.model.Agent; +import com.agentdriving.user.modular.system.service.IAgentService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author zhibing.pu + * @date 2023/5/6 11:53 + */ +@Service +public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements IAgentService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AppUserServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AppUserServiceImpl.java new file mode 100644 index 0000000..7775655 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AppUserServiceImpl.java @@ -0,0 +1,408 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.core.common.constant.JwtConstants; +import com.agentdriving.user.core.shiro.ShiroKit; +import com.agentdriving.user.core.shiro.ShiroUser; +import com.agentdriving.user.core.util.JwtTokenUtil; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.dao.AppUserMapper; +import com.agentdriving.user.modular.system.model.*; +import com.agentdriving.user.modular.system.service.*; +import com.agentdriving.user.modular.system.warpper.*; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.modular.system.model.*; +import com.agentdriving.user.modular.system.service.*; +import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceResponse; +import com.agentdriving.user.modular.system.util.MallBook.model.PaymentOrder; +import com.agentdriving.user.modular.system.util.MallBook.model.PaymentOrderGood; +import com.agentdriving.user.modular.system.util.MallBook.util.TrhRequest; +import com.agentdriving.user.modular.system.util.PayMoneyUtil; +import com.agentdriving.user.modular.system.util.RedisUtil; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.util.UUIDUtil; +import com.agentdriving.user.modular.system.util.weChat.WXCore; +import com.agentdriving.user.modular.system.util.weChat.WeChatUtil; +import com.agentdriving.user.modular.system.util.weChat.model.Code2Session; +import com.agentdriving.user.modular.system.warpper.*; +import org.apache.shiro.authc.SimpleAuthenticationInfo; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.authc.credential.HashedCredentialsMatcher; +import org.apache.shiro.crypto.hash.Md5Hash; +import org.apache.shiro.util.ByteSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.net.InetAddress; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +/** + * 用户 + */ +@Service +public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements IAppUserService { + + @Autowired + private WeChatUtil weChatUtil; + + @Autowired + private RedisUtil redisUtil; + + private final String salt = "s5d1"; + + @Autowired + private ICouponService couponService; + + @Autowired + private IUserToCouponService userToCouponService; + + @Autowired + private IRechargeRecordService rechargeRecordService; + + @Autowired + private PayMoneyUtil payMoneyUtil; + + @Autowired + private IAccountChangeDetailService accountChangeDetailService; + + @Value("${callbackPath}") + private String callbackPath;//支付回调网关地址 + + @Value("${wx.appletsAppid}") + private String appletsAppid; + + + + @Override + public ResultUtil<String> appUserLogin(String jscode) throws Exception { + Code2Session code2Session = weChatUtil.code2Session(jscode); + if(null != code2Session.getErrcode() && code2Session.getErrcode() != 0){ + return ResultUtil.error(code2Session.getErrmsg()); + } + String openid = code2Session.getOpenid(); + AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("openid", openid).eq("status", 1)); + if(null == appUser){ + return ResultUtil.error("无效的账号"); + } + String token = getToken(appUser); + if(ToolUtil.isEmpty(token)){ + return ResultUtil.error("获取身份凭证失败"); + } + return ResultUtil.success(token); + } + + + /** + * 获取身份凭证 + * @return + */ + public String getToken(AppUser appUser){ + //封装请求账号密码为shiro可验证的token + String phone = appUser.getPhone(); + UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(phone, phone.toCharArray()); + + String credentials = ShiroKit.md5(phone, salt); + ByteSource credentialsSalt = new Md5Hash(salt); + SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( + new ShiroUser(), credentials, credentialsSalt, ""); + + //校验用户账号密码 + HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); + md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); + md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); + boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( + usernamePasswordToken, simpleAuthenticationInfo); + + if (passwordTrueFlag) { + String token = JwtTokenUtil.generateToken(phone); + String key = token; + if(token.length() > 16){ + key = token.substring(token.length() - 16); + } + redisUtil.setStrValue(key, appUser.getId().toString(), 7 * 24 * 60 * 60); + redisUtil.setStrValue("USER_" + appUser.getPhone(), key, 7 * 24 * 60 * 60); + return token; + } + return null; + } + + + /** + * 微信授权注册登录 + * @param signInToRegister + * @return + * @throws Exception + */ + @Override + public ResultUtil<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister) throws Exception { + SignInToRegisterWarpper warpper = new SignInToRegisterWarpper(); + if(ToolUtil.isEmpty(signInToRegister.getJscode())){ + return ResultUtil.paranErr("jscode"); + } + if(ToolUtil.isEmpty(signInToRegister.getEncryptedDataPhone())){ + return ResultUtil.paranErr("encryptedDataPhone"); + } + if(ToolUtil.isEmpty(signInToRegister.getIvPhone())){ + return ResultUtil.paranErr("ivPhone"); + } + Code2Session code2Session = weChatUtil.code2Session(signInToRegister.getJscode()); + if(null != code2Session.getErrcode() && code2Session.getErrcode() != 0){ + return ResultUtil.error(code2Session.getErrmsg()); + } + String openid = code2Session.getOpenid(); + String session_key = code2Session.getSession_key(); + String decrypt = WXCore.decrypt(signInToRegister.getEncryptedDataPhone(), session_key, signInToRegister.getIvPhone()); + if(ToolUtil.isEmpty(decrypt)){ + return ResultUtil.error("获取手机号失败"); + } + JSONObject phone = JSON.parseObject(decrypt); + String purePhoneNumber = phone.getString("purePhoneNumber"); + AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("phone", purePhoneNumber).ne("status", 3)); + if(null == appUser){ + appUser = new AppUser(); + appUser.setNickname("亲爱的用户"); + appUser.setAvatar("https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/66cc269703a84e4da87fb21e2c21ab1f.png"); + appUser.setPhone(purePhoneNumber); + appUser.setOpenid(openid); + appUser.setUnionid(code2Session.getUnionid()); + appUser.setAccountBalance(0D); + appUser.setStatus(1); + appUser.setCreateTime(new Date()); + appUser.setIsException(1); + appUser.setInviterId(signInToRegister.getInviterId()); + appUser.setInviterType(signInToRegister.getInviterType()); + this.insert(appUser); + //发送优惠券 + boolean lock = redisUtil.lock(); + if(lock){ + List<CouponWarpper> list = pushCoupon(appUser.getId()); + redisUtil.unlock(); + warpper.setCoupons(list); + } + } + if(appUser.getStatus() == 2){ + return ResultUtil.error("账号被冻结"); + } + String token = getToken(appUser); + if(ToolUtil.isEmpty(token)){ + return ResultUtil.error("获取身份凭证失败"); + } + warpper.setToken(token); + return ResultUtil.success(warpper); + } + + + /** + * 发送优惠券 + * @param userId + */ + public List<CouponWarpper> pushCoupon(Integer userId){ + List<Coupon> coupons = couponService.selectList(new EntityWrapper<Coupon>().eq("coupon_type", 2) + .eq("coupon_state", 1).eq("status", 1).gt("remaining_quantity", 0)); + List<CouponWarpper> list = new ArrayList<>(); + for (Coupon coupon : coupons) { + UserToCoupon userToCoupon = new UserToCoupon(); + userToCoupon.setCouponId(coupon.getId()); + userToCoupon.setCreateTime(new Date()); + userToCoupon.setUserId(userId); + userToCoupon.setStatus(1); + userToCoupon.setCouponTotal(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? + coupon.getRemainingQuantity() : coupon.getCouponSendQuantity()); + userToCoupon.setValidCount(userToCoupon.getCouponTotal()); + userToCoupon.setExpireTime(new Date(System.currentTimeMillis() + (coupon.getCouponValidity() * 24 * 60 * 60 * 1000))); + userToCouponService.insert(userToCoupon); + + coupon.setRemainingQuantity(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? 0 : + coupon.getRemainingQuantity() - coupon.getCouponSendQuantity()); + couponService.updateById(coupon); + + CouponWarpper couponWarpper = new CouponWarpper(); + couponWarpper.setCouponConditionalAmount(coupon.getCouponConditionalAmount()); + couponWarpper.setCouponPreferentialAmount(coupon.getCouponPreferentialAmount()); + couponWarpper.setCouponName(coupon.getCouponName()); + couponWarpper.setNumber(userToCoupon.getValidCount()); + couponWarpper.setExpirationDate(userToCoupon.getExpireTime().getTime()); + list.add(couponWarpper); + } + return list; + } + + + @Override + public Integer getUserByRequest() throws Exception { + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = servletRequestAttributes.getRequest(); + String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); + if (ToolUtil.isNotEmpty(requestHeader) && requestHeader.startsWith("Bearer ")) { + requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1); + String key = null; + int length = requestHeader.length(); + if(length > 16){ + key = requestHeader.substring(length - 16); + }else{ + key = requestHeader; + } + String value = redisUtil.getValue(key); + return null != value ? Integer.valueOf(value) : null; + }else{ + return null; + } + } + + /** + * 修改个人信息 + * @param userInfo + * @return + * @throws Exception + */ + @Override + public ResultUtil updateUserInfo(Integer uid, UserInfo userInfo) throws Exception { + AppUser appUser = this.selectById(uid); + if(ToolUtil.isNotEmpty(userInfo.getAvatar())){ + appUser.setAvatar(userInfo.getAvatar()); + } + if(ToolUtil.isNotEmpty(userInfo.getEmergencyContact())){ + appUser.setEmergencyContact(userInfo.getEmergencyContact()); + } + if(ToolUtil.isNotEmpty(userInfo.getEmergencyPhone())){ + appUser.setEmergencyPhone(userInfo.getEmergencyPhone()); + } + if(ToolUtil.isNotEmpty(userInfo.getNickname())){ + appUser.setNickname(userInfo.getNickname()); + } + if(ToolUtil.isNotEmpty(userInfo.getPhone())){ + if(userInfo.getPhone().equals(appUser.getPhone())){ + return ResultUtil.error("新手机不能和原手机号相同"); + } + String value = redisUtil.getValue("+86" + userInfo.getPhone()); + if(ToolUtil.isEmpty(value) || !value.equals(userInfo.getCode())){ + return ResultUtil.error("验证码无效"); + } + appUser.setPhone(userInfo.getPhone()); + } + this.updateById(appUser); + return ResultUtil.success(); + } + + /** + * 余额充值 + * @param uid + * @param amount + * @return + * @throws Exception + */ + @Override + public ResultUtil rechargeBalance(Integer uid, Double amount) throws Exception { + if(0 >= amount){ + return ResultUtil.error("充值金额必须大于0"); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(3); + AppUser appUser = this.selectById(uid); + RechargeRecord rechargeRecord = new RechargeRecord(); + rechargeRecord.setType(1); + rechargeRecord.setUserId(uid); + rechargeRecord.setCode(out_trade_no); + rechargeRecord.setAmount(amount); + rechargeRecord.setCreateTime(new Date()); + rechargeRecord.setPayStatus(1); + rechargeRecord.setPayType(1); + rechargeRecordService.insert(rechargeRecord); +// ResultUtil weixinpay = payMoneyUtil.weixinpay("余额充值", "", out_trade_no, amount.toString(), "/base/appUser/rechargeBalanceCallback", "JSAPI", appUser.getOpenid()); +// return weixinpay; + + PaymentOrder paymentOrder = new PaymentOrder(); + paymentOrder.setBizOrderId(out_trade_no); + paymentOrder.setAmount(String.valueOf(amount * 100)); + paymentOrder.setOrderName("余额充值"); + paymentOrder.setPayType("WX_MINI"); + paymentOrder.setTransferType("0"); + paymentOrder.setAsynSplitFlag("1"); + paymentOrder.setAppid(appletsAppid); + paymentOrder.setOpenid(appUser.getOpenid()); + paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); + List<PaymentOrderGood> goodsDetail = new ArrayList<>(); + PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); + paymentOrderGood.setGoodsName("余额充值"); + goodsDetail.add(paymentOrderGood); + paymentOrder.setGoodsDetail(goodsDetail); + paymentOrder.setFrontUrl(""); + paymentOrder.setNotifyUrl(callbackPath + "/base/appUser/rechargeBalanceCallback"); + paymentOrder.setParameter1(out_trade_no); + + TrhRequest<PaymentOrder> request = new TrhRequest(); + InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); + if(!"0000".equals(execute.getResult())){ + return ResultUtil.error(execute.getMsg()); + } + JSONObject jsonObject = JSON.parseObject(execute.getResult()); + String status = jsonObject.getString("status"); + if("2".equals(status)){ + return ResultUtil.error("失败"); + } + if("0".equals(status)){ + return ResultUtil.error("处理中"); + } + String payCode = jsonObject.getString("payCode"); + return ResultUtil.success(payCode); + } + + + /** + * 余额充值回调 + * @param out_trade_no + * @param transaction_id + * @return + * @throws Exception + */ + @Override + public void rechargeBalanceCallback(String out_trade_no, String transaction_id) throws Exception { + RechargeRecord rechargeRecord1 = rechargeRecordService.selectOne(new EntityWrapper<RechargeRecord>().eq("code", out_trade_no)); + if(rechargeRecord1.getPayStatus() != 1){ + return; + } + AppUser appUser = this.selectById(rechargeRecord1.getUserId()); + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(1); + accountChangeDetail.setUserId(rechargeRecord1.getUserId()); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setChangeType(3); + accountChangeDetail.setType(1); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setExplain("余额充值"); + accountChangeDetail.setOldData(appUser.getAccountBalance()); + appUser.setAccountBalance(appUser.getAccountBalance() + rechargeRecord1.getAmount()); + accountChangeDetail.setNewData(appUser.getAccountBalance()); + this.updateById(appUser); + accountChangeDetailService.saveData(accountChangeDetail); + + rechargeRecord1.setPayTime(new Date()); + rechargeRecord1.setPayStatus(2); + rechargeRecord1.setOrderNumber(transaction_id); + rechargeRecordService.updateById(rechargeRecord1); + } + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception { + return null; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/BillServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/BillServiceImpl.java new file mode 100644 index 0000000..1683701 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/BillServiceImpl.java @@ -0,0 +1,81 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.dao.BillMapper; +import com.agentdriving.user.modular.system.model.Bill; +import com.agentdriving.user.modular.system.model.Order; +import com.agentdriving.user.modular.system.service.IBillService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.modular.system.service.IOrderService; +import com.agentdriving.user.modular.system.util.ResultUtil; +import com.agentdriving.user.modular.system.warpper.BillWarpper; +import com.agentdriving.user.modular.system.warpper.Invoicing; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:07 + */ +@Service +public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IBillService { + + @Autowired + private IOrderService orderService; + + + /** + * 开票操作 + * @param uid + * @param invoicing + * @return + * @throws Exception + */ + @Override + public ResultUtil invoicing(Integer uid, Invoicing invoicing) throws Exception { + if(ToolUtil.isEmpty(invoicing.getOrderIds())){ + return ResultUtil.error("请选择有效的开票订单"); + } + String[] split = invoicing.getOrderIds().split(","); + List<Order> orders = orderService.selectBatchIds(Arrays.asList(split)); + for (Order order : orders) { + if(null != order.getIsInvoice() && order.getIsInvoice() == 1){ + continue; + } + Bill bill = new Bill(); + BeanUtils.copyProperties(invoicing, bill); + bill.setUserId(order.getUserId()); + bill.setOrderId(order.getId().intValue()); + bill.setBillType(1); + bill.setBillContent("代驾服务费"); + bill.setBillAmount(order.getPayMoney()); + bill.setState(1); + bill.setCreateTime(new Date()); + this.insert(bill); + + order.setIsInvoice(1); + orderService.updateById(order); + } + return ResultUtil.success(); + } + + + /** + * 获取开票记录 + * @param uid + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<BillWarpper> queryBillList(Integer uid, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryBillList(uid, pageNum, pageSize); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/BroadcastServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/BroadcastServiceImpl.java new file mode 100644 index 0000000..3d0b83f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/BroadcastServiceImpl.java @@ -0,0 +1,16 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.BroadcastMapper; +import com.agentdriving.user.modular.system.model.Broadcast; +import com.agentdriving.user.modular.system.service.IBroadcastService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** +* 广播 +* @author pzb +* @Date 2023/2/27 17:10 +*/ +@Service +public class BroadcastServiceImpl extends ServiceImpl<BroadcastMapper, Broadcast> implements IBroadcastService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CancelOrderServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CancelOrderServiceImpl.java new file mode 100644 index 0000000..43a7428 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CancelOrderServiceImpl.java @@ -0,0 +1,16 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.CancelOrderMapper; +import com.agentdriving.user.modular.system.model.CancelOrder; +import com.agentdriving.user.modular.system.service.ICancelOrderService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** +* 取消订单记录 +* @author pzb +* @Date 2023/2/25 14:45 +*/ +@Service +public class CancelOrderServiceImpl extends ServiceImpl<CancelOrderMapper, CancelOrder> implements ICancelOrderService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CommercialServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CommercialServiceImpl.java new file mode 100644 index 0000000..58197ed --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CommercialServiceImpl.java @@ -0,0 +1,57 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.CommercialMapper; +import com.agentdriving.user.modular.system.model.Commercial; +import com.agentdriving.user.modular.system.model.CommercialUserEject; +import com.agentdriving.user.modular.system.service.ICommercialService; +import com.agentdriving.user.modular.system.service.ICommercialUserEjectService; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.modular.system.util.UUIDUtil; +import com.agentdriving.user.modular.system.warpper.CommercialWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +/** + * 广告逻辑类 + */ +@Service +public class CommercialServiceImpl extends ServiceImpl<CommercialMapper, Commercial> implements ICommercialService { + + @Autowired + private ICommercialUserEjectService commercialUserEjectService; + + + /** + * 获取广告列表 + * @param type 广告类型(1=弹窗广告) + * @param device 设备(1=小程序,2=司机端) + * @return + * @throws Exception + */ + @Override + public List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception { + if(type == 1){//弹框广告 + CommercialUserEject commercialUserEject = commercialUserEjectService.selectOne(new EntityWrapper<CommercialUserEject>().eq("userType", 2) + .eq("userId", uid).last(" and DATE_FORMAT(now(), '%Y%m%d') = DATE_FORMAT(lastDate, '%Y%m%d')")); + if(null != commercialUserEject){ + return new ArrayList<>(); + } + } + List<CommercialWarpper> commercialWarppers = this.baseMapper.queryCommercialList(type, device); + if(type == 1 && commercialWarppers.size() > 0){//记录弹窗 + CommercialUserEject commercialUserEject = new CommercialUserEject(); + commercialUserEject.setId(Long.valueOf(UUIDUtil.getNumberRandom(16))); + commercialUserEject.setLastDate(new Date()); + commercialUserEject.setUserId(uid); + commercialUserEject.setUserType(2); + commercialUserEjectService.insert(commercialUserEject); + } + return commercialWarppers; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CommercialUserEjectServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CommercialUserEjectServiceImpl.java new file mode 100644 index 0000000..4da5e44 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CommercialUserEjectServiceImpl.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.CommercialUserEjectMapper; +import com.agentdriving.user.modular.system.model.CommercialUserEject; +import com.agentdriving.user.modular.system.service.ICommercialUserEjectService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class CommercialUserEjectServiceImpl extends ServiceImpl<CommercialUserEjectMapper, CommercialUserEject> implements ICommercialUserEjectService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/ComplaintServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/ComplaintServiceImpl.java new file mode 100644 index 0000000..06abdd4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/ComplaintServiceImpl.java @@ -0,0 +1,48 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.ComplaintMapper; +import com.agentdriving.user.modular.system.model.Complaint; +import com.agentdriving.user.modular.system.model.Order; +import com.agentdriving.user.modular.system.service.IComplaintService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.modular.system.service.IOrderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/24 16:07 + */ +@Service +public class ComplaintServiceImpl extends ServiceImpl<ComplaintMapper, Complaint> implements IComplaintService { + + @Autowired + private IOrderService orderService; + + + + + /** + * 投诉反馈 + * @param orderId + * @param content + * @throws Exception + */ + @Override + public void feedback(Integer uid, Integer orderId, String content) throws Exception { + Complaint complaint = new Complaint(); + complaint.setUserId(uid); + if(null != orderId){ + Order order = orderService.selectById(orderId); + complaint.setOrderId(orderId); + complaint.setDriverId(order.getDriverId()); + } + complaint.setReason(content); + complaint.setState(1); + complaint.setStatus(1); + complaint.setCreateTime(new Date()); + this.insert(complaint); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CouponServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CouponServiceImpl.java new file mode 100644 index 0000000..5422063 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/CouponServiceImpl.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.CouponMapper; +import com.agentdriving.user.modular.system.model.Coupon; +import com.agentdriving.user.modular.system.service.ICouponService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements ICouponService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DeptServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DeptServiceImpl.java new file mode 100644 index 0000000..5670821 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DeptServiceImpl.java @@ -0,0 +1,47 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.modular.system.dao.DeptMapper; +import com.agentdriving.user.modular.system.model.Dept; +import com.agentdriving.user.modular.system.service.IDeptService; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@Service +@Transactional +public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements IDeptService { + + @Resource + private DeptMapper deptMapper; + + @Override + public void deleteDept(Integer deptId) { + Dept dept = deptMapper.selectById(deptId); + + Wrapper<Dept> wrapper = new EntityWrapper<>(); + wrapper = wrapper.like("pids", "%[" + dept.getId() + "]%"); + List<Dept> subDepts = deptMapper.selectList(wrapper); + for (Dept temp : subDepts) { + temp.deleteById(); + } + + dept.deleteById(); + } + + @Override + public List<ZTreeNode> tree() { + return this.baseMapper.tree(); + } + + @Override + public List<Map<String, Object>> list(String condition) { + return this.baseMapper.list(condition); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DictServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DictServiceImpl.java new file mode 100644 index 0000000..6aa9d8f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DictServiceImpl.java @@ -0,0 +1,100 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.core.common.constant.factory.MutiStrFactory; +import com.agentdriving.user.core.common.exception.BizExceptionEnum; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.modular.system.dao.DictMapper; +import com.agentdriving.user.modular.system.model.Dict; +import com.agentdriving.user.modular.system.service.IDictService; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@Service +@Transactional +public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements IDictService { + + @Resource + private DictMapper dictMapper; + + @Override + public void addDict(String dictCode,String dictName,String dictTips, String dictValues) { + //判断有没有该字典 + List<Dict> dicts = dictMapper.selectList(new EntityWrapper<Dict>().eq("code", dictCode).and().eq("pid", 0)); + if (dicts != null && dicts.size() > 0) { + throw new GunsException(BizExceptionEnum.DICT_EXISTED); + } + + //解析dictValues + List<Map<String, String>> items = MutiStrFactory.parseKeyValue(dictValues); + + //添加字典 + Dict dict = new Dict(); + dict.setName(dictName); + dict.setCode(dictCode); + dict.setTips(dictTips); + dict.setNum(0); + dict.setPid(0); + this.dictMapper.insert(dict); + + //添加字典条目 + for (Map<String, String> item : items) { + String code = item.get(MutiStrFactory.MUTI_STR_CODE); + String name = item.get(MutiStrFactory.MUTI_STR_NAME); + String num = item.get(MutiStrFactory.MUTI_STR_NUM); + Dict itemDict = new Dict(); + itemDict.setPid(dict.getId()); + itemDict.setCode(code); + itemDict.setName(name); + + try { + itemDict.setNum(Integer.valueOf(num)); + } catch (NumberFormatException e) { + throw new GunsException(BizExceptionEnum.DICT_MUST_BE_NUMBER); + } + this.dictMapper.insert(itemDict); + } + } + + @Override + public void editDict(Integer dictId,String dictCode, String dictName,String dictTips, String dicts) { + //删除之前的字典 + this.delteDict(dictId); + + //重新添加新的字典 + this.addDict(dictCode,dictName,dictTips, dicts); + } + + @Override + public void delteDict(Integer dictId) { + //删除这个字典的子词典 + Wrapper<Dict> dictEntityWrapper = new EntityWrapper<>(); + dictEntityWrapper = dictEntityWrapper.eq("pid", dictId); + dictMapper.delete(dictEntityWrapper); + + //删除这个词典 + dictMapper.deleteById(dictId); + } + + @Override + public List<Dict> selectByCode(String code) { + return this.baseMapper.selectByCode(code); + } + + @Override + public List<Dict> selectByParentCode(String code) { + return this.baseMapper.selectByParentCode(code); + } + + + @Override + public List<Map<String, Object>> list(String conditiion) { + return this.baseMapper.list(conditiion); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DivisionRecordServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DivisionRecordServiceImpl.java new file mode 100644 index 0000000..4d130f9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DivisionRecordServiceImpl.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.DivisionRecordMapper; +import com.agentdriving.user.modular.system.model.DivisionRecord; +import com.agentdriving.user.modular.system.service.IDivisionRecordService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author zhibing.pu + * @date 2023/5/6 16:42 + */ +@Service +public class DivisionRecordServiceImpl extends ServiceImpl<DivisionRecordMapper, DivisionRecord> implements IDivisionRecordService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DriverServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DriverServiceImpl.java new file mode 100644 index 0000000..8c502a9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DriverServiceImpl.java @@ -0,0 +1,90 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.dao.DriverMapper; +import com.agentdriving.user.modular.system.model.Driver; +import com.agentdriving.user.modular.system.model.DriverWork; +import com.agentdriving.user.modular.system.service.IDriverService; +import com.agentdriving.user.modular.system.service.IDriverWorkService; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.modular.system.util.GeodesyUtil; +import com.agentdriving.user.modular.system.util.RedisUtil; +import com.agentdriving.user.modular.system.util.mongodb.model.Location; +import com.agentdriving.user.modular.system.warpper.NearbyDriverWarpper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.geo.Circle; +import org.springframework.data.geo.Distance; +import org.springframework.data.geo.Metrics; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.geo.GeoJsonPoint; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** +* 司机 +* @author pzb +* @Date 2023/2/8 18:52 +*/ +@Service +public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> implements IDriverService { + + @Autowired + private MongoTemplate mongoTemplate; + + @Autowired + private IDriverWorkService driverWorkService; + + @Autowired + private RedisUtil redisUtil; + + + /** + * 获取5公里范围内的司机 + * @param lon + * @param lat + * @return + * @throws Exception + */ + @Override + public List<NearbyDriverWarpper> queryDriverPosition(String lon, String lat, Double scope) throws Exception { + List<NearbyDriverWarpper> list = new ArrayList<>(); + //找到中心点 + GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(lon), Double.valueOf(lat)); + //构造半径 + Distance distanceR = new Distance(scope, Metrics.KILOMETERS); + //画圆 + Circle circle = new Circle(geoJsonPoint, distanceR); + // 构造query对象 + Query query = Query.query(Criteria.where("location").withinSphere(circle)); + List<Location> locations = mongoTemplate.find(query, Location.class); +// System.err.println("附近空闲司机" + JSON.toJSONString(locations)); + List<Integer> collect = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); + List<DriverWork> driverWorks = driverWorkService.selectList(new EntityWrapper<DriverWork>().in("driverId", collect).eq("status", 1)); + for (DriverWork driverWork : driverWorks) { + String value = redisUtil.getValue("DRIVER" + driverWork.getDriverId()); + if(ToolUtil.isNotEmpty(value)){ + NearbyDriverWarpper nearbyDriverWarpper = new NearbyDriverWarpper(); + nearbyDriverWarpper.setLonLat(value); + Map<String, Double> distance = GeodesyUtil.getDistance(value, lon + "," + lat); + nearbyDriverWarpper.setDistance(distance.get("WGS84") / 1000); + nearbyDriverWarpper.setDriverId(driverWork.getDriverId()); + list.add(nearbyDriverWarpper); + } + } + return list; + } + + + + + + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DriverWorkServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DriverWorkServiceImpl.java new file mode 100644 index 0000000..91a5601 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/DriverWorkServiceImpl.java @@ -0,0 +1,17 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.DriverWorkMapper; +import com.agentdriving.user.modular.system.model.DriverWork; +import com.agentdriving.user.modular.system.service.IDriverWorkService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + + +/** +* 司机上下班操作记录 +* @author pzb +* @Date 2023/2/15 15:48 +*/ +@Service +public class DriverWorkServiceImpl extends ServiceImpl<DriverWorkMapper, DriverWork> implements IDriverWorkService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/EvaluateServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/EvaluateServiceImpl.java new file mode 100644 index 0000000..61f3069 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/EvaluateServiceImpl.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.EvaluateMapper; +import com.agentdriving.user.modular.system.model.Evaluate; +import com.agentdriving.user.modular.system.service.IEvaluateService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author zhibing.pu + * @date 2023/3/11 17:00 + */ +@Service +public class EvaluateServiceImpl extends ServiceImpl<EvaluateMapper, Evaluate> implements IEvaluateService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/HtmlServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/HtmlServiceImpl.java new file mode 100644 index 0000000..6efe41f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/HtmlServiceImpl.java @@ -0,0 +1,16 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.HtmlMapper; +import com.agentdriving.user.modular.system.model.Html; +import com.agentdriving.user.modular.system.service.IHtmlService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * TODO 协议 + * @author 39373 + * @date 2023/2/26 17:31 + */ +@Service +public class HtmlServiceImpl extends ServiceImpl<HtmlMapper, Html> implements IHtmlService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/LoginLogServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/LoginLogServiceImpl.java new file mode 100644 index 0000000..2a14261 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/LoginLogServiceImpl.java @@ -0,0 +1,28 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.LoginLogMapper; +import com.agentdriving.user.modular.system.model.LoginLog; +import com.agentdriving.user.modular.system.service.ILoginLogService; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 登录记录 服务实现类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +@Service +public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements ILoginLogService { + + @Override + public List<Map<String, Object>> getLoginLogs(Page<LoginLog> page, String beginTime, String endTime, String logName, String orderByField, boolean asc) { + return this.baseMapper.getLoginLogs(page, beginTime, endTime, logName, orderByField, asc); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/MainContentServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/MainContentServiceImpl.java new file mode 100644 index 0000000..cffa3f8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/MainContentServiceImpl.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.MainContentMapper; +import com.agentdriving.user.modular.system.model.MainContent; +import com.agentdriving.user.modular.system.service.IMainContentService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class MainContentServiceImpl extends ServiceImpl<MainContentMapper, MainContent> implements IMainContentService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/MenuServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..6ebeedc --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/MenuServiceImpl.java @@ -0,0 +1,90 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.core.node.MenuNode; +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.modular.system.dao.MenuMapper; +import com.agentdriving.user.modular.system.model.Menu; +import com.agentdriving.user.modular.system.service.IMenuService; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 菜单服务 + * + * @author fengshuonan + * @date 2017-05-05 22:20 + */ +@Service +public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IMenuService { + + @Resource + private MenuMapper menuMapper; + + @Override + public void delMenu(Long menuId) { + + //删除菜单 + this.menuMapper.deleteById(menuId); + + //删除关联的relation + this.menuMapper.deleteRelationByMenu(menuId); + } + + @Override + public void delMenuContainSubMenus(Long menuId) { + + Menu menu = menuMapper.selectById(menuId); + + //删除当前菜单 + delMenu(menuId); + + //删除所有子菜单 + Wrapper<Menu> wrapper = new EntityWrapper<>(); + wrapper = wrapper.like("pcodes", "%[" + menu.getCode() + "]%"); + List<Menu> menus = menuMapper.selectList(wrapper); + for (Menu temp : menus) { + delMenu(temp.getId()); + } + } + + @Override + public List<Map<String, Object>> selectMenus(String condition, String level) { + return this.baseMapper.selectMenus(condition, level); + } + + @Override + public List<Long> getMenuIdsByRoleId(Integer roleId) { + return this.baseMapper.getMenuIdsByRoleId(roleId); + } + + @Override + public List<ZTreeNode> menuTreeList() { + return this.baseMapper.menuTreeList(); + } + + @Override + public List<ZTreeNode> menuTreeListByMenuIds(List<Long> menuIds) { + return this.baseMapper.menuTreeListByMenuIds(menuIds); + } + + @Override + public int deleteRelationByMenu(Long menuId) { + return this.baseMapper.deleteRelationByMenu(menuId); + } + + @Override + public List<String> getResUrlsByRoleId(Integer roleId) { + return this.baseMapper.getResUrlsByRoleId(roleId); + } + + @Override + public List<MenuNode> getMenusByRoleIds(List<Integer> roleIds) { + return this.baseMapper.getMenusByRoleIds(roleIds); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/NoticeServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/NoticeServiceImpl.java new file mode 100644 index 0000000..0614095 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/NoticeServiceImpl.java @@ -0,0 +1,27 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.NoticeMapper; +import com.agentdriving.user.modular.system.model.Notice; +import com.agentdriving.user.modular.system.service.INoticeService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 通知表 服务实现类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +@Service +public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService { + + @Override + public List<Map<String, Object>> list(String condition) { + return this.baseMapper.list(condition); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/OperationLogServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/OperationLogServiceImpl.java new file mode 100644 index 0000000..736faee --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/OperationLogServiceImpl.java @@ -0,0 +1,28 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.OperationLogMapper; +import com.agentdriving.user.modular.system.model.OperationLog; +import com.agentdriving.user.modular.system.service.IOperationLogService; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 操作日志 服务实现类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +@Service +public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, OperationLog> implements IOperationLogService { + + @Override + public List<Map<String, Object>> getOperationLogs(Page<OperationLog> page, String beginTime, String endTime, String logName, String s, String orderByField, boolean asc) { + return this.baseMapper.getOperationLogs(page, beginTime, endTime, logName, s, orderByField, asc); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/OrderServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/OrderServiceImpl.java new file mode 100644 index 0000000..89920f4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/OrderServiceImpl.java @@ -0,0 +1,1726 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.model.*; +import com.agentdriving.user.modular.system.service.*; +import com.agentdriving.user.modular.system.util.*; +import com.agentdriving.user.modular.system.util.MallBook.model.*; +import com.agentdriving.user.modular.system.warpper.*; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.dao.OrderMapper; +import com.agentdriving.user.modular.system.model.*; +import com.agentdriving.user.modular.system.service.*; +import com.agentdriving.user.modular.system.util.*; +import com.agentdriving.user.modular.system.util.GaoDe.MapUtil; +import com.agentdriving.user.modular.system.util.GaoDe.model.District; +import com.agentdriving.user.modular.system.util.MallBook.model.*; +import com.agentdriving.user.modular.system.util.MallBook.util.Transfer; +import com.agentdriving.user.modular.system.util.MallBook.util.TrhRequest; +import com.agentdriving.user.modular.system.util.juhe.WeatherUtil; +import com.agentdriving.user.modular.system.util.mongodb.model.Location; +import com.agentdriving.user.modular.system.warpper.*; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.geo.Circle; +import org.springframework.data.geo.Distance; +import org.springframework.data.geo.Metrics; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.geo.GeoJsonPoint; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.math.RoundingMode; +import java.net.InetAddress; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + + +/** +* 订单 +* @author pzb +* @Date 2023/2/16 15:57 +*/ +@Service +public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService { + + @Autowired + private ISystemConfigService systemConfigService; + + @Autowired + private IWeatherCityService weatherCityService; + + @Autowired + private IUserToCouponService userToCouponService; + + @Autowired + private IAppUserService appUserService; + + @Autowired + private IDriverService driverService; + + @Autowired + private PushUtil pushUtil; + + @Autowired + private IYouTuiDriverService youTuiDriverService; + + @Autowired + private RedisUtil redisUtil; + + @Autowired + private MongoTemplate mongoTemplate; + + @Autowired + private IDriverWorkService driverWorkService; + + @Autowired + private ICancelOrderService cancelOrderService; + + @Autowired + private PayMoneyUtil payMoneyUtil; + + @Autowired + private ICouponService couponService; + + @Autowired + private IAccountChangeDetailService accountChangeDetailService; + + @Autowired + private IEvaluateService evaluateService; + + @Autowired + private IRevenueService revenueService; + + @Autowired + private IAgentService agentService; + + @Autowired + private IPlatformRechargeRecordService platformRechargeRecordService; + + @Autowired + private IDivisionRecordService divisionRecordService; + + @Value("${callbackPath}") + private String callbackPath;//支付回调网关地址 + + + + + + /** + * 获取预估费用 + * @param uid + * @param estimatedCosts + * @return + * @throws Exception + */ + @Override + public ResultUtil<EstimatedCostsWarpper> getEstimatedCosts(Integer uid, EstimatedCosts estimatedCosts) throws Exception { + EstimatedCostsWarpper estimatedCostsWarpper = new EstimatedCostsWarpper(); + Double d = 0D; + if(ToolUtil.isNotEmpty(estimatedCosts.getEndAddress())){ + Map<String, String> distance = MapUtil.getDistance(estimatedCosts.getStartLng() + "," + estimatedCosts.getStartLat(), + estimatedCosts.getEndLng() + "," + estimatedCosts.getEndLat(), 1); + if(null == distance){ + return ResultUtil.error("获取预估距离出错"); + } + d = Double.valueOf(distance.get("distance")) / 1000; + estimatedCostsWarpper.setEstimatedMileage(d); + estimatedCostsWarpper.setTravelTime(Integer.valueOf(distance.get("duration")) / 60); + } + String city = ""; + District geocode = MapUtil.geocode(estimatedCosts.getStartLng().toString(), estimatedCosts.getStartLat().toString()); + if(null != geocode){ + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); + city = null != weatherCity ? weatherCity.getId().toString() : ""; + } + Order order = getOrderPrice(1, d, 0, new Order(), city); + Double estimatedPrice = order.getEstimatedPrice(); + Coupon coupon = userToCouponService.queryCoupon(uid, estimatedPrice); + if(null != coupon){ + Double couponPreferentialAmount = coupon.getCouponPreferentialAmount(); + estimatedCostsWarpper.setPrice(estimatedPrice - couponPreferentialAmount); + estimatedCostsWarpper.setDiscountAmount(couponPreferentialAmount); + }else{ + estimatedCostsWarpper.setPrice(estimatedPrice); + estimatedCostsWarpper.setDiscountAmount(0D); + } + //预估接驾时间 + int i = 0; + Double scope = 5D; + while (true){ + List<NearbyDriverWarpper> nearbyDriverWarppers = driverService.queryDriverPosition(estimatedCosts.getLng().toString(), estimatedCosts.getLat().toString(), scope); + if(nearbyDriverWarppers.size() == 0){ + scope += 5; + i++; + if(i >= 10){ + estimatedCostsWarpper.setPickUpTime(60); + break; + } + continue; + } + if(nearbyDriverWarppers.size() > 0){ + NearbyDriverWarpper nearbyDriverWarpper = nearbyDriverWarppers.get(0); + Map<String, String> distance = MapUtil.getDistance(nearbyDriverWarpper.getLonLat(), estimatedCosts.getStartLng() + "," + estimatedCosts.getStartLat(), 1); + if(null != distance){ + distance.get("distance");//距离(M) + String duration = distance.get("duration");//时间(S) + estimatedCostsWarpper.setPickUpTime(Integer.valueOf(duration) / 60); + } + break; + } + } + return ResultUtil.success(estimatedCostsWarpper); + } + + + + + /** + * 获取订单价格 + * @param type 计算类型(1=预估价,2=订单费) + * @param distance 行驶公里 + * @param waitTime 等待时长 + * @param order 订单数据 + * @param city 查询天气的城市 + * @return + */ + public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city){ + order = getOrderInitialPrice(order); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); + if(null == systemConfig){ + if(type == 1){//预估金额 + order.setEstimatedPrice(0D); + } + if(type == 2){//订单金额 + order.setOrderMoney(0D); + } + return order; + } + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); + JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); + Date date = new Date(); + for (int i = 0; i < chargeStandard.size(); i++) { + JSONObject jsonObject1 = chargeStandard.getJSONObject(i); + String num1 = jsonObject1.getString("num1"); + String num2 = jsonObject1.getString("num2"); + Double num3 = jsonObject1.getDouble("num3");//起步里程 + Double num4 = jsonObject1.getDouble("num4");//起步价格 + Double num5 = jsonObject1.getDouble("num5");//超过公里 + Double num6 = jsonObject1.getDouble("num6");//超过num3每num5公里收取num6 + Double num7 = jsonObject1.getDouble("num7");//长途起始公里 + Double num8 = jsonObject1.getDouble("num8");//长途结束公里 + Double num9 = jsonObject1.getDouble("num9");//长途费 + Double num10 = jsonObject1.getDouble("num10");//超出长途里程每num10公里 + Double num11 = jsonObject1.getDouble("num11");//超过num8每num10公里收取num11 + + String[] split = num1.split(":"); + Calendar s = Calendar.getInstance(); + s.setTime(date); + s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); + s.set(Calendar.MINUTE, Integer.valueOf(split[1])); + s.set(Calendar.SECOND, 0); + + split = num2.split(":"); + Calendar e = Calendar.getInstance(); + e.setTime(date); + e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); + e.set(Calendar.MINUTE, Integer.valueOf(split[1])); + e.set(Calendar.SECOND, 0); + + if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ + if(num3.compareTo(distance) >= 0){//起步里程内 + order.setStartDistance(distance);//起步里程 + order.setStartPrice(num4);//起步价 + }else{ + BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num3));//超出起步里程 + BigDecimal divide = subtract.divide(new BigDecimal(num5), new MathContext(2, RoundingMode.HALF_EVEN)); + BigDecimal multiply = divide.multiply(new BigDecimal(num6)); + order.setStartDistance(num3);//起步里程 + order.setStartPrice(num4);//起步价 + order.setOverDriveDistance(subtract.doubleValue());//超出起步里程 + order.setOverDrivePrice(multiply.doubleValue());//超出起步里程费 + + //计算长途费 + if(distance.compareTo(num7) > 0){ + order.setLongDistance(num7 + "-" + num8);//长途里程 + order.setLongDistancePrice(num9);//长途费 + } + //计算长途里程超出的部分 + if(distance.compareTo(num8) > 0){ + BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num8)); + BigDecimal divide1 = subtract1.divide(new BigDecimal(num10), new MathContext(2, RoundingMode.HALF_EVEN)); + BigDecimal multiply1 = divide1.multiply(new BigDecimal(num11)); + order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 + order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 + } + } + break; + } + } + + //计算额外费用 + Integer num1 = extraCost.getInteger("num1");//等待时长 + Double num2 = extraCost.getDouble("num2");//等待费 + Integer num3 = extraCost.getInteger("num3");//等待超出时长 + Double num4 = extraCost.getDouble("num4");//等到超出时长费用单价 X/分钟 + Double num5 = extraCost.getDouble("num5");//恶劣天气公里 + Double num6 = extraCost.getDouble("num6");//恶劣天气费 + Double num7 = extraCost.getDouble("num7");//恶劣天气超出公里 + Double num8 = extraCost.getDouble("num8");//恶劣天气超出公里单价 X/公里 + Double num9 = extraCost.getDouble("num9");//恶劣天气最高收取金额 + + //等待费用 + if(waitTime.compareTo(num1) >= 0){ + order.setWaitTime(num1);//等待时长 + order.setWaitTimePrice(num2);//等待费用 + + Integer w = waitTime - num3; + BigDecimal multiply = new BigDecimal(w).multiply(new BigDecimal(num4)); + order.setOutWaitTime(w);//等待时长超出分钟 + order.setOutWaitTimePrice(multiply.doubleValue());//等待时长超出费用 + } + + //恶劣天气 + systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); + if(null != systemConfig){ + JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); + Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 + if(1 == num11){ + boolean badWeather = WeatherUtil.isBadWeather(city); + if(badWeather){ + order.setBadWeatherDistance(num5);//恶劣天气公里 + order.setBadWeatherPrice(num6);//恶劣天气费 + if(distance.compareTo(num7) > 0){ + BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); + BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); + order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 + order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 + } + + double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); + if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) + if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 + order.setBadWeatherPrice(num9);//恶劣天气费 + order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 + }else{ + BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); + order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 + } + } + } + } + } + + + //计算总金额 + BigDecimal bigDecimal = new BigDecimal(order.getStartPrice() + order.getOverDrivePrice() + order.getLongDistancePrice() + order.getOverLongDistancePrice() + + order.getWaitTimePrice() + order.getOutWaitTimePrice() + order.getBadWeatherPrice() + order.getOverBadWeatherPrice() - order.getDiscountAmount()).setScale(2, BigDecimal.ROUND_HALF_EVEN); + + if(type == 1){//预估价 + order.setEstimatedPrice(bigDecimal.doubleValue()); + } + if(type == 2){//订单金额 + order.setOrderMoney(bigDecimal.doubleValue()); + } + return order; + } + + + + /** + * 初始订单费用 + * @param order + * @return + */ + public Order getOrderInitialPrice(Order order){ + order.setStartDistance(0D);//起步里程 + order.setStartPrice(0D);//起步价 + order.setOverDriveDistance(0D);//超出起步里程 + order.setOverDrivePrice(0D);//超出起步里程费 + order.setLongDistance("");//长途里程 + order.setLongDistancePrice(0D);//长途里程费 + order.setOverLongDistance(0D);//超出长途里程 + order.setOverLongDistancePrice(0d);//超出长途里程费 + order.setWaitTime(0);//等待时长 + order.setWaitTimePrice(0D);//等待费 + order.setOutWaitTime(0);//超出等待时长 + order.setOutWaitTimePrice(0D);//超出等待时长费 + order.setBadWeatherDistance(0D);//恶劣天气里程 + order.setBadWeatherPrice(0D);//恶劣天气里程费 + order.setOverBadWeatherDistance(0D);//恶劣天气超出里程 + order.setOverBadWeatherPrice(0D);//恶劣天气超出里程费 + order.setDiscountedPrice(0D);//优惠金额 + order.setCouponId(null);//优惠券 + order.setDiscountAmount(0D);//折扣优惠金额 + order.setDiscount(0D);//折扣 + return order; + } + + + /** + * 下单操作 + * @param uid + * @param travelOrder + * @return + * @throws Exception + */ + @Override + public ResultUtil travelOrder(Integer uid, TravelOrder travelOrder) throws Exception { + List<Integer> state = Arrays.asList(101, 102, 103, 104, 105, 106, 107, 201, 401); + Order order = this.selectOne(new EntityWrapper<Order>().eq("userId", uid).eq("status", 1).in("state", state)); + if(null != order){ + return ResultUtil.error("您还有正在进行的订单"); + } + AppUser appUser = appUserService.selectById(uid); + order = this.selectOne(new EntityWrapper<Order>().eq("userPhone", appUser.getPhone()).eq("status", 1).in("state", state)); + if(null != order){ + return ResultUtil.error("您还有正在进行的订单"); + } + + String startAddress = travelOrder.getStartAddress(); + startAddress = startAddress.replaceAll("& #40;", "("); + startAddress = startAddress.replaceAll("& #41;", ")"); + travelOrder.setStartAddress(startAddress); + if(ToolUtil.isNotEmpty(travelOrder.getEndAddress())){ + String endAddress = travelOrder.getEndAddress(); + endAddress = endAddress.replaceAll("& #40;", "("); + endAddress = endAddress.replaceAll("& #41;", ")"); + travelOrder.setEndAddress(endAddress); + } + + order = new Order(); + BeanUtils.copyProperties(travelOrder, order); + if(ToolUtil.isEmpty(travelOrder.getUserPhone())){ + order.setUserPhone(appUser.getPhone()); + order.setUserName(appUser.getNickname()); + } + order.setUserId(uid); + order.setSource(1); + order.setHallOrder(0); + order.setStatus(1); + order.setCreateTime(new Date()); + order.setState(null != travelOrder.getDriverId() ? 102 : 101); + Double d = 0D; + if(ToolUtil.isNotEmpty(travelOrder.getEndAddress())){ + Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), order.getEndLng() + "," + order.getEndLat(), 1); + if(null == distance){ + return ResultUtil.error("获取预估距离出错"); + } + d = Double.valueOf(distance.get("distance")) / 1000; + order.setEstimatedMileage(d); + order.setEstimatedTime(Integer.valueOf(distance.get("duration")) / 60); + } + String city = ""; + District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); + if(null != geocode){ + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); + city = null != weatherCity ? weatherCity.getId().toString() : ""; + } + order = getOrderPrice(1, d, 0, order, city); + if(null != travelOrder.getDriverId()){ + DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", travelOrder.getDriverId()).eq("status", 1)); + if(null == driverWork){ + return ResultUtil.error("司机还未上班"); + } + Driver driver = driverService.selectById(travelOrder.getDriverId()); + if(driver.getServerStatus() == 2){ + return ResultUtil.error("司机正在服务中"); + } + order.setAgentId(driver.getAgentId()); + order.setBranchOfficeId(driver.getBranchOfficeId()); + order.setOrderTakingTime(new Date()); + + driver.setServerStatus(2); + driverService.updateById(driver); + + appUser.setCancelCount(0); + appUser.setIsException(1); + appUserService.updateById(appUser); + } + + for (Integer i = 0; i < travelOrder.getDriverNum(); i++) { + order.setId(null); + order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3)); + boolean insert = this.insert(order); + if(insert){ + //推送状态 + pushUtil.pushOrderStatus(uid, 1, order.getId(), order.getState()); + if(null != order.getDriverId()){ + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); + }else{ + //推单 + pushOrder(order.getId()); + } + } + } + return ResultUtil.success(order.getId()); + } + + + + + /** + * 订单推送逻辑 + */ + public void pushOrder(Long orderId){ + Order order = this.selectById(orderId); + /** + * 1.先找最大推单范围内的优推司机 -》 距离最近 + * 没有1 - 》 + * 2.按照后台推送配置在范围内查找合适司机 + * 合适司:积分 > 评分 > 距离 + * 3.司机没有接单直接将订单置入大厅 + */ + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1)); + if(null == systemConfig){ + return; + } + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + Double num3 = jsonObject.getDouble("num3");//推单最大范围 + Integer num4 = jsonObject.getInteger("num4");//接单时间 + String startLat = order.getStartLat(); + String startLng = order.getStartLng(); + + //1 + //找到中心点 + GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(startLng), Double.valueOf(startLat)); + Double num = num3 / 1000;//范围公里 + //构造半径 + Distance distanceR = new Distance(num, Metrics.KILOMETERS); + //画圆 + Circle circle = new Circle(geoJsonPoint, distanceR); + // 构造query对象 + Query query = Query.query(Criteria.where("location").withinSphere(circle)); + List<Location> locations = mongoTemplate.find(query, Location.class); + List<Integer> driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); + Integer driver = null; + YouTuiDriver youTuiDriver1 = null; + if(driverIds.size() > 0){ + List<YouTuiDriver> youTuiDrivers = youTuiDriverService.selectList(new EntityWrapper<YouTuiDriver>().in("driverId", driverIds) + .eq("state", 2).last(" and (surplusQuantity > 0 or now() < endTime) and now() < failureTime")); + Double d = null; + for (YouTuiDriver youTuiDriver : youTuiDrivers) { + String value = redisUtil.getValue("DRIVER" + youTuiDriver.getDriverId()); + if(ToolUtil.isEmpty(value)){ + continue; + } + Driver driver1 = driverService.selectById(youTuiDriver.getDriverId()); + if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){ + continue; + } + Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); + Double wgs84 = distance.get("WGS84"); + if(d == null || d.compareTo(wgs84) > 0){ + d = wgs84; + driver = youTuiDriver.getDriverId(); + youTuiDriver1 = youTuiDriver; + } + } + } + if(null != youTuiDriver1 && youTuiDriver1.getType() == 1){ + youTuiDriver1.setSurplusQuantity(youTuiDriver1.getSurplusQuantity() - 1); + youTuiDriverService.updateById(youTuiDriver1); + } + + //开始范围查找 + if(null == driver){ + for (int i = 1; i < 4; i++) { + if(null != driver){ + break; + } + num = jsonObject.getDouble("num" + i) / 1000;//范围公里 + //构造半径 + distanceR = new Distance(num, Metrics.KILOMETERS); + //画圆 + circle = new Circle(geoJsonPoint, distanceR); + // 构造query对象 + query = Query.query(Criteria.where("location").withinSphere(circle)); + locations = mongoTemplate.find(query, Location.class); + + driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); + if(driverIds.size() > 0){ + List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2) + .eq("serverStatus", 1).eq("openOrderQRCode", 0).eq("status", 1).in("id", driverIds)); + if(drivers.size() == 0){ + continue; + } + + Integer integral = null;//积分 + Double score = null;//评分 + Double d = null; + for (Driver driver1 : drivers) { + String value = redisUtil.getValue("DRIVER" + driver1.getId()); + if(ToolUtil.isEmpty(value)){ + continue; + } + if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 + integral = driver1.getIntegral(); + score = driver1.getScore(); + driver = driver1.getId(); + Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); + Double wgs84 = distance.get("WGS84"); + d = wgs84; + continue; + } + if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) < 0){//积分相同对比评分 + integral = driver1.getIntegral(); + score = driver1.getScore(); + driver = driver1.getId(); + Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); + Double wgs84 = distance.get("WGS84"); + d = wgs84; + continue; + } + if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) == 0){//积分相同/评分相同对比距离 + Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); + Double wgs84 = distance.get("WGS84"); + if(d.compareTo(wgs84) > 0){ + d = wgs84; + integral = driver1.getIntegral(); + score = driver1.getScore(); + driver = driver1.getId(); + continue; + } + } + } + + } + } + } + + if(null != driver){ + pushUtil.pushGrabOrder(driver, 2, order.getId(), num4); + //创建定时任务处理订单到大厅 + new Timer().schedule(new TimerTask() { + @Override + public void run() { + Order order1 = OrderServiceImpl.this.selectById(order.getId()); + if(order1.getState() == 101 || order1.getState() == 201){ + order1.setHallOrder(1); + OrderServiceImpl.this.updateById(order1); + } + } + }, num4 * 1000); + }else{ + order.setHallOrder(1); + this.updateById(order); + } + } + + + /** + * 取消订单 + * @param uid + * @param orderId + * @param cause + * @return + * @throws Exception + */ + @Override + public ResultUtil cancelOrder(Integer uid, Long orderId, String cause) throws Exception { + Order order = this.selectById(orderId); + if(order.getState() >= 105){ + return ResultUtil.error("不能取消订单"); + } + CancelOrder cancelOrder = new CancelOrder(); + cancelOrder.setOrderId(orderId); + cancelOrder.setUserType(1); + cancelOrder.setUserId(uid); + cancelOrder.setCause(cause); + cancelOrder.setStatus(1); + cancelOrder.setCreateTime(new Date()); + cancelOrderService.insert(cancelOrder); + order.setState(301); + this.updateById(order); + AppUser appUser = appUserService.selectById(uid); + appUser.setCancelCount(appUser.getCancelCount() + 1); + if(appUser.getCancelCount() >= 3){ + appUser.setIsException(2); + } + appUserService.updateById(appUser); + Driver driver = driverService.selectById(order.getDriverId()); + if(null != driver){ + driver.setServerStatus(1); + driverService.updateById(driver); + } + + pushUtil.pushOrderStatus(uid, 1, orderId, order.getState()); + if(null != order.getDriverId()){ + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); + } + return ResultUtil.success(); + } + + + /** + * 获取订单详情 + * @param uid + * @param orderId + * @return + * @throws Exception + */ + @Override + public OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception { + OrderInfoWarpper orderInfoWarpper = this.baseMapper.queryOrderInfo(uid, orderId); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7)); + if(null != systemConfig){ + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + orderInfoWarpper.setServiceCell(jsonObject.getString("num1")); + } + String value = redisUtil.getValue("DRIVER" + orderInfoWarpper.getDriverId()); + if(ToolUtil.isNotEmpty(value)){ + String[] split = value.split(","); + orderInfoWarpper.setDriverLon(split[0]); + orderInfoWarpper.setDriverLat(split[1]); + } + return orderInfoWarpper; + } + + + /** + * 修改订单终点 + * @param uid + * @param editOrderEndAddress + * @return + * @throws Exception + */ + @Override + public ResultUtil editOrderEndAddress(Integer uid, EditOrderEndAddress editOrderEndAddress) throws Exception { + Order order = this.selectById(editOrderEndAddress.getOrderId()); + order.setEndAddress(editOrderEndAddress.getEndAddress()); + order.setEndLat(editOrderEndAddress.getEndLat().toString()); + order.setEndLng(editOrderEndAddress.getEndLng().toString()); + Double d = 0D; + if(ToolUtil.isNotEmpty(order.getEndAddress())){ + Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), + order.getEndLng() + "," + order.getEndLat(), 1); + if(null == distance){ + return ResultUtil.error("获取预估距离出错"); + } + d = Double.valueOf(distance.get("distance")) / 1000; + order.setEstimatedMileage(d); + order.setEstimatedTime(Integer.valueOf(distance.get("duration")) / 60); + } + String city = ""; + District geocode = MapUtil.geocode(order.getStartLng().toString(), order.getStartLat().toString()); + if(null != geocode){ + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); + city = null != weatherCity ? weatherCity.getId().toString() : ""; + } + Order order1 = new Order(); + BeanUtils.copyProperties(order, order1); + Order orderPrice = getOrderPrice(1, d, 0, order1, city); + order.setEstimatedPrice(orderPrice.getEstimatedPrice()); + this.updateById(order); + + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushOrderInfoWarpper.setEndAddress(order.getEndAddress()); + pushOrderInfoWarpper.setEndLat(order.getEndLat()); + pushOrderInfoWarpper.setEndLng(order.getEndLng()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); + return ResultUtil.success(); + } + + /** + * 获取费用明细 + * @param uid + * @param orderId + * @return + * @throws Exception + */ + @Override + public OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception { + Order order = this.selectById(orderId); + OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); + BeanUtils.copyProperties(order, orderPriceWarpper); + orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); + orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); + return orderPriceWarpper; + } + + + /** + * 重新计算费用明细 + * @param orderId + * @param couponId + * @param payType + * @param balance + * @return + * @throws Exception + */ + @Override + public OrderPriceWarpper calculationOfExpenses(Integer uid, Long orderId, Integer couponId, Integer payType, Double balance) throws Exception { + Order order = this.selectById(orderId); + OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); + BeanUtils.copyProperties(order, orderPriceWarpper); + AppUser appUser = appUserService.selectById(uid); + orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); + orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); + orderPriceWarpper.setBalance(appUser.getAccountBalance()); + orderPriceWarpper.setDiscount(0D); + orderPriceWarpper.setDiscountAmount(0D); + orderPriceWarpper.setPayType(1);//微信支付 + Double orderMoney = order.getOrderMoney(); + //先算优惠券 +// Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney); +// if(null != coupon && null == couponId){ +// orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount()); +// orderPriceWarpper.setCouponId(coupon.getId()); +// } + if(payType == 1 && null == couponId && appUser.getHavDiscount() == 1 && balance.compareTo(orderMoney) >= 0){//使用余额抵扣 + orderPriceWarpper.setDiscount(9D); + orderPriceWarpper.setDiscountAmount(new BigDecimal(orderMoney * 0.1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); + orderMoney = new BigDecimal(orderMoney * 0.9).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + } + if(null != couponId){ + UserToCoupon userToCoupon = userToCouponService.selectById(couponId); + Coupon coupon1 = couponService.selectById(userToCoupon.getCouponId()); + orderMoney = orderMoney - coupon1.getCouponPreferentialAmount(); + orderPriceWarpper.setDiscountedPrice(coupon1.getCouponPreferentialAmount()); + orderPriceWarpper.setCouponId(couponId); + } + if(payType == 0){//不使用余额抵扣 + orderPriceWarpper.setPayType(1); + } + if(payType == 1 && balance.compareTo(orderMoney) >= 0){//使用余额抵扣 + orderPriceWarpper.setPayType(2); + } + if(payType == 1 && balance.compareTo(orderMoney) < 0){//使用余额抵扣部分 + orderPriceWarpper.setPayType(4); + } + + orderPriceWarpper.setPayMoney(orderMoney); + return orderPriceWarpper; + } + + /** + * 获取订单支付页面优惠券列表 + * @param uid + * @param orderId + * @return + * @throws Exception + */ + @Override + public List<CouponWarpper> queryPayCouponList(Integer uid, Long orderId) throws Exception { + Order order = this.selectById(orderId); + return userToCouponService.queryPayCouponList(uid, order.getOrderMoney()); + } + + + /** + * 支付订单操作 + * @param uid + * @param orderPayment + * @return + * @throws Exception + */ + @Override + public ResultUtil orderPayment(Integer uid, OrderPayment orderPayment) throws Exception { + Order order = this.selectById(orderPayment.getOrderId()); + AppUser appUser = appUserService.selectById(uid); + if(order.getState() != 107){ + return ResultUtil.error("不允许支付"); + } + if(orderPayment.getPayType() == 2){ + Double payMoney = order.getOrderMoney() * (appUser.getHavDiscount() == 1 ? 0.9 : 1); + if(appUser.getAccountBalance() < payMoney){ + return ResultUtil.error("账户余额不足"); + } + } + //开始支付操作 + if(orderPayment.getPayType() == 1){//微信支付 + return weixinPay(order, appUser, orderPayment.getCouponId()); + } + if(orderPayment.getPayType() == 2){//余额支付 + return balancePayment(order, appUser, orderPayment.getCouponId()); + } + if(orderPayment.getPayType() == 3){//线下支付(由司机端操作) + } + if(orderPayment.getPayType() == 4){//微信+余额 + return weixinAndBalancePayment(order, appUser, orderPayment.getCouponId()); + } + return ResultUtil.success(); + } + + + /** + * 微信支付 + * @param order + * @param appUser + * @param couponId + * @return + * @throws Exception + */ + public ResultUtil weixinPay(Order order, AppUser appUser, Integer couponId) throws Exception{ + Double payMoney = order.getOrderMoney(); + if(null != couponId){ + UserToCoupon userToCoupon = userToCouponService.selectById(couponId); + if(userToCoupon.getValidCount() > 0){ + userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); + userToCouponService.updateById(userToCoupon); + Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); + payMoney = payMoney - coupon.getCouponPreferentialAmount(); + order.setCouponId(coupon.getId()); + order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); + userToCouponService.updateById(userToCoupon); + } + } + order.setPayType(1); + order.setPayMoney(payMoney); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String out_trade_no = sdf.format(new Date()) + order.getId(); +// ResultUtil weixinpay = payMoneyUtil.weixinpay("代驾服务费", "", out_trade_no, payMoney.toString(), "/base/order/orderPayCallback", "JSAPI", appUser.getOpenid()); +// this.updateById(order); + + + + PaymentOrder paymentOrder = new PaymentOrder(); + paymentOrder.setBizOrderId(out_trade_no); + paymentOrder.setAmount(String.valueOf(payMoney * 100)); + paymentOrder.setOrderName("代驾服务费"); + paymentOrder.setPayType("WX_MINI"); + paymentOrder.setTransferType("0"); + paymentOrder.setAsynSplitFlag("1"); + paymentOrder.setAppid(""); + paymentOrder.setOpenid(appUser.getOpenid()); + paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); + List<PaymentOrderGood> goodsDetail = new ArrayList<>(); + PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); + paymentOrderGood.setGoodsName("服务费"); + goodsDetail.add(paymentOrderGood); + paymentOrder.setGoodsDetail(goodsDetail); + paymentOrder.setFrontUrl(""); + paymentOrder.setNotifyUrl(callbackPath + "/base/order/orderPayCallback"); + paymentOrder.setParameter1(order.getId().toString()); + + TrhRequest<PaymentOrder> request = new TrhRequest(); + InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); + if(!"0000".equals(execute.getResult())){ + return ResultUtil.error(execute.getMsg()); + } + JSONObject jsonObject = JSON.parseObject(execute.getResult()); + String status = jsonObject.getString("status"); + if("2".equals(status)){ + return ResultUtil.error("失败"); + } + if("0".equals(status)){ + return ResultUtil.error("处理中"); + } + String payCode = jsonObject.getString("payCode"); + this.updateById(order); + return ResultUtil.success(payCode); + } + + + /** + * 账户余额支付 + * @param order + * @param appUser + * @return + */ + public ResultUtil balancePayment(Order order, AppUser appUser, Integer couponId) throws Exception{ + Double payMoney = order.getOrderMoney(); + if(null != couponId){ + UserToCoupon userToCoupon = userToCouponService.selectById(couponId); + if(userToCoupon.getValidCount() > 0){ + userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); + userToCouponService.updateById(userToCoupon); + Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); + payMoney = payMoney - coupon.getCouponPreferentialAmount(); + order.setCouponId(coupon.getId()); + order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); + + Driver driver = driverService.selectById(order.getDriverId()); + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(order.getDriverId()); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(7); + accountChangeDetail.setOrderId(order.getId()); + accountChangeDetail.setExplain("优惠券收入"); + driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); + accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); + driverService.updateById(driver); + accountChangeDetailService.insert(accountChangeDetail); + } + } + + if(appUser.getHavDiscount() == 1){//9折 + payMoney = payMoney * 0.9; + order.setDiscount(9D); + order.setDiscountAmount(payMoney * 0.1); + } + + order.setPayType(2); + order.setPayMoney(payMoney); + order.setPayTime(new Date()); + order.setState(108); + this.updateById(order); + + pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); + if(null != order.getDriverId()) { + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); + } + + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(1); + accountChangeDetail.setUserId(appUser.getId()); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setOldData(appUser.getAccountBalance()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(2); + accountChangeDetail.setOrderId(order.getId()); + accountChangeDetail.setExplain("代驾服务费"); + appUser.setAccountBalance(appUser.getAccountBalance() - payMoney); + accountChangeDetail.setNewData(appUser.getAccountBalance()); + appUserService.updateById(appUser); + accountChangeDetailService.insert(accountChangeDetail); + + //处理佣金和收入记录 + saveCommission(order); + return ResultUtil.success(); + } + + + /** + * 微信+账户余额支付 + * @param order + * @param appUser + * @param couponId + * @return + * @throws Exception + */ + public ResultUtil weixinAndBalancePayment(Order order, AppUser appUser, Integer couponId) throws Exception{ + Double payMoney = order.getOrderMoney(); + if(null != couponId){ + UserToCoupon userToCoupon = userToCouponService.selectById(couponId); + if(userToCoupon.getValidCount() > 0){ + userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); + userToCouponService.updateById(userToCoupon); + Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); + payMoney = payMoney - coupon.getCouponPreferentialAmount(); + order.setCouponId(coupon.getId()); + order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); + } + } + order.setPayType(1); + order.setPayMoney(payMoney); + + payMoney = payMoney > appUser.getAccountBalance() ? payMoney - appUser.getAccountBalance() : 0D; + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(1); + accountChangeDetail.setUserId(appUser.getId()); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setOldData(appUser.getAccountBalance()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(2); + accountChangeDetail.setOrderId(order.getId()); + accountChangeDetail.setExplain("代驾服务费"); + appUser.setAccountBalance(appUser.getAccountBalance() > payMoney ? appUser.getAccountBalance() - payMoney : 0); + accountChangeDetail.setNewData(appUser.getAccountBalance()); + appUserService.updateById(appUser); + accountChangeDetailService.insert(accountChangeDetail); + + if(0 < payMoney){//还需要调起微信支付 + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String out_trade_no = sdf.format(new Date()) + order.getId(); +// ResultUtil weixinpay = payMoneyUtil.weixinpay("代驾服务费", "", out_trade_no, payMoney.toString(), "/base/order/orderPayCallback", "JSAPI", appUser.getOpenid()); + + PaymentOrder paymentOrder = new PaymentOrder(); + paymentOrder.setBizOrderId(out_trade_no); + paymentOrder.setAmount(String.valueOf(payMoney * 100)); + paymentOrder.setOrderName("代驾服务费"); + paymentOrder.setPayType("WX_MINI"); + paymentOrder.setTransferType("0"); + paymentOrder.setAsynSplitFlag("1"); + paymentOrder.setAppid(""); + paymentOrder.setOpenid(appUser.getOpenid()); + paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); + List<PaymentOrderGood> goodsDetail = new ArrayList<>(); + PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); + paymentOrderGood.setGoodsName("服务费"); + goodsDetail.add(paymentOrderGood); + paymentOrder.setGoodsDetail(goodsDetail); + paymentOrder.setFrontUrl(""); + paymentOrder.setNotifyUrl(callbackPath + "/base/order/orderPayCallback"); + paymentOrder.setParameter1(order.getId().toString()); + + TrhRequest<PaymentOrder> request = new TrhRequest(); + InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); + if(!"0000".equals(execute.getResult())){ + return ResultUtil.error(execute.getMsg()); + } + JSONObject jsonObject = JSON.parseObject(execute.getResult()); + String status = jsonObject.getString("status"); + if("2".equals(status)){ + return ResultUtil.error("失败"); + } + if("0".equals(status)){ + return ResultUtil.error("处理中"); + } + String payCode = jsonObject.getString("payCode"); + this.updateById(order); + return ResultUtil.success(payCode); + + // TODO: 2023/5/18 取消支付后需要处理优惠券数据回退 +// +// +// new Thread(new Runnable() { +// @Override +// public void run() { +// try { +// int num = 1; +// int wait = 0; +// while (num <= 10){ +// int min = 5000; +// wait += (min * num); +// Order order1 = OrderServiceImpl.this.selectById(order.getId()); +// if(order1.getState() != 107){ +// return; +// } +// +// /** +// * SUCCESS--支付成功 +// * REFUND--转入退款 +// * NOTPAY--未支付 +// * CLOSED--已关闭 +// * REVOKED--已撤销(刷卡支付) +// * USERPAYING--用户支付中 +// * PAYERROR--支付失败(其他原因,如银行返回失败) +// * ACCEPT--已接收,等待扣款 +// */ +// ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(out_trade_no, ""); +// if(resultUtil.getCode() == 200){ +// Map<String, String> map = resultUtil.getData(); +// String trade_type = map.get("trade_type"); +// String trade_state = map.get("trade_state"); +// String transaction_id = map.get("transaction_id"); +// if("REFUND".equals(trade_state) || "NOTPAY".equals(trade_state) || "CLOSED".equals(trade_state) || "REVOKED".equals(trade_state) || "PAYERROR".equals(trade_state)){ +// AccountChangeDetail accountChangeDetail1 = accountChangeDetailService.selectById(accountChangeDetail.getId()); +// AppUser appUser1 = appUserService.selectById(accountChangeDetail1.getUserId()); +// Double b = accountChangeDetail1.getOldData() - accountChangeDetail1.getNewData(); +// appUser1.setAccountBalance(appUser1.getAccountBalance() + b); +// appUserService.updateById(appUser1); +// +// accountChangeDetailService.deleteById(accountChangeDetail.getId()); +// return; +// } +// if("SUCCESS".equals(trade_state)){ +// order1.setPayTime(new Date()); +// order1.setState(108); +// order1.setOrderNo(transaction_id); +// OrderServiceImpl.this.updateById(order1); +// +// //处理抽成及收入 +// saveCommission(order1); +// return; +// } +// if("USERPAYING".equals(trade_state) || "ACCEPT".equals(trade_state)){ +// Thread.sleep(wait); +// num++; +// } +// }else{ +// Thread.sleep(wait); +// num++; +// } +// if(10 == num){ +// AccountChangeDetail accountChangeDetail1 = accountChangeDetailService.selectById(accountChangeDetail.getId()); +// AppUser appUser1 = appUserService.selectById(accountChangeDetail1.getUserId()); +// Double b = accountChangeDetail1.getOldData() - accountChangeDetail1.getNewData(); +// appUser1.setAccountBalance(appUser1.getAccountBalance() + b); +// appUserService.updateById(appUser1); +// +// accountChangeDetailService.deleteById(accountChangeDetail.getId()); +// } +// } +// }catch (Exception e){ +// e.printStackTrace(); +// } +// } +// }).start(); +// return weixinpay; + } +// order.setPayTime(new Date()); +// this.updateById(order); + + + return ResultUtil.success(); + + } + + /** + * 订单微信支付回调 + * @param orderId + * @return + * @throws Exception + */ + @Override + public ResultUtil orderPayCallback(String orderId, String transaction_id) throws Exception { + Order order = this.selectById(orderId); + if(order.getState() != 107){ + return ResultUtil.success(); + } + order.setState(108); + order.setPayTime(new Date()); + order.setOrderNo(transaction_id); + this.updateById(order); + //添加收入明细 + saveCommission(order); + + pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); + if(null != order.getDriverId()) { + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); + } + + //支付成功---->异步分账----->10s钟后再进行确认收货 + //确认收货后才能进行提现(结算接口) + //异步分账 + List<Revenue> revenues = revenueService.selectList(new EntityWrapper<Revenue>().eq("orderId", order.getId())); + Complete complete = new Complete(); + complete.setOriginalMerOrderId(transaction_id); + complete.setNotifyUrl(callbackPath + "/base/order/ledgerCallback"); + List<PamentOrderUser> splitList = new ArrayList<>(); + for (Revenue revenue : revenues) { + if(revenue.getUserType() == 2){//司机 + Driver driver = driverService.selectById(revenue.getUserId()); + PamentOrderUser pamentOrderUser = new PamentOrderUser(); + pamentOrderUser.setSplitUserId(driver.getMerchantNumber()); + pamentOrderUser.setSplitAmount(revenue.getAmount().toString()); + pamentOrderUser.setSplitType("2"); + splitList.add(pamentOrderUser); + + DivisionRecord divisionRecord = new DivisionRecord(); + divisionRecord.setUserType(1); + divisionRecord.setUserId(revenue.getUserId()); + divisionRecord.setOrderId(order.getId()); + divisionRecord.setMerOrderId(transaction_id); + divisionRecord.setSourceType(1); + divisionRecord.setAmount(revenue.getAmount()); + divisionRecord.setMerchantNumber(driver.getMerchantNumber()); + divisionRecord.setState(1); + divisionRecord.setCreateTime(new Date()); + divisionRecordService.insert(divisionRecord); + } + if(revenue.getUserType() == 3){//代理商 + Agent agent = agentService.selectById(revenue.getUserId()); + PamentOrderUser pamentOrderUser = new PamentOrderUser(); + pamentOrderUser.setSplitUserId(agent.getMerchantNumber()); + pamentOrderUser.setSplitAmount(revenue.getAmount().toString()); + pamentOrderUser.setSplitType("2"); + splitList.add(pamentOrderUser); + + DivisionRecord divisionRecord = new DivisionRecord(); + divisionRecord.setUserType(2); + divisionRecord.setUserId(revenue.getUserId()); + divisionRecord.setOrderId(order.getId()); + divisionRecord.setMerOrderId(transaction_id); + divisionRecord.setSourceType(1); + divisionRecord.setAmount(revenue.getAmount()); + divisionRecord.setMerchantNumber(agent.getMerchantNumber()); + divisionRecord.setState(1); + divisionRecord.setCreateTime(new Date()); + divisionRecordService.insert(divisionRecord); + } + + } + complete.setSplitList(splitList); + TrhRequest<Complete> request = new TrhRequest(); + InterfaceResponse execute = request.execute(complete, Complete.SERVICE_CODE); + if(!"0000".equals(execute.getResult())){ + return ResultUtil.error(execute.getMsg()); + } + JSONObject jsonObject = JSON.parseObject(execute.getResult()); + String status = jsonObject.getString("status"); + if("2".equals(status)){ + return ResultUtil.error("失败"); + } + if("0".equals(status)){ + return ResultUtil.error("处理中"); + } + + //使用优惠券的情况,通过转账接口将优惠券的收入转到司机电子账簿 + if(null != order.getCouponId()){ + List<PlatformRechargeRecord> platformRechargeRecords = platformRechargeRecordService.selectList(new EntityWrapper<PlatformRechargeRecord>().eq("state", 2).last(" and balance > 0 order by payTime")); + Double discountedPrice = order.getDiscountedPrice(); + Driver driver = driverService.selectById(order.getDriverId()); + + UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); + Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(order.getDriverId()); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(7); + accountChangeDetail.setOrderId(order.getId()); + accountChangeDetail.setExplain("优惠券收入"); + driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); + accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); + driverService.updateById(driver); + accountChangeDetailService.insert(accountChangeDetail); + + + for (PlatformRechargeRecord platformRechargeRecord : platformRechargeRecords) { + if(discountedPrice == 0){ + break; + } + + if(platformRechargeRecord.getBalance().compareTo(discountedPrice) >= 0){ + discountedPrice = 0D; + platformRechargeRecord.setBalance(platformRechargeRecord.getBalance() - discountedPrice); + platformRechargeRecordService.updateById(platformRechargeRecord); + }else{ + + } + + Transfer transfer = new Transfer(); + transfer.setDepositMerOrderId("6831518911582834611"); + transfer.setToUserId(driver.getMerchantNumber()); + transfer.setAmount(discountedPrice.toString()); + transfer.setOrderName(""); + transfer.setNotifyUrl(""); + transfer.setParameter1(order.getId().toString()); + + TrhRequest<Transfer> request1 = new TrhRequest(); + InterfaceResponse execute1 = request1.execute(transfer, Transfer.SERVICE_CODE); + if(!"0000".equals(execute1.getResult())){ + return ResultUtil.error(execute1.getMsg()); + } + JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); + String status1 = jsonObject1.getString("status"); + if("2".equals(status1)){ + return ResultUtil.error("失败"); + } + if("0".equals(status1)){ + return ResultUtil.error("处理中"); + } + } + } + + + return ResultUtil.success(); + } + + + + + + + + + + /** + * 订单评价 + * @param uid + * @param orderId + * @param score + * @param content + * @return + * @throws Exception + */ + @Override + public ResultUtil orderAppraise(Integer uid, Long orderId, Integer score, String content) throws Exception { + Order order = this.selectById(orderId); + if(order.getState() != 108){ + return ResultUtil.error("不能进行评价"); + } + order.setState(109); + this.updateById(order); + Evaluate evaluate = new Evaluate(); + evaluate.setOrderId(orderId.intValue()); + evaluate.setCreateTime(new Date()); + evaluate.setScore(score); + evaluate.setEvaluate(content); + evaluate.setStatus(1); + evaluate.setUserId(uid); + evaluateService.insert(evaluate); + Driver driver = driverService.selectById(order.getDriverId()); + driver.setScore(((null == driver.getScore() ? 0 : driver.getScore()) + score) / 2); + if(score == 5){//司机积分奖励 + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); + if(null != systemConfig){ + //{"num1":"10:00","num2":"14:00","num3":10,"num4":10,"num5":10,"num6":10,"num7":10,"num8":10,"num9":5,"num10":5} + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + Integer num5 = jsonObject.getInteger("num5"); + + //增加积分变动记录 + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(order.getDriverId()); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); + accountChangeDetail.setType(2); + accountChangeDetail.setExplain("代驾5星好评"); + driver.setIntegral(driver.getIntegral() + num5); + accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); + accountChangeDetailService.insert(accountChangeDetail); + } + } + if(score < 3){//差评扣减积分 + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); + if(null != systemConfig){ + //{"num1":"10:00","num2":"14:00","num3":10,"num4":10,"num5":10,"num6":10,"num7":10,"num8":10,"num9":5,"num10":5} + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + Integer num9 = jsonObject.getInteger("num9"); + + //增加积分变动记录 + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(order.getDriverId()); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); + accountChangeDetail.setType(2); + accountChangeDetail.setExplain("差评扣减积分"); + driver.setIntegral(driver.getIntegral() - num9); + accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); + accountChangeDetailService.insert(accountChangeDetail); + } + } + driverService.updateById(driver); + return ResultUtil.success(); + } + + + /** + * 处理订单收入及分佣抽成 + * @param order + * @return + * @throws Exception + */ + public void saveCommission(Order order) throws Exception{ + //司机收入和代理商抽成(先分佣,后抽成) + //司机分佣和司机推荐用户首单奖励都在平台的抽佣中扣除,剩余的为平台抽佣。 + Driver driver = driverService.selectById(order.getDriverId()); + AppUser appUser = appUserService.selectById(order.getUserId()); + Double payMoney = order.getPayMoney(); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); + if(null != systemConfig){ + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + Double num2 = jsonObject.getDouble("num2"); + Double num3 = jsonObject.getDouble("num3"); + if(order.getPayMoney() >= num2){ + payMoney = payMoney - num3;//司机收入 + SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 2)); + if(null != systemConfig1){ + JSONObject jsonObject1 = JSON.parseObject(systemConfig1.getContent()); + //司机推荐首单收入 + List<Integer> state = Arrays.asList(108, 109); + int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); + if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ + Double num1 = jsonObject1.getDouble("num1"); + num1 = (num3 >= num1 ? num1 : num3); + + if(num1 > 0){ + Driver driver1 = driverService.selectById(appUser.getInviterId()); + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver1.setCommission(driver1.getCommission() + num1); + accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); + driverService.updateById(driver1); + accountChangeDetailService.saveData(accountChangeDetail); + + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver1.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num1); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + } + num3 = (num3 >= num1 ? num3 - num1 : 0); + } + + //开始处理层级抽佣 + if(null != driver & null != driver.getInviterType() && driver.getInviterType() == 2){ + Driver driver1 = driverService.selectById(driver.getInviterId());//一级司机 + if(null != driver1 && null != driver1.getInviterType() && driver1.getInviterType() == 2){ + Driver driver2 = driverService.selectById(driver1.getInviterId());//二级司机 + if(null != driver2 && null != driver2.getInviterType() && driver2.getInviterType() == 2){ + Driver driver3 = driverService.selectById(driver2.getInviterId());//三级级司机 + Double num5 = jsonObject1.getDouble("num5"); + Double num6 = jsonObject1.getDouble("num6"); + Double num7 = jsonObject1.getDouble("num7"); + num5 = (num3 >= num5 ? num5 : num3); + if(num5 > 0 && null != driver1){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver1.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num5); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver1.setCommission(driver1.getCommission() + num5); + accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); + driverService.updateById(driver1); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num5 ? num3 - num5 : 0); + } + num6 = (num3 >= num6 ? num6 : num3); + if(num6 > 0 && null != driver2){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver2.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num6); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver2.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver2.setCommission(driver2.getCommission() + num6); + accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); + driverService.updateById(driver2); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num6 ? num3 - num6 : 0); + } + num7 = (num3 >= num7 ? num7 : num3); + if(num7 > 0 && null != driver3){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver3.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num7); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver3.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver3.setCommission(driver3.getCommission() + num7); + accountChangeDetail.setNewData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); + driverService.updateById(driver3); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num7 ? num3 - num7 : 0); + } + }else{ + Double num3_ = jsonObject1.getDouble("num3"); + Double num4 = jsonObject1.getDouble("num4"); + num3_ = (num3 >= num3_ ? num3_ : num3); + if(num3_ > 0 && null != driver1){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver1.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num3_); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver1.setCommission(driver1.getCommission() + num3_); + accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); + driverService.updateById(driver1); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num3_ ? num3 - num3_ : 0); + } + num4 = (num3 >= num4 ? num4 : num3); + if(num4 > 0 && null != driver2){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver2.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num4); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver2.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver2.setCommission(driver2.getCommission() + num4); + accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); + driverService.updateById(driver2); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num4 ? num3 - num4 : 0); + } + } + }else{ + Double num2_ = jsonObject1.getDouble("num2"); + num2_ = (num3 >= num2_ ? num2_ : num3); + if(num2_ > 0 && null != driver1){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver1.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num2_); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver1.setCommission(driver1.getCommission() + num2_); + accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); + driverService.updateById(driver1); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num2_ ? num3 - num2_ : 0); + } + } + } + //处理代理商抽佣 + if(num3 > 0 && null != driver){ + Revenue revenue = new Revenue(); + revenue.setType(1); + revenue.setUserType(3); + revenue.setUserId(driver.getAgentId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num3); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + } + } + } + } + //司机订单收入 + Revenue revenue = new Revenue(); + revenue.setType(1); + revenue.setUserType(2); + revenue.setUserId(driver.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(payMoney + order.getDiscountedPrice()); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(1); + accountChangeDetail.setOrderId(order.getId()); + accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); + accountChangeDetail.setExplain("订单收入"); + accountChangeDetail.setCreateTime(new Date()); + driver.setBalance(driver.getBalance() + payMoney); + if(null != order.getCouponId()){ + driver.setCouponBalance(driver.getCouponBalance() + order.getDiscountedPrice()); + } + accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); + driverService.updateById(driver); + accountChangeDetailService.saveData(accountChangeDetail); + } + + + /** + * 获取乘客行程 + * @param uid + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<OrderListWarpper> queryMyOrder(Integer uid, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryMyOrder(uid, pageNum, pageSize); + } + + + /** + * 获取未开票订单 + * @param uid + * @return + * @throws Exception + */ + @Override + public List<OrderListWarpper> queryNotInvoiceOrder(Integer uid, NotInvoiceOrder notInvoiceOrder) throws Exception { + notInvoiceOrder.setPageNum((notInvoiceOrder.getPageNum() - 1) * notInvoiceOrder.getPageSize());; + return this.baseMapper.queryNotInvoiceOrder(uid, notInvoiceOrder); + } + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/PlatformRechargeRecordServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/PlatformRechargeRecordServiceImpl.java new file mode 100644 index 0000000..c8e3549 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/PlatformRechargeRecordServiceImpl.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.PlatformRechargeRecordMapper; +import com.agentdriving.user.modular.system.model.PlatformRechargeRecord; +import com.agentdriving.user.modular.system.service.IPlatformRechargeRecordService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author zhibing.pu + * @date 2023/5/6 14:11 + */ +@Service +public class PlatformRechargeRecordServiceImpl extends ServiceImpl<PlatformRechargeRecordMapper, PlatformRechargeRecord> implements IPlatformRechargeRecordService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RechargeRecordServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RechargeRecordServiceImpl.java new file mode 100644 index 0000000..d90c58d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RechargeRecordServiceImpl.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.RechargeRecordMapper; +import com.agentdriving.user.modular.system.model.RechargeRecord; +import com.agentdriving.user.modular.system.service.IRechargeRecordService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author zhibing.pu + * @date 2023/3/23 14:57 + */ +@Service +public class RechargeRecordServiceImpl extends ServiceImpl<RechargeRecordMapper, RechargeRecord> implements IRechargeRecordService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RelationServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RelationServiceImpl.java new file mode 100644 index 0000000..4b2ca00 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RelationServiceImpl.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.RelationMapper; +import com.agentdriving.user.modular.system.model.Relation; +import com.agentdriving.user.modular.system.service.IRelationService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * <p> + * 角色和菜单关联表 服务实现类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +@Service +public class RelationServiceImpl extends ServiceImpl<RelationMapper, Relation> implements IRelationService { + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RevenueServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RevenueServiceImpl.java new file mode 100644 index 0000000..3891cf6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RevenueServiceImpl.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.RevenueMapper; +import com.agentdriving.user.modular.system.model.Revenue; +import com.agentdriving.user.modular.system.service.IRevenueService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author zhibing.pu + * @date 2023/3/13 10:09 + */ +@Service +public class RevenueServiceImpl extends ServiceImpl<RevenueMapper, Revenue> implements IRevenueService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RoleServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..f11fa4e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/RoleServiceImpl.java @@ -0,0 +1,73 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.core.node.ZTreeNode; +import com.agentdriving.user.core.util.Convert; +import com.agentdriving.user.modular.system.dao.RelationMapper; +import com.agentdriving.user.modular.system.dao.RoleMapper; +import com.agentdriving.user.modular.system.model.Relation; +import com.agentdriving.user.modular.system.model.Role; +import com.agentdriving.user.modular.system.service.IRoleService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@Service +public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService { + + @Resource + private RoleMapper roleMapper; + + @Resource + private RelationMapper relationMapper; + + @Override + @Transactional(readOnly = false) + public void setAuthority(Integer roleId, String ids) { + + // 删除该角色所有的权限 + this.roleMapper.deleteRolesById(roleId); + + // 添加新的权限 + for (Long id : Convert.toLongArray(true, Convert.toStrArray(",", ids))) { + Relation relation = new Relation(); + relation.setRoleid(roleId); + relation.setMenuid(id); + this.relationMapper.insert(relation); + } + } + + @Override + @Transactional(readOnly = false) + public void delRoleById(Integer roleId) { + //删除角色 + this.roleMapper.deleteById(roleId); + + // 删除该角色所有的权限 + this.roleMapper.deleteRolesById(roleId); + } + + @Override + public List<Map<String, Object>> selectRoles(String condition) { + return this.baseMapper.selectRoles(condition); + } + + @Override + public int deleteRolesById(Integer roleId) { + return this.baseMapper.deleteRolesById(roleId); + } + + @Override + public List<ZTreeNode> roleTreeList() { + return this.baseMapper.roleTreeList(); + } + + @Override + public List<ZTreeNode> roleTreeListByRoleId(String[] roleId) { + return this.baseMapper.roleTreeListByRoleId(roleId); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/SystemConfigServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/SystemConfigServiceImpl.java new file mode 100644 index 0000000..cc4a211 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/SystemConfigServiceImpl.java @@ -0,0 +1,93 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.SystemConfigMapper; +import com.agentdriving.user.modular.system.model.SystemConfig; +import com.agentdriving.user.modular.system.service.ISystemConfigService; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.modular.system.warpper.PriceRulesWarpper; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** +* 系统配置 +* @author pzb +* @Date 2023/2/15 16:26 +*/ +@Service +public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements ISystemConfigService { + + + /** + * 获取价格表 + * @return + * @throws Exception + */ + @Override + public PriceRulesWarpper queryPriceRules() throws Exception { + SystemConfig systemConfig = this.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); + PriceRulesWarpper priceRulesWarpper = new PriceRulesWarpper(); + if(null != systemConfig){ + //{"ChargeStandard":[{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"06:00","num2":"08:00","num3":1,"num4":1,"num5":1,"num6":1,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"00:00","num2":"10:00","num3":3,"num4":3,"num5":3,"num6":3,"num7":3,"num8":3,"num9":3,"num10":3,"num11":3}],"ExtraCost":{"num1":1,"num2":1,"num3":1,"num4":1,"num5":1,"num6":1,"num7":1,"num8":1,"num9":1}} + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); + List<Map<String, Object>> basePrice = new ArrayList<>(); + List<Map<String, Object>> longDistanceCharges = new ArrayList<>(); + for (int i = 0; i < chargeStandard.size(); i++) { + JSONObject jsonObject1 = chargeStandard.getJSONObject(i); + String num1 = jsonObject1.getString("num1"); + String num2 = jsonObject1.getString("num2"); + Double num3 = jsonObject1.getDouble("num3"); + Double num4 = jsonObject1.getDouble("num4"); + Double num5 = jsonObject1.getDouble("num5"); + Double num6 = jsonObject1.getDouble("num6"); + Double num7 = jsonObject1.getDouble("num7"); + Double num8 = jsonObject1.getDouble("num8"); + Double num9 = jsonObject1.getDouble("num9"); + Double num10 = jsonObject1.getDouble("num10"); + Double num11 = jsonObject1.getDouble("num11"); + + + Map<String, Object> map1 = new HashMap<>(); + map1.put("time", num1 + "-" + num2); + map1.put("startingMileage", num3 + "公里(包含" + num3 + "公里)"); + map1.put("startingPrice", num4 + "元"); + map1.put("exceedStartingPrice", num6 + "元/" + num5 + "公里"); + basePrice.add(map1); + + Map<String, Object> map2 = new HashMap<>(); + map2.put("time", num1 + "-" + num2); + map2.put("startingMileage", num7 + "-" + num8 + "公里"); + map2.put("startingPrice", num9 + "元"); + map2.put("exceedStartingPrice", num11 + "元/" + num10 + "公里"); + longDistanceCharges.add(map2); + } + priceRulesWarpper.setBasePrice(JSON.toJSONString(basePrice)); + priceRulesWarpper.setLongDistanceCharges(JSON.toJSONString(longDistanceCharges)); + //额外费用 + JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); + Integer num1 = extraCost.getInteger("num1"); + Double num2 = extraCost.getDouble("num2"); + Integer num3 = extraCost.getInteger("num3"); + Double num4 = extraCost.getDouble("num4"); + Double num5 = extraCost.getDouble("num5"); + Double num6 = extraCost.getDouble("num6"); + Double num7 = extraCost.getDouble("num7"); + Double num8 = extraCost.getDouble("num8"); + Double num9 = extraCost.getDouble("num9"); + Map<String, Object> map = new HashMap<>(); + map.put("waitTime", num1 + "分钟/" + num2 + "元"); + map.put("exceedWaitTime", "超出" + num3 + "分钟,收取" + num4 + "元/分钟"); + map.put("badWeather", num5 + "公里内加收" + num6 + "元,超过" + num7 + "公里按照订单单价的" + num8 + "倍计费,最高收取" + num9 + "元"); + priceRulesWarpper.setAdditionalFee(JSON.toJSONString(map)); + } + return priceRulesWarpper; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/UserServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..8ba95b4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/UserServiceImpl.java @@ -0,0 +1,48 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.core.datascope.DataScope; +import com.agentdriving.user.modular.system.dao.UserMapper; +import com.agentdriving.user.modular.system.model.User; +import com.agentdriving.user.modular.system.service.IUserService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 管理员表 服务实现类 + * </p> + * + * @author stylefeng123 + * @since 2018-02-22 + */ +@Service +public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService { + + @Override + public int setStatus(Integer userId, int status) { + return this.baseMapper.setStatus(userId, status); + } + + @Override + public int changePwd(Integer userId, String pwd) { + return this.baseMapper.changePwd(userId, pwd); + } + + @Override + public List<Map<String, Object>> selectUsers(DataScope dataScope, String name, String beginTime, String endTime, Integer deptid) { + return this.baseMapper.selectUsers(dataScope, name, beginTime, endTime, deptid); + } + + @Override + public int setRoles(Integer userId, String roleIds) { + return this.baseMapper.setRoles(userId, roleIds); + } + + @Override + public User getByAccount(String account) { + return this.baseMapper.getByAccount(account); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/UserToCouponServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/UserToCouponServiceImpl.java new file mode 100644 index 0000000..541788c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/UserToCouponServiceImpl.java @@ -0,0 +1,79 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.UserToCouponMapper; +import com.agentdriving.user.modular.system.model.Coupon; +import com.agentdriving.user.modular.system.model.UserToCoupon; +import com.agentdriving.user.modular.system.service.IUserToCouponService; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.agentdriving.user.modular.system.warpper.CouponWarpper; +import com.agentdriving.user.modular.system.warpper.CouponsWarpper; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/2 14:22 + */ +@Service +public class UserToCouponServiceImpl extends ServiceImpl<UserToCouponMapper, UserToCoupon> implements IUserToCouponService { + + + /** + * 获取可用优惠券 + * @param uid + * @param price + * @return + * @throws Exception + */ + @Override + public Coupon queryCoupon(Integer uid, Double price) throws Exception { + return this.baseMapper.queryCoupon(uid, price); + } + + /** + * 获取订单支付页面的优惠券列表 + * @param uid + * @param price + * @return + * @throws Exception + */ + @Override + public List<CouponWarpper> queryPayCouponList(Integer uid, Double price) throws Exception { + return this.baseMapper.queryPayCouponList(uid, price); + } + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryMyCoupons(uid, state, pageNum, pageSize); + } + + @Override + public Integer queryUsedCouponNum(Integer uid) { + return this.baseMapper.queryUsedCouponNum(uid); + } + + + /** + * 删除优惠券 + */ + @Override + public void delUserCoupon() { + List<UserToCoupon> userToCoupons = this.selectList(new EntityWrapper<UserToCoupon>().eq("status", 1).last(" and UNIX_TIMESTAMP(expireTime) + 1296000 <= UNIX_TIMESTAMP(now())")); + for (UserToCoupon userToCoupon : userToCoupons) { + userToCoupon.setStatus(3); + this.updateById(userToCoupon); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/WeatherCityServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/WeatherCityServiceImpl.java new file mode 100644 index 0000000..941173d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/WeatherCityServiceImpl.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.WeatherCityMapper; +import com.agentdriving.user.modular.system.model.WeatherCity; +import com.agentdriving.user.modular.system.service.IWeatherCityService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class WeatherCityServiceImpl extends ServiceImpl<WeatherCityMapper, WeatherCity> implements IWeatherCityService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/YouTuiDriverServiceImpl.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/YouTuiDriverServiceImpl.java new file mode 100644 index 0000000..252444a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/YouTuiDriverServiceImpl.java @@ -0,0 +1,16 @@ +package com.agentdriving.user.modular.system.service.impl; + +import com.agentdriving.user.modular.system.dao.YouTuiDriverMapper; +import com.agentdriving.user.modular.system.model.YouTuiDriver; +import com.agentdriving.user.modular.system.service.IYouTuiDriverService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** +* 用户优推数据 +* @author pzb +* @Date 2023/2/22 14:06 +*/ +@Service +public class YouTuiDriverServiceImpl extends ServiceImpl<YouTuiDriverMapper, YouTuiDriver> implements IYouTuiDriverService { +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ManagerUser.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ManagerUser.java new file mode 100644 index 0000000..b708611 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ManagerUser.java @@ -0,0 +1,97 @@ +package com.agentdriving.user.modular.system.transfer; + +import java.util.Date; + +/** + * 管理员的信息封装 + * + * @author fengshuonan + * @Date 2017年1月11日 下午7:46:53 + */ +public class ManagerUser { + + private String userId; + + /* 用户账号 */ + private String userNo; + + /* 用户姓名 */ + private String userName; + + private String userPhone; + + //1:超级管理员 2:管理员 + private String userRole; + + /* 1:登录状态 2:退出状态 3:停用状态 */ + private Integer userStatus; + + private Date createTime; + + private Date loginTime; + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserNo() { + return userNo; + } + + public void setUserNo(String userNo) { + this.userNo = userNo; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserPhone() { + return userPhone; + } + + public void setUserPhone(String userPhone) { + this.userPhone = userPhone; + } + + public String getUserRole() { + return userRole; + } + + public void setUserRole(String userRole) { + this.userRole = userRole; + } + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getLoginTime() { + return loginTime; + } + + public void setLoginTime(Date loginTime) { + this.loginTime = loginTime; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ReqAddManager.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ReqAddManager.java new file mode 100644 index 0000000..66ef7e0 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ReqAddManager.java @@ -0,0 +1,76 @@ +package com.agentdriving.user.modular.system.transfer; + +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotNull; + +/** + * 添加管理员的请求bean + * + * @author fengshuonan + * @Date 2017年1月12日 下午6:46:24 + */ +public class ReqAddManager { + + // 用户姓名 + @NotNull + private String userName; + + // 用户账号 + @NotNull + private String userNo; + + // 手机号 + @NotNull + @Length(min = 11, max = 11) + private String userPhone; + + // 1:超级管理员 2:管理员 + @NotNull + private String userRole; + + // 密码 + @NotNull + private String userPassword; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserNo() { + return userNo; + } + + public void setUserNo(String userNo) { + this.userNo = userNo; + } + + public String getUserPhone() { + return userPhone; + } + + public void setUserPhone(String userPhone) { + this.userPhone = userPhone; + } + + public String getUserRole() { + return userRole; + } + + public void setUserRole(String userRole) { + this.userRole = userRole; + } + + public String getUserPassword() { + return userPassword; + } + + public void setUserPassword(String userPassword) { + this.userPassword = userPassword; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ReqEditManager.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ReqEditManager.java new file mode 100644 index 0000000..5ac5fa0 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/ReqEditManager.java @@ -0,0 +1,60 @@ +package com.agentdriving.user.modular.system.transfer; + +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotNull; + +/** + * 编辑管理员的请求 + * + * @author fengshuonan + * @Date 2017年1月15日 下午10:29:16 + */ +public class ReqEditManager { + + @NotNull + private String userId; + + /* 用户姓名 */ + @NotNull + private String userName; + + private String userPassword; + + @NotNull + @Length(min = 11, max = 11) + private String userPhone; + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserPassword() { + return userPassword; + } + + public void setUserPassword(String userPassword) { + this.userPassword = userPassword; + } + + public String getUserPhone() { + return userPhone; + } + + public void setUserPhone(String userPhone) { + this.userPhone = userPhone; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/UserDto.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/UserDto.java new file mode 100644 index 0000000..aa099d4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/transfer/UserDto.java @@ -0,0 +1,153 @@ +package com.agentdriving.user.modular.system.transfer; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * 用户传输bean + * + * @author stylefeng + * @Date 2017/5/5 22:40 + */ +public class UserDto{ + + private Integer id; + private String account; + private String password; + private String salt; + private String name; + + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date birthday; + private Integer sex; + private String email; + private String phone; + private String roleid; + private Integer deptid; + private Integer status; + private Date createtime; + private Integer version; + private String avatar; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Date getBirthday() { + return birthday; + } + + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getRoleid() { + return roleid; + } + + public void setRoleid(String roleid) { + this.roleid = roleid; + } + + public Integer getDeptid() { + return deptid; + } + + public void setDeptid(Integer deptid) { + this.deptid = deptid; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ALiSendSms.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ALiSendSms.java new file mode 100644 index 0000000..a4ab8bb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ALiSendSms.java @@ -0,0 +1,123 @@ +package com.agentdriving.user.modular.system.util; + + +import com.aliyuncs.CommonRequest; +import com.aliyuncs.CommonResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.profile.DefaultProfile; +import com.google.gson.Gson; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 阿里云短信工具类 + */ +@Component +public class ALiSendSms { + + // 设置鉴权参数,初始化客户端 + private DefaultProfile profile = DefaultProfile.getProfile( + "cn-hangzhou",// 地域ID + "LTAI4G9Zez9H4B36vakPXGy4",// 您的AccessKey ID + "BOVPUeZndKVbrPOq6Ef5j6oiydB3XZ");// 您的AccessKey Secret + private IAcsClient client = new DefaultAcsClient(profile); + + private static void log_print(String functionName, Object result) { + Gson gson = new Gson(); + System.out.println("-------------------------------" + functionName + "-------------------------------"); + System.out.println(gson.toJson(result)); + } + + /** + * 添加短信模板 + */ + public String addSmsTemplate() throws ClientException { + CommonRequest addSmsTemplateRequest = new CommonRequest(); + addSmsTemplateRequest.setSysDomain("dysmsapi.aliyuncs.com"); + addSmsTemplateRequest.setSysAction("AddSmsTemplate"); + addSmsTemplateRequest.setSysVersion("2017-05-25"); + // 短信类型。0:验证码;1:短信通知;2:推广短信;3:国际/港澳台消息 + addSmsTemplateRequest.putQueryParameter("TemplateType", "0"); + // 模板名称,长度为1~30个字符 + addSmsTemplateRequest.putQueryParameter("TemplateName", "测试短信模板"); + // 模板内容,长度为1~500个字符 + addSmsTemplateRequest.putQueryParameter("TemplateContent", "您正在申请手机注册,验证码为:${code},5分钟内有效!"); + // 短信模板申请说明 + addSmsTemplateRequest.putQueryParameter("Remark", "测试"); + CommonResponse addSmsTemplateResponse = client.getCommonResponse(addSmsTemplateRequest); + String data = addSmsTemplateResponse.getData(); + // 消除返回文本中的反转义字符 + String sData = data.replaceAll("'\'", ""); + log_print("addSmsTemplate", sData); + Gson gson = new Gson(); + // 将字符串转换为Map类型,取TemplateCode字段值 + Map map = gson.fromJson(sData, Map.class); + Object templateCode = map.get("TemplateCode"); + return templateCode.toString(); + } + + /** + * 发送短信 + */ + public String sendSms(String phone, String templateCode, String json) throws ClientException { + CommonRequest request = new CommonRequest(); + request.setSysDomain("dysmsapi.aliyuncs.com"); + request.setSysVersion("2017-05-25"); + request.setSysAction("SendSms"); + // 接收短信的手机号码 + request.putQueryParameter("PhoneNumbers", phone); + // 短信签名名称。请在控制台签名管理页面签名名称一列查看(必须是已添加、并通过审核的短信签名)。 + request.putQueryParameter("SignName", "OK出行"); + // 短信模板ID + request.putQueryParameter("TemplateCode", templateCode); + // 短信模板变量对应的实际值,JSON格式。 + request.putQueryParameter("TemplateParam", json); + CommonResponse commonResponse = client.getCommonResponse(request); + String data = commonResponse.getData(); + String sData = data.replaceAll("'\'", ""); + log_print("sendSms", sData); + return sData; + } + + /** + * 查询发送详情 + */ + private void querySendDetails(String bizId) throws ClientException { + CommonRequest request = new CommonRequest(); + request.setSysDomain("dysmsapi.aliyuncs.com"); + request.setSysVersion("2017-05-25"); + request.setSysAction("QuerySendDetails"); + // 接收短信的手机号码 + request.putQueryParameter("PhoneNumber", "156xxxxxxxx"); + // 短信发送日期,支持查询最近30天的记录。格式为yyyyMMdd,例如20191010。 + request.putQueryParameter("SendDate", "20191010"); + // 分页记录数量 + request.putQueryParameter("PageSize", "10"); + // 分页当前页码 + request.putQueryParameter("CurrentPage", "1"); + // 发送回执ID,即发送流水号。 + request.putQueryParameter("BizId", bizId); + CommonResponse response = client.getCommonResponse(request); + log_print("querySendDetails", response.getData()); + } + + public static void main(String[] args) { + ALiSendSms sendSmsDemo = new ALiSendSms(); + try { + // 创建短信模板 + String templateCode = sendSmsDemo.addSmsTemplate(); + // 使用刚创建的短信模板发送短信 + String sData = sendSmsDemo.sendSms("156xxxxxxxx", templateCode, "{\"code\":\"8888\"}"); + Gson gson = new Gson(); + Map map = gson.fromJson(sData, Map.class); + String bizId = map.get("BizId").toString(); + // 根据短信发送流水号查询短信发送情况 + sendSmsDemo.querySendDetails(bizId); + } catch (ClientException e) { + e.printStackTrace(); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/DateUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/DateUtil.java new file mode 100644 index 0000000..85f94fa --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/DateUtil.java @@ -0,0 +1,135 @@ +package com.agentdriving.user.modular.system.util; + +import com.agentdriving.user.core.util.ToolUtil; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 日期处理工具类 + */ +@Component +public class DateUtil { + + + /** + * 获取给定日期天的开始时间点或结束时间点 + * @param time 日期 + * @param type 时间点类型start一天的开始时间点,end一天的结束时间点 + * @return + */ + public Date getStartOrEndDate(Date time, String type){ + if(ToolUtil.isEmpty(time) || ToolUtil.isEmpty(type)){ + return null; + } + int hourOfDay = "start".equals(type) ? 0 : 23; + int minute = "start".equals(type) ? 0 : 59; + int second = "start".equals(type) ? 0 : 59; + int millisecond = "start".equals(type) ? 0 : 999; + Calendar s = Calendar.getInstance(); + s.setTime(time); + s.set(s.get(Calendar.YEAR), s.get(Calendar.MONTH), s.get(Calendar.DAY_OF_MONTH), hourOfDay, minute, second); + s.set(Calendar.MILLISECOND, millisecond); + return s.getTime(); + } + + + + + /** + * 获取给定日期天的起始时间和结束时间 + * @param time + * @return + */ + public Map<String, Date> getStartAndEndDate(Date time){ + if(ToolUtil.isEmpty(time)){ + return null; + } + Map<String, Date> map = new HashMap<>(); + map.put("startTime", getStartOrEndDate(time, "start")); + map.put("endTime", getStartOrEndDate(time, "end")); + return map; + } + + + + + /** + * 获取格式化的字符串日期返回日期天的起始时间和结束时间 + * @param time yyyy-MM-dd DD:mm:ss/yyyy-MM-dd + * @return + */ + public Map<String, Date> getStartAndEndDate(String time){ + if(ToolUtil.isEmpty(time)){ + return null; + } + int index = time.indexOf(" "); + String pattern = "yyyy-MM-dd DD:mm:ss"; + if(index == -1){ + pattern = "yyyy-MM-dd"; + } + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + Date date = null; + try { + date = sdf.parse(time); + } catch (ParseException e) { + e.printStackTrace(); + } + return getStartAndEndDate(date); + } + + + /** + * 获取格式化的字符串区间日期返回区间日期天的起始时间和结束时间 + * @param time yyyy-MM-dd DD:mm:ss - yyyy-MM-dd DD:mm:ss/yyyy-MM-dd - yyyy-MM-dd + * @param split 区间时间的分隔符 + * @return + */ + public List<Date> getStartAndEndDate(String time, String split){ + if(ToolUtil.isEmpty(time) || ToolUtil.isEmpty(split)){ + return null; + } + List<Date> list = new ArrayList<>(); + String[] split1 = time.split(split); + int index = split1[0].indexOf(" "); + String pattern = "yyyy-MM-dd DD:mm:ss"; + if(index == -1){ + pattern = "yyyy-MM-dd"; + } + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + Date date1 = null; + Date date2 = null; + try { + date1 = sdf.parse(split1[0]); + date2 = sdf.parse(split1[1]); + } catch (ParseException e) { + e.printStackTrace(); + } + list.add(getStartOrEndDate(date1, "start")); + list.add(getStartOrEndDate(date2, "end")); + return list; + } + + + /** + * 获取月初和月末日期 + * @param date + * @return + */ + public Map<String, Date> getMonthStartAndEnd(Date date){ + Calendar s = Calendar.getInstance(); + s.setTime(date); + s.set(Calendar.DAY_OF_MONTH, 1); + Calendar e = Calendar.getInstance(); + e.setTime(date); + e.set(Calendar.DAY_OF_MONTH, e.getActualMaximum(Calendar.DAY_OF_MONTH)); + Date start = this.getStartOrEndDate(s.getTime(), "start"); + Date end = this.getStartOrEndDate(e.getTime(), "end"); + Map<String, Date> map = new HashMap<>(); + map.put("startTime", start); + map.put("endTime", end); + return map; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/MapConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/MapConfig.java new file mode 100644 index 0000000..78e4dde --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/MapConfig.java @@ -0,0 +1,14 @@ +package com.agentdriving.user.modular.system.util.GaoDe; + +/** +* 高德地图配置 +* @author pzb +* @Date 2023/2/16 18:52 +*/ +public interface MapConfig { + + /** + * 高德key + */ + String key = "e0370a9a4d10739045fb0b8f4742a67e"; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/MapUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/MapUtil.java new file mode 100644 index 0000000..506c493 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/MapUtil.java @@ -0,0 +1,138 @@ +package com.agentdriving.user.modular.system.util.GaoDe; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.agentdriving.user.modular.system.util.GaoDe.model.District; +import com.agentdriving.user.modular.system.util.httpClinet.HttpClientUtil; +import com.agentdriving.user.modular.system.util.httpClinet.HttpResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** +* 地图工具类 +* @author pzb +* @Date 2023/2/16 18:48 +*/ +public class MapUtil { + + public static Logger logger = LoggerFactory.getLogger("ServiceLog"); + + + + + /** + * 获取两点的距离 + * @param origins 起点坐标 + * @param destination 终点坐标 + * @param type 计算类型:0:直线距离 1:驾车导航距离(仅支持国内坐标)。 + * @return + */ + public static Map<String, String> getDistance(String origins, String destination, Integer type){ + try { + String url = "https://restapi.amap.com/v3/distance?key=" + MapConfig.key + "&origins=" + origins + "&destination=" + destination + + "&type=" + type; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + if(httpResult.getCode() != 200){ + logger.debug(httpResult.getData()); + return null; + } + String data = httpResult.getData(); + JSONObject jsonObject = JSON.parseObject(data); + String status = jsonObject.getString("status"); + if(status.equals("1")){ + JSONArray results = jsonObject.getJSONArray("results"); + JSONObject jsonObject1 = results.getJSONObject(0); + Map<String, String> map = new HashMap<>(); + map.put("distance", jsonObject1.getString("distance"));//距离(米) + map.put("duration", jsonObject1.getString("duration"));//预计时间(秒) + return map; + }else{ + logger.debug(data); + } + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + + /** + * 地址转换经纬度 + * @param address + * @return + */ + public static List<String> geocoding(String address){ + try { + String url = "https://restapi.amap.com/v3/geocode/geo?key=" + MapConfig.key + "&output=JSON&address=" + address; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + if(httpResult.getCode() != 200){ + return null; + } + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + String status = jsonObject.getString("status"); + List<String> list = new ArrayList<>(); + if(status.equals("1")){ + JSONArray geocodes = jsonObject.getJSONArray("geocodes"); + for(int i = 0; i < geocodes.size(); i++){ + String location = geocodes.getJSONObject(i).getString("location"); + list.add(location); + } + } + return list; + }catch (Exception e){ + e.printStackTrace(); + return null; + } + } + + + + /** + * 根据经纬度获取行政区域信息 + * @param lon + * @param lan + * @return + * @throws Exception + */ + public static District geocode(String lon, String lan) { + try { + String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + MapConfig.key + "&location=" + lon + "," + lan; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + if(httpResult.getCode() != 200){ + return null; + } + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + Map<String, String> map = new HashMap<>(); + if(jsonObject.getString("status").equals("1")){ + JSONObject regeocode = jsonObject.getJSONObject("regeocode"); + JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); + String address = regeocode.getString("formatted_address"); + map.put("address", address); + String code = addressComponent.getString("adcode"); + String province = addressComponent.getString("province"); + String city = addressComponent.getString("city"); + String district = addressComponent.getString("district"); + District district1 = new District(); + district1.setProvince(province); + district1.setProvinceCode(code.substring(0, 2) + "0000"); + district1.setCity(city); + district1.setCityCode(code.substring(0, 4) + "00"); + district1.setDistrict(district); + district1.setDistrictCode(code); + return district1; + } + logger.debug(httpResult.getData()); + return null; + }catch (Exception e){ + e.printStackTrace(); + return null; + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/model/District.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/model/District.java new file mode 100644 index 0000000..c7bc9c3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/model/District.java @@ -0,0 +1,36 @@ +package com.agentdriving.user.modular.system.util.GaoDe.model; + +import lombok.Data; + +/** +* 行政区域 +* @author pzb +* @Date 2023/2/25 11:40 +*/ +@Data +public class District { + /** + * 省名称 + */ + private String province; + /** + * 省编号 + */ + private String provinceCode; + /** + * 市名称 + */ + private String city; + /** + * 市编号 + */ + private String cityCode; + /** + * 区县名称 + */ + private String district; + /** + * 区县编号 + */ + private String districtCode; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GeodesyUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GeodesyUtil.java new file mode 100644 index 0000000..c37435f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GeodesyUtil.java @@ -0,0 +1,73 @@ +package com.agentdriving.user.modular.system.util; + +import com.agentdriving.user.core.util.ToolUtil; +import org.gavaghan.geodesy.Ellipsoid; +import org.gavaghan.geodesy.GeodeticCalculator; +import org.gavaghan.geodesy.GeodeticCurve; +import org.gavaghan.geodesy.GlobalCoordinates; + +import java.util.HashMap; +import java.util.Map; + +/** + * 计算两个金纬度坐标之间的直线距离 + */ +public class GeodesyUtil { + + + /** + * 获取直线距离 + * @param fromLonLat + * @param toLonLat + * @return + */ + public static Map<String, Double> getDistance(String fromLonLat, String toLonLat){ + Map<String, Double> map = null; + if(ToolUtil.isNotEmpty(fromLonLat) && ToolUtil.isNotEmpty(toLonLat)){ + map = new HashMap<>(); + String[] from = fromLonLat.split(","); + String[] to = toLonLat.split(","); + GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); + GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); + double Sphere = getDistanceMeter(source, target, Ellipsoid.Sphere); + double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); + double GRS80 = getDistanceMeter(source, target, Ellipsoid.GRS80); + double GRS67 = getDistanceMeter(source, target, Ellipsoid.GRS67); + double ANS = getDistanceMeter(source, target, Ellipsoid.ANS); + double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72); + double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858); + double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880); +// System.out.println("Sphere坐标系计算结果:"+Sphere + "米"); +// System.out.println("WGS84坐标系计算结果:"+WGS84 + "米"); +// System.out.println("GRS80坐标系计算结果:"+GRS80 + "米"); +// System.out.println("GRS67坐标系计算结果:"+GRS67 + "米"); +// System.out.println("ANS坐标系计算结果:"+ANS + "米"); +// System.out.println("WGS72坐标系计算结果:"+WGS72 + "米"); +// System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米"); +// System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米"); + map.put("Sphere", Sphere); + map.put("WGS84", WGS84); + map.put("GRS80", GRS80); + map.put("GRS67", GRS67); + map.put("ANS", ANS); + map.put("WGS72", WGS72); + map.put("Clarke1858", Clarke1858); + map.put("Clarke1880", Clarke1880); + } + return map; + } + + + private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){ + //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 + GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); + return geoCurve.getEllipsoidalDistance(); + } + + + + public static void main(String[] ages){ + GeodesyUtil geodesyUtil = new GeodesyUtil(); + geodesyUtil.getDistance("115.481028,39.989643", "114.465302,40.004717"); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/JGPushUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/JGPushUtil.java new file mode 100644 index 0000000..f5cdbf0 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/JGPushUtil.java @@ -0,0 +1,92 @@ +package com.agentdriving.user.modular.system.util; + +import cn.jiguang.common.ClientConfig; +import cn.jiguang.common.resp.APIConnectionException; +import cn.jiguang.common.resp.APIRequestException; +import cn.jpush.api.JPushClient; +import cn.jpush.api.push.PushResult; +import cn.jpush.api.push.model.Platform; +import cn.jpush.api.push.model.PushPayload; +import cn.jpush.api.push.model.audience.Audience; +import cn.jpush.api.push.model.notification.Notification; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 极光推送工具类 + */ +@Component +public class JGPushUtil { + + @Value("${jiguang.appKey-driver}") + private String appKeyDriver; + + @Value("${jiguang.masterSecret-driver}") + private String masterSecretDriver; + + @Value("${jiguang.appKey-dispatch}") + private String appKeyDispatch; + + @Value("${jiguang.masterSecret-dispatch}") + private String masterSecretDispatch; + + + private PushPayload buildPushObject_all_all_alert(String content, String...tags) { + return PushPayload.newBuilder() + .setPlatform(Platform.all())//设置推送平台为全部平台 + .setAudience(Audience.alias(tags))//通过别名的方式发送(用户owner_id,员工user_id) + .setNotification(Notification.alert(content)) + .build(); + } + + + private PushPayload buildPushObject_all_all_alert(String title, String content, Map<String, String> map, String...tags) { + return PushPayload.newBuilder() + .setPlatform(Platform.all())//设置推送平台为全部平台 + .setAudience(Audience.alias(tags))//通过别名的方式发送(用户owner_id,员工user_id) + .setNotification(Notification.android(content, title, map)) + .setNotification(Notification.ios(content, map)) + .setNotification(Notification.winphone(content, map)) + .build(); + } + + + /** + * 推送 + * @param tags + * @param content + */ + public void push(Integer type, String content, String...tags){ + String masterSecret = (type == 1 ? masterSecretDriver : masterSecretDispatch); + String appKey = (type == 1 ? appKeyDriver : appKeyDispatch); + JPushClient jpushClient = new JPushClient(masterSecret, appKey, null, ClientConfig.getInstance()); + PushPayload payload = this.buildPushObject_all_all_alert(content, tags); + try { + PushResult result = jpushClient.sendPush(payload); + System.err.println(result.statusCode); + } catch (APIConnectionException e) { + e.printStackTrace(); + } catch (APIRequestException e) { + e.printStackTrace(); + } + } + + + public void push(Integer type, String content, String title, Map<String, String> map, String...tags){ + String masterSecret = (type == 1 ? masterSecretDriver : masterSecretDispatch); + String appKey = (type == 1 ? appKeyDriver : appKeyDispatch); + JPushClient jpushClient = new JPushClient(masterSecret, appKey, null, ClientConfig.getInstance()); + PushPayload payload = this.buildPushObject_all_all_alert(title, content, map, tags); + try { + PushResult result = jpushClient.sendPush(payload); + System.err.println(result.statusCode); + } catch (APIConnectionException e) { + e.printStackTrace(); + } catch (APIRequestException e) { + e.printStackTrace(); + } + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MD5AndKL.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MD5AndKL.java new file mode 100644 index 0000000..b8db987 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MD5AndKL.java @@ -0,0 +1,112 @@ +package com.agentdriving.user.modular.system.util; + +import java.security.MessageDigest; + +public class MD5AndKL { + + /** + * MD5加码。32位 + * + * @param inStr + * @return + */ + public static String MD5(String inStr) { + MessageDigest md5 = null; + try { + md5 = MessageDigest.getInstance("MD5"); + } catch (Exception e) { + throw new RuntimeException(e.toString()); + } + byte[] md5Bytes = md5.digest(inStr.getBytes()); + StringBuffer hexValue = new StringBuffer(); + for (int i = 0; i < md5Bytes.length; i++) { + int val = ((int) md5Bytes[i]) & 0xff; + if (val < 16) { + hexValue.append("0"); + } + hexValue.append(Integer.toHexString(val)); + } + return hexValue.toString(); + } + + /** + * 可逆的加密算法 + * + * @param inStr + * @return + */ + public static String KL(String inStr) { + char[] a = inStr.toCharArray(); + for (int i = 0; i < a.length; i++) { + a[i] = (char) (a[i] ^ 't'); + } + String s = new String(a); + return s; + } + + /** + * 加密后解密 + * + * @param inStr + * @return + */ + public static String JM(String inStr) { + char[] a = inStr.toCharArray(); + for (int i = 0; i < a.length; i++) { + a[i] = (char) (a[i] ^ 't'); + } + String k = new String(a); + return k; + } + + + + private static String byteArrayToHexString(byte b[]) { + StringBuffer resultSb = new StringBuffer(); + for (int i = 0; i < b.length; i++) + resultSb.append(byteToHexString(b[i])); + + return resultSb.toString(); + } + + private static String byteToHexString(byte b) { + int n = b; + if (n < 0) + n += 256; + int d1 = n / 16; + int d2 = n % 16; + return hexDigits[d1] + hexDigits[d2]; + } + + public static String MD5Encode(String origin, String charsetname) { + String resultString = null; + try { + resultString = new String(origin); + MessageDigest md = MessageDigest.getInstance("MD5"); + if (charsetname == null || "".equals(charsetname)){ + resultString = byteArrayToHexString(md.digest(resultString.getBytes())); + }else{ + resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); + } + } catch (Exception exception) { + exception.printStackTrace(); + } + return resultString; + } + + private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5", + "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }; + + public static void main(String args[]) { + + System.out.println("MD5后再加密:" + KL(MD5("123456"))); + System.out.println(MD5("123456")); + // System.out.println("加密:" + KL(MD5("123456"))); + // s = KL(s); + // System.out.println("解密:" + KL("81dc9bdb52d04dc20036dbd8313ed055")); + // System.out.println("解密:" + JM(KL(s))); + // System.out.println("解密为MD5后的:" + KL(KL(MD5(s)))); + // System.out.println(JM("5d62957bb57d3e49dcf48a0df064be4c")); + // System.out.println(MD5AndKL.KL(MD5AndKL.MD5("admin"+"87654321"))); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/config/ChannelConfig.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/config/ChannelConfig.java new file mode 100644 index 0000000..01b372f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/config/ChannelConfig.java @@ -0,0 +1,60 @@ +package com.agentdriving.user.modular.system.util.MallBook.config; + +import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; +import org.springframework.core.io.ClassPathResource; + +import java.util.Properties; + +/** + * @Author xiaogc + * @Date 2022/2/10 10:03 + */ +public class ChannelConfig { + /** + * mallbook 测试环境地址 + */ + public static String payUrl; + + /** + * 业务系统商户平台编号 + */ + public static String merchantNo; + /** + * 接口版本号,不同版本号触发不同接口业务 + */ + public static String version; + /* + * 渠道类型 HF:汇付 + */ + public static String channelType; + + /** + * 商户平台私钥路径 + */ + public static String merchantPrivateKey; + /** + * mallbook公钥路径 + */ + public static String mallBookPublicKey; + + static { + YamlPropertiesFactoryBean yamlProFb = new YamlPropertiesFactoryBean(); + yamlProFb.setResources(new ClassPathResource("application.yaml")); + Properties properties = yamlProFb.getObject(); + System.out.println("mallbook 参数配置初始化"); + System.out.println("--------------------------------"); + System.out.println("环境地址:" + properties.get("mallbook.pay_url")); + System.out.println("商户平台编号:" + properties.get("mallbook.merchant_no")); + System.out.println("接口版本号:" + properties.get("mallbook.version")); + System.out.println("渠道类型:" + properties.get("mallbook.channel_type")); + System.out.println("商户平台私钥:" + properties.get("mallbook.merchant_private_key")); + System.out.println("mallbook 公钥:" + properties.get("mallbook.mall_book_public_key")); + System.out.println("--------------------------------"); + payUrl = properties.get("mallbook.pay_url").toString(); + merchantNo = properties.get("mallbook.merchant_no").toString(); + version = properties.get("mallbook.version").toString(); + channelType = properties.get("mallbook.channel_type").toString(); + merchantPrivateKey = properties.get("mallbook.merchant_private_key").toString(); + mallBookPublicKey = properties.get("mallbook.mall_book_public_key").toString(); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Complete.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Complete.java new file mode 100644 index 0000000..6ccff8d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Complete.java @@ -0,0 +1,58 @@ +package com.agentdriving.user.modular.system.util.MallBook.model; + +import java.util.List; + +public class Complete { + /**业务类型编号,必须和接口文档一致*/ + public static String SERVICE_CODE = "complete"; + //原支付请求订单号 + private String originalMerOrderId; + //分账方列表 + private List<PamentOrderUser> splitList; + //后台回调地址 + private String notifyUrl; + //自定义参数1 + private String parameter1; + //自定义参数2 + private String parameter2; + + public String getOriginalMerOrderId() { + return originalMerOrderId; + } + + public void setOriginalMerOrderId(String originalMerOrderId) { + this.originalMerOrderId = originalMerOrderId; + } + + public List<PamentOrderUser> getSplitList() { + return splitList; + } + + public void setSplitList(List<PamentOrderUser> splitList) { + this.splitList = splitList; + } + + public String getNotifyUrl() { + return notifyUrl; + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + public String getParameter1() { + return parameter1; + } + + public void setParameter1(String parameter1) { + this.parameter1 = parameter1; + } + + public String getParameter2() { + return parameter2; + } + + public void setParameter2(String parameter2) { + this.parameter2 = parameter2; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceRequest.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceRequest.java new file mode 100644 index 0000000..86c6796 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceRequest.java @@ -0,0 +1,176 @@ +/** + * + */ +package com.agentdriving.user.modular.system.util.MallBook.model; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.agentdriving.user.modular.system.util.MallBook.config.ChannelConfig; +import com.agentdriving.user.modular.system.util.MallBook.util.RSASignature; +import com.agentdriving.user.modular.system.util.MallBook.util.StringUtil; + +import java.io.Serializable; + +/** + * 接口请求包 + * + */ +public class InterfaceRequest<T> implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -8130938432046696213L; + + + /** + * 商户平台编号 + */ + private String merchantNo = ChannelConfig.merchantNo; + + /** + * 接口版本号,不同版本号触发不同接口业务 + */ + private String version = ChannelConfig.version; + /* + * 渠道类型 HF:汇付 + */ + private String channelType = ChannelConfig.channelType; + + + /** + * 业务系统订单ID + */ + private String merOrderId; + + /** + * 签名 + */ + private String sign; + + /** + * 业务类型编号 + */ + private String serverCode; + + /** + * 业务参数,json格式 + */ + private String params; + + /** + * 时间戳 + */ + private String date; + + + public String getChannelType() { + return channelType; + } + + public void setChannelType(String channelType) { + this.channelType = channelType; + } + + public String getMerOrderId() { + return merOrderId; + } + + public void setMerOrderId(String merOrderId) { + this.merOrderId = merOrderId; + } + + public String getMerchantNo() { + return merchantNo; + } + + public void setMerchantNo(String merchantNo) { + this.merchantNo = merchantNo; + } + + public String getSign() { + return sign; + } + + public void setSign(String sign) { + this.sign = sign; + } + + public String getServerCode() { + return serverCode; + } + + public void setServerCode(String serverCode) { + this.serverCode = serverCode; + } + + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + + /** + * 签名顺序必须一致!!! + * 签名顺序必须一致!!! + * 签名顺序必须一致!!! + * 订单号 + 商户号 + 渠道类型 + 时间戳 + 业务参数json + * @return 待签名字符串 + */ + public String content() { + return StrUtil.builder() + .append(StringUtil.convertNull(merOrderId)) + .append(StringUtil.convertNull(merchantNo)) + .append(StringUtil.convertNull(channelType)) + .append(StringUtil.convertNull(date)) + .append(StringUtil.convertNull(params)) + .toString(); + } + + public InterfaceRequest() { + } + + public InterfaceRequest(T obj, String serverCode) { + this.merOrderId = IdUtil.fastSimpleUUID(); + this.serverCode = serverCode; + this.date = System.currentTimeMillis() + ""; + this.params = JSONUtil.toJsonStr(obj); + // todo 使用商户平台私钥生成sign,需要修改证书对应路径 + this.sign = RSASignature.sign(content()); + } + + + @Override + public String toString() { + return "InterfaceRequest{" + + "merOrderId='" + merOrderId + '\'' + + ", merchantNo='" + merchantNo + '\'' + + ", sign='" + sign + '\'' + + ", serverCode='" + serverCode + '\'' + + ", params='" + params + '\'' + + ", date='" + date + '\'' + + ", version='" + version + '\'' + + ", channelType='" + channelType + '\'' + + '}'; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceResponse.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceResponse.java new file mode 100644 index 0000000..c907a5a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceResponse.java @@ -0,0 +1,121 @@ +/** + * + */ +package com.agentdriving.user.modular.system.util.MallBook.model; + + +import cn.hutool.core.util.StrUtil; +import com.agentdriving.user.modular.system.util.MallBook.util.StringUtil; + +import java.io.Serializable; + + +public class InterfaceResponse implements Serializable { + + + /** + * 结果字符串,json格式 + */ + private String result; + + /** + * 签名,由code+msg+date+result根据私钥生成, 如果有参数为null,签名串中应当做空字符串("")来处理 + */ + private String sign; + + /** + * 结果代码 + */ + private String code; + + /** + * 结果信息 + */ + private String msg; + + /** + * 时间戳 + */ + private String date; + + /** + * 接口版本号 + */ + private String version; + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public String getSign() { + return sign; + } + + public void setSign(String sign) { + this.sign = sign; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @Override + public String toString() { + return "InterfaceResponse{" + + "result='" + result + '\'' + + ", sign='" + sign + '\'' + + ", code='" + code + '\'' + + ", msg='" + msg + '\'' + + ", date='" + date + '\'' + + ", version='" + version + '\'' + + '}'; + } + + /** + * 签名顺序必须一致!!! + * 签名顺序必须一致!!! + * 签名顺序必须一致!!! + * 结果代码 + 结果信息 + 渠道类型 + 时间戳 + 结果字符串json + * @return 待签名字符串 + */ + public String content() { + return StrUtil.builder() + .append(StringUtil.convertNull(code)) + .append(StringUtil.convertNull(msg)) + .append(StringUtil.convertNull(date)) + .append(StringUtil.convertNull(result)) + .toString(); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PamentOrderUser.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PamentOrderUser.java new file mode 100644 index 0000000..314c755 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PamentOrderUser.java @@ -0,0 +1,46 @@ +package com.agentdriving.user.modular.system.util.MallBook.model; + +public class PamentOrderUser { + + /** + * 分账方会员ID(必填) + */ + private String splitUserId; + + /** + * 分账金额(必填) + */ + private String splitAmount; + + /** + * 分账类型(必填) + * 0:收单金额(收款人) + * 1:分账金额 + * 2:佣金 + */ + private String splitType; + + public String getSplitUserId() { + return splitUserId; + } + + public void setSplitUserId(String splitUserId) { + this.splitUserId = splitUserId; + } + + public String getSplitAmount() { + return splitAmount; + } + + public void setSplitAmount(String splitAmount) { + this.splitAmount = splitAmount; + } + + public String getSplitType() { + return splitType; + } + + public void setSplitType(String splitType) { + this.splitType = splitType; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrder.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrder.java new file mode 100644 index 0000000..6cc876a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrder.java @@ -0,0 +1,293 @@ +package com.agentdriving.user.modular.system.util.MallBook.model; + +import java.util.List; + +public class PaymentOrder { + /**业务类型编号,必须和接口文档一致*/ + public static String SERVICE_CODE = "paymentOrder"; + /** + * 业务订单号(必填) + */ + private String bizOrderId; + + /** + * 交易金额(必填) + */ + private String amount; + + /** + * 付款人 + */ + private String payerUserName; + + /** + * 收款人会员ID(必填) + */ + private String payeeUserId; + + /** + * 订单名称(必填) + */ + private String orderName; + + /** + * 支付类型(必填) + */ + private String payType; + + /** + * 交易类型(必填) + */ + private String transferType; + + /** + * 订单过期时间 + */ + private String expire; + + /** + * 微信或支付宝的appid + */ + private String appid; + + /** + * 微信或支付宝用户id + */ + private String openid; + + /** + * 终端IP(必填) + */ + private String terminalIp; + + /** + * 分账方列表(必填) + */ + private List<PamentOrderUser> splitList; + + /** + * 商品列表(必填) + */ + private List<PaymentOrderGood> goodsDetail; + + /** + * 前台回调地址(必填) + */ + private String frontUrl; + + /** + * 后台回调地址(必填) + */ + private String notifyUrl; + + /** + * 自定义参数1 + */ + private String parameter1; + + /** + * 自定义参数2 + */ + private String parameter2; + /* + * 是否异步分账 + */ + private String asynSplitFlag; + + /** + * 付款方子商户编号 + */ + private String payerUserId; + + /** + * 银行编码 + */ + private String bankCode; + + /** + * 银行卡类型 + */ + private String cardType; + + /** + * 快捷卡唯一标识 + */ + private String tokenNo; + + + public String getPayerUserId() { + return payerUserId; + } + + public void setPayerUserId(String payerUserId) { + this.payerUserId = payerUserId; + } + + public String getBankCode() { + return bankCode; + } + + public void setBankCode(String bankCode) { + this.bankCode = bankCode; + } + + public String getCardType() { + return cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + + public String getTokenNo() { + return tokenNo; + } + + public void setTokenNo(String tokenNo) { + this.tokenNo = tokenNo; + } + + public String getAsynSplitFlag() { + return asynSplitFlag; + } + + public void setAsynSplitFlag(String asynSplitFlag) { + this.asynSplitFlag = asynSplitFlag; + } + + public String getBizOrderId() { + return bizOrderId; + } + + public void setBizOrderId(String bizOrderId) { + this.bizOrderId = bizOrderId; + } + + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public String getPayerUserName() { + return payerUserName; + } + + public void setPayerUserName(String payerUserName) { + this.payerUserName = payerUserName; + } + + public String getPayeeUserId() { + return payeeUserId; + } + + public void setPayeeUserId(String payeeUserId) { + this.payeeUserId = payeeUserId; + } + + public String getOrderName() { + return orderName; + } + + public void setOrderName(String orderName) { + this.orderName = orderName; + } + + public String getPayType() { + return payType; + } + + public void setPayType(String payType) { + this.payType = payType; + } + + public String getTransferType() { + return transferType; + } + + public void setTransferType(String transferType) { + this.transferType = transferType; + } + + public String getExpire() { + return expire; + } + + public void setExpire(String expire) { + this.expire = expire; + } + + public String getAppid() { + return appid; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public String getTerminalIp() { + return terminalIp; + } + + public void setTerminalIp(String terminalIp) { + this.terminalIp = terminalIp; + } + + public List<PamentOrderUser> getSplitList() { + return splitList; + } + + public void setSplitList(List<PamentOrderUser> splitList) { + this.splitList = splitList; + } + + public List<PaymentOrderGood> getGoodsDetail() { + return goodsDetail; + } + + public void setGoodsDetail(List<PaymentOrderGood> goodsDetail) { + this.goodsDetail = goodsDetail; + } + + public String getFrontUrl() { + return frontUrl; + } + + public void setFrontUrl(String frontUrl) { + this.frontUrl = frontUrl; + } + + public String getNotifyUrl() { + return notifyUrl; + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + public String getParameter1() { + return parameter1; + } + + public void setParameter1(String parameter1) { + this.parameter1 = parameter1; + } + + public String getParameter2() { + return parameter2; + } + + public void setParameter2(String parameter2) { + this.parameter2 = parameter2; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrderGood.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrderGood.java new file mode 100644 index 0000000..2a43d4f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrderGood.java @@ -0,0 +1,48 @@ +package com.agentdriving.user.modular.system.util.MallBook.model; + +public class PaymentOrderGood { + + /** 商品编号 */ + private String goodsId; + + /** 商品名称,必填 */ + private String goodsName; + + /** 商品数量 */ + private String quantity; + + /** 商品价格 */ + private String price; + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } + + public String getGoodsName() { + return goodsName; + } + + public void setGoodsName(String goodsName) { + this.goodsName = goodsName; + } + + public String getQuantity() { + return quantity; + } + + public void setQuantity(String quantity) { + this.quantity = quantity; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Receive.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Receive.java new file mode 100644 index 0000000..85bd40d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Receive.java @@ -0,0 +1,102 @@ +package com.agentdriving.user.modular.system.util.MallBook.model; + +import java.util.List; + +/** + * 确认收货信息参数 + */ +public class Receive { + /**业务类型编号,必须和接口文档一致*/ + public static String SERVICE_CODE = "receive"; + /** + * 原支付请求订单号(必填) + */ + private String originalMerOrderId; + /** + * 异步分账订单号(多次异步确认订单进行确认收货时必传) + */ + private String asynMerOrderId; + + /** + * 确认收货总额(必填) + * 必须大于0 + * 确认收货总额=总确认分账金额 + */ + private String rcvAmount; + + /** + * 分账方列表(必填) + */ + private List<ReceiveUser> splitList; + + /** + * 商品列表 + */ + private List<ReceiveGood> goodsDetail; + /** + * 自定义参数1 + */ + private String parameter1; + + /** + * 自定义参数2 + */ + private String parameter2; + + public String getOriginalMerOrderId() { + return originalMerOrderId; + } + + public void setOriginalMerOrderId(String originalMerOrderId) { + this.originalMerOrderId = originalMerOrderId; + } + + public String getAsynMerOrderId() { + return asynMerOrderId; + } + + public void setAsynMerOrderId(String asynMerOrderId) { + this.asynMerOrderId = asynMerOrderId; + } + + public String getRcvAmount() { + return rcvAmount; + } + + public void setRcvAmount(String rcvAmount) { + this.rcvAmount = rcvAmount; + } + + public List<ReceiveUser> getSplitList() { + return splitList; + } + + public void setSplitList(List<ReceiveUser> splitList) { + this.splitList = splitList; + } + + public List<ReceiveGood> getGoodsDetail() { + return goodsDetail; + } + + public void setGoodsDetail(List<ReceiveGood> goodsDetail) { + this.goodsDetail = goodsDetail; + } + + public String getParameter1() { + return parameter1; + } + + public void setParameter1(String parameter1) { + this.parameter1 = parameter1; + } + + public String getParameter2() { + return parameter2; + } + + public void setParameter2(String parameter2) { + this.parameter2 = parameter2; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveGood.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveGood.java new file mode 100644 index 0000000..11edf3c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveGood.java @@ -0,0 +1,48 @@ +package com.agentdriving.user.modular.system.util.MallBook.model; + +public class ReceiveGood { + + /** 商品编号 */ + private String goodsId; + + /** 商品名称,必填 */ + private String goodsName; + + /** 商品数量 */ + private String quantity; + + /** 商品价格 */ + private String price; + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } + + public String getGoodsName() { + return goodsName; + } + + public void setGoodsName(String goodsName) { + this.goodsName = goodsName; + } + + public String getQuantity() { + return quantity; + } + + public void setQuantity(String quantity) { + this.quantity = quantity; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveUser.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveUser.java new file mode 100644 index 0000000..b084d30 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveUser.java @@ -0,0 +1,27 @@ +package com.agentdriving.user.modular.system.util.MallBook.model; + + +public class ReceiveUser { + + /** 分账方会员ID,必填 */ + private String splitUserId; + + /** 确认分账金额,必填 */ + private String rcvSplitAmount; + + public String getSplitUserId() { + return splitUserId; + } + + public void setSplitUserId(String splitUserId) { + this.splitUserId = splitUserId; + } + + public String getRcvSplitAmount() { + return rcvSplitAmount; + } + + public void setRcvSplitAmount(String rcvSplitAmount) { + this.rcvSplitAmount = rcvSplitAmount; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Base64.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Base64.java new file mode 100644 index 0000000..058e621 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Base64.java @@ -0,0 +1,288 @@ +package com.agentdriving.user.modular.system.util.MallBook.util; + +/** + * @Author xiaogc + * @Date 2021/12/21 14:23 + */ +public class Base64 { + static private final int BASELENGTH = 128; + static private final int LOOKUPLENGTH = 64; + static private final int TWENTYFOURBITGROUP = 24; + static private final int EIGHTBIT = 8; + static private final int SIXTEENBIT = 16; + static private final int FOURBYTE = 4; + static private final int SIGN = -128; + static private final char PAD = '='; + static private final boolean fDebug = false; + static final private byte[] base64Alphabet = new byte[BASELENGTH]; + static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; + + static { + for (int i = 0; i < BASELENGTH; ++i) { + base64Alphabet[i] = -1; + } + for (int i = 'Z'; i >= 'A'; i--) { + base64Alphabet[i] = (byte) (i - 'A'); + } + for (int i = 'z'; i >= 'a'; i--) { + base64Alphabet[i] = (byte) (i - 'a' + 26); + } + + for (int i = '9'; i >= '0'; i--) { + base64Alphabet[i] = (byte) (i - '0' + 52); + } + + base64Alphabet['+'] = 62; + base64Alphabet['/'] = 63; + + for (int i = 0; i <= 25; i++) { + lookUpBase64Alphabet[i] = (char) ('A' + i); + } + + for (int i = 26, j = 0; i <= 51; i++, j++) { + lookUpBase64Alphabet[i] = (char) ('a' + j); + } + + for (int i = 52, j = 0; i <= 61; i++, j++) { + lookUpBase64Alphabet[i] = (char) ('0' + j); + } + lookUpBase64Alphabet[62] = (char) '+'; + lookUpBase64Alphabet[63] = (char) '/'; + + } + + private static boolean isWhiteSpace(char octect) { + return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); + } + + private static boolean isPad(char octect) { + return (octect == PAD); + } + + private static boolean isData(char octect) { + return (octect < BASELENGTH && base64Alphabet[octect] != -1); + } + + /** + * Encodes hex octects into Base64 + * + * @param binaryData + * Array containing binaryData + * @return Encoded Base64 array + */ + public static String encode(byte[] binaryData) { + + if (binaryData == null) { + return null; + } + + int lengthDataBits = binaryData.length * EIGHTBIT; + if (lengthDataBits == 0) { + return ""; + } + + int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; + int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; + int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 + : numberTriplets; + char encodedData[] = null; + + encodedData = new char[numberQuartet * 4]; + + byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; + + int encodedIndex = 0; + int dataIndex = 0; + if (fDebug) { + System.out.println("number of triplets = " + numberTriplets); + } + + for (int i = 0; i < numberTriplets; i++) { + b1 = binaryData[dataIndex++]; + b2 = binaryData[dataIndex++]; + b3 = binaryData[dataIndex++]; + + if (fDebug) { + System.out.println("b1= " + b1 + ", b2= " + b2 + ", b3= " + b3); + } + + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) + : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) + : (byte) ((b2) >> 4 ^ 0xf0); + byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) + : (byte) ((b3) >> 6 ^ 0xfc); + + if (fDebug) { + System.out.println("val2 = " + val2); + System.out.println("k4 = " + (k << 4)); + System.out.println("vak = " + (val2 | (k << 4))); + } + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; + } + + // form integral number of 6-bit groups + if (fewerThan24bits == EIGHTBIT) { + b1 = binaryData[dataIndex]; + k = (byte) (b1 & 0x03); + if (fDebug) { + System.out.println("b1=" + b1); + System.out.println("b1<<2 = " + (b1 >> 2)); + } + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) + : (byte) ((b1) >> 2 ^ 0xc0); + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; + encodedData[encodedIndex++] = PAD; + encodedData[encodedIndex++] = PAD; + } else if (fewerThan24bits == SIXTEENBIT) { + b1 = binaryData[dataIndex]; + b2 = binaryData[dataIndex + 1]; + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) + : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) + : (byte) ((b2) >> 4 ^ 0xf0); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; + encodedData[encodedIndex++] = PAD; + } + + return new String(encodedData); + } + + /** + * Decodes Base64 data into octects + * + * @param encoded + * string containing Base64 data + * @return Array containind decoded data. + */ + public static byte[] decode(String encoded) { + + if (encoded == null) { + return null; + } + + char[] base64Data = encoded.toCharArray(); + // remove white spaces + int len = removeWhiteSpace(base64Data); + + if (len % FOURBYTE != 0) { + return null;// should be divisible by four + } + + int numberQuadruple = (len / FOURBYTE); + + if (numberQuadruple == 0) { + return new byte[0]; + } + + byte decodedData[] = null; + byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; + char d1 = 0, d2 = 0, d3 = 0, d4 = 0; + + int i = 0; + int encodedIndex = 0; + int dataIndex = 0; + decodedData = new byte[(numberQuadruple) * 3]; + + for (; i < numberQuadruple - 1; i++) { + + if (!isData((d1 = base64Data[dataIndex++])) + || !isData((d2 = base64Data[dataIndex++])) + || !isData((d3 = base64Data[dataIndex++])) + || !isData((d4 = base64Data[dataIndex++]))) { + return null; + }// if found "no data" just return null + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + } + + if (!isData((d1 = base64Data[dataIndex++])) + || !isData((d2 = base64Data[dataIndex++]))) { + return null;// if found "no data" just return null + } + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + + d3 = base64Data[dataIndex++]; + d4 = base64Data[dataIndex++]; + if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters + if (isPad(d3) && isPad(d4)) { + if ((b2 & 0xf) != 0)// last 4 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 1]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + return tmp; + } else if (!isPad(d3) && isPad(d4)) { + b3 = base64Alphabet[d3]; + if ((b3 & 0x3) != 0)// last 2 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 2]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + return tmp; + } else { + return null; + } + } else { // No PAD e.g 3cQl + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + + } + + return decodedData; + } + + /** + * remove WhiteSpace from MIME containing encoded Base64 data. + * + * @param data + * the byte array of base64 data (with WS) + * @return the new length + */ + private static int removeWhiteSpace(char[] data) { + if (data == null) { + return 0; + } + + // count characters that's not whitespace + int newSize = 0; + int len = data.length; + for (int i = 0; i < len; i++) { + if (!isWhiteSpace(data[i])) { + data[newSize++] = data[i]; + } + } + return newSize; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/CacheUtils.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/CacheUtils.java new file mode 100644 index 0000000..7d1bea0 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/CacheUtils.java @@ -0,0 +1,39 @@ +package com.agentdriving.user.modular.system.util.MallBook.util; + +import cn.hutool.cache.CacheUtil; +import cn.hutool.cache.impl.TimedCache; + +/** + * @author linqy + * 缓存工具类,生产建议使用其他缓存中间件 + */ +public class CacheUtils { + private static final TimedCache<String, String> TIMED_CACHE = CacheUtil.newTimedCache(5000); + + static { + /** 每1s检查一次过期 */ + TIMED_CACHE.schedulePrune(1000); + } + + /** + * 存入键值对,提供消逝时间 + * + * @param key + * @param value + * @param timeout + */ + public static void put(String key, String value, Long timeout) { + /** 设置消逝时间 */ + TIMED_CACHE.put(key, value, timeout); + } + + /** + * 每次重新get一次缓存,均会重新刷新消逝时间 + * @param key + * @return + */ + public static String get(String key) { + return TIMED_CACHE.get(key); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSAEncryptGeneration.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSAEncryptGeneration.java new file mode 100644 index 0000000..877829d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSAEncryptGeneration.java @@ -0,0 +1,65 @@ +package com.agentdriving.user.modular.system.util.MallBook.util; +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; + +/** + * 公私钥代码生成 + * @Author xiaogc + * @Date 2021/12/21 14:22 + */ +public class RSAEncryptGeneration { + + public static void main(String[] args) { + // 生成一对公私钥到指定路径下 .pfx私钥 .cer公钥 + RSAEncryptGeneration.genKeyPair("D:\\tools"); + } + /** + * 随机生成密钥对 + */ + public static void genKeyPair(String filePath) { + // KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象 + KeyPairGenerator keyPairGen = null; + try { + keyPairGen = KeyPairGenerator.getInstance("RSA"); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + // 初始化密钥对生成器,密钥大小为96-1024位 + keyPairGen.initialize(1024, new SecureRandom()); + // 生成一个密钥对,保存在keyPair中 + KeyPair keyPair = keyPairGen.generateKeyPair(); + // 得到私钥 + RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); + // 得到公钥 + RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); + try { + // 得到公钥字符串 + String publicKeyString = Base64.encode(publicKey.getEncoded()); + System.out.println("公钥字符串:"+publicKeyString); + // 得到私钥字符串 + String privateKeyString = Base64.encode(privateKey.getEncoded()); + System.out.println("私钥字符串:"+privateKeyString); + // 将密钥对写入到文件 .pfx私钥 .cer公钥 + FileWriter pubfw = new FileWriter(filePath + "/merchant_no.cer"); + FileWriter prifw = new FileWriter(filePath + "/merchant_no.pfx"); + BufferedWriter pubbw = new BufferedWriter(pubfw); + BufferedWriter pribw = new BufferedWriter(prifw); + pubbw.write(publicKeyString); + pribw.write(privateKeyString); + pubbw.flush(); + pubbw.close(); + pubfw.close(); + pribw.flush(); + pribw.close(); + prifw.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSASignature.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSASignature.java new file mode 100644 index 0000000..1513b73 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSASignature.java @@ -0,0 +1,118 @@ +package com.agentdriving.user.modular.system.util.MallBook.util; + + +import com.agentdriving.user.modular.system.util.MallBook.config.ChannelConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.security.KeyFactory; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +/** + * @author RSA签名验签类 + */ +public class RSASignature { + + public static Logger logger = LoggerFactory.getLogger(RSASignature.class); + + /** + * 签名算法 + */ + public static final String SIGN_ALGORITHMS = "SHA1WithRSA"; + + + /** + * 商户平台私钥签名 + * + * @param content + * @return + */ + public static String sign(String content) { + try { + String privateKey = ChannelConfig.merchantPrivateKey; + PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.decode(privateKey)); + KeyFactory keyf = KeyFactory.getInstance("RSA"); + PrivateKey priKey = keyf.generatePrivate(priPKCS8); + java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS); + signature.initSign(priKey); + signature.update(content.getBytes()); + byte[] signed = signature.sign(); + return Base64.encode(signed); + } catch (Exception e) { + logger.error("签名失败{}", e); + } + return null; + } + + + /** + * 读取证书 + * + * @param filePath 证书文件路径 + */ + public static String loadKey(String filePath) throws Exception { + try (BufferedReader br = new BufferedReader(new FileReader(filePath))) { + String readLine; + StringBuilder sb = new StringBuilder(); + while ((readLine = br.readLine()) != null) { + sb.append(readLine); + } + return sb.toString(); + } catch (IOException e) { + throw new Exception("私钥数据读取错误"); + } catch (NullPointerException e) { + throw new Exception("私钥输入流为空"); + } + } + + + /** + * mallbook公钥验签 + * + * @param content 待签名数据 + * @param sign 签名值 + * @return false 验签失败 true 成功 + */ + public static boolean validate(String content, String sign) { + boolean verify = false; + try { + String publicKey = ChannelConfig.mallBookPublicKey; + verify = RSASignature.doCheck(content, sign, publicKey, "utf-8"); + } catch (Exception e) { + logger.error("验签失败:{}", e); + } + return verify; + } + + + /** + * RSA验签 + * + * @param content 待签名数据 + * @param sign 签名值 + * @param publicKey 分配给开发商公钥 + * @param encode 字符集编码 + * @return 布尔值 + */ + public static boolean doCheck(String content, String sign, String publicKey, String encode) { + try { + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + byte[] encodedKey = Base64.decode(publicKey); + PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); + java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS); + signature.initVerify(pubKey); + signature.update(content.getBytes(encode)); + return signature.verify(Base64.decode(sign)); + } catch (Exception e) { + logger.error("验签失败{}", e); + } + return false; + } + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/StringUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/StringUtil.java new file mode 100644 index 0000000..ea0267c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/StringUtil.java @@ -0,0 +1,23 @@ + +package com.agentdriving.user.modular.system.util.MallBook.util; + +import cn.hutool.core.util.StrUtil; + + +public class StringUtil extends StrUtil { + + /** + * null转为空字符串 + * + * @param str + * @return + */ + public static String convertNull(String str) { + if (str == null) { + return ""; + } + return str; + } + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Transfer.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Transfer.java new file mode 100644 index 0000000..d3441d2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Transfer.java @@ -0,0 +1,76 @@ +package com.agentdriving.user.modular.system.util.MallBook.util; + +public class Transfer { + /**业务类型编号,必须和接口文档一致*/ + public static String SERVICE_CODE = "transfer"; + //充值订单号 + private String depositMerOrderId; + //收款方子商户号 + private String toUserId; + //转账金额 + private String amount; + //订单信息 + private String orderName; + //后台回调地址 + private String notifyUrl; + //自定义参数1 + private String parameter1; + //自定义参数2 + private String parameter2; + + public String getDepositMerOrderId() { + return depositMerOrderId; + } + + public void setDepositMerOrderId(String depositMerOrderId) { + this.depositMerOrderId = depositMerOrderId; + } + + public String getToUserId() { + return toUserId; + } + + public void setToUserId(String toUserId) { + this.toUserId = toUserId; + } + + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public String getOrderName() { + return orderName; + } + + public void setOrderName(String orderName) { + this.orderName = orderName; + } + + public String getNotifyUrl() { + return notifyUrl; + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + public String getParameter1() { + return parameter1; + } + + public void setParameter1(String parameter1) { + this.parameter1 = parameter1; + } + + public String getParameter2() { + return parameter2; + } + + public void setParameter2(String parameter2) { + this.parameter2 = parameter2; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/TrhRequest.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/TrhRequest.java new file mode 100644 index 0000000..0aab384 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/TrhRequest.java @@ -0,0 +1,31 @@ +package com.agentdriving.user.modular.system.util.MallBook.util; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.exceptions.ValidateException; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.agentdriving.user.modular.system.util.MallBook.config.ChannelConfig; +import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceRequest; +import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceResponse; + +/** + * @Author xiaogc + * @Date 2022/1/24 13:45 + */ +public class TrhRequest<T> { + + public InterfaceResponse execute(T t, String serverCode) { + InterfaceRequest<T> request = new InterfaceRequest(t, serverCode); + System.out.println("mallbook请求参数:" + JSONUtil.toJsonStr(request)); + String result = HttpUtil.post(ChannelConfig.payUrl, BeanUtil.beanToMap(request)); + System.out.println("mallbook响应参数:" + result); + InterfaceResponse response = JSONUtil.toBean(result, InterfaceResponse.class); + boolean verify = RSASignature.validate(response.content(), response.getSign()); + if (!verify) { + throw new ValidateException("签名验证失败"); + } else { + System.out.printf("签名验证通过"); + } + return response; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PayMoneyUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PayMoneyUtil.java new file mode 100644 index 0000000..1015904 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PayMoneyUtil.java @@ -0,0 +1,1196 @@ +package com.agentdriving.user.modular.system.util; + +import com.agentdriving.user.core.util.ToolUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alipay.api.AlipayApiException; +import com.alipay.api.AlipayClient; +import com.alipay.api.CertAlipayRequest; +import com.alipay.api.DefaultAlipayClient; +import com.alipay.api.domain.AlipayTradeAppPayModel; +import com.alipay.api.domain.AlipayTradeRefundModel; +import com.alipay.api.request.*; +import com.alipay.api.response.*; +import com.agentdriving.user.modular.system.util.httpClinet.HttpClientUtil; +import org.apache.commons.collections.map.HashedMap; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.SecretKeySpec; +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.math.BigDecimal; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.Security; +import java.util.*; + +/** + * 第三方支付工具类 + */ +@Component +public class PayMoneyUtil { + + @Value("${alipay.appid}") + private String aliAppid;//支付宝appid + + @Value("${alipay.appPrivateKey}") + private String appPrivateKey;//支付宝开发者应用私钥 + + @Value("${alipay.alipayPublicKey}") + private String alipayPublicKey;//支付宝应用公钥 + + @Value("${alipay.alipay_public_key}") + private String alipay_public_key;//支付宝支付公钥 + + @Value("${wx.appid}") + private String appid;//微信appid + + @Value("${wx.appletsAppid}") + private String appletsAppid;//微信小程序appid + + @Value("${wx.mchId}") + private String mchId;//微信商户号 + + @Value("${wx.key}") + private String key;//微信商户号 + + @Value("${callbackPath}") + private String callbackPath;//支付回调网关地址 + + private String app_cert_path = "/usr/local/server/app/cer/zhifubao/user/app_cert_path.crt";//应用公钥证书路径 + + private String alipay_cert_path = "/usr/local/server/app/cer/zhifubao/user/alipay_cert_path.crt";//支付宝公钥证书文件路径 + + private String alipay_root_cert_path = "/usr/local/server/app/cer/zhifubao/user/alipay_root_cert_path.crt";//支付宝CA根证书文件路径 + + private String weixin_cert_path = "/usr/local/server/app/cert/weixin/apiclient_cert.p12";//微信支付证书 + + private Map<String, JSONObject> order = new HashMap<>();//存储支付订单用于主动查询支付结果 + + + /** + * 支付宝支付 + */ + public ResultUtil alipay(String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl){ +// //构造client +// CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); +// //设置网关地址 +// certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); +// //设置应用Id +// certAlipayRequest.setAppId(aliAppid); +// //设置应用私钥 +// certAlipayRequest.setPrivateKey(appPrivateKey); +// //设置请求格式,固定值json +// certAlipayRequest.setFormat("json"); +// //设置字符集 +// certAlipayRequest.setCharset("UTF-8"); +// //设置签名类型 +// certAlipayRequest.setSignType("RSA2"); +// //设置应用公钥证书路径 +// certAlipayRequest.setCertPath(app_cert_path); +// //设置支付宝公钥证书路径 +// certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); +// //设置支付宝根证书路径 +// certAlipayRequest.setRootCertPath(alipay_root_cert_path); +// //构造client +// AlipayClient alipayClient = null; +// try { +// alipayClient = new DefaultAlipayClient(certAlipayRequest); +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// } +// //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay +// AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); +// //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 +// AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); +// model.setBody(body); +// model.setSubject (subject); +// model.setOutTradeNo (outTradeNo); +// model.setTimeoutExpress ("30m" ); +// model.setTotalAmount (amount); +// model.setProductCode ( "QUICK_MSECURITY_PAY" ); +// model.setPassbackParams(passbackParams);//自定义参数 +// request.setBizModel ( model ); +// request.setNotifyUrl (callbackPath + notifyUrl); +// try { +// //这里和普通的接口调用不同,使用的是sdkExecute +// AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); +// Map<String, String> map = new HashMap<>(); +// map.put("orderString", response.getBody()); +// System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 +// return ResultUtil.success(map); +// } catch (AlipayApiException e ) { +// e.printStackTrace(); +// } + + + //实例化客户端 + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); + //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay + AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); + //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 + AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); + model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 + model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 + model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 + model.setTimeoutExpress("30m"); + model.setTotalAmount(amount);//付款金额 + model.setProductCode("QUICK_MSECURITY_PAY"); + model.setPassbackParams(passbackParams);//自定义参数 + request.setBizModel(model); + request.setNotifyUrl(callbackPath + notifyUrl); + try { + //这里和普通的接口调用不同,使用的是sdkExecute + AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); + Map<String, String> map = new HashMap<>(); + map.put("orderString", response.getBody()); + System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 + return ResultUtil.success(map); + } catch (AlipayApiException e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 支付宝扫码支付下单 + * @param body + * @param subject + * @param outTradeNo + * @param amount + * @param notifyUrl + * @return + */ + public ResultUtil aliScanCodePay(String body, String subject, String outTradeNo, String amount, String notifyUrl){ + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); //获得初始化的AlipayClient + AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();//创建API对应的request类 + request.setBizContent("{" + + " \"out_trade_no\":\"" + outTradeNo + "\"," +//商户订单号 + " \"total_amount\":\"" + 1 + "\"," + + " \"subject\":\"" + subject + "\"," + + " \"notify_url\":\"" + callbackPath + notifyUrl + "\"," + + " \"body\":\"" + body + "\"," + + " \"store_id\":\"NJ_001\"," + + " \"timeout_express\":\"90m\"}");//订单允许的最晚付款时间 + AlipayTradePrecreateResponse response = null; + try { + response = alipayClient.execute(request); + } catch (AlipayApiException e) { + e.printStackTrace(); + } + JSONObject alipay_trade_precreate_response = JSON.parseObject(response.getBody()).getJSONObject("alipay_trade_precreate_response"); + + System.err.print(alipay_trade_precreate_response.getString("qr_code")); + return ResultUtil.success(alipay_trade_precreate_response.getString("qr_code")); + } + + + /** + * 支付成功后的回调处理逻辑 + * @param request + */ + public Map<String, String> alipayCallback(HttpServletRequest request){ + //获取支付宝POST过来反馈信息 + Map<String,String> params = new HashMap<String,String>(); + Map requestParams = request.getParameterMap(); + for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { + String name = (String) iter.next(); + String[] values = (String[]) requestParams.get(name); + String valueStr = ""; + for (int i = 0; i < values.length; i++) { + valueStr = (i == values.length - 1) ? valueStr + values[i] + : valueStr + values[i] + "_"; + } + //乱码解决,这段代码在出现乱码时使用。 + //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8"); + params.put(name, valueStr); + } + //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。 + //boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type) +// try { +// boolean flag = AlipaySignature.rsaCheckV1(params, alipay_public_key, "UTF-8","RSA2"); +// if(flag){ +// Map<String, String> map = new HashMap<>(); +// String out_trade_no = params.get("out_trade_no"); +// String subject = params.get("subject"); +// String total_amount = params.get("total_amount"); +// String trade_no = params.get("trade_no"); +// String passback_params = params.get("passback_params"); +// map.put("out_trade_no", out_trade_no);//商家订单号 +// map.put("subject", subject); +// map.put("total_amount", total_amount); +// map.put("trade_no", trade_no);//支付宝交易号 +// map.put("passback_params", passback_params);//回传参数 +// return map; +// }else{ +// System.err.println("验签失败"); +// } +// +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// } +// return null; + + + Map<String, String> map = new HashMap<>(); + String out_trade_no = params.get("out_trade_no"); + String subject = params.get("subject"); + String total_amount = params.get("total_amount"); + String trade_no = params.get("trade_no"); + String passback_params = params.get("passback_params"); + map.put("out_trade_no", out_trade_no);//商家订单号 + map.put("subject", subject); + map.put("total_amount", total_amount); + map.put("trade_no", trade_no);//支付宝交易号 + map.put("passback_params", passback_params);//回传参数 + return map; + } + + + /** + * 支付宝查询订单支付状态 + * @param out_trade_no + * @return + * @throws Exception + */ + public ResultUtil queryALIOrder(String out_trade_no) throws Exception{ + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",aliAppid, appPrivateKey,"json","UTF-8", alipay_public_key,"RSA2"); + AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); + request.setBizContent("{" + + "\"out_trade_no\":" + out_trade_no + + " }"); + AlipayTradeQueryResponse response = alipayClient.execute(request); + if(response.isSuccess()){ + String tradeStatus = response.getTradeStatus();//交易状态:WAIT_BUYER_PAY(交易创建,等待买家付款)、TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、TRADE_SUCCESS(交易支付成功)、TRADE_FINISHED(交易结束,不可退款) + return ResultUtil.success(tradeStatus); + } else { + return ResultUtil.error(response.getMsg()); + } + } + + + + /** + * 微信统一下单 + * @param body 商品描述 + * @param attach 附加数据 + * @param out_trade_no 商户订单号 + * @param total_fee 标价金额 + * @param notify_url 通知地址 + * @param tradeType 交易类型 + * @return + */ + public ResultUtil weixinpay(String body, String attach, String out_trade_no, String total_fee, String notify_url, String tradeType, String openId) throws Exception{ + if("JSAPI".equals(tradeType) && ToolUtil.isEmpty(openId)){ + return ResultUtil.error("请先用微信登录后再进行支付"); + } + int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); + String hostAddress = null; + try { + hostAddress = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + String nonce_str = UUIDUtil.getRandomCode(16); + Map<String, Object> map = new HashMap<>(); + map.put("appid", "APP".equals(tradeType) ? appid : appletsAppid); + map.put("mch_id", mchId); + map.put("nonce_str", nonce_str); + map.put("body", body); + map.put("attach", attach);//存储订单id + map.put("out_trade_no", out_trade_no);//存储的订单code + map.put("total_fee", i); + map.put("spbill_create_ip", hostAddress); + map.put("notify_url", callbackPath + notify_url); + map.put("trade_type", tradeType); + if("JSAPI".equals(tradeType)){ + map.put("openid", openId); + } + String s = this.weixinSignature(map); + map.put("sign", s); + + String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; + //设置请求头 + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_XML); + StringBuffer xmlString = new StringBuffer(); + Set<String> strings = map.keySet(); + String[] keys = {}; + keys = strings.toArray(keys); + Arrays.sort(keys); + xmlString.append("<xml>"); + for(int l = 0; l < keys.length; l++){ + xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); + } + xmlString.append("</xml>"); + + Map<String, String> map1 = null; + String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); + //将结果xml解析成map + body1 = body1.replaceAll("<!\\[CDATA\\[",""); + body1 = body1.replaceAll("]]>", ""); + try { + map1 = this.xmlToMap(body1, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); + } + String return_code = map1.get("return_code"); + if("SUCCESS".equals(return_code)){ + String result_code = map1.get("result_code"); + if("SUCCESS".equals(result_code)){ + String type = map1.get("trade_type"); + String prepay_id = map1.get("prepay_id"); + switch (type){ + case "JSAPI": + //重新进行签名后返回给前端 + Map<String, Object> map2 = new HashMap<>(); + map2.put("appId", map1.get("appid")); + map2.put("nonceStr", map1.get("nonce_str")); + map2.put("package", "prepay_id=" + prepay_id); + map2.put("signType", "MD5"); + map2.put("timeStamp", new Date().getTime() + ""); + String s2 = this.weixinSignature(map2); + + map2.put("prepay_id", prepay_id); + map2.put("mch_id", map1.get("mch_id")); + map2.put("trade_type", map1.get("trade_type")); + + map2.put("sign", s2); + return ResultUtil.success(map2); + case "NATIVE": + String code_url = map1.get("code_url"); + return ResultUtil.success(code_url); + case "APP": + //重新进行签名后返回给前端 + Map<String, Object> map3 = new HashMap<>(); + map3.put("appid", appid); + map3.put("noncestr", nonce_str); + map3.put("package", "Sign=WXPay"); + map3.put("partnerid", mchId); + map3.put("prepayid", prepay_id); + map3.put("timestamp", new Date().getTime() / 1000); + String s1 = this.weixinSignature(map3); + map3.put("sign", s1); + System.err.println(map3); + return ResultUtil.success(map3); + } + return null; + }else{ + System.err.println(map1.get("err_code_des")); + return ResultUtil.error(map1.get("err_code_des")); + } + }else{ + System.err.println(map1.get("return_msg") + appid + "----" + mchId); + return ResultUtil.error(map1.get("return_msg"), new JSONObject()); + } + } + + + + + + /** + * 微信支付成功后的回调处理 + * @param request + */ + public Map<String, String> weixinpayCallback(HttpServletRequest request){ + try { + String param = this.getParam(request); + param = param.replaceAll("<!\\[CDATA\\[",""); + param = param.replaceAll("]]>", ""); + Map<String, String> map = this.xmlToMap(param, "UTF-8"); + String return_code = map.get("return_code"); + if("SUCCESS".equals(return_code)){ + String result_code = map.get("result_code"); + if("SUCCESS".equals(result_code)){ + Map<String, String> map1 = new HashedMap(); + map1.put("nonce_str", map.get("nonce_str")); + map1.put("out_trade_no", map.get("out_trade_no"));//存储的订单code + map1.put("attach", map.get("attach"));//存储订单id + map1.put("total_fee", map.get("total_fee")); + map1.put("transaction_id", map.get("transaction_id"));//微信支付订单号 + String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; + map1.put("result", result); + return map1; + }else{ + System.err.println(map.get("err_code_des")); + } + }else{ + System.err.println(map.get("return_msg")); + } + } catch (IOException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 微信扫码收款 + * @param body 商品描述 + * @param attach 附加数据 + * @param nonce_str 随机字符串 + * @param out_trade_no 商户订单号 + * @param total_fee 订单金额 + * @param auth_code 授权码 扫码支付授权码,设备读取用户微信中的条码或者二维码信息(注:用户付款码条形码规则:18位纯数字,以10、11、12、13、14、15开头) + * @return + */ + public ResultUtil wxScanQRCodePay(String body, String attach, String nonce_str, String out_trade_no, String total_fee, String auth_code) throws Exception{ + int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); + String hostAddress = null; + try { + InetAddress address = InetAddress.getLocalHost(); + hostAddress = address.getHostAddress(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + String randomCode = null; + try { + randomCode = UUIDUtil.getRandomCode(10); + } catch (Exception e) { + e.printStackTrace(); + } + Map<String, Object> map = new HashMap<>(); + map.put("appid", appid); + map.put("mch_id", mchId); + map.put("nonce_str", nonce_str);//存储的支付人员id,员工扫描二维码支付的时候存储的是收款员工id + map.put("body", body); + map.put("attach", attach);//存储的费用月份数据,员工扫描二维码支付的时候存储的是收费项id + map.put("out_trade_no", randomCode + "_" + out_trade_no);//存储的房间id + map.put("total_fee", i); + map.put("spbill_create_ip", hostAddress); + map.put("auth_code", auth_code); + String s = this.weixinSignature(map); + map.put("sign", s); + + String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; + //设置请求头 + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_XML); + StringBuffer xmlString = new StringBuffer(); + Set<String> strings = map.keySet(); + String[] keys = {}; + keys = strings.toArray(keys); + Arrays.sort(keys); + xmlString.append("<xml>"); + for(int l = 0; l < keys.length; l++){ + xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); + } + xmlString.append("</xml>"); + + Map<String, String> map1 = null; + String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); + //将结果xml解析成map + body1 = body1.replaceAll("<!\\[CDATA\\[",""); + body1 = body1.replaceAll("]]>", ""); + try { + map1 = this.xmlToMap(body1, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); + } + String return_code = map1.get("return_code"); + if("SUCCESS".equals(return_code)){ + String result_code = map1.get("result_code"); + if("SUCCESS".equals(result_code)){ + String type = map1.get("trade_type"); + switch (type){ + case "JSAPI": + break; + case "NATIVE": + String code_url = map1.get("code_url"); + return ResultUtil.success(code_url); + case "APP": + String prepay_id = map1.get("prepay_id"); + //重新进行签名后返回给前端 + Map<String, Object> map2 = new HashMap<>(); + map2.put("appid", appid); + map2.put("noncestr", nonce_str); + map2.put("package", "Sign=WXPay"); + map2.put("partnerid", mchId); + map2.put("prepayid", prepay_id); + map2.put("timestamp", new Date().getTime() + ""); + String s1 = this.weixinSignature(map2); + + map2.put("pac", "Sign=WXPay"); + map2.put("sign", s1); +// System.err.println(map2); + return ResultUtil.success(map2); + } + return null; + }else{ +// System.err.println(map1.get("err_code_des")); + return ResultUtil.error(map1.get("err_code_des")); + } + }else{ +// System.err.println(map1.get("return_msg") + appid + "----" + mchId); + return ResultUtil.error(map1.get("return_msg"), new JSONObject()); + } + } + + + /** + * 支付宝扫码收款 + * @param data + * @return + */ + public Object aliScanQRCodePay(String data){ + return null; + } + + + /** + * 微信退款申请 + * @param transaction_id 微信订单号。微信生成的订单号,在支付通知中有返回 + * @param out_refund_no 商户退款单号。商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 + * @param total_fee 订单金额。订单总金额,单位为分,只能为整数 + * @param refund_fee 退款金额。退款总金额,订单总金额,单位为分,只能为整数 + * @param notify_url 退款结果通知url。异步接收微信支付退款结果通知的回调地址,通知URL必须为外网可访问的url,不允许带参数 如果参数中传了notify_url,则商户平台上配置的回调地址将不会生效。 + * @return + */ + public Map<String, String> wxRefund(String transaction_id, String out_refund_no, String total_fee, String refund_fee, String notify_url){ + int tf = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); + int rf = new BigDecimal(refund_fee).multiply(new BigDecimal("100")).intValue(); + String nonce_str = UUIDUtil.getRandomCode(); + Map<String, Object> map = new HashMap<>(); + map.put("appid", appid); + map.put("mch_id", mchId); + map.put("nonce_str", nonce_str); + map.put("transaction_id", transaction_id); + map.put("out_refund_no", out_refund_no); + map.put("total_fee", tf); + map.put("refund_fee", rf); + map.put("notify_url", callbackPath + notify_url); + String s = this.weixinSignature(map, key); + map.put("sign", s); + + String url = "https://api.mch.weixin.qq.com/secapi/pay/refund"; + //设置请求头 + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_XML); + StringBuffer xmlString = new StringBuffer(); + Set<String> strings = map.keySet(); + String[] keys = {}; + keys = strings.toArray(keys); + Arrays.sort(keys); + xmlString.append("<xml>"); + for(int l = 0; l < keys.length; l++){ + xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); + } + xmlString.append("</xml>"); + + Map<String, String> map1 = null; + String body1 = null; + try { + body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, weixin_cert_path, "PKCS12"); + } catch (Exception e) { + e.printStackTrace(); + } + System.err.println(body1); + //将结果xml解析成map + body1 = body1.replaceAll("<!\\[CDATA\\[",""); + body1 = body1.replaceAll("]]>", ""); + try { + map1 = this.xmlToMap(body1, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); + } + String return_code = map1.get("return_code"); + Map<String, String> map2 = new HashMap<>(); + if("SUCCESS".equals(return_code)){ + String result_code = map1.get("result_code"); + if("SUCCESS".equals(result_code)){ + map2.put("return_code", result_code); + map2.put("refund_id", String.valueOf(map1.get("refund_id")));//微信退款订单号 + map2.put("refund_fee", String.valueOf(map1.get("refund_fee")));//退款金额 + return map2; + }else{ + map2.put("return_code", result_code); + map2.put("return_msg", map1.get("err_code_des")); + return map2; + } + }else{ + map2.put("return_code", return_code); + map2.put("return_msg", map1.get("return_msg")); + return map2; + } + } + + + /** + * 微信退款成功后的回调处理 + * @param request + * @return + */ + public Map<String, String> wxRefundCallback(HttpServletRequest request){ + try { + String param = this.getParam(request); + param = param.replaceAll("<!\\[CDATA\\[",""); + param = param.replaceAll("]]>", ""); + Map<String, String> map = this.xmlToMap(param, "UTF-8"); + String return_code = map.get("return_code"); + if("SUCCESS".equals(return_code)){ + String req_info = map.get("req_info");//加密信息请用商户秘钥进行解密 + String s = this.wxDecrypt(req_info); + s = s.replaceAll("<!\\[CDATA\\[",""); + s = s.replaceAll("]]>", ""); + map = this.xmlToMap(s, "UTF-8"); + Map<String, String> map1 = new HashMap<>(); + map1.put("refund_id", map.get("refund_id")); + map1.put("out_refund_no", map.get("out_refund_no")); + String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; + map1.put("result", result); + return map1; + }else{ +// System.err.println(map.get("return_msg")); + } + } catch (IOException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } catch (NoSuchProviderException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 支付宝退款 + * @param trade_no 支付宝交易号 + * @param refund_amount 退款金额 + * @return + * @throws AlipayApiException + */ + public Map<String, String> aliRefund(String trade_no, String refund_amount) throws AlipayApiException { + //构造client + CertAlipayRequest certAlipayRequest = new CertAlipayRequest(); + //设置网关地址 + certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); + //设置应用Id + certAlipayRequest.setAppId(aliAppid); + //设置应用私钥 + certAlipayRequest.setPrivateKey(appPrivateKey); + //设置请求格式,固定值json + certAlipayRequest.setFormat("json"); + //设置字符集 + certAlipayRequest.setCharset("UTF8"); + //设置签名类型 + certAlipayRequest.setSignType("RSA2"); + //设置应用公钥证书路径 + certAlipayRequest.setCertPath(app_cert_path); + //设置支付宝公钥证书路径 + certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); + //设置支付宝根证书路径 + certAlipayRequest.setRootCertPath(alipay_root_cert_path); + //构造client + AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest); + //构造API请求 + AlipayTradeRefundApplyRequest request = new AlipayTradeRefundApplyRequest(); + AlipayTradeRefundModel model = new AlipayTradeRefundModel(); + model.setTradeNo(trade_no); + model.setRefundAmount(refund_amount); + request.setBizModel(model); + //发送请求 + AlipayTradeRefundApplyResponse response = alipayClient.certificateExecute(request); + +// AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey,"json","UTF-8", alipay_public_key,"RSA2"); +// AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); +// JSONObject jsonObject = new JSONObject(); +// jsonObject.put("trade_no", trade_no); +// jsonObject.put("refund_amount", refund_amount); +// request.setBizContent(jsonObject.toJSONString()); +// System.err.println(jsonObject.toJSONString()); +// AlipayTradeRefundResponse response = alipayClient.execute(request); + + Map<String, String> map = new HashMap<>(); + System.err.println(response.getSubMsg()); + if(response.isSuccess()){ + System.out.println("调用成功"); + String outTradeNo = response.getOutTradeNo(); + map.put("code", response.getCode());//10000 + map.put("trade_no", response.getTradeNo());//支付宝交易号 + map.put("out_trade_no", outTradeNo);//商户订单号 + } else { + System.out.println("调用失败"); + map.put("code", response.getCode()); + map.put("msg", response.getSubMsg()); + } + return map; + } + + + /** + * 查询微信支付订单 + * @return + * @throws Exception + */ + public ResultUtil<Map<String, String>> queryWXOrder(String out_trade_no, String transaction_id) throws Exception{ + String url = "https://api.mch.weixin.qq.com/pay/orderquery"; + String nonce_str = UUIDUtil.getRandomCode(16); + Map<String, Object> map = new HashMap<>(); + map.put("appid", appid); + map.put("mch_id", mchId); + map.put("out_trade_no", out_trade_no);//商户订单号 + map.put("transaction_id", transaction_id);//微信订单号 + map.put("nonce_str", nonce_str);//随机字符串 + String s = this.weixinSignature(map); + map.put("sign", s); + + //设置请求头 + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_XML); + StringBuffer xmlString = new StringBuffer(); + Set<String> strings = map.keySet(); + String[] keys = {}; + keys = strings.toArray(keys); + Arrays.sort(keys); + xmlString.append("<xml>"); + for(int l = 0; l < keys.length; l++){ + xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); + } + xmlString.append("</xml>"); + + Map<String, String> map1 = null; + String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); + //将结果xml解析成map + body1 = body1.replaceAll("<!\\[CDATA\\[",""); + body1 = body1.replaceAll("]]>", ""); + try { + map1 = this.xmlToMap(body1, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); + } + String return_code = map1.get("return_code"); + if("SUCCESS".equals(return_code)){ + String result_code = map1.get("result_code"); + if("SUCCESS".equals(result_code)){ + Map<String, String> map2 = new HashMap<>(); + map2.put("trade_type", map1.get("trade_type")); + map2.put("trade_state", map1.get("trade_state"));//订单状态SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败) + map2.put("transaction_id", map1.get("transaction_id")); + return ResultUtil.success(map2); + }else{ + System.err.println(map1.get("err_code_des")); + return ResultUtil.error(map1.get("err_code_des")); + } + }else{ + System.err.println(map1.get("return_msg") + appid + "----" + mchId); + return ResultUtil.error(map1.get("return_msg")); + } + } + + + + /** + * 微信转账功能(企业付款到零钱) + * @param openid 商户appid下,某用户的openid + * @param desc 企业付款备注,必填。 + * @param total_fee 企业付款金额 + * @param partner_trade_no 商户订单号,需保持唯一性 + * @return + */ + public Map<String, String> wxTransfers(String openid, String desc, String total_fee, String partner_trade_no) throws Exception{ + int amount = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); + String nonce_str = UUIDUtil.getRandomCode(); + Map<String, Object> map = new HashMap<>(); + map.put("mch_appid", appid);//申请商户号的appid或商户号绑定的appid + map.put("mchid", mchId);//微信支付分配的商户号 + map.put("nonce_str", nonce_str);//随机字符串,不长于32位 + map.put("partner_trade_no", partner_trade_no);//商户订单号,需保持唯一性 + map.put("openid", openid);//商户appid下,某用户的openid + map.put("check_name", "NO_CHECK");//NO_CHECK:不校验真实姓名 FORCE_CHECK:强校验真实姓名 + map.put("amount", amount);//企业付款金额,单位为分 + map.put("desc", desc);//企业付款备注,必填。 + String s = this.weixinSignature(map, key); + map.put("sign", s); + + String url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"; + //设置请求头 + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_XML); + StringBuffer xmlString = new StringBuffer(); + Set<String> strings = map.keySet(); + String[] keys = {}; + keys = strings.toArray(keys); + Arrays.sort(keys); + xmlString.append("<xml>"); + for(int l = 0; l < keys.length; l++){ + xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); + } + xmlString.append("</xml>"); + + Map<String, String> map1 = null; + String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, weixin_cert_path, "PKCS12"); + //将结果xml解析成map + body1 = body1.replaceAll("<!\\[CDATA\\[",""); + body1 = body1.replaceAll("]]>", ""); + try { + map1 = this.xmlToMap(body1, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); + } + String return_code = map1.get("return_code"); + Map<String, String> map2 = new HashMap<>(); + if("SUCCESS".equals(return_code)){ + String result_code = map1.get("result_code"); + if("SUCCESS".equals(result_code)){ + map2.put("return_code", result_code); + map2.put("payment_no", String.valueOf(map1.get("payment_no")));//付款订单号 + map2.put("payment_time", String.valueOf(map1.get("payment_time")));//付款时间 + return map2; + }else{ + map2.put("return_code", result_code); + map2.put("err_code", map1.get("err_code")); + map2.put("err_code_des", map1.get("err_code_des")); + return map2; + } + }else{ + map2.put("return_code", return_code); + map2.put("return_msg", map1.get("return_msg")); + return map2; + } + } + + + /** + * 微信转账功能(企业付款到银行卡) + * @param desc 备注信息 + * @param total_fee 转账金额 + * @param partner_trade_no 订单号 + * @param enc_bank_no 银行卡号 + * @param enc_true_name 收款方用户名 + * @param bankName 银行名称 + * @return + * @throws Exception + */ + public Map<String, String> wxPayBank(String desc, String total_fee, String partner_trade_no, String enc_bank_no, String enc_true_name, String bankName) throws Exception{ + int amount = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); + String nonce_str = UUIDUtil.getRandomCode(); + Map<String, Object> map = new HashMap<>(); + map.put("mch_id", mchId);//微信支付分配的商户号 + map.put("nonce_str", nonce_str);//随机字符串,不长于32位 + map.put("partner_trade_no", partner_trade_no);//商户订单号,需保持唯一性 + map.put("enc_bank_no", enc_bank_no);//收款方银行卡号(采用标准RSA算法,公钥由微信侧提供) + map.put("enc_true_name", enc_true_name);//收款方用户名(采用标准RSA算法,公钥由微信侧提供) + map.put("bank_code", findBankCode(bankName));// + map.put("amount", amount);//企业付款金额,单位为分 + map.put("desc", desc);//企业付款备注,必填。 + String s = this.weixinSignature(map, key); + map.put("sign", s); + + String url = "https://api.mch.weixin.qq.com/mmpaysptrans/pay_bank"; + //设置请求头 + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_XML); + StringBuffer xmlString = new StringBuffer(); + Set<String> strings = map.keySet(); + String[] keys = {}; + keys = strings.toArray(keys); + Arrays.sort(keys); + xmlString.append("<xml>"); + for(int l = 0; l < keys.length; l++){ + xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); + } + xmlString.append("</xml>"); + + Map<String, String> map1 = null; + String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, weixin_cert_path, "PKCS12"); + //将结果xml解析成map + body1 = body1.replaceAll("<!\\[CDATA\\[",""); + body1 = body1.replaceAll("]]>", ""); + try { + map1 = this.xmlToMap(body1, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); + } + String return_code = map1.get("return_code"); + Map<String, String> map2 = new HashMap<>(); + if("SUCCESS".equals(return_code)){ + String result_code = map1.get("result_code"); + if("SUCCESS".equals(result_code)){ + map2.put("return_code", result_code); + map2.put("payment_no", String.valueOf(map1.get("payment_no")));//付款订单号 + map2.put("cmms_amt", String.valueOf(map1.get("cmms_amt")));//手续费金额 RMB:分 + return map2; + }else{ + map2.put("return_code", result_code); + map2.put("err_code", map1.get("err_code")); + map2.put("err_code_des", map1.get("err_code_des")); + return map2; + } + }else{ + map2.put("return_code", return_code); + map2.put("return_msg", map1.get("return_msg")); + return map2; + } + } + + /** + * 微信转账到银行卡不编号 + * @param bankName + * @return + */ + public String findBankCode(String bankName){ + String json = "{\"工商银行 \":1002,\"农业银行\":1005,\"建设银行\":1003,\"中国银行\":1026,\"交通银行 \":1020,\"招商银行 \":1001,\"邮储银行\":1066,\"民生银行 \":1006,\"平安银行 \":1010,\"中信银行\":1021,\"浦发银行 \":1004,\"兴业银行 \":1009,\"光大银行 \":1022,\"广发银行\":1027,\"华夏银行\":1025,\"宁波银行\":1056,\"北京银行\":4836,\"上海银行\":1024,\"南京银行\":1054,\"长子县融汇村镇银行\":4755,\"长沙银行\":4216,\"浙江泰隆商业银行\":4051,\"中原银行 \":4753,\"企业银行(中国)\":4761,\"顺德农商银行 \":4036,\"衡水银行\":4752,\"长治银行\":4756,\"大同银行\":4767,\"河南省农村信用社\":4115,\"宁夏黄河农村商业银行\":4150,\"山西省农村信用社\":4156,\"安徽省农村信用社\":4166,\"甘肃省农村信用社\":4157,\"天津农村商业银行\":4153,\"广西壮族自治区农村信用社\":4113,\"陕西省农村信用社\":4108,\"深圳农村商业银行\":4076,\"宁波鄞州农村商业银行\":4052,\"浙江省农村信用社联合社\":4764,\"江苏省农村信用社联合社\":4217,\"江苏紫金农村商业银行股份有限公司 \":4072,\"北京中关村银行股份有限公司 \":4769,\"星展银行( 中国) 有限公司 \":4778,\"枣庄银行股份有限公司 \":4766,\"海口联合农村商业银行股份有限公司 \":4758,\"南洋商业银行( 中国) 有限公司 \":4763}"; + JSONObject jsonObject = JSON.parseObject(json); + Set<String> strings = jsonObject.keySet(); + for(String key : strings){ + if(key.indexOf(bankName) >= 0){ + return jsonObject.getString(key); + } + } + return ""; + } + + + + /** + * 支付宝转账 + * @param out_biz_no 商家侧唯一订单号,由商家自定义。对于不同转账请求,商家需保证该订单号在自身系统唯一。 + * @param trans_amount 订单总金额,单位为元,精确到小数点后两位 + * @param order_title 转账业务的标题,用于在支付宝用户的账单里显示 + * @param identity 参与方的唯一标识(收款方支付宝账号) + * @param name 参与方真实姓名,如果非空,将校验收款支付宝账号姓名一致性。 + * @param remark 业务备注 + * @return + * @throws Exception + */ + public Map<String, Object> aliTransfer(String out_biz_no, Double trans_amount, String order_title, String identity, String name, String remark) throws Exception{ + CertAlipayRequest certAlipayRequest = new CertAlipayRequest(); + certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); //gateway:支付宝网关(固定)https://openapi.alipay.com/gateway.do + certAlipayRequest.setAppId(aliAppid); //APPID 即创建应用后生成,详情见创建应用并获取 APPID + certAlipayRequest.setPrivateKey(appPrivateKey); //开发者应用私钥,由开发者自己生成 + certAlipayRequest.setFormat("json"); //参数返回格式,只支持 json 格式 + certAlipayRequest.setCharset("UTF-8"); //请求和签名使用的字符编码格式,支持 GBK和 UTF-8 + certAlipayRequest.setSignType("RSA2"); //商户生成签名字符串所使用的签名算法类型,目前支持 RSA2 和 RSA,推荐商家使用 RSA2。 + certAlipayRequest.setCertPath(app_cert_path); //应用公钥证书路径(app_cert_path 文件绝对路径) + certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); //支付宝公钥证书文件路径(alipay_cert_path 文件绝对路径) + certAlipayRequest.setRootCertPath(alipay_root_cert_path); //支付宝CA根证书文件路径(alipay_root_cert_path 文件绝对路径) + AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest); + AlipayFundTransUniTransferRequest request = new AlipayFundTransUniTransferRequest(); + request.setBizContent("{" + + "\"out_biz_no\":\"" + out_biz_no + "\"," + + "\"trans_amount\":" + trans_amount + "," + + "\"product_code\":\"TRANS_ACCOUNT_NO_PWD\"," + + "\"biz_scene\":\"DIRECT_TRANSFER\"," + + "\"order_title\":\"" + order_title + "\"," + + "\"payee_info\":{" + + "\"identity\":\"" + identity + "\"," + + "\"identity_type\":\"ALIPAY_USER_ID\"," + + "\"name\":\"" + name + "\"," + + "}," + + "\"remark\":\"" + remark + "\"" + + "}"); + AlipayFundTransUniTransferResponse response = alipayClient.certificateExecute(request); + Map<String, Object> map = new HashMap<>(); + if(response.isSuccess()){ + String status = response.getStatus(); + if(status.equals("SUCCESS")){//成功 + map.put("code", response.getCode()); + map.put("order_id", response.getOrderId());//支付宝订单号 + map.put("pay_fund_order_id", response.getPayFundOrderId());//支付宝流水号 + }else{ + map.put("code", response.getCode()); + map.put("sub_msg", response.getSubMsg()); + } + } else { + map.put("code", response.getSubCode()); + map.put("sub_msg", response.getSubMsg()); + } + return map; + } + + + /** + * 获取请求内容 + * @param request + * @return + * @throws IOException + */ + private String getParam(HttpServletRequest request) throws IOException { + // 读取参数 + InputStream inputStream; + StringBuilder sb = new StringBuilder(); + inputStream = request.getInputStream(); + String s; + BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); + while ((s = in.readLine()) != null) { + sb.append(s); + } + in.close(); + inputStream.close(); + return sb.toString(); + } + + + /** + * 微信下单的签名算法 + * @param map + * @return + */ + private String weixinSignature(Map<String, Object> map){ + try { + Set<Map.Entry<String, Object>> entries = map.entrySet(); + List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); + // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) + Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { + public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { + return (o1.getKey()).toString().compareTo(o2.getKey()); + } + }); + // 构造签名键值对的格式 + StringBuilder sb = new StringBuilder(); + for (Map.Entry<String, Object> item : infoIds) { + if (item.getKey() != null || item.getKey() != "") { + String key = item.getKey(); + Object val = item.getValue(); + if (!(val == "" || val == null)) { + sb.append(key + "=" + val + "&"); + } + } + } + sb.append("key=" + key); + String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 + return sign; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 微信下单的签名算法 + * @param map + * @return + */ + private String weixinSignature(Map<String, Object> map, String key_){ + try { + Set<Map.Entry<String, Object>> entries = map.entrySet(); + List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); + // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) + Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { + public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { + return (o1.getKey()).toString().compareTo(o2.getKey()); + } + }); + // 构造签名键值对的格式 + StringBuilder sb = new StringBuilder(); + for (Map.Entry<String, Object> item : infoIds) { + if (item.getKey() != null || item.getKey() != "") { + String key = item.getKey(); + Object val = item.getValue(); + if (!(val == "" || val == null)) { + sb.append(key + "=" + val + "&"); + } + } + } + sb.append("key=" + key_); + String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 + return sign; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 微信退款成功后的解密 + * @param req_info + * @return + */ + private String wxDecrypt(String req_info) throws NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException, + InvalidKeyException, BadPaddingException, IllegalBlockSizeException { + byte[] decode = Base64.getDecoder().decode(req_info); + String sign = MD5AndKL.MD5Encode(key, "UTF-8").toLowerCase(); + if (Security.getProvider("BC") == null){ + Security.addProvider(new BouncyCastleProvider()); + } + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); + SecretKeySpec secretKeySpec = new SecretKeySpec(sign.getBytes(), "AES"); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec); + return new String(cipher.doFinal(decode)); + } + + + public static void main(String[] ages){ +// PayMoneyUtil payMoneyUtil = new PayMoneyUtil(); +// payMoneyUtil.weixinpay("测试", "123", "12.5", ""); + } + + + /** + * xml转map + * @param xml + * @param charset + * @return + * @throws UnsupportedEncodingException + * @throws DocumentException + */ + public static Map<String, String> xmlToMap(String xml, String charset) throws UnsupportedEncodingException, DocumentException { + + Map<String, String> respMap = new HashMap<String, String>(); + + SAXReader reader = new SAXReader(); + Document doc = reader.read(new ByteArrayInputStream(xml.getBytes(charset))); + Element root = doc.getRootElement(); + xmlToMap(root, respMap); + return respMap; + } + + public static Map<String, String> xmlToMap(Element tmpElement, Map<String, String> respMap){ + if (tmpElement.isTextOnly()) { + respMap.put(tmpElement.getName(), tmpElement.getText()); + return respMap; + } + + @SuppressWarnings("unchecked") + Iterator<Element> eItor = tmpElement.elementIterator(); + while (eItor.hasNext()) { + Element element = eItor.next(); + xmlToMap(element, respMap); + } + return respMap; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PushUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PushUtil.java new file mode 100644 index 0000000..72aaae7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PushUtil.java @@ -0,0 +1,240 @@ +package com.agentdriving.user.modular.system.util; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.agentdriving.user.modular.system.warpper.PushOrderInfoWarpper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.util.HashMap; +import java.util.Map; + +/** + * socket推单处理类 + */ +@Component +public class PushUtil { + + Logger logger = LoggerFactory.getLogger("ServiceLog"); + + @Autowired + private RestTemplate internalRestTemplate; + + + + /** + * 推送强迫下线 + * @param id + * @param type + */ + public void pushOffline(Integer id, Integer type){ + JSONObject msg = new JSONObject(); + msg.put("code", 200); + msg.put("msg", "SUCCESS"); + msg.put("method", "OFFLINE"); + msg.put("data", new Object()); + + //调用推送 + HttpHeaders headers = new HttpHeaders(); + // 以表单的方式提交 + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + //将请求头部和参数合成一个请求 + MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); + params.add("msg", msg.toJSONString()); + params.add("id", id.toString()); + params.add("type", type.toString()); + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); + String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); + JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); + if(jsonObject1.getIntValue("code") != 200){ + logger.debug(jsonObject1.getString("msg")); + System.err.println(jsonObject1.getString("msg")); + } + } + + + /** + * 下班提醒 + * @param id + * @param type + */ + public void pushOffWork(Integer id, Integer type){ + JSONObject msg = new JSONObject(); + msg.put("code", 200); + msg.put("msg", "SUCCESS"); + msg.put("method", "OFF_WORK"); + msg.put("data", new Object()); + + //调用推送 + HttpHeaders headers = new HttpHeaders(); + // 以表单的方式提交 + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + //将请求头部和参数合成一个请求 + MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); + params.add("msg", msg.toJSONString()); + params.add("id", id.toString()); + params.add("type", type.toString()); + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); + String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); + JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); + if(jsonObject1.getIntValue("code") != 200){ + logger.debug(jsonObject1.getString("msg")); + System.err.println(jsonObject1.getString("msg")); + } + } + + + /** + * 推送订单状态 + * @param id + * @param type + * @param orderId + * @param status + */ + public void pushOrderStatus(Integer id, Integer type, Long orderId, Integer status){ + JSONObject msg = new JSONObject(); + msg.put("code", 200); + msg.put("msg", "SUCCESS"); + msg.put("method", "ORDER_STATUS"); + + Map<String, Object> map = new HashMap<>(); + map.put("orderId", orderId); + map.put("status", status); + + msg.put("data", map); + + //调用推送 + HttpHeaders headers = new HttpHeaders(); + // 以表单的方式提交 + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + //将请求头部和参数合成一个请求 + MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); + params.add("msg", msg.toJSONString()); + params.add("id", id.toString()); + params.add("type", type.toString()); + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); + String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); + JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); + if(jsonObject1.getIntValue("code") != 200){ + logger.debug(jsonObject1.getString("msg")); + System.err.println(jsonObject1.getString("msg")); + } + } + + + + /** + * 推送订单数据 + * @param id + * @param type + * @param pushOrderInfoWarpper + */ + public void pushOrderInfo(Integer id, Integer type, PushOrderInfoWarpper pushOrderInfoWarpper){ + JSONObject msg = new JSONObject(); + msg.put("code", 200); + msg.put("msg", "SUCCESS"); + msg.put("method", "ORDER_INFO"); + msg.put("data", pushOrderInfoWarpper); + + //调用推送 + HttpHeaders headers = new HttpHeaders(); + // 以表单的方式提交 + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + //将请求头部和参数合成一个请求 + MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); + params.add("msg", msg.toJSONString()); + params.add("id", id.toString()); + params.add("type", type.toString()); + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); + String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); + JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); + if(jsonObject1.getIntValue("code") != 200){ + logger.debug(jsonObject1.getString("msg")); + System.err.println(jsonObject1.getString("msg")); + } + } + + + + + /** + * 系统推单推送 + * @param id 接受对象id + * @param type 接受对象类型(1=用户,2=司机) + * @param orderId 订单id + * @param countdown 抢单倒计时(秒) + */ + public void pushGrabOrder(Integer id, Integer type, Long orderId, Integer countdown){ + JSONObject msg = new JSONObject(); + msg.put("code", 200); + msg.put("msg", "SUCCESS"); + msg.put("method", "GRAB_ORDER"); + + Map<String, Object> map = new HashMap<>(); + map.put("orderId", orderId); + map.put("countdown", countdown); + + msg.put("data", map); + + //调用推送 + HttpHeaders headers = new HttpHeaders(); + // 以表单的方式提交 + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + //将请求头部和参数合成一个请求 + MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); + params.add("msg", msg.toJSONString()); + params.add("id", id.toString()); + params.add("type", type.toString()); + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); + String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); + JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); + if(jsonObject1.getIntValue("code") != 200){ + logger.debug(jsonObject1.getString("msg")); + System.err.println(jsonObject1.getString("msg")); + } + } + + + + + /** + * 转单成功推送 + * @param id + * @param type + */ + public void pushTransferSuccessful(Integer id, Integer type, Long orderId){ + JSONObject msg = new JSONObject(); + msg.put("code", 200); + msg.put("msg", "SUCCESS"); + msg.put("method", "TRANSFER_SUCCESS"); + Map<String, Object> map = new HashMap<>(); + + map.put("orderId", orderId); + msg.put("data", map); + + //调用推送 + HttpHeaders headers = new HttpHeaders(); + // 以表单的方式提交 + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + //将请求头部和参数合成一个请求 + MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); + params.add("msg", msg.toJSONString()); + params.add("id", id.toString()); + params.add("type", type.toString()); + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); + String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); + JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); + if(jsonObject1.getIntValue("code") != 200){ + logger.debug(jsonObject1.getString("msg")); + System.err.println(jsonObject1.getString("msg")); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/RedisUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/RedisUtil.java new file mode 100644 index 0000000..8fa00dd --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/RedisUtil.java @@ -0,0 +1,272 @@ +package com.agentdriving.user.modular.system.util; + +import com.agentdriving.user.core.util.ToolUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; +import redis.clients.jedis.Pipeline; + +import java.io.IOException; +import java.util.*; + + +/** + * Redis工具类 + */ +@Component +public class RedisUtil { + + @Autowired + private JedisPool jedisPool; + + private Timer timer; + + + /** + * 向redis中存储字符串没有过期时间 + * @param key + * @param value + */ + public void setStrValue(String key, String value){ + if(ToolUtil.isNotEmpty(key) && ToolUtil.isNotEmpty(value)){ + Jedis resource = jedisPool.getResource(); + String set = resource.set(key, value); + closeJedis(resource); + } + } + + + /** + * 以分钟为单位设置存储值(设置过期时间) + * @param key + * @param value + * @param time 秒 + */ + public void setStrValue(String key, String value, int time){ + if(ToolUtil.isNotEmpty(key) && ToolUtil.isNotEmpty(value)){ + Jedis resource = jedisPool.getResource(); + String setex = resource.setex(key, time, value); + closeJedis(resource); + } + } + + + /** + * 从redis中获取值 + * @param key + * @return + */ + public String getValue(String key){ + if(ToolUtil.isNotEmpty(key)){ + Jedis resource = jedisPool.getResource(); + String data = resource.get(key); + closeJedis(resource); + return data; + } + return null; + } + + + /** + * 批量获取 + * @param kes + * @return + */ + public List<Object> getValues(List<String> kes){ + if(null != kes){ + Jedis resource = jedisPool.getResource(); + Pipeline pipelined = resource.pipelined(); + for(String key : kes){ + pipelined.get(key); + } + List<Object> list = pipelined.syncAndReturnAll(); + + closeJedis(resource); + pipelined.clear(); + try { + pipelined.close(); + } catch (IOException e) { + e.printStackTrace(); + } + List<Object> data = new ArrayList<>(); + for(Object o : list){ + if(null != o){ + data.add(o); + } + } + return data; + } + return null; + } + + + /** + * 删除key + * @param key + */ + public void remove(String key){ + if(ToolUtil.isNotEmpty(key)){ + Jedis resource = jedisPool.getResource(); + Long del = resource.del(key); + closeJedis(resource); + } + } + + + /** + * 向集合key添加数据 + * @param key + * @param members + */ + public void addSetValue(String key, String...members){ + if(ToolUtil.isNotEmpty(key) && ToolUtil.isNotEmpty(members)){ + Jedis resource = jedisPool.getResource(); + Long sadd = resource.sadd(key, members); + resource.close(); + } + } + + + /** + * 返回Set集合数据 + * @param key + * @return + */ + public Set<String> getSetAllValue(String key){ + Set<String> smembers = new HashSet<>(); + if(ToolUtil.isNotEmpty(key)){ + Jedis resource = jedisPool.getResource(); + smembers = resource.smembers(key); + resource.close(); + } + return smembers; + } + + + /** + * 删除Set集合中的值 + * @param key + * @param members + */ + public void delSetValue(String key, String...members){ + if(ToolUtil.isNotEmpty(key) && ToolUtil.isNotEmpty(members)){ + Jedis resource = jedisPool.getResource(); + Long sadd = resource.srem(key, members); + resource.close(); + } + } + + + /** + * 删除资源 + * @param jedis + */ + public void closeJedis(Jedis jedis){ + if(null != jedis){ + jedis.close(); + } + } + + + /** + * redis加锁 + * @param key + * @param value + * @param time + * @return + */ + public boolean lock(String key, String value, int time){ + if(!StringUtils.isEmpty(key)){ + key += "_lock"; + Jedis resource = jedisPool.getResource(); + String set = resource.set(key, value, "nx", "ex", time); + if("OK".equals(set)){ + String finalKey = key; + timer = new Timer(); + timer.schedule(new TimerTask() { + @Override + public void run() { + System.err.println("定时任务启动"); + Jedis resource = jedisPool.getResource(); + resource.setex(finalKey, time, value); + resource.close(); + } + }, 1000, 500); + } + resource.close(); + return "OK".equals(set) ? true : false; + } + return false; + } + + /** + * 获取redis锁 + * @return + */ + public boolean lock(){ + try { + boolean b = lock(5); + if(!b){ + int num1 = 1; + while (num1 <= 10){ + try { + Thread.sleep(3000);//等待3秒 + } catch (InterruptedException e) { + e.printStackTrace(); + } + b = lock(5); + if(b){ + return true; + }else{ + num1++; + } + } + return false; + } + return b; + }catch (Exception e){ + e.printStackTrace(); + unlock(); + } + return false; + } + + + /** + * 获取redis锁 + * @param time + * @return + */ + public boolean lock(int time){ + String uuid = UUID.randomUUID().toString(); + return lock("redis", uuid, time); + } + + + /** + * redis释放锁 + * @param key + * @return + */ + public boolean unlock(String key){ + if(!StringUtils.isEmpty(key)){ + key += "_lock"; + Jedis resource = jedisPool.getResource(); + timer.cancel();//取消定时任务 + Long del = resource.del(key); + resource.close(); + return del != 0 ? true : false; + } + return false; + } + + /** + * 删除锁 + * @return + */ + public boolean unlock(){ + return unlock("redis"); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ResultUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ResultUtil.java new file mode 100644 index 0000000..61254d9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ResultUtil.java @@ -0,0 +1,187 @@ +package com.agentdriving.user.modular.system.util; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * 定义统一返回对象 + */ +@ApiModel(value = "统一返回结果集") +public class ResultUtil<T> { + + public static final Integer SUCCESS = 10000; + + public static final Integer PARAM_ERROR = 10010; + + public static final Integer SYSTEM_INFO = 10020; + + public static final Integer TOKEN_ERROR = 10030; + + public static final Integer SIGN_ERROR = 10040; + + public static final Integer RUNTIME_ERROR = 10050; + + public static final String Token = "token无效"; + + public static final String SIGN = "签名无效"; + + @ApiModelProperty(name = "code", value = "业务状态码 10000:成功,10010:参数错误,10020:系统提示, 10030:身份校验异常,10040:签名不通过,10050:系统运行异常") + private Integer code;//备用状态码 + + @ApiModelProperty(name = "msg", value = "返回结果说明") + private String msg;//返回说明 + + @ApiModelProperty(name = "data", value = "返回结果值") + private T data;//返回数据 + + + + public String getMsg() { + return msg; + } + + public T getData() { + return data; + } + + + public Integer getCode() { + return code; + } + + private ResultUtil(Integer code, String msg) { + this.code = code; + this.msg = msg; + } + + private ResultUtil(Integer code, String msg, T data) { + this.code = code; + this.msg = msg; + this.data = data; + } + + + public static <T> ResultUtil<T> getResult(Integer code, String msg){ + return new ResultUtil<>(code, msg); + } + + public static <T> ResultUtil<T> getResult(Integer code, String msg, T data){ + return new ResultUtil<>(code, msg, data); + } + + /** + * 错误信息 + * @return + */ + public static ResultUtil error(String mag){ + return ResultUtil.getResult(ResultUtil.SYSTEM_INFO, mag, new Object()); + } + + /** + * 错误信息 + * @return + */ + public static <T> ResultUtil <T> error(String mag, T obj){ + return ResultUtil.getResult(ResultUtil.SYSTEM_INFO, mag, obj); + } + + /** + * token失效 + * @return + */ + public static ResultUtil tokenErr(){ + return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, ResultUtil.Token, new Object()); + } + + /** + * token失效 + * @return + */ + public static ResultUtil tokenErr(String msg){ + return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, msg, new Object()); + } + + /** + * 参数异常 + * @return + */ + public static ResultUtil paranErr(String ages){ + return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "【" + ages + "】参数异常", new Object()); + } + + /** + * 参数异常 + * @return + */ + public static ResultUtil paranErr(){ + return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "参数异常", new Object()); + } + + /** + * 运行异常 + * @return + */ + public static ResultUtil runErr(){ + return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "系统运行异常", new Object()); + } + + + /** + * 运行异常 + * @return + */ + public static <T>ResultUtil<T> runErr(T data){ + return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "系统运行异常", data); + } + + /** + * 运行异常 + * @return + */ + public static <T>ResultUtil<T> runErr(T data, String msg){ + return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, msg, data); + } + + + /** + * 返回成功 + * @param + * @return + */ + public static ResultUtil success(){ + return ResultUtil.getResult(ResultUtil.SUCCESS, "成功", new Object()); + } + + + /** + * 返回成功 + * @param data + * @param <T> + * @return + */ + public static <T> ResultUtil<T> success(T data){ + return ResultUtil.getResult(ResultUtil.SUCCESS, "成功", data); + } + + /** + * 返回成功 + * @param msg + * @param data + * @param <T> + * @return + */ + public static <T> ResultUtil<T> success(String msg, T data){ + return ResultUtil.getResult(ResultUtil.SUCCESS, msg, data); + } + + + /** + * 签名无效 + * @param <T> + * @return + */ + public static <T> ResultUtil<T> sign(){ + return ResultUtil.getResult(ResultUtil.SIGN_ERROR, SIGN); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/SystemException.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/SystemException.java new file mode 100644 index 0000000..cf28a40 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/SystemException.java @@ -0,0 +1,18 @@ +package com.agentdriving.user.modular.system.util; + +public class SystemException extends Exception { + private String msg; + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public SystemException(String msg){ + super(msg); + this.setMsg(msg); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/TaskUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/TaskUtil.java new file mode 100644 index 0000000..7e7a8e6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/TaskUtil.java @@ -0,0 +1,71 @@ +package com.agentdriving.user.modular.system.util; + + +import com.agentdriving.user.modular.system.service.IUserToCouponService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + + +/** + * 定时任务工具类 + */ +@Component +public class TaskUtil { + + @Autowired + private IUserToCouponService userToCouponService; + + + + + /** + * 每隔一分钟去处理的定时任务 + */ + @Scheduled(fixedRate = 1000 * 60) + public void taskMinute(){ + try { + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * 每天的凌晨执行的任务 + */ + @Scheduled(cron = "0 0 0 * * *") + public void taskDay(){ + try { + userToCouponService.delUserCoupon(); + }catch (Exception e){ + e.printStackTrace(); + } + } + + + + /** + * 每月1日凌晨执行的任务 + */ + @Scheduled(cron = "0 0 0 1 * *") + public void taskMonth1(){ + try { + }catch (Exception e){ + e.printStackTrace(); + } + } + + + /** + * 每月16日凌晨执行的任务 + */ + @Scheduled(cron = "0 0 0 16 * *") + public void taskMonth16(){ + try { + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/UUIDUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/UUIDUtil.java new file mode 100644 index 0000000..b1e1011 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/UUIDUtil.java @@ -0,0 +1,99 @@ +package com.agentdriving.user.modular.system.util; + + + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +/** + * 定义生成随机码的工具类 + */ +public class UUIDUtil { + + private int i = 1; + + + /** + * 定义生成原生的UUID随机码 + * @return + */ + public static String getNativeUUID(){ + return UUID.randomUUID().toString(); + } + + + /** + * 生成32位随机码 + * @return + */ + public static String getRandomCode(){ + return UUIDUtil.getNativeUUID().replaceAll("-", ""); + } + + + /** + * 获取给定长度的随机码 + * @param num + * @return + * @throws Exception + */ + public static String getRandomCode(Integer num) throws Exception{ + String str = null; + if(0 < num){ + if(num % 32 > 0){ + Integer s = num / 32; + Integer l = num % 32; + StringBuffer sb = new StringBuffer(); + for(int i = 0; i < s; i++){ + sb.append(UUIDUtil.getRandomCode()); + } + sb.append(UUIDUtil.getRandomCode().substring(0, l)); + str = sb.toString(); + }else if(num % 32 == 0){ + Integer s = num / 32; + StringBuffer sb = new StringBuffer(); + for(int i = 0; i < s; i++){ + sb.append(UUIDUtil.getRandomCode()); + } + str = sb.toString(); + }else{ + str = UUIDUtil.getRandomCode().substring(0, num); + } + }else{ + throw new Exception("参数只能大于0"); + } + return str; + } + + + /** + * 获取根据当前时间的字符串数据 + * @return + */ + public synchronized static String getTimeStr(){ + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + return simpleDateFormat.format(new Date()); + } + + + + /** + * @Description: 获取数字随机码 + * @Author pzb + * @Date 2021/8/11 16:52 + * @Param + * @Return + * @Exception + */ + public static String getNumberRandom(Integer num){ + if(null == num){ + num = 32; + } + StringBuffer sb = new StringBuffer(); + for(int i = 0; i < num; i++){ + sb.append(Double.valueOf(Math.random() * 10).intValue()); + } + return sb.toString(); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpClientUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpClientUtil.java new file mode 100644 index 0000000..d84c97b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpClientUtil.java @@ -0,0 +1,268 @@ +package com.agentdriving.user.modular.system.util.httpClinet; + +import com.alibaba.fastjson.JSON; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.ssl.SSLContexts; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.net.ssl.SSLContext; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.security.KeyStore; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * http工具类 + */ + +public class HttpClientUtil { + + private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); + + private static PoolingHttpClientConnectionManager connectionManager; + + + { + //1.创建连接池管理器 + connectionManager = new PoolingHttpClientConnectionManager(60000, + TimeUnit.MILLISECONDS); + connectionManager.setMaxTotal(1000); + connectionManager.setDefaultMaxPerRoute(50); + } + + /** + * 创建一个httpClient对象 + */ + private static CloseableHttpClient getHttpCline(){ + return HttpClients.custom() + .setConnectionManager(connectionManager) + .disableAutomaticRetries() + .build(); + } + + private static RequestConfig getRequestConfig(){ + RequestConfig.Builder builder = RequestConfig.custom(); + builder.setSocketTimeout(60000)//3.1设置客户端等待服务端返回数据的超时时间 + .setConnectTimeout(30000)//3.2设置客户端发起TCP连接请求的超时时间 + .setExpectContinueEnabled(true) + .setConnectionRequestTimeout(30000);//3.3设置客户端从连接池获取链接的超时时间 + return builder.build(); + } + + + + /** + * 创建一个POST请求实例 + * @param url 请求地址 + * @param params 请求参数 + */ + private static CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ + HttpPost httpPost = new HttpPost(url); + httpPost.setConfig(getRequestConfig()); + if(null != header){ + for(String key : header.keySet()){ + httpPost.setHeader(key, header.get(key)); + } + } + List<NameValuePair> list = new ArrayList<>(); + if(null != params){ + Set<String> keys = params.keySet(); + for(String key : keys){ + list.add(new BasicNameValuePair(key, null == params.get(key) ? null : params.get(key).toString())); + } + } + switch (contentType){ + case "form": + httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); + break; + case "json": + ObjectMapper objectMapper = new ObjectMapper(); + String s =objectMapper.writeValueAsString(params); + httpPost.setEntity(new StringEntity(s, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), Charset.forName("UTF-8")))); + break; + } + return getHttpCline().execute(httpPost); + } + + + /** + * 获取get请求实例 + * @param url 请求地址 + * @param params 请求参数 + */ + private static CloseableHttpResponse setGetHttpRequset(String url, Map<String, Object> params, Map<String, String> header) throws Exception{ + StringBuffer sb = new StringBuffer(); + String p = ""; + if(null != params){ + Set<String> keys = params.keySet(); + for(String key : keys){ + sb.append(key + "=" + params.get(key) + "&"); + } + p = "?" + sb.substring(0, sb.length() - 1); + } + HttpGet httpGet = new HttpGet(url + p); + httpGet.setConfig(getRequestConfig()); + if(null != header){ + for(String key : header.keySet()){ + httpGet.setHeader(key, header.get(key)); + } + } + return getHttpCline().execute(httpGet); + } + + + /** + * 发送http请求 + * @param mothed "GET、POST、PUT、HEAD、DELETE、HEAD、OPTIONS" + * @param url 请求地址 + * @param params 请求参数 + * @param header 请求头 + * @param contentType 参数请求方式form/json + * @return + */ + public static HttpResult pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ + String randome = UUID.randomUUID().toString(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); + logger.info(sdf.format(new Date()) + "----(" + randome + ")请求参数:" + JSON.toJSONString(params)); + CloseableHttpResponse httpResponse = null; + switch (mothed){ + case "GET": + httpResponse = setGetHttpRequset(url, params, header); + break; + case "POST": + httpResponse = setPostHttpRequset(url, params, header, contentType); + break; + } + int statusCode = httpResponse.getStatusLine().getStatusCode(); + String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + logger.info(sdf.format(new Date()) + "----(" + randome + ")返回结果:" + content); + HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); + close(httpResponse); + return httpResult; + } + + + /** + * 发送XML请求 + * @param url 请求地址 + * @param xml XML数据 + * @param header 自定义请求头 + * @return + */ + public static HttpResult pushHttpRequsetXml(String url, String xml, Map<String, String> header) throws Exception{ + HttpPost httpPost = new HttpPost(url); + httpPost.setConfig(getRequestConfig()); + for(String key : header.keySet()){ + httpPost.setHeader(key, header.get(key)); + } + httpPost.setHeader("Content-Type", "application/xml"); + httpPost.setEntity(new StringEntity(xml, "UTF-8")); + CloseableHttpResponse httpResponse = getHttpCline().execute(httpPost); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); + close(httpResponse); + return httpResult; + } + + + + /** + * 请求https发送XML请求 + * @param url 接口路径 + * @param xml 内容 + * @param header 请求头 + * @param certPassword 证书密码 + * @param certPath 证书路径 + * @param certType 证书类型 + * @return + * @throws Exception + */ + public static String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception{ + HttpPost httpPost = new HttpPost(url); + for(String key : header.keySet()){ + httpPost.setHeader(key, header.get(key)); + } + httpPost.setHeader("Content-Type", "application/xml"); + httpPost.setEntity(new StringEntity(xml, "UTF-8")); + CloseableHttpClient httpCline = initCert(certPassword, certPath, certType); + CloseableHttpResponse httpResponse = httpCline.execute(httpPost); + String content = null; + if(httpResponse.getStatusLine().getStatusCode() == 200){ + content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + }else{ + content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); + } + close(httpResponse); + httpCline.close(); + return content; + } + + + /** + * 初始化https对象(带证书) + * @param key 证书密码 + * @param certPath 证书路径 + * @param certType 证书类型 + * @throws Exception + */ + private static CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { + KeyStore keyStore = KeyStore.getInstance(certType); + InputStream inputStream = new FileInputStream(new File(certPath)); + try { + keyStore.load(inputStream, key.toCharArray()); + } finally { + inputStream.close(); + } + SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, key.toCharArray()).build(); + SSLConnectionSocketFactory sslsf = + new SSLConnectionSocketFactory(sslcontext, null, null, + SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); + return HttpClients.custom().setSSLSocketFactory(sslsf).build(); + } + + + + /** + * 关闭资源 + */ + private static void close(CloseableHttpResponse httpResponse){ + try { + if(null != httpResponse){ + EntityUtils.consume(httpResponse.getEntity());//此处高能,通过源码分析,由EntityUtils是否回收HttpEntity + httpResponse.close(); + } + } catch (Exception e) { + e.printStackTrace(); + }finally { + try { + if(null != httpResponse){ + httpResponse.close(); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + } + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpResult.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpResult.java new file mode 100644 index 0000000..2e67c28 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpResult.java @@ -0,0 +1,31 @@ +package com.agentdriving.user.modular.system.util.httpClinet; + +import lombok.Data; + +/** + * http请求返回封装 + */ +@Data +public class HttpResult { + /** + * 返回状态码 + */ + private Integer code; + /** + * 返回结果 + */ + private String data; + + /** + * 返回封装结果 + * @param code + * @param data + * @return + */ + public static HttpResult getHttpResult(Integer code, String data){ + HttpResult httpResult = new HttpResult(); + httpResult.setCode(code); + httpResult.setData(data); + return httpResult; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/OBSUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/OBSUtil.java new file mode 100644 index 0000000..ab22ec9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/OBSUtil.java @@ -0,0 +1,43 @@ +package com.agentdriving.user.modular.system.util.huawei; + +import com.obs.services.ObsClient; +import com.obs.services.model.PutObjectRequest; +import com.obs.services.model.PutObjectResult; + +import java.io.*; + +/** + * 对象存储上传 + * @author zhibing.pu + * @date 2023/3/15 11:32 + */ +public class OBSUtil { + + public static String endPoint = "https://obs.cn-south-1.myhuaweicloud.com"; + public static String ak = "N52IGR6DHOC3JAZFHZIW"; + public static String sk = "jq7Q7jnFS4Gxamwh3naN2sbNKwQQ7cZISPVumGBS"; + public static String bucketname = "csxdj"; + + /** + * 上传文件 + * @param inputStream + * @param objectKey + * @return + */ + public static String putObjectToBucket(InputStream inputStream, String objectKey) { + try { + // 创建ObsClient实例 + ObsClient obsClient = new ObsClient(ak, sk, endPoint); + // 待上传的本地文件路径,需要指定到具体的文件名 + PutObjectRequest request = new PutObjectRequest(); + request.setBucketName(bucketname); + request.setObjectKey(objectKey); + request.setInput(inputStream); + PutObjectResult putObjectResult = obsClient.putObject(request); + return putObjectResult.getObjectUrl(); + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/SMSUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/SMSUtil.java new file mode 100644 index 0000000..ada1bb6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/SMSUtil.java @@ -0,0 +1,250 @@ +package com.agentdriving.user.modular.system.util.huawei; + +import javax.net.ssl.*; +import java.io.*; +import java.net.URL; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 短信工具类 + * @author zhibing.pu + * @date 2023/3/15 11:23 + */ +public class SMSUtil { + //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值 + private static final String WSSE_HEADER_FORMAT = "UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\""; + //无需修改,用于格式化鉴权头域,给"Authorization"参数赋值 + private static final String AUTH_HEADER_VALUE = "WSSE realm=\"SDP\",profile=\"UsernameToken\",type=\"Appkey\""; + + /** + * 发送短信 + * @param phones //必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔 + * @param templateId //模板ID + * @param templateParas //模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。 + * @throws Exception + */ + public static void send(String phones, String templateId, String templateParas) throws Exception { + //必填,请参考"开发准备"获取如下数据,替换为实际值 + String url = "https://smsapi.cn-south-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI + String appKey = "9I0xrhdGXthf1fv9nn8G3glZ6Zng"; //APP_Key + String appSecret = "U7WxwX2LVk2YD6KAHxjc9tdnXoM9"; //APP_Secret + String sender = "8823031523874"; //国内短信签名通道号或国际/港澳台短信通道号 +// String templateId = "8ff55eac1d0b478ab3c06c3c6a492300"; //模板ID + + //条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 + //国际/港澳台短信不用关注该参数 + String signature = "超省新代驾"; //签名名称 + + //必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔 +// String receiver = "+86151****6789,+86152****7890"; //短信接收人号码 + + //选填,短信状态报告接收地址,推荐使用域名,为空或者不填表示不接收状态报告 + String statusCallBack = ""; + + /** + * 选填,使用无变量模板时请赋空值 String templateParas = ""; + * 单变量模板示例:模板内容为"您的验证码是${1}"时,templateParas可填写为"[\"369751\"]" + * 双变量模板示例:模板内容为"您有${1}件快递请到${2}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]" + * 模板中的每个变量都必须赋值,且取值不能为空 + * 查看更多模板和变量规范:产品介绍>模板和变量规范 + */ +// String templateParas = "[\"369751\"]"; //模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。 + + //请求Body,不携带签名名称时,signature请填null + String body = buildRequestBody(sender, phones, templateId, templateParas, statusCallBack, signature); + if (null == body || body.isEmpty()) { + System.out.println("body is null."); + return; + } + + //请求Headers中的X-WSSE参数值 + String wsseHeader = buildWsseHeader(appKey, appSecret); + if (null == wsseHeader || wsseHeader.isEmpty()) { + System.out.println("wsse header is null."); + return; + } + + Writer out = null; + BufferedReader in = null; + StringBuffer result = new StringBuffer(); + HttpsURLConnection connection = null; + InputStream is = null; + + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + trustAllHttpsCertificates(); + + try { + URL realUrl = new URL(url); + connection = (HttpsURLConnection) realUrl.openConnection(); + + connection.setHostnameVerifier(hv); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setUseCaches(true); + //请求方法 + connection.setRequestMethod("POST"); + //请求Headers参数 + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + connection.setRequestProperty("Authorization", AUTH_HEADER_VALUE); + connection.setRequestProperty("X-WSSE", wsseHeader); + + connection.connect(); + out = new OutputStreamWriter(connection.getOutputStream()); + out.write(body); //发送请求Body参数 + out.flush(); + out.close(); + + int status = connection.getResponseCode(); + if (200 == status) { //200 + is = connection.getInputStream(); + } else { //400/401 + is = connection.getErrorStream(); + } + in = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String line = ""; + while ((line = in.readLine()) != null) { + result.append(line); + } + System.out.println(result.toString()); //打印响应消息实体 + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (null != out) { + out.close(); + } + if (null != is) { + is.close(); + } + if (null != in) { + in.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + /** + * 构造请求Body体 + * @param sender + * @param receiver + * @param templateId + * @param templateParas + * @param statusCallBack + * @param signature | 签名名称,使用国内短信通用模板时填写 + * @return + */ + static String buildRequestBody(String sender, String receiver, String templateId, String templateParas, + String statusCallBack, String signature) { + if (null == sender || null == receiver || null == templateId || sender.isEmpty() || receiver.isEmpty() + || templateId.isEmpty()) { + System.out.println("buildRequestBody(): sender, receiver or templateId is null."); + return null; + } + Map<String, String> map = new HashMap<String, String>(); + + map.put("from", sender); + map.put("to", receiver); + map.put("templateId", templateId); + if (null != templateParas && !templateParas.isEmpty()) { + map.put("templateParas", templateParas); + } + if (null != statusCallBack && !statusCallBack.isEmpty()) { + map.put("statusCallback", statusCallBack); + } + if (null != signature && !signature.isEmpty()) { + map.put("signature", signature); + } + + StringBuilder sb = new StringBuilder(); + String temp = ""; + + for (String s : map.keySet()) { + try { + temp = URLEncoder.encode(map.get(s), "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + sb.append(s).append("=").append(temp).append("&"); + } + + return sb.deleteCharAt(sb.length()-1).toString(); + } + + /** + * 构造X-WSSE参数值 + * @param appKey + * @param appSecret + * @return + */ + static String buildWsseHeader(String appKey, String appSecret) { + if (null == appKey || null == appSecret || appKey.isEmpty() || appSecret.isEmpty()) { + System.out.println("buildWsseHeader(): appKey or appSecret is null."); + return null; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + String time = sdf.format(new Date()); //Created + String nonce = UUID.randomUUID().toString().replace("-", ""); //Nonce + + MessageDigest md; + byte[] passwordDigest = null; + + try { + md = MessageDigest.getInstance("SHA-256"); + md.update((nonce + time + appSecret).getBytes()); + passwordDigest = md.digest(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + //如果JDK版本是1.8,请加载原生Base64类,并使用如下代码 + String passwordDigestBase64Str = Base64.getEncoder().encodeToString(passwordDigest); //PasswordDigest + //如果JDK版本低于1.8,请加载三方库提供Base64类,并使用如下代码 + //String passwordDigestBase64Str = Base64.encodeBase64String(passwordDigest); //PasswordDigest + //若passwordDigestBase64Str中包含换行符,请执行如下代码进行修正 + //passwordDigestBase64Str = passwordDigestBase64Str.replaceAll("[\\s*\t\n\r]", ""); + return String.format(WSSE_HEADER_FORMAT, appKey, passwordDigestBase64Str, nonce, time); + } + + /*** @throws Exception + */ + static void trustAllHttpsCertificates() throws Exception { + TrustManager[] trustAllCerts = new TrustManager[] { + new X509TrustManager() { + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + return; + } + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + return; + } + public X509Certificate[] getAcceptedIssuers() { + return null; + } + } + }; + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, null); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + } + + + public static void main(String[] ages){ + try { + SMSUtil.send("15828353127", "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + 123456 + "\"]"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/Realtime.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/Realtime.java new file mode 100644 index 0000000..a43acbd --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/Realtime.java @@ -0,0 +1,40 @@ +package com.agentdriving.user.modular.system.util.juhe; + +import lombok.Data; + +/** +* 天气实况 +* @author pzb +* @Date 2023/2/20 11:38 +*/ +@Data +public class Realtime { + /** + * 天气情况,如:晴、多云 + */ + private String info; + /** + * 天气标识id,可参考小接口2 + */ + private String wid; + /** + * 温度,可能为空 + */ + private String temperature; + /** + * 湿度,可能为空 + */ + private String humidity; + /** + * 风向,可能为空 + */ + private String direct; + /** + * 风力,可能为空 + */ + private String power; + /** + * 空气质量指数,可能为空 + */ + private String aqi; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherCityInfo.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherCityInfo.java new file mode 100644 index 0000000..60304ab --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherCityInfo.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.modular.system.util.juhe; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +/** +* 天气相关城市 +* @author pzb +* @Date 2023/2/25 10:56 +*/ +@Data +@TableName("t_weather_city") +public class WeatherCityInfo { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.INPUT) + @TableField("id") + private Integer id; + /** + * 省 + */ + @TableField("province") + private String province; + /** + * 市 + */ + @TableField("city") + private String city; + /** + * 区 + */ + @TableField("district") + private String district; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherUtil.java new file mode 100644 index 0000000..3175a8f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherUtil.java @@ -0,0 +1,119 @@ +package com.agentdriving.user.modular.system.util.juhe; + +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.util.httpClinet.HttpClientUtil; +import com.agentdriving.user.modular.system.util.httpClinet.HttpResult; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + + +/** +* 天气工具类 +* @author pzb +* @Date 2023/2/18 16:54 +*/ +public class WeatherUtil { + + static Logger logger = LoggerFactory.getLogger("ServiceLog"); + + private final static String weather_type = "[{\"wid\":\"00\",\"weather\":\"晴\"},{\"wid\":\"01\",\"weather\":\"多云\"},{\"wid\":\"02\",\"weather\":\"阴\"},{\"wid\":\"03\",\"weather\":\"阵雨\"},{\"wid\":\"04\",\"weather\":\"雷阵雨\"},{\"wid\":\"05\",\"weather\":\"雷阵雨伴有冰雹\"},{\"wid\":\"06\",\"weather\":\"雨夹雪\"},{\"wid\":\"07\",\"weather\":\"小雨\"},{\"wid\":\"08\",\"weather\":\"中雨\"},{\"wid\":\"09\",\"weather\":\"大雨\"},{\"wid\":\"10\",\"weather\":\"暴雨\"},{\"wid\":\"11\",\"weather\":\"大暴雨\"},{\"wid\":\"12\",\"weather\":\"特大暴雨\"},{\"wid\":\"13\",\"weather\":\"阵雪\"},{\"wid\":\"14\",\"weather\":\"小雪\"},{\"wid\":\"15\",\"weather\":\"中雪\"},{\"wid\":\"16\",\"weather\":\"大雪\"},{\"wid\":\"17\",\"weather\":\"暴雪\"},{\"wid\":\"18\",\"weather\":\"雾\"},{\"wid\":\"19\",\"weather\":\"冻雨\"},{\"wid\":\"20\",\"weather\":\"沙尘暴\"},{\"wid\":\"21\",\"weather\":\"小到中雨\"},{\"wid\":\"22\",\"weather\":\"中到大雨\"},{\"wid\":\"23\",\"weather\":\"大到暴雨\"},{\"wid\":\"24\",\"weather\":\"暴雨到大暴雨\"},{\"wid\":\"25\",\"weather\":\"大暴雨到特大暴雨\"},{\"wid\":\"26\",\"weather\":\"小到中雪\"},{\"wid\":\"27\",\"weather\":\"中到大雪\"},{\"wid\":\"28\",\"weather\":\"大到暴雪\"},{\"wid\":\"29\",\"weather\":\"浮尘\"},{\"wid\":\"30\",\"weather\":\"扬沙\"},{\"wid\":\"31\",\"weather\":\"强沙尘暴\"},{\"wid\":\"53\",\"weather\":\"霾\"}]"; + + private final static String bad_weather = "[{\"wid\":\"03\",\"weather\":\"阵雨\"},{\"wid\":\"04\",\"weather\":\"雷阵雨\"},{\"wid\":\"05\",\"weather\":\"雷阵雨伴有冰雹\"},{\"wid\":\"06\",\"weather\":\"雨夹雪\"},{\"wid\":\"07\",\"weather\":\"小雨\"},{\"wid\":\"08\",\"weather\":\"中雨\"},{\"wid\":\"09\",\"weather\":\"大雨\"},{\"wid\":\"10\",\"weather\":\"暴雨\"},{\"wid\":\"11\",\"weather\":\"大暴雨\"},{\"wid\":\"12\",\"weather\":\"特大暴雨\"},{\"wid\":\"13\",\"weather\":\"阵雪\"},{\"wid\":\"14\",\"weather\":\"小雪\"},{\"wid\":\"15\",\"weather\":\"中雪\"},{\"wid\":\"16\",\"weather\":\"大雪\"},{\"wid\":\"17\",\"weather\":\"暴雪\"},{\"wid\":\"19\",\"weather\":\"冻雨\"},{\"wid\":\"20\",\"weather\":\"沙尘暴\"},{\"wid\":\"21\",\"weather\":\"小到中雨\"},{\"wid\":\"22\",\"weather\":\"中到大雨\"},{\"wid\":\"23\",\"weather\":\"大到暴雨\"},{\"wid\":\"24\",\"weather\":\"暴雨到大暴雨\"},{\"wid\":\"25\",\"weather\":\"大暴雨到特大暴雨\"},{\"wid\":\"26\",\"weather\":\"小到中雪\"},{\"wid\":\"27\",\"weather\":\"中到大雪\"},{\"wid\":\"28\",\"weather\":\"大到暴雪\"},{\"wid\":\"30\",\"weather\":\"扬沙\"},{\"wid\":\"31\",\"weather\":\"强沙尘暴\"},{\"wid\":\"53\",\"weather\":\"霾\"}]"; + + private final static String key = "aaebb3e5c18fd371257a2ab6b5670efe"; + + private static HttpClientUtil httpClientUtil = new HttpClientUtil(); + + + /** + * 获取天气实况数据 + * @param city 要查询的城市名称/id,城市名称如:温州、上海、北京,需要utf8 urlencode + * @return + */ + public static Realtime queryNowWeather(String city){ + if(ToolUtil.isEmpty(city)){ + return null; + } + String url = "http://apis.juhe.cn/simpleWeather/query?city=" + city + "&key=" + key; + HttpResult httpResult = null; + try { + httpResult = httpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + } catch (Exception e) { + e.printStackTrace(); + } + if(httpResult.getCode() != 200){ + logger.debug("查询天气失败:" + httpResult.getData()); + return null; + } + String data = httpResult.getData(); + JSONObject jsonObject = JSON.parseObject(data); + Integer error_code = jsonObject.getInteger("error_code"); + if(0 != error_code){ + logger.debug("查询天气失败:" + jsonObject.getString("reason")); + return null; + } + Realtime realtime = jsonObject.getObject("realtime", Realtime.class); + return realtime; + } + + + /** + * 查询是否是恶劣天气 + * @param city + * @return + */ + public static boolean isBadWeather(String city){ + if(null == city){ + return false; + } + Realtime realtime = queryNowWeather(city); + if(null == realtime){ + return false; + } + String wid = realtime.getWid(); + JSONArray badWeather = JSON.parseArray(bad_weather); + for (int i = 0; i < badWeather.size(); i++) { + JSONObject jsonObject = badWeather.getJSONObject(i); + String wid1 = jsonObject.getString("wid"); + if(wid.equals(wid1)){ + return true; + } + } + return false; + } + + + /** + * 获取支持城市列表 + * @return + */ + public static List<WeatherCityInfo> queryCityList(){ + String url = "http://apis.juhe.cn/simpleWeather/cityList?key=" + key; + HttpResult httpResult = null; + try { + httpResult = httpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + } catch (Exception e) { + e.printStackTrace(); + } + if(httpResult.getCode() != 200){ + logger.debug("查询支持城市失败:" + httpResult.getData()); + return null; + } + String data = httpResult.getData(); + JSONObject jsonObject = JSON.parseObject(data); + Integer error_code = jsonObject.getInteger("error_code"); + if(0 != error_code){ + logger.debug("查询支持城失败:" + jsonObject.getString("reason")); + return null; + } + JSONArray result = jsonObject.getJSONArray("result"); + List<WeatherCityInfo> weatherCities = result.toJavaList(WeatherCityInfo.class); + return weatherCities; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/MongoUtils.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/MongoUtils.java new file mode 100644 index 0000000..6cc2d80 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/MongoUtils.java @@ -0,0 +1,166 @@ +package com.agentdriving.user.modular.system.util.mongodb; + +import com.alibaba.fastjson.JSONObject; +import com.mongodb.BasicDBObject; +import com.mongodb.client.AggregateIterable; +import com.mongodb.client.MongoCursor; +import com.agentdriving.user.modular.system.util.mongodb.model.Location; +import com.agentdriving.user.modular.system.util.mongodb.model.LocationQuery; +import org.bson.Document; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.Map.Entry; +import java.util.function.Supplier; + + +@Component +public class MongoUtils<T> { + + @Autowired + private MongoTemplate mongoTemplate; + + /** + * lambda + * @param data 添加数据 + * @param collectionName 表名 + */ + public void insert(Supplier<T> data,String collectionName){ + mongoTemplate.insert(data.get(),collectionName); + } + + public void insert(Object data, String collectionName){ + mongoTemplate.insert(data,collectionName); + } + + /** + * + * @param sp 查询条件lambda + * @param sets 更新的字段 + * @param collectionName 表名 + */ + public void update(Supplier<Criteria> sp, Supplier<Map<String,Object>> sets, String collectionName){ + Query query = Query.query(sp.get()); + Update update = new Update(); + + sets.get().forEach((key,value) ->{ + //System.out.println(key); + //System.out.println(value); + update.set(key,value); + }); + mongoTemplate.updateFirst(query, update, collectionName); + } + + public void update(Criteria sp, Supplier<Map<String,Object>> sets, String collectionName){ + Query query = Query.query(sp); + Update update = new Update(); + + sets.get().forEach((key,value) ->{ + //System.out.println(key); + //System.out.println(value); + update.set(key,value); + }); + mongoTemplate.updateFirst(query, update, collectionName); + } + + /**lambda + * @param sp 查询条件lambda + * @param collectionName 表名 + * @return + */ + public List<T> query(Supplier<Criteria> sp, String collectionName, Class entityClass){ + Query query = Query.query(sp.get()); + List<T> ts = mongoTemplate.find(query,entityClass,collectionName); + + return ts; + } + + public List<T> query(Criteria sp, String collectionName, Class entityClass){ + Query query = Query.query(sp); + List<T> ts = mongoTemplate.find(query,entityClass,collectionName); + + return ts; + } + + /** + * @param sp 查询条件lambda + * @param collectionName 表名 + * @return + */ + public void delete(Supplier<Criteria> sp, String collectionName){ + Query query = Query.query(sp.get()); + mongoTemplate.remove(query, collectionName); + } + + public void delete(Criteria sp, String collectionName){ + Query query = Query.query(sp); + mongoTemplate.remove(query, collectionName); + } + + + + /** + * 查询符合条件总条数 + * @return + * @throws Exception + */ + public long findLogCount(HashMap<String,Object> paras,Class entityClass,String collectionName) throws Exception { + Query query = new Query(); + Criteria criteria = new Criteria(); + if (null != paras ) { + Iterator<Entry<String, Object>> iterator = paras.entrySet().iterator(); + while(iterator.hasNext()) { + Entry<String, Object> entry = iterator.next(); + String key = entry.getKey(); + Object value = entry.getValue(); + criteria.and(key).is(value); + + } + query.addCriteria(criteria); + } + long count = mongoTemplate.count(query, entityClass,collectionName); + + return count; + } + + /** + * 查询附近的对象 + * @param model + * @return + */ + public List<Location> geoNear(LocationQuery model){ + List<Location> resultList = new ArrayList<>(); + try{ + List<BasicDBObject> pipeLine = new ArrayList<>(); + BasicDBObject aggregate = new BasicDBObject("$geoNear", + new BasicDBObject("near" + , new BasicDBObject("type", "Point") + .append("coordinates", model.getCoordinates())) + .append("distanceField", "distance") + .append("maxDistance", model.getDistance()) + .append("spherical", true) + + ); + + pipeLine.add(aggregate); + AggregateIterable<Document> location = mongoTemplate.getCollection("location").aggregate(pipeLine); + MongoCursor<Document> cursor = location.iterator(); + + //将查询的结果,封装成对象返回出去 + while (cursor.hasNext()) { + Document document = cursor.next(); + Location node = JSONObject.parseObject(JSONObject.toJSONString(document),Location.class); + resultList.add(node); + } + }catch (Exception e){ + e.printStackTrace(); + } + return resultList; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/GeoJson.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/GeoJson.java new file mode 100644 index 0000000..9234374 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/GeoJson.java @@ -0,0 +1,9 @@ +package com.agentdriving.user.modular.system.util.mongodb.model; + +import lombok.Data; + +@Data +public class GeoJson { + private String type; + private Double[] coordinates; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/Location.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/Location.java new file mode 100644 index 0000000..71fe5c4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/Location.java @@ -0,0 +1,50 @@ +package com.agentdriving.user.modular.system.util.mongodb.model; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.geo.GeoJsonPoint; +import org.springframework.data.mongodb.core.index.CompoundIndex; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.io.Serializable; + + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Document(collection = "driver_location") +@CompoundIndex(name = "location_index", def = "{'location': '2dsphere'}") +public class Location implements Serializable { + + private static final long serialVersionUID = 4508868382007529970L; + + @Id + private String id; + /** + * 司机id + */ + private Integer driverId; + /** + * x:经度 y:纬度 + */ + private GeoJsonPoint location; + /** + * 位置名称 + **/ + private String name; + /** + * 创建时间 + */ + private Long created; + /** + * 更新时间 + */ + private Long updated; + /** + * 上次更新时间 + */ + private Long lastUpdated; + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/LocationQuery.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/LocationQuery.java new file mode 100644 index 0000000..cd416f6 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/LocationQuery.java @@ -0,0 +1,23 @@ +package com.agentdriving.user.modular.system.util.mongodb.model; + +import lombok.Data; + +@Data +public class LocationQuery { + /** + * 当前经纬度[xxx,xxx] + **/ + private Double[] coordinates; + /** + * 距离,如:200,500,1,3,5,10,20 + **/ + private Double distance; + /** + * 距离单位,如:m,km + **/ + private String unit; + /** + * 位置类型:1-景点,2-加油站,3-酒店 + **/ + private Integer type; +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AES.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AES.java new file mode 100644 index 0000000..4358ba7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AES.java @@ -0,0 +1,72 @@ +package com.agentdriving.user.modular.system.util.weChat; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.security.*; + +/** +* AES加密 +* @author pzb +* @Date 2021/12/3 15:43 +*/ +public class AES { + + public static boolean initialized = false; + + /** + * AES解密 + * + * @param content + * 密文 + * @return + * @throws InvalidAlgorithmParameterException + * @throws NoSuchProviderException + */ + public byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) throws InvalidAlgorithmParameterException { + initialize(); + try { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); + Key sKeySpec = new SecretKeySpec(keyByte, "AES"); + cipher.init(Cipher.DECRYPT_MODE, sKeySpec, generateIV(ivByte));// 初始化 + byte[] result = cipher.doFinal(content); + return result; + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } catch (NoSuchProviderException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + public static void initialize() { + if (initialized) + return; + Security.addProvider(new BouncyCastleProvider()); + initialized = true; + } + + // 生成iv + public static AlgorithmParameters generateIV(byte[] iv) throws Exception { + AlgorithmParameters params = AlgorithmParameters.getInstance("AES"); + params.init(new IvParameterSpec(iv)); + return params; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AesException.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AesException.java new file mode 100644 index 0000000..e3de9b0 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AesException.java @@ -0,0 +1,59 @@ +package com.agentdriving.user.modular.system.util.weChat; + +@SuppressWarnings("serial") +public class AesException extends Exception { + + public final static int OK = 0; + public final static int ValidateSignatureError = -40001; + public final static int ParseXmlError = -40002; + public final static int ComputeSignatureError = -40003; + public final static int IllegalAesKey = -40004; + public final static int ValidateAppidError = -40005; + public final static int EncryptAESError = -40006; + public final static int DecryptAESError = -40007; + public final static int IllegalBuffer = -40008; + //public final static int EncodeBase64Error = -40009; + //public final static int DecodeBase64Error = -40010; + //public final static int GenReturnXmlError = -40011; + + private int code; + + private static String getMessage(int code) { + switch (code) { + case ValidateSignatureError: + return "签名验证错误"; + case ParseXmlError: + return "xml解析失败"; + case ComputeSignatureError: + return "sha加密生成签名失败"; + case IllegalAesKey: + return "SymmetricKey非法"; + case ValidateAppidError: + return "appid校验失败"; + case EncryptAESError: + return "aes加密失败"; + case DecryptAESError: + return "aes解密失败"; + case IllegalBuffer: + return "解密后得到的buffer非法"; +// case EncodeBase64Error: +// return "base64加密错误"; +// case DecodeBase64Error: +// return "base64解密错误"; +// case GenReturnXmlError: +// return "xml生成失败"; + default: + return null; // cannot be + } + } + + public int getCode() { + return code; + } + + AesException(int code) { + super(getMessage(code)); + this.code = code; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/ByteGroup.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/ByteGroup.java new file mode 100644 index 0000000..7aaa4dd --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/ByteGroup.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.util.weChat; + +import java.util.ArrayList; + +class ByteGroup { + ArrayList<Byte> byteContainer = new ArrayList<Byte>(); + + public byte[] toBytes() { + byte[] bytes = new byte[byteContainer.size()]; + for (int i = 0; i < byteContainer.size(); i++) { + bytes[i] = byteContainer.get(i); + } + return bytes; + } + + public ByteGroup addBytes(byte[] bytes) { + for (byte b : bytes) { + byteContainer.add(b); + } + return this; + } + + public int size() { + return byteContainer.size(); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/PKCS7Encoder.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/PKCS7Encoder.java new file mode 100644 index 0000000..44a12f2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/PKCS7Encoder.java @@ -0,0 +1,67 @@ +/** + * 对公众平台发送给公众账号的消息加解密示例代码. + * + * @copyright Copyright (c) 1998-2014 Tencent Inc. + */ + +// ------------------------------------------------------------------------ + +package com.agentdriving.user.modular.system.util.weChat; + +import java.nio.charset.Charset; +import java.util.Arrays; + +/** + * 提供基于PKCS7算法的加解密接口. + */ +class PKCS7Encoder { + static Charset CHARSET = Charset.forName("utf-8"); + static int BLOCK_SIZE = 32; + + /** + * 获得对明文进行补位填充的字节. + * + * @param count 需要进行填充补位操作的明文字节个数 + * @return 补齐用的字节数组 + */ + static byte[] encode(int count) { + // 计算需要填充的位数 + int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE); + if (amountToPad == 0) { + amountToPad = BLOCK_SIZE; + } + // 获得补位所用的字符 + char padChr = chr(amountToPad); + String tmp = new String(); + for (int index = 0; index < amountToPad; index++) { + tmp += padChr; + } + return tmp.getBytes(CHARSET); + } + + /** + * 删除解密后明文的补位字符 + * + * @param decrypted 解密后的明文 + * @return 删除补位字符后的明文 + */ + static byte[] decode(byte[] decrypted) { + int pad = (int) decrypted[decrypted.length - 1]; + if (pad < 1 || pad > 32) { + pad = 0; + } + return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad); + } + + /** + * 将数字转化成ASCII码对应的字符,用于对明文进行补码 + * + * @param a 需要转化的数字 + * @return 转化得到的字符 + */ + static char chr(int a) { + byte target = (byte) (a & 0xFF); + return (char) target; + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/SHA1.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/SHA1.java new file mode 100644 index 0000000..a9b2835 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/SHA1.java @@ -0,0 +1,61 @@ +/** + * 对公众平台发送给公众账号的消息加解密示例代码. + * + * @copyright Copyright (c) 1998-2014 Tencent Inc. + */ + +// ------------------------------------------------------------------------ + +package com.agentdriving.user.modular.system.util.weChat; + +import java.security.MessageDigest; +import java.util.Arrays; + +/** + * SHA1 class + * + * 计算公众平台的消息签名接口. + */ +public class SHA1 { + + /** + * 用SHA1算法生成安全签名 + * @param token 票据 + * @param timestamp 时间戳 + * @param nonce 随机字符串 + * @param encrypt 密文 + * @return 安全签名 + * @throws AesException + */ + public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException + { + try { + String[] array = new String[] { token, timestamp, nonce, encrypt }; + StringBuffer sb = new StringBuffer(); + // 字符串排序 + Arrays.sort(array); + for (int i = 0; i < 4; i++) { + sb.append(array[i]); + } + String str = sb.toString(); + // SHA1签名生成 + MessageDigest md = MessageDigest.getInstance("SHA-1"); + md.update(str.getBytes()); + byte[] digest = md.digest(); + + StringBuffer hexstr = new StringBuffer(); + String shaHex = ""; + for (int i = 0; i < digest.length; i++) { + shaHex = Integer.toHexString(digest[i] & 0xFF); + if (shaHex.length() < 2) { + hexstr.append(0); + } + hexstr.append(shaHex); + } + return hexstr.toString(); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.ComputeSignatureError); + } + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXBizMsgCrypt.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXBizMsgCrypt.java new file mode 100644 index 0000000..35b34d1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXBizMsgCrypt.java @@ -0,0 +1,288 @@ +/** + * 对公众平台发送给公众账号的消息加解密示例代码. + * + * @copyright Copyright (c) 1998-2014 Tencent Inc. + */ + +// ------------------------------------------------------------------------ + +/** + * 针对org.apache.commons.codec.binary.Base64, + * 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本) + * 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi + */ +package com.agentdriving.user.modular.system.util.weChat; + +import org.apache.commons.codec.binary.Base64; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.Charset; +import java.util.Arrays; +import java.util.Random; + +/** + * 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串). + * <ol> + * <li>第三方回复加密消息给公众平台</li> + * <li>第三方收到公众平台发送的消息,验证消息的安全性,并对消息进行解密。</li> + * </ol> + * 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案 + * <ol> + * <li>在官方网站下载JCE无限制权限策略文件(JDK7的下载地址: + * http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html</li> + * <li>下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt</li> + * <li>如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件</li> + * <li>如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件</li> + * </ol> + */ +public class WXBizMsgCrypt { + static Charset CHARSET = Charset.forName("utf-8"); + Base64 base64 = new Base64(); + byte[] aesKey; + String token; + String appId; + + /** + * 构造函数 + * @param token 公众平台上,开发者设置的token + * @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey + * @param appId 公众平台appid + * + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public WXBizMsgCrypt(String token, String encodingAesKey, String appId) throws AesException { + if (encodingAesKey.length() != 43) { + throw new AesException(AesException.IllegalAesKey); + } + + this.token = token; + this.appId = appId; + aesKey = Base64.decodeBase64(encodingAesKey + "="); + } + + // 生成4个字节的网络字节序 + byte[] getNetworkBytesOrder(int sourceNumber) { + byte[] orderBytes = new byte[4]; + orderBytes[3] = (byte) (sourceNumber & 0xFF); + orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF); + orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF); + orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF); + return orderBytes; + } + + // 还原4个字节的网络字节序 + int recoverNetworkBytesOrder(byte[] orderBytes) { + int sourceNumber = 0; + for (int i = 0; i < 4; i++) { + sourceNumber <<= 8; + sourceNumber |= orderBytes[i] & 0xff; + } + return sourceNumber; + } + + // 随机生成16位字符串 + String getRandomStr() { + String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < 16; i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + return sb.toString(); + } + + /** + * 对明文进行加密. + * + * @param text 需要加密的明文 + * @return 加密后base64编码的字符串 + * @throws AesException aes加密失败 + */ + String encrypt(String randomStr, String text) throws AesException { + ByteGroup byteCollector = new ByteGroup(); + byte[] randomStrBytes = randomStr.getBytes(CHARSET); + byte[] textBytes = text.getBytes(CHARSET); + byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); + byte[] appidBytes = appId.getBytes(CHARSET); + + // randomStr + networkBytesOrder + text + appid + byteCollector.addBytes(randomStrBytes); + byteCollector.addBytes(networkBytesOrder); + byteCollector.addBytes(textBytes); + byteCollector.addBytes(appidBytes); + + // ... + pad: 使用自定义的填充方式对明文进行补位填充 + byte[] padBytes = PKCS7Encoder.encode(byteCollector.size()); + byteCollector.addBytes(padBytes); + + // 获得最终的字节流, 未加密 + byte[] unencrypted = byteCollector.toBytes(); + + try { + // 设置加密模式为AES的CBC模式 + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); + SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES"); + IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv); + + // 加密 + byte[] encrypted = cipher.doFinal(unencrypted); + + // 使用BASE64对加密后的字符串进行编码 + String base64Encrypted = base64.encodeToString(encrypted); + + return base64Encrypted; + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.EncryptAESError); + } + } + + /** + * 对密文进行解密. + * + * @param text 需要解密的密文 + * @return 解密得到的明文 + * @throws AesException aes解密失败 + */ + String decrypt(String text) throws AesException { + byte[] original; + try { + // 设置解密模式为AES的CBC模式 + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); + SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES"); + IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16)); + cipher.init(Cipher.DECRYPT_MODE, key_spec, iv); + + // 使用BASE64对密文进行解码 + byte[] encrypted = Base64.decodeBase64(text); + + // 解密 + original = cipher.doFinal(encrypted); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.DecryptAESError); + } + + String xmlContent, from_appid; + try { + // 去除补位字符 + byte[] bytes = PKCS7Encoder.decode(original); + + // 分离16位随机字符串,网络字节序和AppId + byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20); + + int xmlLength = recoverNetworkBytesOrder(networkOrder); + + xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET); + from_appid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length), + CHARSET); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.IllegalBuffer); + } + + // appid不相同的情况 + if (!from_appid.equals(appId)) { + throw new AesException(AesException.ValidateAppidError); + } + return xmlContent; + + } + + /** + * 将公众平台回复用户的消息加密打包. + * <ol> + * <li>对要发送的消息进行AES-CBC加密</li> + * <li>生成安全签名</li> + * <li>将消息密文和安全签名打包成xml格式</li> + * </ol> + * + * @param replyMsg 公众平台待回复用户的消息,xml格式的字符串 + * @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp + * @param nonce 随机串,可以自己生成,也可以用URL参数的nonce + * + * @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串 + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public String encryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException { + // 加密 + String encrypt = encrypt(getRandomStr(), replyMsg); + + // 生成安全签名 + if (timeStamp == "") { + timeStamp = Long.toString(System.currentTimeMillis()); + } + + String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt); + + // System.out.println("发送给平台的签名是: " + signature[1].toString()); + // 生成发送的xml + String result = XMLParse.generate(encrypt, signature, timeStamp, nonce); + return result; + } + + /** + * 检验消息的真实性,并且获取解密后的明文. + * <ol> + * <li>利用收到的密文生成安全签名,进行签名验证</li> + * <li>若验证通过,则提取xml中的加密消息</li> + * <li>对消息进行解密</li> + * </ol> + * + * @param msgSignature 签名串,对应URL参数的msg_signature + * @param timeStamp 时间戳,对应URL参数的timestamp + * @param nonce 随机串,对应URL参数的nonce + * @param postData 密文,对应POST请求的数据 + * + * @return 解密后的原文 + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData) + throws AesException { + + // 密钥,公众账号的app secret + // 提取密文 + Object[] encrypt = XMLParse.extract(postData); + + // 验证安全签名 + String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString()); + + // 和URL中的签名比较是否相等 + // System.out.println("第三方收到URL中的签名:" + msg_sign); + // System.out.println("第三方校验签名:" + signature); + if (!signature.equals(msgSignature)) { + throw new AesException(AesException.ValidateSignatureError); + } + + // 解密 + String result = decrypt(encrypt[1].toString()); + return result; + } + + /** + * 验证URL + * @param msgSignature 签名串,对应URL参数的msg_signature + * @param timeStamp 时间戳,对应URL参数的timestamp + * @param nonce 随机串,对应URL参数的nonce + * @param echoStr 随机串,对应URL参数的echostr + * + * @return 解密之后的echostr + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr) + throws AesException { + String signature = SHA1.getSHA1(token, timeStamp, nonce, ""); + + if (!signature.equals(msgSignature)) { + throw new AesException(AesException.ValidateSignatureError); + } + + String result = decrypt(echoStr); + return result; + } + +} \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXCore.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXCore.java new file mode 100644 index 0000000..29485c1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXCore.java @@ -0,0 +1,52 @@ +package com.agentdriving.user.modular.system.util.weChat; + +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; + +public class WXCore { + + private static Logger logger = LoggerFactory.getLogger(WXCore.class); + + private static final String WATERMARK = "watermark"; + + @Value("${wx.appletsAppid}") + private static String appid ; + + + + /** + * 解密数据 + * @return + * @throws Exception + */ + public static String decrypt(String encryptedData, String sessionKey, String iv){ + String result = ""; + try { + AES aes = new AES(); + byte[] resultByte = aes.decrypt(Base64.decodeBase64(encryptedData), Base64.decodeBase64(sessionKey), Base64.decodeBase64(iv)); + if(null != resultByte && resultByte.length > 0){ + result = new String(WxPKCS7Encoder.decode(resultByte), "UTF-8"); +// JSONObject jsonObject = JSON.parseObject(result); +// String decryptAppid = jsonObject.getJSONObject(WATERMARK).getString("appid"); +// if(!appid.equals(decryptAppid)){ +// result = ""; +// } + } + } catch (Exception e) { + result = ""; + e.printStackTrace(); + } + return result; + } + + + public static void main(String[] args) throws Exception{ + String appId = "wx4f4bc4dec97d474b"; + String encryptedData = "ajhisfk0EhWCBcoxt/5QJA3bKPTygQXANbCSev92MyqIqGxRhzZFS1SlQrIWAo3tx8YfsB+VlScZNOlRyfnXKqPUl9h+PDeKsTkTst9V4pq4mUbI+r3AautXBffVk/rpyjMfanVsWeOlxkupdv2U9U4BrueR/Rak+TCmHTWUUf8eDLoi6nioL/Pft/rYaO3JD54hgpcY0Ef/k7Boyap4E0/uKVowY1ANO7KVydSXE6S7OKzXuzmDTbV38v+7ryMHtglUzoKzF1gL8y9OZRwkaesfHN1kfItjpsAibjSgkIiiW6ZEHLT2n1UDkJtfUqg63je2cJAH7gzeUm9TCDDftdhLU+NuPk3j/LXyFQ05pJ8B19+kIXF3dcmHOH7lFvi7yGmVuAD/9AnetGWgId3TZDS/OjbiVUM30RogeziAw98VpAyAAq1r2ULFwi8e928m"; + String sessionKey = "CdxFGwXIluQFZ+qD+NSFKQ=="; + String iv = "3FD8r1Spwlf7LG8YEq41+Q=="; + logger.debug(decrypt(encryptedData, sessionKey, iv)); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WeChatUtil.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WeChatUtil.java new file mode 100644 index 0000000..197c0b2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WeChatUtil.java @@ -0,0 +1,415 @@ +package com.agentdriving.user.modular.system.util.weChat; + +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.util.RedisUtil; +import com.agentdriving.user.modular.system.util.UUIDUtil; +import com.agentdriving.user.modular.system.util.httpClinet.HttpClientUtil; +import com.agentdriving.user.modular.system.util.httpClinet.HttpResult; +import com.agentdriving.user.modular.system.util.weChat.model.Code2Session; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.codec.digest.DigestUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.*; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +/** + * 微信工具类 + */ +@Component +public class WeChatUtil { + + private static Logger logger = LoggerFactory.getLogger(WeChatUtil.class); + + @Value("${wx.appletsAppid}") + private String wxAppletsAppid; + + @Value("${wx.appletsAppSecret}") + private String wxAppletsAppSecret; + + @Value("${wx.officialAccountAppid}") + private String officialAccountAppid; + + @Value("{wx.officialAccountAppSecret}") + private String officialAccountAppSecret; + + @Value("${wx.appid}") + private String webAppId; + + @Value("${wx.appSecret}") + private String webAppSecret; + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private RedisUtil redisUtil; + + + + { + new Thread(new Runnable() { + @Override + public void run() { + try { + Thread.sleep(30000); + new Timer().schedule(new TimerTask() { + @Override + public void run() { + try { + String wxAppletsAccessToken = getWxAppletsAccessToken(); + if(ToolUtil.isEmpty(wxAppletsAccessToken)){ + System.err.println("获取微信小程序access_token失败"); + return; + } + redisUtil.setStrValue("wxAppletsAccessToken", wxAppletsAccessToken, 7000); + }catch (Exception e){ + e.printStackTrace(); + } + } + }, 0, 7000000); + }catch (Exception e){ + e.printStackTrace(); + } + } + }).start(); + + } + + + /** + * 小程序使用jscode获取openid + * @param jscode + * @return + */ + public Code2Session code2Session(String jscode) throws Exception{ + String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxAppletsAppid + "&secret=" + wxAppletsAppSecret + + "&js_code=" + jscode + "&grant_type=authorization_code"; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); + if(null == httpResult || httpResult.getCode() != 200){ + return null; + } + Code2Session code2Session = JSON.parseObject(httpResult.getData(), Code2Session.class); + return code2Session; + } + + + /** + * 获取微信小程序token + * @return + */ + public String getWxAppletsAccessToken() throws Exception{ + String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + wxAppletsAppid + "&secret=" + wxAppletsAppSecret; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); + if(httpResult.getCode() != 200){ + return ""; + } + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + return jsonObject.getString("access_token"); + } + + + /*** + * 获取jsapiTicket(小程序) + * 来源 www.vxzsk.com + * @return + */ + public String getWxAppletsJSApiTicket() throws Exception{ + String wxAppletsAccessToken = redisUtil.getValue("wxAppletsAccessToken"); + String urlStr = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + wxAppletsAccessToken + "&type=jsapi"; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", urlStr, null, null, "form"); + if(httpResult.getCode() != 200){ + return null; + } + logger.debug(httpResult.getData()); + String ticket = JSONObject.parseObject(httpResult.getData()).getString("ticket"); + return ticket; + } + + /** + * 通过config接口注入权限验证配置(小程序) + * 附录1-JS-SDK使用权限签名算法, + * @return + */ + public Map<String,Object> getWxAppletsSignatureConfig(String url) throws Exception{ + //获取token + try { + url = URLDecoder.decode(url, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + String ticket = getWxAppletsJSApiTicket(); + String noncestr = UUIDUtil.getRandomCode(); + Long timestamp = System.currentTimeMillis(); + String content = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; + String signature = DigestUtils.sha1Hex(content); + Map<String,Object> map=new HashMap<>(); + map.put("appId", wxAppletsAppid); + map.put("timestamp", timestamp); + map.put("nonceStr", noncestr); + map.put("signature", signature); + return map; + } + + + + /** + * 网站应用登录 + * @param code + * @return + */ + public Map<String, String> webAccessToken(String code) throws Exception{ + String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + webAppId + "&secret=" + webAppSecret + "&code=" + code + "&grant_type=authorization_code"; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); + if(httpResult.getCode() != 200){ + return null; + } + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + int errcode = jsonObject.getIntValue("errcode"); + Map<String, String> map = new HashMap<>(); + if(errcode == 0){//成功 + map.put("access_token", jsonObject.getString("access_token")); + map.put("openid", jsonObject.getString("openid")); + map.put("refresh_token", jsonObject.getString("refresh_token")); + map.put("unionid", jsonObject.getString("unionid")); + return map; + } + if(errcode == -1){//系统繁忙,此时请开发者稍候再试 + map.put("msg", jsonObject.getString("errmsg")); + return map; + } + if(errcode == 40029){//code 无效 + map.put("msg", jsonObject.getString("errmsg")); + return map; + } + if(errcode == 45011){//频率限制,每个用户每分钟100次 + map.put("msg", jsonObject.getString("errmsg")); + return map; + } + return map; + } + + + /** + * 获取微信个人信息 + * @param access_token + * @param openid + * @return + */ + public Map<String, Object> getUserInfo(String access_token, String openid) throws Exception{ + String url = "https://api.weixin.qq.com/sns/userinfo?access_token=" + access_token + "&openid=" + openid; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); + if(httpResult.getCode() != 200){ + return null; + } + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + int errcode = jsonObject.getIntValue("errcode"); + Map<String, Object> map = new HashMap<>(); + if(errcode == 0){//成功 + map.put("nickname", jsonObject.getString("nickname")); + map.put("openid", jsonObject.getString("openid")); + map.put("sex", jsonObject.getString("sex")); + map.put("headimgurl", jsonObject.getString("headimgurl")); + return map; + } + if(errcode == -1){//系统繁忙,此时请开发者稍候再试 + map.put("msg", jsonObject.getString("errmsg")); + return map; + } + if(errcode == 40029){//code 无效 + map.put("msg", jsonObject.getString("errmsg")); + return map; + } + if(errcode == 45011){//频率限制,每个用户每分钟100次 + map.put("msg", jsonObject.getString("errmsg")); + return map; + } + return map; + } + + + /** + * 公众号获取openid + * @param code + * @return + */ + public Map<String,Object> getOpenId(String code) throws Exception{ + if (code == null || code.length() == 0) { + return null; + } + String grantType = "authorization_code"; + String params = "appid=" + officialAccountAppid + "&secret=" + officialAccountAppSecret + "&code=" + code + "&grant_type=" + grantType; + logger.debug("sssss"+params); + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", "https://api.weixin.qq.com/sns/oauth2/access_token?" + params, null, null, "form"); + if(httpResult.getCode() != 200){ + return null; + } + JSONObject json = JSON.parseObject(httpResult.getData()); + logger.debug(json.toJSONString()); + String openId = json.get("openid").toString(); + String accessToken = json.get("access_token").toString(); + Integer expiresIn = json.getInteger("expires_in"); + String refresh_token = json.getString("refresh_token"); + String unionid = json.getString("unionid"); + Map<String,Object> map=new HashMap<>(); + map.put("openId",openId); + map.put("accessToken",accessToken); + map.put("expiresIn", expiresIn); + map.put("refreshToken", refresh_token); + map.put("unionid", unionid); + return map; + } + + + /*** + * 获取acess_token (公众号) + * 来源www.vxzsk.com + * @return + */ + public String getAccessToken() throws Exception{ + String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + officialAccountAppid + + "&secret=" + officialAccountAppSecret; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); + if(httpResult.getCode() != 200){ + return null; + } + String accessToken = JSONObject.parseObject(httpResult.getData()).getString("access_token"); + return accessToken; + } + + /*** + * 获取jsapiTicket(公众号) + * 来源 www.vxzsk.com + * @return + */ + public String getJSApiTicket() throws Exception{ + //获取token + String acess_token = redisUtil.getValue("acess_token"); + String urlStr = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + acess_token + "&type=jsapi"; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", urlStr, null, null, "form"); + if(httpResult.getCode() != 200){ + return null; + } + logger.debug(httpResult.getData()); + String ticket = JSONObject.parseObject(httpResult.getData()).getString("ticket"); + return ticket; + } + + /** + * 通过config接口注入权限验证配置(公众号) + * 附录1-JS-SDK使用权限签名算法, + * @return + */ + public Map<String,Object> getSignatureConfig(String url) throws Exception{ + //获取token + try { + url = URLDecoder.decode(url, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + String ticket = getJSApiTicket(); + String noncestr = UUIDUtil.getRandomCode(); + Long timestamp = System.currentTimeMillis(); + String content = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; + String signature = DigestUtils.sha1Hex(content); + Map<String,Object> map=new HashMap<>(); + map.put("appId", officialAccountAppid); + map.put("timestamp", timestamp); + map.put("nonceStr", noncestr); + map.put("signature", signature); + return map; + } + + + /** + * 公众号获取用户个人信息 + * @param access_token + * @param openid + * @return + */ + public Map<String, Object> queryUserInfo(String access_token, String openid) throws Exception{ + String url = "https://api.weixin.qq.com/sns/userinfo?access_token=" + access_token + "&openid=" + openid + "&lang=zh_CN"; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); + if(httpResult.getCode() != 200){ + return null; + } + logger.debug(httpResult.getData()); + JSONObject j = JSON.parseObject(httpResult.getData()); + Map<String, Object> map = new HashMap<>(); + map.put("nickname", j.getString("nickname")); + map.put("sex", j.getInteger("sex")); + map.put("headimgurl", j.getString("headimgurl")); + map.put("unionid", j.getString("unionid")); + return map; + } + + + /** + * 获取小程序二维码 + * @param page 跳转页 例如 pages/index/index + * @param scene 参数 a=1&b=2 + */ + public InputStream getwxacodeunlimit(String page, String scene, String envVersion) throws Exception{ + try { + String wxAppletsAccessToken = redisUtil.getValue("wxAppletsAccessToken"); + String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + wxAppletsAccessToken; + Map<String, Object> param = new HashMap<>(); + param.put("scene", scene); + param.put("page", page); + param.put("env_version", envVersion); + HttpHeaders httpHeaders = new HttpHeaders(); + MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8"); + httpHeaders.setContentType(type); + HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(param, httpHeaders); + ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class, new Object[0]); + String body1 = exchange.getBody(); +// System.err.println(body1); + ResponseEntity<byte[]> entity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); + byte[] body = entity.getBody(); +// System.err.println(Base64.encodeBase64String(body)); + return new ByteArrayInputStream(body); + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + + /** + * 获取小程序urlscheme码 + * @return + */ + public String getUrlscheme(String path) throws Exception{ + String wxAppletsAccessToken = redisUtil.getValue("wxAppletsAccessToken"); + String url = "https://api.weixin.qq.com/wxa/generatescheme?access_token=" + wxAppletsAccessToken; + Map<String, Object> param = new HashMap<>(); + param.put("is_expire", true); + param.put("expire_type", 1); + param.put("expire_interval", 180); + Map<String, Object> map1 = new HashMap<>(); + map1.put("path", path); + map1.put("query", ""); + map1.put("env_version", "release"); + param.put("jump_wxa", map1); + HttpHeaders httpHeaders = new HttpHeaders(); + MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8"); + httpHeaders.setContentType(type); + HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(param, httpHeaders); + ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class); + String body1 = exchange.getBody(); + return body1; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WxPKCS7Encoder.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WxPKCS7Encoder.java new file mode 100644 index 0000000..30db51b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WxPKCS7Encoder.java @@ -0,0 +1,63 @@ +package com.agentdriving.user.modular.system.util.weChat; + +import java.nio.charset.Charset; +import java.util.Arrays; + +/** +* 微信小程序加解密 +* @author pzb +* @Date 2021/12/3 15:43 +*/ +public class WxPKCS7Encoder { + private static final Charset CHARSET = Charset.forName("utf-8"); + private static final int BLOCK_SIZE = 32; + + /** + * 获得对明文进行补位填充的字节. + * + * @param count + * 需要进行填充补位操作的明文字节个数 + * @return 补齐用的字节数组 + */ + public static byte[] encode(int count) { + // 计算需要填充的位数 + int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE); + if (amountToPad == 0) { + amountToPad = BLOCK_SIZE; + } + // 获得补位所用的字符 + char padChr = chr(amountToPad); + String tmp = new String(); + for (int index = 0; index < amountToPad; index++) { + tmp += padChr; + } + return tmp.getBytes(CHARSET); + } + + /** + * 删除解密后明文的补位字符 + * + * @param decrypted + * 解密后的明文 + * @return 删除补位字符后的明文 + */ + public static byte[] decode(byte[] decrypted) { + int pad = decrypted[decrypted.length - 1]; + if (pad < 1 || pad > 32) { + pad = 0; + } + return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad); + } + + /** + * 将数字转化成ASCII码对应的字符,用于对明文进行补码 + * + * @param a + * 需要转化的数字 + * @return 转化得到的字符 + */ + public static char chr(int a) { + byte target = (byte) (a & 0xFF); + return (char) target; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/XMLParse.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/XMLParse.java new file mode 100644 index 0000000..7a2fb20 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/XMLParse.java @@ -0,0 +1,71 @@ +/** + * 对公众平台发送给公众账号的消息加解密示例代码. + * + * @copyright Copyright (c) 1998-2014 Tencent Inc. + */ + +// ------------------------------------------------------------------------ + +package com.agentdriving.user.modular.system.util.weChat; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.StringReader; + +/** + * XMLParse class + * + * 提供提取消息格式中的密文及生成回复消息格式的接口. + */ +class XMLParse { + + /** + * 提取出xml数据包中的加密消息 + * @param xmltext 待提取的xml字符串 + * @return 提取出的加密消息字符串 + * @throws AesException + */ + public static Object[] extract(String xmltext) throws AesException { + Object[] result = new Object[3]; + try { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + StringReader sr = new StringReader(xmltext); + InputSource is = new InputSource(sr); + Document document = db.parse(is); + + Element root = document.getDocumentElement(); + NodeList nodelist1 = root.getElementsByTagName("Encrypt"); + NodeList nodelist2 = root.getElementsByTagName("ToUserName"); + result[0] = 0; + result[1] = nodelist1.item(0).getTextContent(); + result[2] = nodelist2.item(0).getTextContent(); + return result; + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.ParseXmlError); + } + } + + /** + * 生成xml消息 + * @param encrypt 加密后的消息密文 + * @param signature 安全签名 + * @param timestamp 时间戳 + * @param nonce 随机字符串 + * @return 生成的xml字符串 + */ + public static String generate(String encrypt, String signature, String timestamp, String nonce) { + + String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n" + + "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n" + + "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>"; + return String.format(format, encrypt, signature, timestamp, nonce); + + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Category.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Category.java new file mode 100644 index 0000000..a52a11b --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Category.java @@ -0,0 +1,18 @@ +package com.agentdriving.user.modular.system.util.weChat.model; + +import lombok.Data; + +/** + * 订阅消息类目 + */ +@Data +public class Category { + /** + * 类目id + */ + private String id; + /** + * 类目名称 + */ + private String name; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Code2Session.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Code2Session.java new file mode 100644 index 0000000..ae80092 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Code2Session.java @@ -0,0 +1,33 @@ +package com.agentdriving.user.modular.system.util.weChat.model; + +import lombok.Data; + +/** + * TODO + * + * @author 39373 + * @date 2023/2/26 19:42 + */ +@Data +public class Code2Session { + /** + * 状态码(-1=系统繁忙,0=成功,40029=code无效,45011=频率限制,每个用户每分钟100次,40226=高风险等级用户,小程序登录拦截 ) + */ + private Integer errcode; + /** + * 状态说明 + */ + private String errmsg; + /** + * openid + */ + private String openid; + /** + * sessionKey + */ + private String session_key; + /** + * unionid + */ + private String unionid; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/KeywordEnum.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/KeywordEnum.java new file mode 100644 index 0000000..573cf49 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/KeywordEnum.java @@ -0,0 +1,17 @@ +package com.agentdriving.user.modular.system.util.weChat.model; + +import lombok.Data; + +import java.util.List; + +@Data +public class KeywordEnum { + /** + * 枚举参数的 key + */ + private String keywordCode; + /** + * 枚举参数值范围列表 + */ + private List<String> enumValueList; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/MessageTemplate.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/MessageTemplate.java new file mode 100644 index 0000000..fdf30c4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/MessageTemplate.java @@ -0,0 +1,36 @@ +package com.agentdriving.user.modular.system.util.weChat.model; + +import lombok.Data; + +import java.util.List; + +/** + * 消息模板 + */ +@Data +public class MessageTemplate { + /** + * 添加至帐号下的模板 id,发送小程序订阅消息时所需 + */ + private String priTmplId; + /** + * 模版标题 + */ + private String title; + /** + * 模版内容 + */ + private String content; + /** + * 模板内容示例 + */ + private String example; + /** + * 模版类型,2 为一次性订阅,3 为长期订阅 + */ + private Integer type; + /** + * 枚举参数值范围 + */ + private List<KeywordEnum> keywordEnumValueList; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplateKeywords.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplateKeywords.java new file mode 100644 index 0000000..9bbccb5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplateKeywords.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.util.weChat.model; + +import lombok.Data; + +/** + * 公共消息模板关键字 + */ +@Data +public class PubTemplateKeywords { + /** + * 关键词 id,选用模板时需要 + */ + private Integer kid; + /** + * 关键词内容 + */ + private String name; + /** + * 关键词内容对应的示例 + */ + private String example; + /** + * 参数类型 + */ + private String rule; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplatetitles.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplatetitles.java new file mode 100644 index 0000000..3ce1b6a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplatetitles.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.util.weChat.model; + +import lombok.Data; + +/** + * 功能模板 + */ +@Data +public class PubTemplatetitles { + /** + * 模版标题 id + */ + private Integer tid; + /** + * 模版标题 + */ + private String title; + /** + * 模版类型,2 为一次性订阅,3 为长期订阅 + */ + private Integer type; + /** + * 模版所属类目 id + */ + private Integer categoryId; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ActivityWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ActivityWarpper.java new file mode 100644 index 0000000..50b46fe --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ActivityWarpper.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel("活动") +public class ActivityWarpper { + @ApiModelProperty("活动id") + private Integer id; + @ApiModelProperty("活动描述") + private String content; + @ApiModelProperty("完成情况") + private String carryOut; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getCarryOut() { + return carryOut; + } + + public void setCarryOut(String carryOut) { + this.carryOut = carryOut; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BalanceDetailsWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BalanceDetailsWarpper.java new file mode 100644 index 0000000..c9bd32e --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BalanceDetailsWarpper.java @@ -0,0 +1,28 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/23 17:15 + */ +@Data +@ApiModel +public class BalanceDetailsWarpper { + @ApiModelProperty("使用类型(2=支付订单,3=余额充值)") + private Integer type; + @ApiModelProperty("使用说明") + private String explain; + @ApiModelProperty("起点") + private String startAddress; + @ApiModelProperty("终点") + private String endAddress; + @ApiModelProperty("时间") + private Long createTime; + @ApiModelProperty("变动金额") + private Double amount; + @ApiModelProperty("余额") + private Double balance; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BaseWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BaseWarpper.java new file mode 100644 index 0000000..b31dc16 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BaseWarpper.java @@ -0,0 +1,171 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 公共封装类 + */ +@ApiModel("公共对象") +public class BaseWarpper { + @ApiModelProperty("主键id") + private Integer id; + @ApiModelProperty("名称") + private String name; + @ApiModelProperty("内容") + private String content; + @ApiModelProperty("数量") + private Integer number; + @ApiModelProperty("金额") + private Double amount; + @ApiModelProperty("时长(分钟)") + private Integer minute; + @ApiModelProperty("经度") + private Double lon; + @ApiModelProperty("纬度") + private Double lat; + @ApiModelProperty("日期") + private String day; + @ApiModelProperty("其他内容") + private Object data; + + public BaseWarpper() { + this.id = 0; + this.name = ""; + this.content = ""; + this.number = 0; + this.amount = 0D; + this.minute = 0; + this.lon = 0D; + this.lat = 0D; + this.day = ""; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public Integer getMinute() { + return minute; + } + + public void setMinute(Integer minute) { + this.minute = minute; + } + + public Double getLon() { + return lon; + } + + public void setLon(Double lon) { + this.lon = lon; + } + + public Double getLat() { + return lat; + } + + public void setLat(Double lat) { + this.lat = lat; + } + + public String getDay() { + return day; + } + + public void setDay(String day) { + this.day = day; + } + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } + + @Override + public String toString() { + return "BaseWarpper{" + + "id=" + id + + ", name='" + name + '\'' + + ", content='" + content + '\'' + + ", number=" + number + + ", amount=" + amount + + ", minute=" + minute + + ", lon=" + lon + + ", lat=" + lat + + ", day='" + day + '\'' + + ", data=" + data + + '}'; + } + + public static BaseWarpper getBaseWarpper(Map<String, Object> map){ + BaseWarpper baseWarpper = new BaseWarpper(); + if(null != map){ + baseWarpper.setId(null != map.get("id") ? Integer.valueOf(map.get("id").toString()) : 0); + baseWarpper.setName(null != map.get("name") ? map.get("name").toString() : ""); + baseWarpper.setContent(null != map.get("content") ? map.get("content").toString() : ""); + baseWarpper.setNumber(null != map.get("number") ? Integer.valueOf(map.get("number").toString()) : 0); + baseWarpper.setAmount(null != map.get("amount") ? Double.valueOf(map.get("amount").toString()) : 0); + baseWarpper.setMinute(null != map.get("minute") ? Integer.valueOf(map.get("minute").toString()) : 0); + baseWarpper.setLon(null != map.get("lon") ? Double.valueOf(map.get("lon").toString()) : 0.0); + baseWarpper.setLat(null != map.get("lat") ? Double.valueOf(map.get("lat").toString()) : 0.0); + baseWarpper.setDay(null != map.get("day") ? map.get("day").toString() : ""); + baseWarpper.setData(null != map.get("data") ? map.get("data") : new Object()); + } + return baseWarpper; + } + + + public static List<BaseWarpper> getBaseWarppers(List<Map<String, Object>> list){ + List<BaseWarpper> data = new ArrayList<>(); + if(null != list){ + for(Map<String, Object> map : list){ + data.add(BaseWarpper.getBaseWarpper(map)); + } + } + return data; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BillWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BillWarpper.java new file mode 100644 index 0000000..792fac8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BillWarpper.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:50 + */ +@Data +@ApiModel +public class BillWarpper { + @ApiModelProperty("数据id") + private Integer id; + @ApiModelProperty("时间") + private Long createTime; + @ApiModelProperty("发票内容") + private String billContent; + @ApiModelProperty("发票类型 1电子发票") + private Integer billType; + @ApiModelProperty("开票金额") + private Double billAmount; + @ApiModelProperty("开票状态 1待开票 2已开票 3开票失败") + private Integer state; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CommercialWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CommercialWarpper.java new file mode 100644 index 0000000..0be2413 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CommercialWarpper.java @@ -0,0 +1,24 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel +public class CommercialWarpper { + @ApiModelProperty("广告名称") + private String name; + @ApiModelProperty("广告类型(1=弹窗广告,2=底部广告)") + private Integer type; + @ApiModelProperty("广告地址") + private String url; + @ApiModelProperty("是否跳转(0=否,1=是)") + private Integer isJump; + @ApiModelProperty("跳转类型(1=内部跳转,2=外部跳转)") + private Integer jumpType; + @ApiModelProperty("跳转链接") + private String jumpUrl; + @ApiModelProperty("H5页面") + private String html; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponWarpper.java new file mode 100644 index 0000000..39842f0 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponWarpper.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/3 14:26 + */ +@Data +@ApiModel +public class CouponWarpper { + @ApiModelProperty("优惠券id") + private Integer id; + @ApiModelProperty("满金额") + private Double couponConditionalAmount; + @ApiModelProperty("优惠金额") + private Double couponPreferentialAmount; + @ApiModelProperty("优惠券名称") + private String couponName; + @ApiModelProperty("有效期") + private Long expirationDate; + @ApiModelProperty("张数") + private Integer number; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponsWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponsWarpper.java new file mode 100644 index 0000000..7e58846 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponsWarpper.java @@ -0,0 +1,24 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/23 15:28 + */ +@Data +@ApiModel +public class CouponsWarpper { + @ApiModelProperty("优惠券id") + private Integer id; + @ApiModelProperty("名称") + private String name; + @ApiModelProperty("优惠金额") + private Double discountAmount; + @ApiModelProperty("优惠条件") + private Double preferentialTerms; + @ApiModelProperty("有效期") + private Long endTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DeptWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DeptWarpper.java new file mode 100644 index 0000000..1ea346d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DeptWarpper.java @@ -0,0 +1,33 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.agentdriving.user.core.base.warpper.BaseControllerWarpper; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.util.ToolUtil; + +import java.util.Map; + +/** + * 部门列表的包装 + * + * @author fengshuonan + * @date 2017年4月25日 18:10:31 + */ +public class DeptWarpper extends BaseControllerWarpper { + + public DeptWarpper(Object list) { + super(list); + } + + @Override + public void warpTheMap(Map<String, Object> map) { + + Integer pid = (Integer) map.get("pid"); + + if (ToolUtil.isEmpty(pid) || pid.equals(0)) { + map.put("pName", "--"); + } else { + map.put("pName", ConstantFactory.me().getDeptName(pid)); + } + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DictWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DictWarpper.java new file mode 100644 index 0000000..e778d04 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DictWarpper.java @@ -0,0 +1,36 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.agentdriving.user.core.base.warpper.BaseControllerWarpper; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.modular.system.model.Dict; + +import java.util.List; +import java.util.Map; + +/** + * 字典列表的包装 + * + * @author fengshuonan + * @date 2017年4月25日 18:10:31 + */ +public class DictWarpper extends BaseControllerWarpper { + + public DictWarpper(Object list) { + super(list); + } + + @Override + public void warpTheMap(Map<String, Object> map) { + StringBuffer detail = new StringBuffer(); + Integer id = Integer.valueOf(map.get("id").toString()); + List<Dict> dicts = ConstantFactory.me().findInDict(id); + if(dicts != null){ + for (Dict dict : dicts) { + detail.append(dict.getCode() + ":" +dict.getName() + ","); + } + map.put("detail", ToolUtil.removeSuffix(detail.toString(),",")); + } + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DriverInfoWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DriverInfoWarpper.java new file mode 100644 index 0000000..f5fcef2 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DriverInfoWarpper.java @@ -0,0 +1,359 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Map; + +@ApiModel("个人中心详情") +public class DriverInfoWarpper { + @ApiModelProperty("司机id(用于生成二维码)") + private Integer id; + @ApiModelProperty("头像") + private String avatar; + @ApiModelProperty("姓名") + private String name; + @ApiModelProperty("电话") + private String phone; + @ApiModelProperty("性别") + private Integer sex; + @ApiModelProperty("车牌") + private String licensePlate; + @ApiModelProperty("车辆品牌") + private String brand; + @ApiModelProperty("车辆颜色") + private String carColor; + @ApiModelProperty("历史接单数") + private Integer orderNum; + @ApiModelProperty("评分") + private Double score; + @ApiModelProperty("账户余额") + private Double balance; + @ApiModelProperty("活动总收入") + private Double activityMoney; + @ApiModelProperty("剩余可提现活动收入") + private Double laveActivityMoney; + @ApiModelProperty("历史总收入") + private Double businessMoney; + @ApiModelProperty("剩余可提现收入") + private Double laveBusinessMoney; + @ApiModelProperty("出租车资格证号") + private String taxiAptitudeCard; + @ApiModelProperty("发证日期") + private String networkCarlssueDate; + @ApiModelProperty("公司") + private String company; + @ApiModelProperty("居住地(带分隔符)") + private String driverContactAddress_; + @ApiModelProperty("身份证号码") + private String idCard; + @ApiModelProperty("身份证正面照") + private String idCardImgUrl1; + @ApiModelProperty("身份证背面照") + private String idCardImgUrl2; + @ApiModelProperty("初次领取驾驶证日期") + private String getDriverLicenseDate; + @ApiModelProperty("服务模式(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)多个以逗号分隔") + private String type; + @ApiModelProperty("从业地(带分隔符)") + private String placeOfPractice; + @ApiModelProperty("从业地行政区域代码") + private String placeOfEmployment; + @ApiModelProperty("驾驶证照片") + private String driveCardImgUrl; + @ApiModelProperty("网约车资格证照片") + private String networkCarlssueImg; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public String getLicensePlate() { + return licensePlate; + } + + public void setLicensePlate(String licensePlate) { + this.licensePlate = licensePlate; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getCarColor() { + return carColor; + } + + public void setCarColor(String carColor) { + this.carColor = carColor; + } + + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + public Double getScore() { + return score; + } + + public void setScore(Double score) { + this.score = score; + } + + public Double getBalance() { + return balance; + } + + public void setBalance(Double balance) { + this.balance = balance; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Double getActivityMoney() { + return activityMoney; + } + + public void setActivityMoney(Double activityMoney) { + this.activityMoney = activityMoney; + } + + public Double getBusinessMoney() { + return businessMoney; + } + + public void setBusinessMoney(Double businessMoney) { + this.businessMoney = businessMoney; + } + + public String getTaxiAptitudeCard() { + return taxiAptitudeCard; + } + + public void setTaxiAptitudeCard(String taxiAptitudeCard) { + this.taxiAptitudeCard = taxiAptitudeCard; + } + + public String getNetworkCarlssueDate() { + return networkCarlssueDate; + } + + public void setNetworkCarlssueDate(String networkCarlssueDate) { + this.networkCarlssueDate = networkCarlssueDate; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public String getDriverContactAddress_() { + return driverContactAddress_; + } + + public void setDriverContactAddress_(String driverContactAddress_) { + this.driverContactAddress_ = driverContactAddress_; + } + + public String getIdCard() { + return idCard; + } + + public void setIdCard(String idCard) { + this.idCard = idCard; + } + + public String getIdCardImgUrl1() { + return idCardImgUrl1; + } + + public void setIdCardImgUrl1(String idCardImgUrl1) { + this.idCardImgUrl1 = idCardImgUrl1; + } + + public String getIdCardImgUrl2() { + return idCardImgUrl2; + } + + public void setIdCardImgUrl2(String idCardImgUrl2) { + this.idCardImgUrl2 = idCardImgUrl2; + } + + public String getGetDriverLicenseDate() { + return getDriverLicenseDate; + } + + public void setGetDriverLicenseDate(String getDriverLicenseDate) { + this.getDriverLicenseDate = getDriverLicenseDate; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getPlaceOfPractice() { + return placeOfPractice; + } + + public void setPlaceOfPractice(String placeOfPractice) { + this.placeOfPractice = placeOfPractice; + } + + public String getDriveCardImgUrl() { + return driveCardImgUrl; + } + + public void setDriveCardImgUrl(String driveCardImgUrl) { + this.driveCardImgUrl = driveCardImgUrl; + } + + public String getNetworkCarlssueImg() { + return networkCarlssueImg; + } + + public void setNetworkCarlssueImg(String networkCarlssueImg) { + this.networkCarlssueImg = networkCarlssueImg; + } + + public String getPlaceOfEmployment() { + return placeOfEmployment; + } + + public void setPlaceOfEmployment(String placeOfEmployment) { + this.placeOfEmployment = placeOfEmployment; + } + + public Double getLaveActivityMoney() { + return laveActivityMoney; + } + + public void setLaveActivityMoney(Double laveActivityMoney) { + this.laveActivityMoney = laveActivityMoney; + } + + public Double getLaveBusinessMoney() { + return laveBusinessMoney; + } + + public void setLaveBusinessMoney(Double laveBusinessMoney) { + this.laveBusinessMoney = laveBusinessMoney; + } + + @Override + public String toString() { + return "DriverInfoWarpper{" + + "id=" + id + + ", avatar='" + avatar + '\'' + + ", name='" + name + '\'' + + ", phone='" + phone + '\'' + + ", sex=" + sex + + ", licensePlate='" + licensePlate + '\'' + + ", brand='" + brand + '\'' + + ", carColor='" + carColor + '\'' + + ", orderNum=" + orderNum + + ", score=" + score + + ", balance=" + balance + + ", activityMoney=" + activityMoney + + ", laveActivityMoney=" + laveActivityMoney + + ", businessMoney=" + businessMoney + + ", laveBusinessMoney=" + laveBusinessMoney + + ", taxiAptitudeCard='" + taxiAptitudeCard + '\'' + + ", networkCarlssueDate='" + networkCarlssueDate + '\'' + + ", company='" + company + '\'' + + ", driverContactAddress_='" + driverContactAddress_ + '\'' + + ", idCard='" + idCard + '\'' + + ", idCardImgUrl1='" + idCardImgUrl1 + '\'' + + ", idCardImgUrl2='" + idCardImgUrl2 + '\'' + + ", getDriverLicenseDate='" + getDriverLicenseDate + '\'' + + ", type='" + type + '\'' + + ", placeOfPractice='" + placeOfPractice + '\'' + + ", placeOfEmployment='" + placeOfEmployment + '\'' + + ", driveCardImgUrl='" + driveCardImgUrl + '\'' + + ", networkCarlssueImg='" + networkCarlssueImg + '\'' + + '}'; + } + + public static DriverInfoWarpper getDriverInfoWarpper(Map<String, Object> map){ + DriverInfoWarpper driverInfoWarpper = new DriverInfoWarpper(); + if(null != map){ + driverInfoWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); + driverInfoWarpper.setAvatar(null != map.get("avatar") ? String.valueOf(map.get("avatar")) : ""); + driverInfoWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); + driverInfoWarpper.setPhone(null != map.get("phone") ? String.valueOf(map.get("phone")) : ""); + driverInfoWarpper.setSex(null != map.get("sex") ? Integer.valueOf(String.valueOf(map.get("sex"))) : 0); + driverInfoWarpper.setLicensePlate(null != map.get("licensePlate") ? String.valueOf(map.get("licensePlate")) : ""); + driverInfoWarpper.setBrand(null != map.get("brand") ? String.valueOf(map.get("brand")) : ""); + driverInfoWarpper.setCarColor(null != map.get("carColor") ? String.valueOf(map.get("carColor")) : ""); + driverInfoWarpper.setOrderNum(null != map.get("orderNum") ? Integer.valueOf(String.valueOf(map.get("orderNum"))) : 0); + driverInfoWarpper.setScore(null != map.get("score") ? Double.valueOf(String.valueOf(map.get("score"))) : 0); + driverInfoWarpper.setBalance(null != map.get("balance") ? Double.valueOf(String.valueOf(map.get("balance"))) : 0); + driverInfoWarpper.setActivityMoney(null != map.get("activityMoney") ? Double.valueOf(String.valueOf(map.get("activityMoney"))) : 0); + driverInfoWarpper.setBusinessMoney(null != map.get("businessMoney") ? Double.valueOf(String.valueOf(map.get("businessMoney"))) : 0); + driverInfoWarpper.setTaxiAptitudeCard(null != map.get("taxiAptitudeCard") ? String.valueOf(map.get("taxiAptitudeCard")) : ""); + driverInfoWarpper.setNetworkCarlssueDate(null != map.get("networkCarlssueDate") ? String.valueOf(map.get("networkCarlssueDate")) : ""); + driverInfoWarpper.setCompany(null != map.get("company") ? String.valueOf(map.get("company")) : ""); + driverInfoWarpper.setDriverContactAddress_(null != map.get("driverContactAddress_") ? String.valueOf(map.get("driverContactAddress_")) : ""); + driverInfoWarpper.setIdCard(null != map.get("idCard") ? String.valueOf(map.get("idCard")) : ""); + driverInfoWarpper.setIdCardImgUrl1(null != map.get("idCardImgUrl1") ? String.valueOf(map.get("idCardImgUrl1")) : ""); + driverInfoWarpper.setIdCardImgUrl2(null != map.get("idCardImgUrl2") ? String.valueOf(map.get("idCardImgUrl2")) : ""); + driverInfoWarpper.setGetDriverLicenseDate(null != map.get("getDriverLicenseDate") ? String.valueOf(map.get("getDriverLicenseDate")) : ""); + driverInfoWarpper.setType(null != map.get("type") ? String.valueOf(map.get("type")) : ""); + driverInfoWarpper.setPlaceOfPractice(null != map.get("placeOfPractice") ? String.valueOf(map.get("placeOfPractice")) : ""); + driverInfoWarpper.setDriveCardImgUrl(null != map.get("driveCardImgUrl") ? String.valueOf(map.get("driveCardImgUrl")) : ""); + driverInfoWarpper.setNetworkCarlssueImg(null != map.get("networkCarlssueImg") ? String.valueOf(map.get("networkCarlssueImg")) : ""); + driverInfoWarpper.setPlaceOfEmployment(null != map.get("placeOfEmployment") ? String.valueOf(map.get("placeOfEmployment")) : ""); + driverInfoWarpper.setLaveActivityMoney(null != map.get("laveActivityMoney") ? Double.valueOf(String.valueOf(map.get("laveActivityMoney"))) : 0); + driverInfoWarpper.setLaveBusinessMoney(null != map.get("laveBusinessMoney") ? Double.valueOf(String.valueOf(map.get("laveBusinessMoney"))) : 0); + } + return driverInfoWarpper; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EditOrderEndAddress.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EditOrderEndAddress.java new file mode 100644 index 0000000..3e71e7f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EditOrderEndAddress.java @@ -0,0 +1,22 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/4 17:13 + */ +@Data +@ApiModel +public class EditOrderEndAddress { + @ApiModelProperty(value = "订单id", required = true, dataType = "long") + private Long orderId; + @ApiModelProperty(value = "终点纬度", dataType = "double", required = true) + private Double endLat; + @ApiModelProperty(value = "终点经度", dataType = "double", required = true) + private Double endLng; + @ApiModelProperty(value = "终点地址", dataType = "string", required = true) + private String endAddress; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCosts.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCosts.java new file mode 100644 index 0000000..fb255d8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCosts.java @@ -0,0 +1,30 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/3 15:07 + */ +@Data +@ApiModel +public class EstimatedCosts { + @ApiModelProperty(value = "起点纬度", dataType = "double", required = true) + private Double startLat; + @ApiModelProperty(value = "起点经度", dataType = "double", required = true) + private Double startLng; + @ApiModelProperty(value = "起点地址", dataType = "string", required = true) + private String startAddress; + @ApiModelProperty(value = "终点纬度", dataType = "double", required = true) + private Double endLat; + @ApiModelProperty(value = "终点经度", dataType = "double", required = true) + private Double endLng; + @ApiModelProperty(value = "终点地址", dataType = "string", required = true) + private String endAddress; + @ApiModelProperty(value = "当前纬度", dataType = "double", required = true) + private Double lat; + @ApiModelProperty(value = "当前经度", dataType = "double", required = true) + private Double lng; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCostsWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCostsWarpper.java new file mode 100644 index 0000000..f90c8dd --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCostsWarpper.java @@ -0,0 +1,24 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/3 15:20 + */ +@Data +@ApiModel +public class EstimatedCostsWarpper { + @ApiModelProperty("预估里程") + private Double estimatedMileage; + @ApiModelProperty("预估费用") + private Double price; + @ApiModelProperty("优惠金额") + private Double discountAmount; + @ApiModelProperty("接驾时间") + private Integer pickUpTime; + @ApiModelProperty("行驶时间") + private Integer travelTime; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/HomeWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/HomeWarpper.java new file mode 100644 index 0000000..cf46ebb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/HomeWarpper.java @@ -0,0 +1,115 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Map; + +@ApiModel("首页统计") +public class HomeWarpper { + @ApiModelProperty("车牌号") + private String licensePlate; + @ApiModelProperty("车辆品牌") + private String brand; + @ApiModelProperty("今日接单") + private Integer dayNum; + @ApiModelProperty("月接单") + private Integer mouthNum; + @ApiModelProperty("评分") + private Double score; + @ApiModelProperty("活动数") + private Integer activity; + @ApiModelProperty("上下班状态(1=上班,2=下班)") + private Integer work; + + public String getLicensePlate() { + return licensePlate; + } + + public void setLicensePlate(String licensePlate) { + this.licensePlate = licensePlate; + } + + public String getBand() { + return brand; + } + + public void setBand(String brand) { + this.brand = brand; + } + + public Integer getDayNum() { + return dayNum; + } + + public void setDayNum(Integer dayNum) { + this.dayNum = dayNum; + } + + public Integer getMouthNum() { + return mouthNum; + } + + public void setMouthNum(Integer mouthNum) { + this.mouthNum = mouthNum; + } + + public Double getScore() { + return score; + } + + public void setScore(Double score) { + this.score = score; + } + + public Integer getActivity() { + return activity; + } + + public void setActivity(Integer activity) { + this.activity = activity; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public Integer getWork() { + return work; + } + + public void setWork(Integer work) { + this.work = work; + } + + @Override + public String toString() { + return "HomeWarpper{" + + "licensePlate='" + licensePlate + '\'' + + ", brand='" + brand + '\'' + + ", dayNum=" + dayNum + + ", mouthNum=" + mouthNum + + ", score=" + score + + ", activity=" + activity + + ", work=" + work + + '}'; + } + + public static HomeWarpper getHomeWarpper(Map<String, Object> map){ + HomeWarpper homeWarpper = new HomeWarpper(); + if(null != map){ + homeWarpper.setLicensePlate(null != map.get("licensePlate") ? String.valueOf(map.get("licensePlate")) : ""); + homeWarpper.setBand(null != map.get("brand") ? String.valueOf(map.get("brand")) : ""); + homeWarpper.setDayNum(null != map.get("dayNum") ? Integer.valueOf(String.valueOf(map.get("dayNum"))) : 0); + homeWarpper.setMouthNum(null != map.get("mouthNum") ? Integer.valueOf(String.valueOf(map.get("mouthNum"))) : 0); + homeWarpper.setScore(null != map.get("score") ? Double.valueOf(String.valueOf(map.get("score"))) : 0); + homeWarpper.setActivity(null != map.get("activity") ? Integer.valueOf(String.valueOf(map.get("activity"))) : 0); + homeWarpper.setWork(null != map.get("work") ? Integer.valueOf(String.valueOf(map.get("work"))) : 0); + } + return homeWarpper; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/Invoicing.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/Invoicing.java new file mode 100644 index 0000000..f556732 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/Invoicing.java @@ -0,0 +1,30 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/24 9:55 + */ +@Data +@ApiModel +public class Invoicing { + @ApiModelProperty(value = "订单id,多个已逗号分隔", dataType = "string", required = true) + private String orderIds; + @ApiModelProperty(value = "发票抬头类型(1=企业,2=个人)", dataType = "int", required = true) + private Integer billHeaderType; + @ApiModelProperty(value = "公司名称/个人名称", dataType = "string", required = true) + private String companyName; + @ApiModelProperty(value = "公司税号", dataType = "string", required = false) + private String companyTaxNumber; + @ApiModelProperty(value = "发票更多内容", dataType = "string", required = true) + private String moreContent; + @ApiModelProperty(value = "收件人姓名", dataType = "string", required = true) + private String addresseeName; + @ApiModelProperty(value = "收件人手机号", dataType = "string", required = true) + private String addresseePhone; + @ApiModelProperty(value = "收件人电子邮箱", dataType = "string", required = true) + private String addresseeEmail; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LogWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LogWarpper.java new file mode 100644 index 0000000..a10c2e9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LogWarpper.java @@ -0,0 +1,44 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.agentdriving.user.core.base.warpper.BaseControllerWarpper; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.util.Contrast; +import com.agentdriving.user.core.util.ToolUtil; + +import java.util.Map; + +/** + * 日志列表的包装类 + * + * @author fengshuonan + * @date 2017年4月5日22:56:24 + */ +public class LogWarpper extends BaseControllerWarpper { + + public LogWarpper(Object list) { + super(list); + } + + @Override + public void warpTheMap(Map<String, Object> map) { + String message = (String) map.get("message"); + + Integer userid = (Integer) map.get("userid"); + map.put("userName", ConstantFactory.me().getUserNameById(userid)); + + //如果信息过长,则只截取前100位字符串 + if (ToolUtil.isNotEmpty(message) && message.length() >= 100) { + String subMessage = message.substring(0, 100) + "..."; + map.put("message", subMessage); + } + + //如果信息中包含分割符号;;; 则分割字符串返给前台 + if (ToolUtil.isNotEmpty(message) && message.indexOf(Contrast.separator) != -1) { + String[] msgs = message.split(Contrast.separator); + map.put("regularMessage",msgs); + }else{ + map.put("regularMessage",message); + } + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LoginWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LoginWarpper.java new file mode 100644 index 0000000..f726168 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LoginWarpper.java @@ -0,0 +1,58 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel("登录") +public class LoginWarpper { + @ApiModelProperty("用户id") + private Integer id; + @ApiModelProperty("token") + private String token; + @ApiModelProperty("appid") + private String appid; + @ApiModelProperty("高德猎鹰服务id") + private String serverId; + @ApiModelProperty("高德猎鹰终端id") + private String terminalId; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getAppid() { + return appid; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public String getTerminalId() { + return terminalId; + } + + public void setTerminalId(String terminalId) { + this.terminalId = terminalId; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MenuWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MenuWarpper.java new file mode 100644 index 0000000..f2c5e0d --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MenuWarpper.java @@ -0,0 +1,28 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.agentdriving.user.core.base.warpper.BaseControllerWarpper; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; +import com.agentdriving.user.core.constant.IsMenu; + +import java.util.List; +import java.util.Map; + +/** + * 菜单列表的包装类 + * + * @author fengshuonan + * @date 2017年2月19日15:07:29 + */ +public class MenuWarpper extends BaseControllerWarpper { + + public MenuWarpper(List<Map<String, Object>> list) { + super(list); + } + + @Override + public void warpTheMap(Map<String, Object> map) { + map.put("statusName", ConstantFactory.me().getMenuStatusName((Integer) map.get("status"))); + map.put("isMenuName", IsMenu.valueOf((Integer) map.get("ismenu"))); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MoneyInfoWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MoneyInfoWarpper.java new file mode 100644 index 0000000..f63d9f1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MoneyInfoWarpper.java @@ -0,0 +1,229 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Map; + +/** + * 费用明细 + */ +@ApiModel("费用明细") +public class MoneyInfoWarpper { + @ApiModelProperty("订单总金额") + private Double orderMoney; + @ApiModelProperty("起步里程") + private Double startMileage; + @ApiModelProperty("起步价") + private Double startMoney; + @ApiModelProperty("里程费") + private Double mileageMoney; + @ApiModelProperty("里程数") + private Double mileage; + @ApiModelProperty("时长费") + private Double durationMoney; + @ApiModelProperty("时长") + private Double duration; + @ApiModelProperty("等待费") + private Double waitMoney; + @ApiModelProperty("等待时长") + private Double wait; + @ApiModelProperty("远途费") + private Double longDistanceMoney; + @ApiModelProperty("远途里程") + private Double longDistance; + @ApiModelProperty("停车费") + private Double parkMoney; + @ApiModelProperty("过路费") + private Double roadTollMoney; + @ApiModelProperty("红包抵扣金额") + private Double redPacketMoney; + @ApiModelProperty("优惠券抵扣金额") + private Double couponMoney; + @ApiModelProperty("折扣抵扣金额") + private Double discountMoney; + @ApiModelProperty("折扣") + private Double discount; + + public Double getOrderMoney() { + return orderMoney; + } + + public void setOrderMoney(Double orderMoney) { + this.orderMoney = orderMoney; + } + + public Double getStartMoney() { + return startMoney; + } + + public void setStartMoney(Double startMoney) { + this.startMoney = startMoney; + } + + public Double getMileageMoney() { + return mileageMoney; + } + + public void setMileageMoney(Double mileageMoney) { + this.mileageMoney = mileageMoney; + } + + public Double getDurationMoney() { + return durationMoney; + } + + public void setDurationMoney(Double durationMoney) { + this.durationMoney = durationMoney; + } + + public Double getWaitMoney() { + return waitMoney; + } + + public void setWaitMoney(Double waitMoney) { + this.waitMoney = waitMoney; + } + + public Double getLongDistanceMoney() { + return longDistanceMoney; + } + + public void setLongDistanceMoney(Double longDistanceMoney) { + this.longDistanceMoney = longDistanceMoney; + } + + public Double getParkMoney() { + return parkMoney; + } + + public void setParkMoney(Double parkMoney) { + this.parkMoney = parkMoney; + } + + public Double getRoadTollMoney() { + return roadTollMoney; + } + + public void setRoadTollMoney(Double roadTollMoney) { + this.roadTollMoney = roadTollMoney; + } + + public Double getRedPacketMoney() { + return redPacketMoney; + } + + public void setRedPacketMoney(Double redPacketMoney) { + this.redPacketMoney = redPacketMoney; + } + + public Double getCouponMoney() { + return couponMoney; + } + + public void setCouponMoney(Double couponMoney) { + this.couponMoney = couponMoney; + } + + public Double getDiscountMoney() { + return discountMoney; + } + + public void setDiscountMoney(Double discountMoney) { + this.discountMoney = discountMoney; + } + + public Double getDiscount() { + return discount; + } + + public void setDiscount(Double discount) { + this.discount = discount; + } + + public Double getMileage() { + return mileage; + } + + public void setMileage(Double mileage) { + this.mileage = mileage; + } + + public Double getDuration() { + return duration; + } + + public void setDuration(Double duration) { + this.duration = duration; + } + + public Double getWait() { + return wait; + } + + public void setWait(Double wait) { + this.wait = wait; + } + + public Double getLongDistance() { + return longDistance; + } + + public void setLongDistance(Double longDistance) { + this.longDistance = longDistance; + } + + public Double getStartMileage() { + return startMileage; + } + + public void setStartMileage(Double startMileage) { + this.startMileage = startMileage; + } + + @Override + public String toString() { + return "MoneyInfoWarpper{" + + "orderMoney=" + orderMoney + + ", startMoney=" + startMoney + + ", mileageMoney=" + mileageMoney + + ", mileage=" + mileage + + ", durationMoney=" + durationMoney + + ", duration=" + duration + + ", waitMoney=" + waitMoney + + ", wait=" + wait + + ", longDistanceMoney=" + longDistanceMoney + + ", longDistance=" + longDistance + + ", parkMoney=" + parkMoney + + ", roadTollMoney=" + roadTollMoney + + ", redPacketMoney=" + redPacketMoney + + ", couponMoney=" + couponMoney + + ", discountMoney=" + discountMoney + + ", discount=" + discount + + '}'; + } + + public static MoneyInfoWarpper getMoneyInfoWarpper(Map<String, Object> map){ + MoneyInfoWarpper moneyInfoWarpper = new MoneyInfoWarpper(); + if(null != map){ + moneyInfoWarpper.setOrderMoney(null != map.get("orderMoney") ? Double.valueOf(map.get("orderMoney").toString()) : 0D); + moneyInfoWarpper.setStartMileage(null != map.get("startMileage") ? Double.valueOf(map.get("startMileage").toString()) : 0D); + moneyInfoWarpper.setStartMoney(null != map.get("startMoney") ? Double.valueOf(map.get("startMoney").toString()) : 0D); + moneyInfoWarpper.setMileage(null != map.get("mileageKilometers") ? Double.valueOf(map.get("mileageKilometers").toString()) : 0D); + moneyInfoWarpper.setMileageMoney(null != map.get("mileageMoney") ? Double.valueOf(map.get("mileageMoney").toString()) : 0D); + moneyInfoWarpper.setDuration(null != map.get("duration") ? Double.valueOf(map.get("duration").toString()) : 0D); + moneyInfoWarpper.setDurationMoney(null != map.get("durationMoney") ? Double.valueOf(map.get("durationMoney").toString()) : 0D); + moneyInfoWarpper.setWait(null != map.get("wait") ? Double.valueOf(map.get("wait").toString()) : 0D); + moneyInfoWarpper.setWaitMoney(null != map.get("waitMoney") ? Double.valueOf(map.get("waitMoney").toString()) : 0D); + moneyInfoWarpper.setLongDistance(null != map.get("longDistance") ? Double.valueOf(map.get("longDistance").toString()) : 0D); + moneyInfoWarpper.setLongDistanceMoney(null != map.get("longDistanceMoney") ? Double.valueOf(map.get("longDistanceMoney").toString()) : 0D); + moneyInfoWarpper.setParkMoney(null != map.get("parkMoney") ? Double.valueOf(map.get("parkMoney").toString()) : 0D); + moneyInfoWarpper.setRoadTollMoney(null != map.get("roadTollMoney") ? Double.valueOf(map.get("roadTollMoney").toString()) : 0D); + moneyInfoWarpper.setRedPacketMoney(null != map.get("redPacketMoney") ? Double.valueOf(map.get("redPacketMoney").toString()) : 0D); + moneyInfoWarpper.setCouponMoney(null != map.get("couponMoney") ? Double.valueOf(map.get("couponMoney").toString()) : 0D); + moneyInfoWarpper.setDiscountMoney(null != map.get("discountMoney") ? Double.valueOf(map.get("discountMoney").toString()) : 0D); + moneyInfoWarpper.setDiscount(null != map.get("discount") ? Double.valueOf(map.get("discount").toString()) : 0D); + } + return moneyInfoWarpper; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NearbyDriverWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NearbyDriverWarpper.java new file mode 100644 index 0000000..3d9e6ba --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NearbyDriverWarpper.java @@ -0,0 +1,21 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** +* 附近司机 +* @author pzb +* @Date 2023/2/28 10:32 +*/ +@Data +@ApiModel +public class NearbyDriverWarpper { + @ApiModelProperty("经纬度") + private String lonLat; + @ApiModelProperty("距离") + private Double distance; + @ApiModelProperty("司机id") + private Integer driverId; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NotInvoiceOrder.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NotInvoiceOrder.java new file mode 100644 index 0000000..c9a7060 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NotInvoiceOrder.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:30 + */ +@Data +@ApiModel +public class NotInvoiceOrder { + @ApiModelProperty(value = "订单开始时间(2023-01-01)", required = false, dataType = "string") + private String startTime; + @ApiModelProperty(value = "订单结束时间(2023-01-01)", required = false, dataType = "string") + private String endTime; + @ApiModelProperty(value = "订单开始金额", required = false, dataType = "double") + private Double startAmount; + @ApiModelProperty(value = "订单结束金额", required = false, dataType = "double") + private Double endAmount; + @ApiModelProperty(value = "页码,首页1", required = true, dataType = "int") + private Integer pageNum; + @ApiModelProperty(value = "页条数", required = true, dataType = "int") + private Integer pageSize; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NoticeWrapper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NoticeWrapper.java new file mode 100644 index 0000000..308c128 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NoticeWrapper.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.agentdriving.user.core.base.warpper.BaseControllerWarpper; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; + +import java.util.Map; + +/** + * 部门列表的包装 + * + * @author fengshuonan + * @date 2017年4月25日 18:10:31 + */ +public class NoticeWrapper extends BaseControllerWarpper { + + public NoticeWrapper(Object list) { + super(list); + } + + @Override + public void warpTheMap(Map<String, Object> map) { + Integer creater = (Integer) map.get("creater"); + map.put("createrName", ConstantFactory.me().getUserNameById(creater)); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderEvaluateWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderEvaluateWarpper.java new file mode 100644 index 0000000..bb692e8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderEvaluateWarpper.java @@ -0,0 +1,45 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@ApiModel("评价列表") +public class OrderEvaluateWarpper { + @ApiModelProperty("总评分") + private Double sumScore; + @ApiModelProperty("历史评价列表") + private List<JSONObject> list; + + public Double getSumScore() { + return sumScore; + } + + public void setSumScore(Double sumScore) { + this.sumScore = sumScore; + } + + public List<JSONObject> getList() { + return list; + } + + public void setList(List<JSONObject> list) { + this.list = list; + } + + public static OrderEvaluateWarpper getOrderEvaluateWarpper(Map<String, Object> map){ + OrderEvaluateWarpper orderEvaluateWarpper = new OrderEvaluateWarpper(); + if(null != map){ + orderEvaluateWarpper.setSumScore(null != map.get("sumScore") ? Double.valueOf(String.valueOf(map.get("sumScore"))) : 0); + List<JSONObject> list = JSONArray.parseArray(JSON.toJSONString(map.get("list")), JSONObject.class); + orderEvaluateWarpper.setList(null != map.get("list") ? list : new ArrayList<>()); + } + return orderEvaluateWarpper; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderInfoWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderInfoWarpper.java new file mode 100644 index 0000000..c66bc0a --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderInfoWarpper.java @@ -0,0 +1,59 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Map; + +@Data +@ApiModel("订单详情") +public class OrderInfoWarpper { + @ApiModelProperty("订单id") + private Long orderId; + @ApiModelProperty("订单编号") + private String code; + @ApiModelProperty("起点地址") + private String startAddress; + @ApiModelProperty("起点纬度") + private String startLat; + @ApiModelProperty("起点经度") + private String startLng; + @ApiModelProperty("终点地址") + private String endAddress; + @ApiModelProperty("终点纬度") + private String endLat; + @ApiModelProperty("终点经度") + private String endLng; + @ApiModelProperty("司机id") + private Integer driverId; + @ApiModelProperty("司机头像") + private String driverAvatar; + @ApiModelProperty("司机名称") + private String driverName; + @ApiModelProperty("司机电话") + private String driverPhone; + @ApiModelProperty("司机编号") + private String driverCode; + @ApiModelProperty("司机驾龄") + private Integer driverAge; + @ApiModelProperty("代驾次数") + private Integer driverNumber; + @ApiModelProperty("司机评分") + private Double driverScore; + @ApiModelProperty("司机位置经度") + private String driverLon; + @ApiModelProperty("司机位置纬度") + private String driverLat; + @ApiModelProperty("订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)") + private Integer state; + @ApiModelProperty("客服电话") + private String serviceCell; + @ApiModelProperty("订单创建时间") + private Long createTime; + @ApiModelProperty("订单评分") + private Integer evaluationScore; + @ApiModelProperty("评价内容") + private String evaluationContent; + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderListWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderListWarpper.java new file mode 100644 index 0000000..baf3438 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderListWarpper.java @@ -0,0 +1,28 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/18 10:22 + */ +@Data +@ApiModel +public class OrderListWarpper { + @ApiModelProperty("订单id") + private Integer id; + @ApiModelProperty("标题") + private String title; + @ApiModelProperty("订单时间") + private Long createTime; + @ApiModelProperty("金额") + private Double amount; + @ApiModelProperty("起点地址") + private String startAddress; + @ApiModelProperty("终点地址") + private String endAddress; + @ApiModelProperty("订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)") + private Integer state; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPayment.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPayment.java new file mode 100644 index 0000000..9c4f47f --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPayment.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/10 10:50 + */ +@Data +@ApiModel +public class OrderPayment { + @ApiModelProperty(value = "订单id", required = true, dataType = "Long") + private Long orderId; + @ApiModelProperty(value = "支付方式(1=微信,2=余额,3=线下,4=微信+余额)", required = true, dataType = "int") + private Integer payType; + @ApiModelProperty(value = "优惠券id", required = false, dataType = "int") + private Integer couponId; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPriceWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPriceWarpper.java new file mode 100644 index 0000000..17362af --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPriceWarpper.java @@ -0,0 +1,67 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/10 9:06 + */ +@Data +@ApiModel +public class OrderPriceWarpper { + @ApiModelProperty("订单金额") + private Double orderMoney; + @ApiModelProperty("总行驶里程") + private Double actualMileage; + @ApiModelProperty("总行驶时间") + private Integer travelTime; + @ApiModelProperty("起步里程") + private Double startDistance; + @ApiModelProperty("起步价") + private Double startPrice; + @ApiModelProperty("超过起步里程") + private Double overDriveDistance; + @ApiModelProperty("超过起步里程费") + private Double overDrivePrice; + @ApiModelProperty("长途里程") + private Double longDistance; + @ApiModelProperty("长途费") + private Double longDistancePrice; + @ApiModelProperty("超过长途里程") + private Double overLongDistance; + @ApiModelProperty("超过长途里程费") + private Double overLongDistancePrice; + @ApiModelProperty("等待时长") + private Integer waitTime; + @ApiModelProperty("等待费") + private Double waitTimePrice; + @ApiModelProperty("超出等待时长") + private Integer outWaitTime; + @ApiModelProperty("超出等待费") + private Double outWaitTimePrice; + @ApiModelProperty("恶劣天气里程") + private Double badWeatherDistance; + @ApiModelProperty("恶劣天气费") + private Double badWeatherPrice; + @ApiModelProperty("恶劣天气超出里程") + private Double overBadWeatherDistance; + @ApiModelProperty("恶劣天气超出里程费") + private Double overBadWeatherPrice; + @ApiModelProperty("折扣") + private Double discount; + @ApiModelProperty("折扣金额") + private Double discountAmount; + @ApiModelProperty("优惠券id") + private Integer couponId; + @ApiModelProperty("优惠券金额") + private Double discountedPrice; + @ApiModelProperty("当前余额") + private Double balance; + @ApiModelProperty("支付途径(1=微信支付,2=余额支付,3=线下付款,4=微信+余额)") + private Integer payType; + @ApiModelProperty("支付金额") + private Double payMoney; + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PriceRulesWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PriceRulesWarpper.java new file mode 100644 index 0000000..a62ed2c --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PriceRulesWarpper.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/23 14:16 + */ +@Data +@ApiModel +public class PriceRulesWarpper { + @ApiModelProperty("基础价格") + private String basePrice; + @ApiModelProperty("长途公里费用") + private String longDistanceCharges; + @ApiModelProperty("额外费") + private String additionalFee; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PushOrderInfoWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PushOrderInfoWarpper.java new file mode 100644 index 0000000..e3d3816 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PushOrderInfoWarpper.java @@ -0,0 +1,30 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel +public class PushOrderInfoWarpper { + @ApiModelProperty("订单id") + private Long id; + @ApiModelProperty("司机纬度") + private String driverLat; + @ApiModelProperty("司机经度") + private String driverLng; + @ApiModelProperty("等待时长(分钟)") + private Integer waitTime; + @ApiModelProperty("行驶里程(公里)") + private Double actualMileage; + @ApiModelProperty("行驶时间(分钟)") + private Integer travelTime; + @ApiModelProperty("终点地址") + private String endAddress; + @ApiModelProperty("终点纬度") + private String endLat; + @ApiModelProperty("终点经度") + private String endLng; + @ApiModelProperty("101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中") + private Integer state; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RegisteredWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RegisteredWarpper.java new file mode 100644 index 0000000..0006999 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RegisteredWarpper.java @@ -0,0 +1,206 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Date; + +@ApiModel("司机注册信息") +public class RegisteredWarpper { + @ApiModelProperty("电话") + private String phone; + @ApiModelProperty("密码") + private String password; + @ApiModelProperty("姓名") + private String name; + @ApiModelProperty("性别(1=男,2=女)") + private Integer sex; + @ApiModelProperty("居住地") + private String driverContactAddress; + @ApiModelProperty("居住地(带分隔符)") + private String driverContactAddress_; + @ApiModelProperty("身份证号码") + private String idCard; + @ApiModelProperty("身份证正面照") + private String idCardImgUrl1; + @ApiModelProperty("身份证背面照") + private String idCardImgUrl2; + @ApiModelProperty("初次领取驾驶证日期") + private Date getDriverLicenseDate; + @ApiModelProperty("服务模式(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)多个以逗号分隔") + private String type; + @ApiModelProperty("从业地行政代码(510100)") + private String placeOfEmployment; + @ApiModelProperty("从业地地址(带分隔符)") + private String placeOfPractice; + @ApiModelProperty("头像") + private String headImgUrl; + @ApiModelProperty("驾驶证照片") + private String driveCardImgUrl; + @ApiModelProperty("网约车资格证照片") + private String networkCarlssueImg; + @ApiModelProperty("出租车资格证号") + private String taxiAptitudeCard; + + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public String getDriverContactAddress() { + return driverContactAddress; + } + + public void setDriverContactAddress(String driverContactAddress) { + this.driverContactAddress = driverContactAddress; + } + + public String getIdCard() { + return idCard; + } + + public void setIdCard(String idCard) { + this.idCard = idCard; + } + + public String getIdCardImgUrl1() { + return idCardImgUrl1; + } + + public void setIdCardImgUrl1(String idCardImgUrl1) { + this.idCardImgUrl1 = idCardImgUrl1; + } + + public String getIdCardImgUrl2() { + return idCardImgUrl2; + } + + public void setIdCardImgUrl2(String idCardImgUrl2) { + this.idCardImgUrl2 = idCardImgUrl2; + } + + public Date getGetDriverLicenseDate() { + return getDriverLicenseDate; + } + + public void setGetDriverLicenseDate(Date getDriverLicenseDate) { + this.getDriverLicenseDate = getDriverLicenseDate; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getPlaceOfEmployment() { + return placeOfEmployment; + } + + public void setPlaceOfEmployment(String placeOfEmployment) { + this.placeOfEmployment = placeOfEmployment; + } + + public String getHeadImgUrl() { + return headImgUrl; + } + + public void setHeadImgUrl(String headImgUrl) { + this.headImgUrl = headImgUrl; + } + + public String getDriveCardImgUrl() { + return driveCardImgUrl; + } + + public void setDriveCardImgUrl(String driveCardImgUrl) { + this.driveCardImgUrl = driveCardImgUrl; + } + + public String getNetworkCarlssueImg() { + return networkCarlssueImg; + } + + public void setNetworkCarlssueImg(String networkCarlssueImg) { + this.networkCarlssueImg = networkCarlssueImg; + } + + public String getTaxiAptitudeCard() { + return taxiAptitudeCard; + } + + public void setTaxiAptitudeCard(String taxiAptitudeCard) { + this.taxiAptitudeCard = taxiAptitudeCard; + } + + public String getDriverContactAddress_() { + return driverContactAddress_; + } + + public void setDriverContactAddress_(String driverContactAddress_) { + this.driverContactAddress_ = driverContactAddress_; + } + + public String getPlaceOfPractice() { + return placeOfPractice; + } + + public void setPlaceOfPractice(String placeOfPractice) { + this.placeOfPractice = placeOfPractice; + } + + @Override + public String toString() { + return "RegisteredWarpper{" + + "phone='" + phone + '\'' + + ", password='" + password + '\'' + + ", name='" + name + '\'' + + ", sex=" + sex + + ", driverContactAddress='" + driverContactAddress + '\'' + + ", idCard='" + idCard + '\'' + + ", idCardImgUrl1='" + idCardImgUrl1 + '\'' + + ", idCardImgUrl2='" + idCardImgUrl2 + '\'' + + ", getDriverLicenseDate=" + getDriverLicenseDate + + ", type=" + type + + ", placeOfEmployment='" + placeOfEmployment + '\'' + + ", headImgUrl='" + headImgUrl + '\'' + + ", driveCardImgUrl='" + driveCardImgUrl + '\'' + + ", networkCarlssueImg='" + networkCarlssueImg + '\'' + + ", taxiAptitudeCard='" + taxiAptitudeCard + '\'' + + '}'; + } + + + + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ResponseWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ResponseWarpper.java new file mode 100644 index 0000000..df84cf4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ResponseWarpper.java @@ -0,0 +1,49 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.agentdriving.user.modular.system.util.ResultUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** +* 统一返回实体 +* @author pzb +* @Date 2023/2/3 10:46 +*/ +@Data +@ApiModel +public class ResponseWarpper<T> { + @ApiModelProperty(value = "返回状态码(200/300/400/500)", required = true, dataType = "int") + private Integer code; + @ApiModelProperty(value = "结果备注", required = true, dataType = "string") + private String message; + @ApiModelProperty(value = "结果集对象", required = false) + private ResultUtil<T> resultUtil; + + public ResponseWarpper() { + } + + public ResponseWarpper(Integer code, String message) { + this.code = code; + this.message = message; + this.resultUtil = ResultUtil.success(); + } + + public ResponseWarpper(Integer code, String message, ResultUtil<T> resultUtil) { + this.code = code; + this.message = message; + this.resultUtil = resultUtil; + } + + public static ResponseWarpper success() { + return new ResponseWarpper(200, "success", ResultUtil.success()); + } + + public static <T> ResponseWarpper<T> success(T data) { + return new ResponseWarpper(200, "success", ResultUtil.success(data)); + } + + public static <T> ResponseWarpper<T> success(ResultUtil<T> resultUtil) { + return new ResponseWarpper(200, "success", resultUtil); + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RoleWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RoleWarpper.java new file mode 100644 index 0000000..97f38a8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RoleWarpper.java @@ -0,0 +1,27 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.agentdriving.user.core.base.warpper.BaseControllerWarpper; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; + +import java.util.List; +import java.util.Map; + +/** + * 角色列表的包装类 + * + * @author fengshuonan + * @date 2017年2月19日10:59:02 + */ +public class RoleWarpper extends BaseControllerWarpper { + + public RoleWarpper(List<Map<String, Object>> list) { + super(list); + } + + @Override + public void warpTheMap(Map<String, Object> map) { + map.put("pName", ConstantFactory.me().getSingleRoleName((Integer) map.get("pid"))); + map.put("deptName", ConstantFactory.me().getDeptName((Integer) map.get("deptid"))); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegister.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegister.java new file mode 100644 index 0000000..bb31bf4 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegister.java @@ -0,0 +1,23 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 登录 + * @author 39373 + * @date 2023/2/26 21:21 + */ +@Data +public class SignInToRegister { + @ApiModelProperty(value = "微信jscode", required = true, dataType = "string") + private String jscode; + @ApiModelProperty(value = "手机加密数据", required = true, dataType = "string") + private String encryptedDataPhone; + @ApiModelProperty(value = "手机号码解码iv", required = true, dataType = "string") + private String ivPhone; + @ApiModelProperty(value = "邀约人类型(1=用户,2=司机)", required = false, dataType = "int") + private Integer inviterType; + @ApiModelProperty(value = "邀约人id", required = false, dataType = "int") + private Integer inviterId; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegisterWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegisterWarpper.java new file mode 100644 index 0000000..770b425 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegisterWarpper.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/3 14:25 + */ +@Data +@ApiModel +public class SignInToRegisterWarpper { + @ApiModelProperty("token") + private String token; + @ApiModelProperty("优惠券列表") + private List<CouponWarpper> coupons; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/StartPriceWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/StartPriceWarpper.java new file mode 100644 index 0000000..47e73ca --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/StartPriceWarpper.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel +public class StartPriceWarpper { + @ApiModelProperty("起步价") + private Double startPrice; + @ApiModelProperty("起步公里") + private Double startDistance; + @ApiModelProperty("超出起步里程单价") + private Double excessMileageUnitPrice; + @ApiModelProperty("超出起步里程计算距离") + private Double overmileage; + @ApiModelProperty("起步价说明") + private String description; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SystemNoticeWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SystemNoticeWarpper.java new file mode 100644 index 0000000..b347057 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SystemNoticeWarpper.java @@ -0,0 +1,113 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@ApiModel("消息类表") +public class SystemNoticeWarpper { + @ApiModelProperty("主键") + private Integer id; + @ApiModelProperty("类型(1=公告,2=系统消息)") + private Integer type; + @ApiModelProperty("标题") + private String title; + @ApiModelProperty("内容") + private String content; + @ApiModelProperty("图片") + private String img; + @ApiModelProperty("时间") + private String time; + @ApiModelProperty("阅读状态(1=未读,2=已读)") + private Integer read; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getImg() { + return img; + } + + public void setImg(String img) { + this.img = img; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public Integer getRead() { + return read; + } + + public void setRead(Integer read) { + this.read = read; + } + + @Override + public String toString() { + return "SystemNoticeWarpper{" + + "id=" + id + + ", type=" + type + + ", title='" + title + '\'' + + ", content='" + content + '\'' + + ", img='" + img + '\'' + + ", time='" + time + '\'' + + '}'; + } + + + public static List<SystemNoticeWarpper> getSystemNoticeWarpper(List<Map<String, Object>> maps){ + List<SystemNoticeWarpper> list = new ArrayList<>(); + if(null != maps){ + for(Map<String, Object> map : maps){ + SystemNoticeWarpper systemNoticeWarpper = new SystemNoticeWarpper(); + systemNoticeWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); + systemNoticeWarpper.setType(null != map.get("type") ? Integer.valueOf(String.valueOf(map.get("type"))) : 0); + systemNoticeWarpper.setTitle(null != map.get("title") ? String.valueOf(map.get("title")) : ""); + systemNoticeWarpper.setContent(null != map.get("content") ? String.valueOf(map.get("content")) : ""); + systemNoticeWarpper.setImg(null != map.get("img") ? String.valueOf(map.get("img")) : ""); + systemNoticeWarpper.setTime(null != map.get("time") ? String.valueOf(map.get("time")) : ""); + systemNoticeWarpper.setRead(null != map.get("read") ? Integer.valueOf(String.valueOf(map.get("read"))) : 0); + list.add(systemNoticeWarpper); + } + } + return list; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/TravelOrder.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/TravelOrder.java new file mode 100644 index 0000000..2419844 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/TravelOrder.java @@ -0,0 +1,35 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/3 14:57 + */ +@Data +@ApiModel +public class TravelOrder { + @ApiModelProperty(value = "起点纬度", dataType = "string", required = true) + private String startLat; + @ApiModelProperty(value = "起点经度", dataType = "string", required = true) + private String startLng; + @ApiModelProperty(value = "起点地址", dataType = "string", required = true) + private String startAddress; + @ApiModelProperty(value = "终点纬度", dataType = "string", required = false) + private String endLat; + @ApiModelProperty(value = "终点经度", dataType = "string", required = false) + private String endLng; + @ApiModelProperty(value = "终点地址", dataType = "string", required = false) + private String endAddress; + @ApiModelProperty(value = "司机数量", dataType = "int", required = true) + private Integer driverNum; + @ApiModelProperty(value = "乘车人姓名", dataType = "string", required = false) + private String userName; + @ApiModelProperty(value = "乘车人电话", dataType = "string", required = false) + private String userPhone; + @ApiModelProperty(value = "司机id", dataType = "int", required = false) + private Integer driverId; + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfo.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfo.java new file mode 100644 index 0000000..deff563 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfo.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/23 10:00 + */ +@Data +@ApiModel +public class UserInfo { + @ApiModelProperty(value = "头像", required = false, dataType = "string") + private String avatar; + @ApiModelProperty(value = "紧急联系人", required = false, dataType = "string") + private String emergencyContact; + @ApiModelProperty(value = "紧急联系人电话", required = false, dataType = "string") + private String emergencyPhone; + @ApiModelProperty(value = "姓名", required = false, dataType = "string") + private String nickname; + @ApiModelProperty(value = "手机号", required = false, dataType = "string") + private String phone; + @ApiModelProperty(value = "验证码", required = false, dataType = "string") + private String code; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfoWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfoWarpper.java new file mode 100644 index 0000000..fbad5cb --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfoWarpper.java @@ -0,0 +1,30 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/10 10:11 + */ +@Data +@ApiModel +public class UserInfoWarpper { + @ApiModelProperty("用户id") + private Integer id; + @ApiModelProperty("头像") + private String avatar; + @ApiModelProperty("昵称") + private String nickname; + @ApiModelProperty("电话") + private String phone; + @ApiModelProperty("账户余额") + private Double accountBalance; + @ApiModelProperty("紧急联系人") + private String emergencyContact; + @ApiModelProperty("紧急人电话") + private String emergencyPhone; + @ApiModelProperty("客服电话") + private String serviceCell; +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserWarpper.java new file mode 100644 index 0000000..23c30a5 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserWarpper.java @@ -0,0 +1,29 @@ +package com.agentdriving.user.modular.system.warpper; + +import com.agentdriving.user.core.base.warpper.BaseControllerWarpper; +import com.agentdriving.user.core.common.constant.factory.ConstantFactory; + +import java.util.List; +import java.util.Map; + +/** + * 用户管理的包装类 + * + * @author fengshuonan + * @date 2017年2月13日 下午10:47:03 + */ +public class UserWarpper extends BaseControllerWarpper { + + public UserWarpper(List<Map<String, Object>> list) { + super(list); + } + + @Override + public void warpTheMap(Map<String, Object> map) { + map.put("sexName", ConstantFactory.me().getSexName((Integer) map.get("sex"))); + map.put("roleName", ConstantFactory.me().getRoleName((String) map.get("roleid"))); + map.put("deptName", ConstantFactory.me().getDeptName((Integer) map.get("deptid"))); + map.put("statusName", ConstantFactory.me().getStatusName((Integer) map.get("status"))); + } + +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/VersionWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/VersionWarpper.java new file mode 100644 index 0000000..3d7c613 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/VersionWarpper.java @@ -0,0 +1,84 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Map; + +@ApiModel("版本") +public class VersionWarpper { + @ApiModelProperty("主键") + private Integer id = 0; + @ApiModelProperty("包地址") + private String url; + @ApiModelProperty("版本说明") + private String content; + @ApiModelProperty("是否强制更新(0=否,1=是)") + private Integer mandatory = 0; + @ApiModelProperty("版本号") + private String version; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Integer getMandatory() { + return mandatory; + } + + public void setMandatory(Integer mandatory) { + this.mandatory = mandatory; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @Override + public String toString() { + return "VersionWarpper{" + + "id=" + id + + ", url='" + url + '\'' + + ", content='" + content + '\'' + + ", mandatory=" + mandatory + + ", version='" + version + '\'' + + '}'; + } + + + public static VersionWarpper getVersionWarpper(Map<String, Object> map){ + VersionWarpper versionWarpper = new VersionWarpper(); + if(null != map){ + versionWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); + versionWarpper.setUrl(null != map.get("url") ? String.valueOf(map.get("url")) : ""); + versionWarpper.setContent(null != map.get("content") ? String.valueOf(map.get("content")) : ""); + versionWarpper.setMandatory(null != map.get("mandatory") ? Integer.valueOf(String.valueOf(map.get("mandatory"))) : 0); + versionWarpper.setVersion(null != map.get("version") ? String.valueOf(map.get("version")) : ""); + } + return versionWarpper; + } +} diff --git a/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/WithdrawalWarpper.java b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/WithdrawalWarpper.java new file mode 100644 index 0000000..1cc7770 --- /dev/null +++ b/user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/WithdrawalWarpper.java @@ -0,0 +1,101 @@ +package com.agentdriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@ApiModel("提现历史记录") +public class WithdrawalWarpper { + @ApiModelProperty("主键") + private Integer id; + @ApiModelProperty("提现时间") + private String insertTime; + @ApiModelProperty("提现金额") + private Double money; + @ApiModelProperty("提现方式") + private String name; + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("提现状态(1=待处理,2=成功,3=失败)") + private Integer state; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getInsertTime() { + return insertTime; + } + + public void setInsertTime(String insertTime) { + this.insertTime = insertTime; + } + + public Double getMoney() { + return money; + } + + public void setMoney(Double money) { + this.money = money; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + @Override + public String toString() { + return "WithdrawalWarpper{" + + "id=" + id + + ", insertTime='" + insertTime + '\'' + + ", money=" + money + + ", name='" + name + '\'' + + ", remark='" + remark + '\'' + + ", state=" + state + + '}'; + } + + public static List<WithdrawalWarpper> getWithdrawalWarpper(List<Map<String, Object>> maps){ + List<WithdrawalWarpper> list = new ArrayList<>(); + if(null != maps){ + for(Map<String, Object> map : maps){ + WithdrawalWarpper withdrawalWarpper = new WithdrawalWarpper(); + withdrawalWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); + withdrawalWarpper.setMoney(null != map.get("money") ? Double.valueOf(String.valueOf(map.get("money"))) : 0); + withdrawalWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); + withdrawalWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); + withdrawalWarpper.setState(null != map.get("state") ? Integer.valueOf(String.valueOf(map.get("state"))) : 0); + withdrawalWarpper.setInsertTime(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : ""); + list.add(withdrawalWarpper); + } + } + return list; + } +} diff --git a/user/guns-admin/src/main/resources/META-INF/spring-devtools.properties b/user/guns-admin/src/main/resources/META-INF/spring-devtools.properties new file mode 100644 index 0000000..3e72835 --- /dev/null +++ b/user/guns-admin/src/main/resources/META-INF/spring-devtools.properties @@ -0,0 +1 @@ +restart.include.beetl=/beetl-2.8.5.jar \ No newline at end of file diff --git a/user/guns-admin/src/main/resources/application.yml b/user/guns-admin/src/main/resources/application.yml new file mode 100644 index 0000000..6d540c4 --- /dev/null +++ b/user/guns-admin/src/main/resources/application.yml @@ -0,0 +1,153 @@ +server: + port: 8006 + +guns: + swagger-open: true #是否开启swagger (true/false) + kaptcha-open: false #是否开启登录时验证码 (true/false) +# file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) + spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) + session-invalidate-time: 1800 #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒 + session-validation-interval: 900 #多久检测一次失效的session(只在单机环境下生效) 单位:秒 + +spring: + application: + name: user-server + profiles: + active: dev +# active: produce + mvc: + static-path-pattern: /static/** + view: + prefix: /WEB-INF/view + devtools: + restart: + enabled: false + additional-paths: src/main/java + exclude: static/**,WEB-INF/view/** + servlet: + multipart: + max-request-size: 100MB + max-file-size: 100MB + +mybatis-plus: + typeAliasesPackage: com.agentdriving.user.modular + global-config: + id-type: 0 #0:数据库ID自增 1:用户输入id 2:全局唯一id(IdWorker) 3:全局唯一ID(uuid) + db-column-underline: false + configuration: + configuration.map-underscore-to-camel-case: true #是否开启自动驼峰命名规则(camel case)映射 + log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #输出Sql,如需打印Sql注释该配置 + mapper-locations: classpath*:com/agentdriving/user/modular/system/dao/**/*.xml + + + +eureka: + client: + service-url: #注册中心地址 + defaultZone: http://sinata:sinata@127.0.0.1:8000/eureka #启用身份验证的方式连接 + register-with-eureka: true #在注册中心进行注册 + fetch-registry: true #从Eureka中获取注册信息。 + +--- + + +spring: + datasource: + url: jdbc:mysql://127.0.0.1:3306/fh_agent_driving?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai + username: root +# password: PI_v6J5@dvHwGTqc + password: 123456 + db-name: guns #用来搜集数据库的所有表 + filters: wall,mergeStat + +#多数据源情况的配置 +guns: + muti-datasource: + open: false + url: jdbc:mysql://127.0.0.1:3306/guns_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: root + dataSourceNames: + - dataSourceGuns + - dataSourceBiz + + + +--- + +wx: + grantType: authorization_code #填authorization_code + appid: 11 #应用唯一标识,在微信开放平台提交应用审核通过后获得 + appSecret: 11 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 + appletsAppid: wx8ae6c610563f2fe6 #小程序APPid + appletsAppSecret: 8b2c93b0be4f017350050f1e660680fe # + officialAccountAppid: 11111 + officialAccountAppSecret: 1111 + webAppId: 111 + webAppSecret: 11 + mchId: 1636941942 #微信支付分配的商户号 + key: Eri2GR2SB3b6iIhaoD7k3KQ8X0wf1Ybh #key为商户平台设置的密钥key: + apiv3: AKJ51Z4nhSqYBxmOXgUyCKA1vLP0J5Aj #key为商户平台设置的密钥key: + +--- + +alipay: + appid: 2021001161600393 #应用程序唯一标识 + appPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCEbTcG2wz+kaYDo2YxflpHE59MvKc3rbl6RlBgO6i5GzgphzeRTv5kRWUpSVkKCsbxFvAYLcgFPmm5nY2fz5hCTKiRcYfpUjH/OougUbzYU3ilUc9JqMbmvy7KN+Kv7+kQYCGLvMqlyYPiJ7LrmJLpE/FUcNLDwo6xUmwJSxaF7M4TbD3ZQZdddki1iJp9GihlqehZCMWOBeotEXvPKDEzSEkYlnvHPQaaspVgeesGmlHDuOiZUokENutxpjo7klWe97NA49hXEtI+xlczNGJKdBr0keBX/kSMsnx8kMxYDjh4QTySBaR6zlO4RYPFekWv9QZ2CrfiKCS7AHUpZYZ5AgMBAAECggEAXjCoUPIBHhhOcowIJe/vGlr0lUohzdJ8+GGGzcvhSDf6DF+mwG3lN0C8oU8QS7o6okRkZW46tLAd1u4fS6oGbDHGPBz6RJQ4B4eGxHMe1OcaCsxTmdq4DmuxRhfV3rnPldwqQA/6O01HxtXhxvzwkWOj5SGSZ7a8c5diTIHh9ULd6neUI/rIFC97mH1TeW0uDIxAtyvswz0pIfDhAR+lsOyTg/8qzsIXjpBFG4gAVxhUeUqQA5HzbsFglC08V7ViDk1OEoWi3yIj1CmNdtntJI4cxqLgTK7MNB9udhbN2I9YasuIpZvlAcvPi5R9cYT8vvFBCFGM+i22wtcsQmxdAQKBgQDaD9y6WNmsp+IaAUG3FqbJC8SqwreGIiEflWwVjrd+LuN6yhyr45CobOmhbTz0de8gRJEZKgJZEJcywL1ScrPIC4n1JaG688lk5aR+0Lik5fy1+L6G/CydJoJqlh6KKdwPJmDGpVu/geLJcLkWcYOwL56IL7GK2JI1p607R0x6iQKBgQCbd0n4xG9GkpvW4LDAJiMEhwPu9QcCKIT0mXVXCgMFdWel9bY3+8RSZoziWutaofm9tRHFAqwjbRyOZ+EdckkNsWVkkTnkKGtAhYKgM0GaOwdMFxmvME5WYJ74a5t1jiezDmR3obUBtS2nyQ8CFPUnlimoTR9F6APrth3h8uvwcQKBgFWaCn1AqdrEYNbyjViRVNHxg7fBDohiV3xtjOt9hfzL7VLjipPTlpL3hlNvbZFNxpx1LjyhqCBMif5LeUanbnnmRbbtmeqpDvNDzupVh1Z8TlMlHa4hymW6m1G6MqzsN83es/jnKvgnxd5sGMx9rUN5vhMaHekykVrswu1VVOl5AoGAMDljh7gfMEv/7TqLeT8bM6dR8AivoNrCy0Di5hnj8AiIGzHJ0TnWnxzSbNB5GwcNeew109/NV7vb1MyiRskRoh657eUiiQSEqGIBsAHWQqo2zEKKJA6e7ipQhYyTj3aGGAPJ5FYT2LDDtb0nW6T2ms34pA0wOzYKKU63nEQHLfECgYEAgbbpZJRtPxWB1M/Dg7loguT5O/VUsKefS0JrSD+tJIqYkumH5mejvYW5YEeDdelkvBhAEFUW9JOkzL+1w1g3wz2QQ2aPV/r55cJE3EfOzbwgw6GsO+8UuyiavbFhS3pFZNI0pR5M3u1+SIcLqQCnYLbO11vnEXglB6wjw9/oxPE= #开发者应用私钥 + alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhG03BtsM/pGmA6NmMX5aRxOfTLynN625ekZQYDuouRs4KYc3kU7+ZEVlKUlZCgrG8RbwGC3IBT5puZ2Nn8+YQkyokXGH6VIx/zqLoFG82FN4pVHPSajG5r8uyjfir+/pEGAhi7zKpcmD4iey65iS6RPxVHDSw8KOsVJsCUsWhezOE2w92UGXXXZItYiafRooZanoWQjFjgXqLRF7zygxM0hJGJZ7xz0GmrKVYHnrBppRw7jomVKJBDbrcaY6O5JVnvezQOPYVxLSPsZXMzRiSnQa9JHgV/5EjLJ8fJDMWA44eEE8kgWkes5TuEWDxXpFr/UGdgq34igkuwB1KWWGeQIDAQAB #应用公钥 + alipay_public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzmDrvcNvhexu3KkxVS9bemdSn6pyQUFmpyOGMDOirGR+RbmldpH2N9bPegzZynb5+bmRHii4ib31XeoXc7M7r6UsPhmPeLoSBNwpC+Uig0VxPa0hmvHjAl6StArhB3eMib6Zo40nM6eCYZLLZ1kKpI5Ad/APov9uLrbSnoeZsgeRibQix07arvTEsZq6pJavNlA+UBjp65o6Bv0+kfQ65pMTpbu+jRtTzkTj1hoW9PjwlWrY21F1FvN67zDWkTB2LjGFsqan0Qoe4/X8nK3VsDvkjIm/ZQsnQr8ZzfcuTzQPrcZpo3h9DPZoHeiToEfXtyk7E0bQHEmYVpmrvk/IJwIDAQAB #支付宝公钥 + +--- + +juhe: #聚合数据 + appKey: 0d3fd83eddaa33e5563f548257648577 # + + +--- + +jiguang: + appKey-driver: 93204c35ded9ba377a14af19 #极光推送应用唯一标识 + masterSecret-driver: e4f6f435faefad29db6ba9b2 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 + appKey-dispatch: cc212ee6dcecb26625917f40 #极光推送应用唯一标识 + masterSecret-dispatch: 0d163a25a20647665c28639e #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 + + +--- + +filePath: /usr/local/server/app/orderPostionFile/ #存储订单轨迹文件路径 +#filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 + + + +#支付回调地址 +#正式环境 +#callbackPath: http://121.37.15.157:80/user +#正式测试环境 +callbackPath: http://139.9.238.199:80/user + +--- + +spring: + data: + mongodb: +# uri: mongodb://root:bv@_N36o+cTe1LpS@127.0.0.1:27017/admin + uri: mongodb://127.0.0.1:27017/admin + + +# mallbook 调起接口参数配置 +mallbook: + # pay_url:mallbook接口地址 测试环境: http://ld.mallbook.cn:12000/api 生产环境:https://cloudpay.mallbook.cn/api + pay_url: http://ld.mallbook.cn:12000/api + # merchant_no 业务系统商户平台编号,需替换为mallbook工作人员提供的商户编号 + merchant_no: 需要替换内容 + # version 接口版本号 + version: 1.0.0 + # channel_type 渠道类型 HF:汇付 + channel_type: HF + # merchant_private_key 商户平台私钥,需要替换成商户平台自己生成的私钥 + merchant_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIoGARvX6k6rVwuUW6HjAPkzXVntCtDI8q/niGZbeILc5T/noer+UNDECSy9f8T6ENw7tEKWaHOFcicrqgRv+wXeo2hPiJI2iYsUNs6I8ckd8i4uy/PBEDMW78GlnQLAatk0NC44HKjn8cuIHaETKNG2Vk3rwGBzNgDZ/God1L6JAgMBAAECgYBhCsOwzehBk5pJ2+9pLO+8Rm72EQGvtflb0BBI1zst1x2gBr4DOPedMJe6yymQVrmP/rJItvONdV/DRqHtKMZ2Wa4ul/U1mDnAtS/FkpRYBA5FaXV2hNEW11xBLhL5iGk35P23Bzaa0MJw9Vsd0vjeykridIw/PweDyTdeRBwC2QJBANS+iOaKRuf6BRwCKDmBSHOiZmc/kKnpx2f5BD3h+LWEX3JsNxObMbW1SxQIf2/qwqzIoEm/WbWaOyuwtRZkXQ8CQQCmFjTm5l+Ws2LoQgM+5+eLmPyMyRFOu4G8yqsUkhKuANHK/qrsS1GTbv6SN341NijjNYl05e0h6Jq1T9UZmtrnAkEAwTfzmn7H+3RmI5QJ+IBkzzEWFHv05X0/8DyID7QmcKWzEncaZqIzObdYYu983qa2/LqSaahyz68uQnYRYi7xHQJATr3SgPIRuaH8r360iTtrRHzYp2qgYQJ25On1KECEyKgszp/kqzieSVbjLLFQjavKwMXeEGT+AwiDaJibwJLxWwJAXZApORsqGqdxc9FTxt5iiqG2ZP5DTXxc6E+ihmlmoVl9KncgTf9ez0Q0Qz/4KUTPTHNVgzt1nyBxiLtnyzFavA== + # mall_book_public_key mallbook测试环境公钥 不需要替换 + mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0L2DaHOO8ekhktB6RoHxIcki/0v7OUeOn9tX9VBE+jv6PRjqlZRWL3Qezxz5ADtHEyLv+RFFaceXSep6rWyoQ6DRlvLv5CySUAxAM42LLVe4DI3l/0ccEAIuU5NCpwAAj1zkm2X01DwUCZwymLjlqbDlBvQhpq+1fddtTtA/QLQIDAQAB + # mall_book_public_key mallbook生产环境公钥 不需要替换 + # mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq6OLZKgUHH5wOk9xSBgN7yC17r3PQwMlY9/IorqrOlaIqrU0eAVZ5+dWrJD/3bdu7Ctq8n8trTm/IUYs7wtMg5SKwyX4/N+KQc2N7LL4yCq4vNl41q9sYgrtA0QnZoucIZcq1mwyu7RTDC8Wp7LGddnlkJsmL8masgMxA6cc9NwIDAQAB + diff --git a/user/guns-admin/src/main/resources/ehcache.xml b/user/guns-admin/src/main/resources/ehcache.xml new file mode 100644 index 0000000..1e47379 --- /dev/null +++ b/user/guns-admin/src/main/resources/ehcache.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="ehcache.xsd" + updateCheck="false" monitoring="autodetect" + dynamicConfig="true" > + + <diskStore path="java.io.tmpdir/ehcache"/> + + <defaultCache + maxElementsInMemory="50000" + eternal="false" + timeToIdleSeconds="3600" + timeToLiveSeconds="3600" + overflowToDisk="true" + diskPersistent="false" + diskExpiryThreadIntervalSeconds="120" + /> + + <!-- 全局变量:永不过期--> + <cache name="CONSTANT" + maxElementsInMemory="50000" + eternal="true" + clearOnFlush="false" + overflowToDisk="true" + diskSpoolBufferSizeMB="1024" + maxElementsOnDisk="100000" + diskPersistent="false" + diskExpiryThreadIntervalSeconds="120" + memoryStoreEvictionPolicy="LFU" + transactionalMode="off"> + </cache> + +</ehcache> + + <!-- + maxElementsInMemory="10000" //Cache中最多允许保存的数据对象的数量 + external="false" //缓存中对象是否为永久的,如果是,超时设置将被忽略,对象从不过期 + timeToLiveSeconds="3600" //缓存的存活时间,从开始创建的时间算起 + timeToIdleSeconds="3600" //多长时间不访问该缓存,那么ehcache 就会清除该缓存 + + 这两个参数很容易误解,看文档根本没用,我仔细分析了ehcache的代码。结论如下: + 1、timeToLiveSeconds的定义是:以创建时间为基准开始计算的超时时长; + 2、timeToIdleSeconds的定义是:在创建时间和最近访问时间中取出离现在最近的时间作为基准计算的超时时长; + 3、如果仅设置了timeToLiveSeconds,则该对象的超时时间=创建时间+timeToLiveSeconds,假设为A; + 4、如果没设置timeToLiveSeconds,则该对象的超时时间=min(创建时间,最近访问时间)+timeToIdleSeconds,假设为B; + 5、如果两者都设置了,则取出A、B最少的值,即min(A,B),表示只要有一个超时成立即算超时。 + + overflowToDisk="true" //内存不足时,是否启用磁盘缓存 + diskSpoolBufferSizeMB //设置DiskStore(磁盘缓存)的缓存区大小。默认是30MB。每个Cache都应该有自己的一个缓冲区 + maxElementsOnDisk //硬盘最大缓存个数 + diskPersistent //是否缓存虚拟机重启期数据The default value is false + diskExpiryThreadIntervalSeconds //磁盘失效线程运行时间间隔,默认是120秒。 + memoryStoreEvictionPolicy="LRU" //当达到maxElementsInMemory限制时,Ehcache将会根据指定的策略去清理内存。默认策略是LRU(最近最少使用)。你可以设置为FIFO(先进先出)或是LFU(较少使用)。 + clearOnFlush //内存数量最大时是否清除 + maxEntriesLocalHeap="0" //堆内存中最大缓存对象数,0没有限制 + maxEntriesLocalDisk="1000" //硬盘最大缓存个数。 + --> diff --git a/user/guns-admin/src/main/resources/logback-spring.xml b/user/guns-admin/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..667e44b --- /dev/null +++ b/user/guns-admin/src/main/resources/logback-spring.xml @@ -0,0 +1,228 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,比如: 如果设置为WARN,则低于WARN的信息都不会输出 --> +<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> +<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> +<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> +<configuration scan="true" scanPeriod="10 seconds"> + <contextName>logback</contextName> + + <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> + <property name="log.path" value="/usr/local/server/app/logs/user"/> + <!--<property name="log.path" value="d:/logs/user"/>--> + + <!--0. 日志格式和颜色渲染 --> + <!-- 彩色日志依赖的渲染类 --> + <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> + <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> + <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> + <!-- 彩色日志格式 --> + <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> + + <!--1. 输出到控制台--> + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> + <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>debug</level> + </filter> + <encoder> + <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> + <!-- 设置字符集 --> + <charset>UTF-8</charset> + </encoder> + </appender> + + <!--2. 输出到文档--> + <!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> + <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <!-- 正在记录的日志文档的路径及文档名 --> + <file>${log.path}/debug.log</file> + <!--日志文档输出格式--> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> + <charset>UTF-8</charset> <!-- 设置字符集 --> + </encoder> + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <!-- 日志归档 --> + <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100MB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + <!--日志文档保留天数--> + <maxHistory>15</maxHistory> + </rollingPolicy> + <!-- 此日志文档只记录debug级别的 --> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>debug</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + </appender> + + <!-- 2.2 level为 INFO 日志,时间滚动输出 --> + <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <!-- 正在记录的日志文档的路径及文档名 --> + <file>${log.path}/info.log</file> + <!--日志文档输出格式--> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> + <charset>UTF-8</charset> + </encoder> + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <!-- 每天日志归档路径以及格式 --> + <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100MB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + <!--日志文档保留天数--> + <maxHistory>15</maxHistory> + </rollingPolicy> + <!-- 此日志文档只记录info级别的 --> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>info</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + </appender> + + <!-- 2.3 level为 WARN 日志,时间滚动输出 --> + <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <!-- 正在记录的日志文档的路径及文档名 --> + <file>${log.path}/warn.log</file> + <!--日志文档输出格式--> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> + <charset>UTF-8</charset> <!-- 此处设置字符集 --> + </encoder> + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100MB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + <!--日志文档保留天数--> + <maxHistory>15</maxHistory> + </rollingPolicy> + <!-- 此日志文档只记录warn级别的 --> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>warn</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + </appender> + + <!-- 2.4 level为 ERROR 日志,时间滚动输出 --> + <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <!-- 正在记录的日志文档的路径及文档名 --> + <file>${log.path}/error.log</file> + <!--日志文档输出格式--> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> + <charset>UTF-8</charset> <!-- 此处设置字符集 --> + </encoder> + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100MB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + <!--日志文档保留天数--> + <maxHistory>15</maxHistory> + </rollingPolicy> + <!-- 此日志文档只记录ERROR级别的 --> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>ERROR</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + </appender> + + <!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件 --> + <appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <!-- 正在记录的日志文档的路径及文档名 --> + <file>${log.path}/all.log</file> + <!--日志文档输出格式--> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> + <charset>UTF-8</charset> <!-- 此处设置字符集 --> + </encoder> + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern> + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100MB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + <!--日志文档保留天数--> + <maxHistory>15</maxHistory> + </rollingPolicy> + <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 --> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>DEBUG</level> + <onMatch>DENY</onMatch> + <onMismatch>ACCEPT</onMismatch> + </filter> + </appender> + + <!-- + <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 + 以及指定<appender>。<logger>仅有一个name属性, + 一个可选的level和一个可选的addtivity属性。 + name:用来指定受此logger约束的某一个包或者具体的某一个类。 + level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, + 还有一个特殊值INHERITED或者同义词NULL,代表强制执行上级的级别。 + 如果未设置此属性,那么当前logger将会继承上级的级别。 + addtivity:是否向上级logger传递打印信息。默认是true。 + <logger name="org.springframework.web" level="info"/> + <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/> + --> + + <!-- + root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 + level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, + 不能设置为INHERITED或者同义词NULL。默认是DEBUG + 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 + --> + + <!-- 4 最终的策略: + 基本策略(root级) + 根据profile在启动时, logger标签中定制化package日志级别(优先级高于上面的root级)--> + <springProfile name="dev"> + <root level="info"> + <appender-ref ref="CONSOLE" /> + <appender-ref ref="DEBUG_FILE" /> + <appender-ref ref="INFO_FILE" /> + <appender-ref ref="WARN_FILE" /> + <appender-ref ref="ERROR_FILE" /> + <appender-ref ref="ALL_FILE" /> + </root> + <logger name="ServiceLog" level="debug"/> + <logger name="com.agentdriving.user.modular.system.dao" level="debug"/> + </springProfile> + + <springProfile name="fat"> + <root level="info"> + <appender-ref ref="CONSOLE" /> + <appender-ref ref="DEBUG_FILE" /> + <appender-ref ref="INFO_FILE" /> + <appender-ref ref="WARN_FILE" /> + <appender-ref ref="ERROR_FILE" /> + <appender-ref ref="ALL_FILE" /> + </root> + <logger name="ServiceLog" level="debug"/> + <logger name="com.agentdriving.user.modular.system.dao" level="debug"/> + </springProfile> + + <springProfile name="produce"> + <root level="info"> + <!-- 生产环境最好不配置console写文件 --> + <appender-ref ref="DEBUG_FILE" /> + <appender-ref ref="INFO_FILE" /> + <appender-ref ref="WARN_FILE" /> + <appender-ref ref="ERROR_FILE" /> + <appender-ref ref="ALL_FILE" /> + </root> + <logger name="ServiceLog" level="debug"/> + <logger name="com.agentdriving.user.modular.system.dao" level="debug"/> + </springProfile> + +</configuration> \ No newline at end of file diff --git a/user/guns-admin/src/main/resources/redis.properties b/user/guns-admin/src/main/resources/redis.properties new file mode 100644 index 0000000..1d000e8 --- /dev/null +++ b/user/guns-admin/src/main/resources/redis.properties @@ -0,0 +1,30 @@ +#redis���ÿ�ʼ +# Redis���ݿ�������Ĭ��Ϊ0�� +spring.redis.database=0 + +## Redis��������ַ +#spring.redis.host=127.0.0.1 +## Redis���������Ӷ˿� +#spring.redis.port=16379 +## Redis�������������루Ĭ��Ϊ�գ� +#spring.redis.password=wuOT@8NLdZ*V09Jt + +# Redis��������ַ +spring.redis.host=127.0.0.1 +# Redis���������Ӷ˿� +spring.redis.port=6379 +# Redis�������������루Ĭ��Ϊ�գ� +spring.redis.password=123456 + +# ���ӳ������������ʹ�ø�ֵ��ʾû�����ƣ� +spring.redis.jedis.pool.max-active=1024 +# ���ӳ���������ȴ�ʱ�䣨ʹ�ø�ֵ��ʾû�����ƣ� +spring.redis.jedis.pool.max-wait=10000 +# ���ӳ��е����������� +spring.redis.jedis.pool.max-idle=200 +# ���ӳ��е���С�������� +spring.redis.jedis.pool.min-idle=0 +# ���ӳ�ʱʱ�䣨���룩 +spring.redis.timeout=10000 +#redis���ý��� +spring.redis.block-when-exhausted=true \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/404.html b/user/guns-admin/src/main/webapp/WEB-INF/view/404.html new file mode 100644 index 0000000..98446b5 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/404.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html> + +<head> + + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + + <title>Guns - 404 页面</title> + <link rel="shortcut icon" href="${ctxPath}/static/favicon.ico"> <link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> + <link href="${ctxPath}/static/css/font-awesome.css?v=4.4.0" rel="stylesheet"> + <link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet"> + +</head> + +<body class="gray-bg"> + + + <div class="middle-box text-center"> + <h1>404</h1> + <h3 class="font-bold">页面未找到!</h3> + + <div class="error-desc"> + 抱歉,页面好像去火星了~ + <form class="form-inline m-t" role="form"> + <div class="form-group"> + <input type="email" class="form-control" placeholder="请输入您需要查找的内容 …"> + </div> + <button type="submit" class="btn btn-primary">搜索</button> + </form> + </div> + </div> + + <!-- 全局js --> + <script src="${ctxPath}/static/js/jquery.min.js?v=2.1.4"></script> + <script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script> + +</body> + +</html> diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/blackboard.html b/user/guns-admin/src/main/webapp/WEB-INF/view/blackboard.html new file mode 100644 index 0000000..605b205 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/blackboard.html @@ -0,0 +1,14 @@ +@layout("/common/_container.html"){ +<div class="container-fluid" style="padding: 0 !important;"> + <div class="row"> + <div class="col-sm-12"> + @for(notice in noticeList){ + <div class="alert alert-success alert-dismissable"> + <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> + ${notice.content} + </div> + @} + </div> + </div> +</div> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/code/code.html b/user/guns-admin/src/main/webapp/WEB-INF/view/code/code.html new file mode 100644 index 0000000..6cececb --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/code/code.html @@ -0,0 +1,101 @@ +@layout("/common/_container.html"){ +<div class="row" xmlns=""> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>代码生成</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="form-horizontal" id="generate"> + <div class="row"> + <div class="col-sm-4"> + <#input id="projectPath" name="项目路径" value="${params.projectPath}"/> + </div> + <div class="col-sm-4"> + <#input id="projectPackage" name="项目的包" value="${params.projectPackage}"/> + </div> + <div class="col-sm-4"> + <#input id="corePackage" name="核心包" value="${params.corePackage}"/> + </div> + </div> + + <div class="row"> + <div class="col-sm-3"> + <#input id="author" name="作者" value="${params.author!}"/> + </div> + <div class="col-sm-3"> + <#input id="bizName" name="业务名称" /> + </div> + <div class="col-sm-3"> + <#input id="moduleName" name="模块名称" value="${params.moduleName}"/> + </div> + <div class="col-sm-3"> + <#input id="parentMenuName" name="父级菜单名称" underline="false" value="${params.parentMenuName}" + hidden="pid" readonly="readonly" + clickFun="Code.showMenuSelectTree(); return false;" + style="background-color: #ffffff !important;" + selectFlag="true" selectId="pcodeTreeDiv" selectTreeId="pcodeTree" selectStyle=""/> + </div> + </div> + + <div class="row"> + <div class="col-sm-3"> + <#input id="tableName" name="表名称" disabled="disabled"/> + </div> + <div class="col-sm-3"> + <#input id="ignoreTabelPrefix" name="表前缀" value="${params.ignoreTabelPrefix}"/> + </div> + <div class="col-sm-3"> + <#input id="className" name="类名" disabled="disabled"/> + </div> + </div> + <div class="row"> + <div class="col-sm-6"> + <button id="genBtn" type="button" class="btn btn-primary mr10" + onclick="Code.generate()"> + <span style="padding: 5px 20px;">生成</span> + </button> + </div> + </div> + </div> + <div style="padding-top: 10px; overflow: hidden" + class="container-fluid"> + <div class="col-md-12"> + <div class="row admin-form"> + <div class="col-md-3 col-md-offset-3"> + <h2>数据表</h2> + <div class="list-group" id="tableList" + data-bind="foreach: tables" + style="height: 500px; overflow-y: scroll"> + @for(table in tables!){ + <a href="javascript:void(0)" class="list-group-item" tableName="${table.tableName}" onclick="Code.selectTable('${table.tableName}')">${table.tableName}-${table.tableComment}</a> + @} + </div> + </div> + <div class="col-md-3"> + <span><h2>模板</h2></span> + <div class="list-group" id="templateList" + style="height: 500px; overflow-y: scroll"> + @for(template in templates!){ + <a href="javascript:void(0)" class="list-group-item" key="${template.key}" onclick="Code.selectTemplate('${template.key}')">${template.desc}</a> + @} + </div> + </div> + </div> + </div> + </div> + <ul class="nav nav-list"> + <li class="divider"></li> + </ul> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/js/common/select-list-object.js"></script> +<script src="${ctxPath}/static/modular/code/gen.js"></script> +@} + diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/_container.html b/user/guns-admin/src/main/webapp/WEB-INF/view/common/_container.html new file mode 100644 index 0000000..02663d1 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/_container.html @@ -0,0 +1,71 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="renderer" content="webkit"/><!-- 让360浏览器默认选择webkit内核 --> + + <!-- 全局css --> + <link rel="shortcut icon" href="${ctxPath}/static/favicon.ico"> + <link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> + <link href="${ctxPath}/static/css/font-awesome.css?v=4.4.0" rel="stylesheet"> + <link href="${ctxPath}/static/css/plugins/chosen/chosen.css" rel="stylesheet"> + <link href="${ctxPath}/static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"> + <link href="${ctxPath}/static/css/plugins/validate/bootstrapValidator.min.css" rel="stylesheet"> + <link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet"> + <link href="${ctxPath}/static/css/_fstyle.css" rel="stylesheet"> + <link href="${ctxPath}/static/css/plugins/iCheck/custom.css" rel="stylesheet"> + <link href="${ctxPath}/static/css/plugins/webuploader/webuploader.css" rel="stylesheet"> + <link href="${ctxPath}/static/css/plugins/ztree/zTreeStyle.css" rel="stylesheet"> + <link href="${ctxPath}/static/css/plugins/bootstrap-treetable/bootstrap-treetable.css" rel="stylesheet"/> + <!-- <link href="${ctxPath}/static/css/plugins/ztree/demo.css" rel="stylesheet"> --> + + <!-- 全局js --> + <script src="${ctxPath}/static/js/jquery.min.js?v=2.1.4"></script> + <script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script> + <script src="${ctxPath}/static/js/plugins/ztree/jquery.ztree.all.min.js"></script> + <script src="${ctxPath}/static/js/plugins/bootstrap-table/bootstrap-table.min.js"></script> + <script src="${ctxPath}/static/js/plugins/validate/bootstrapValidator.min.js"></script> + <script src="${ctxPath}/static/js/plugins/validate/zh_CN.js"></script> + <script src="${ctxPath}/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script> + <script src="${ctxPath}/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script> + <script src="${ctxPath}/static/js/plugins/bootstrap-treetable/bootstrap-treetable.js"></script> + <script src="${ctxPath}/static/js/plugins/layer/layer.js"></script> + <script src="${ctxPath}/static/js/plugins/chosen/chosen.jquery.js"></script> + <script src="${ctxPath}/static/js/plugins/iCheck/icheck.min.js"></script> + <script src="${ctxPath}/static/js/plugins/laydate/laydate.js"></script> + <script src="${ctxPath}/static/js/plugins/webuploader/webuploader.min.js"></script> + <script src="${ctxPath}/static/js/common/ajax-object.js"></script> + <script src="${ctxPath}/static/js/common/bootstrap-table-object.js"></script> + <script src="${ctxPath}/static/js/common/tree-table-object.js"></script> + <script src="${ctxPath}/static/js/common/web-upload-object.js"></script> + <script src="${ctxPath}/static/js/common/ztree-object.js"></script> + <script src="${ctxPath}/static/js/common/Feng.js"></script> + + <style type="text/css"> + table{ + width:100px; + table-layout:fixed;/* 只有定义了表格的布局算法为fixed,下面td的定义才能起作用。 */ + } + td{ + width:100%; + word-break:keep-all;/* 不换行 */ + white-space:nowrap;/* 不换行 */ + overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */ + text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用*/ + } + </style> + + <script type="text/javascript"> + Feng.addCtx("${ctxPath}"); + Feng.sessionTimeoutRegistry(); + </script> +</head> + +<body class="gray-bg"> +<div class="wrapper wrapper-content"> + ${layoutContent} +</div> +<script src="${ctxPath}/static/js/content.js?v=1.0.0"></script> +</body> +</html> diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/_right.html b/user/guns-admin/src/main/webapp/WEB-INF/view/common/_right.html new file mode 100644 index 0000000..0dbebf7 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/_right.html @@ -0,0 +1,53 @@ +<div id="page-wrapper" class="gray-bg dashbard-1"> + <div class="row border-bottom"> + <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0"> + <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a> + <form role="search" class="navbar-form-custom" method="post" action="search_results.html"> + <div class="form-group"> + <input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search"> + </div> + </form> + </div> + <ul class="nav navbar-top-links navbar-right"> + <li class="dropdown hidden-xs"> + <a class="right-sidebar-toggle" aria-expanded="false"> + <i class="fa fa-tasks"></i> 主题 + </a> + </li> + </ul> + </nav> + </div> + <div class="row content-tabs"> + <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i> + </button> + <nav class="page-tabs J_menuTabs"> + <div class="page-tabs-content"> + <a href="javascript:;" class="active J_menuTab" data-id="${ctxPath}/blackboard">首页</a> + </div> + </nav> + <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i> + </button> + <div class="btn-group roll-nav roll-right"> + <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span> + + </button> + <ul role="menu" class="dropdown-menu dropdown-menu-right"> + <li class="J_tabShowActive"><a>定位当前选项卡</a> + </li> + <li class="divider"></li> + <li class="J_tabCloseAll"><a>关闭全部选项卡</a> + </li> + <li class="J_tabCloseOther"><a>关闭其他选项卡</a> + </li> + </ul> + </div> + <a href="logout" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a> + </div> + <div class="row J_mainContent" id="content-main"> + <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="${ctxPath}/blackboard" frameborder="0" data-id="${ctxPath}/blackboard" seamless></iframe> + </div> + <div class="footer"> + <div class="pull-right">© 2016-2017 <a href="http://git.oschina.net/naan1993/guns" target="_blank">guns</a> + </div> + </div> +</div> \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/_tab.html b/user/guns-admin/src/main/webapp/WEB-INF/view/common/_tab.html new file mode 100644 index 0000000..e572b3d --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/_tab.html @@ -0,0 +1,74 @@ +<nav class="navbar-default navbar-static-side" role="navigation"> + <div class="nav-close"><i class="fa fa-times-circle"></i> + </div> + <div class="sidebar-collapse"> + <ul class="nav" id="side-menu"> + <li class="nav-header"> + <div class="dropdown profile-element"> + <span><img alt="image" class="img-circle" + @if(isEmpty(avatar)){ + src="${ctxPath}/static/img/girl.gif" + @}else{ + src="${ctxPath}/kaptcha/${avatar}" + @} + width="64px" height="64px"/></span> + <a data-toggle="dropdown" class="dropdown-toggle" href="#"> + <span class="clear"> + <span class="block m-t-xs"><strong class="font-bold">${shiro.getUser().name}</strong></span> + <span class="text-muted text-xs block">${shiro.getUser().roleNames[0]}<b class="caret"></b></span> + </span> + </a> + <ul class="dropdown-menu m-t-xs"> + <li><a class="J_menuItem" href="${ctxPath}/mgr/user_info">个人资料</a></li> + <li><a class="J_menuItem" href="${ctxPath}/mgr/user_chpwd">修改密码</a></li> + <li class="divider"></li> + <li><a href="${ctxPath}/logout">安全退出</a> + </li> + </ul> + </div> + <div class="logo-element">GS + </div> + </li> + + @for(title in titles){ + @if(tool.isEmpty(title.children)){ + <li> + <a class="J_menuItem" href="${ctxPath}${title.url}" name="tabMenuItem"> + <i class="fa ${title.icon}"></i> + <span class="nav-label">${title.name}</span> + </a> + </li> + @}else{ + <li> + <a href="#"> + <i class="fa ${title.icon}"></i> + <span class="nav-label">${title.name}</span> + <span class="fa arrow"></span> + </a> + <ul class="nav nav-second-level"> + @for(subTitle in title.children){ + @if(tool.isEmpty(subTitle.children)){ + <li> + <a class="J_menuItem" href="${ctxPath}${subTitle.url}" name="tabMenuItem">${subTitle.name}</a> + </li> + @}else{ + <li> + <a href="#">${subTitle.name} <span class="fa arrow"></span></a> + <ul class="nav nav-third-level"> + @for(thirdTitle in subTitle.children){ + <li> + <a class="J_menuItem" href="${ctxPath}${thirdTitle.url}" name="tabMenuItem">${thirdTitle.name}</a> + </li> + @} + </ul> + </li> + @} + @} + </ul> + </li> + @} + @} + + </ul> + </div> +</nav> \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/_theme.html b/user/guns-admin/src/main/webapp/WEB-INF/view/common/_theme.html new file mode 100644 index 0000000..4c093d8 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/_theme.html @@ -0,0 +1,84 @@ +<div id="right-sidebar"> + <div class="sidebar-container"> + + <ul class="nav nav-tabs navs-3"> + <li class="active"><a data-toggle="tab" href="#tab-1"> <i + class="fa fa-gear"></i> 主题 + </a></li> + </ul> + + <div class="tab-content"> + <div id="tab-1" class="tab-pane active"> + <div class="sidebar-title"> + <h3> + <i class="fa fa-comments-o"></i> 主题设置 + </h3> + <small><i class="fa fa-tim"></i> + 你可以从这里选择和预览主题的布局和样式,这些设置会被保存在本地,下次打开的时候会直接应用这些设置。</small> + </div> + <div class="skin-setttings"> + <div class="title">主题设置</div> + <div class="setings-item"> + <span>收起左侧菜单</span> + <div class="switch"> + <div class="onoffswitch"> + <input type="checkbox" name="collapsemenu" + class="onoffswitch-checkbox" id="collapsemenu"> <label + class="onoffswitch-label" for="collapsemenu"> <span + class="onoffswitch-inner"></span> <span + class="onoffswitch-switch"></span> + </label> + </div> + </div> + </div> + <div class="setings-item"> + <span>固定顶部</span> + + <div class="switch"> + <div class="onoffswitch"> + <input type="checkbox" name="fixednavbar" + class="onoffswitch-checkbox" id="fixednavbar"> <label + class="onoffswitch-label" for="fixednavbar"> <span + class="onoffswitch-inner"></span> <span + class="onoffswitch-switch"></span> + </label> + </div> + </div> + </div> + <div class="setings-item"> + <span> 固定宽度 </span> + + <div class="switch"> + <div class="onoffswitch"> + <input type="checkbox" name="boxedlayout" + class="onoffswitch-checkbox" id="boxedlayout"> <label + class="onoffswitch-label" for="boxedlayout"> <span + class="onoffswitch-inner"></span> <span + class="onoffswitch-switch"></span> + </label> + </div> + </div> + </div> + <div class="title">皮肤选择</div> + <div class="setings-item default-skin nb"> + <span class="skin-name "> <a href="#" class="s-skin-0"> + 默认皮肤 </a> + </span> + </div> + <div class="setings-item blue-skin nb"> + <span class="skin-name "> <a href="#" class="s-skin-1"> + 蓝色主题 </a> + </span> + </div> + <div class="setings-item yellow-skin nb"> + <span class="skin-name "> <a href="#" class="s-skin-3"> + 黄色/紫色主题 </a> + </span> + </div> + </div> + </div> + + </div> + + </div> +</div> \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/NameCon.tag b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/NameCon.tag new file mode 100644 index 0000000..37cbe1d --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/NameCon.tag @@ -0,0 +1,14 @@ +@/* + 名称查询条件标签的参数说明: + + name : 查询条件的名称 + id : 查询内容的input框id +@*/ +<div class="input-group"> + <div class="input-group-btn"> + <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" + type="button">${name} + </button> + </div> + <input type="text" class="form-control" id="${id}" placeholder="${placeholder!}" /> +</div> \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/SelectCon.tag b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/SelectCon.tag new file mode 100644 index 0000000..a350fc9 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/SelectCon.tag @@ -0,0 +1,16 @@ +@/* + 选择查询条件标签的参数说明: + + name : 查询条件的名称 + id : 查询内容的input框id +@*/ +<div class="input-group"> + <div class="input-group-btn"> + <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button"> + ${name} + </button> + </div> + <select class="form-control" id="${id}"> + ${tagBody!} + </select> +</div> \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/TimeCon.tag b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/TimeCon.tag new file mode 100644 index 0000000..a1fb8a3 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/TimeCon.tag @@ -0,0 +1,15 @@ +@/* + 时间查询条件标签的参数说明: + + name : 查询条件的名称 + id : 查询内容的input框id + isTime : 日期是否带有小时和分钟(true/false) +@*/ +<div class="input-group"> + <div class="input-group-btn"> + <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" + type="button">${name} + </button> + </div> + <input type="text" class="form-control layer-date" id="${id}"/> +</div> \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/avatar.tag b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/avatar.tag new file mode 100644 index 0000000..ce6f2f6 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/avatar.tag @@ -0,0 +1,29 @@ +@/* + 头像参数的说明: + name : 名称 + id : 头像的id +@*/ +<div class="form-group"> + <label class="col-sm-3 control-label head-scu-label">${name}</label> + <div class="col-sm-4"> + <div id="${id}PreId"> + <div><img width="100px" height="100px" + @if(isEmpty(avatarImg)){ + src="${ctxPath}/static/img/girl.gif"></div> + @}else{ + src="${ctxPath}/kaptcha/${avatarImg}"></div> + @} + </div> + </div> + <div class="col-sm-2"> + <div class="head-scu-btn upload-btn" id="${id}BtnId"> + <i class="fa fa-upload"></i> 上传 + </div> + </div> + <input type="hidden" id="${id}" value="${avatarImg!}"/> +</div> +@if(isNotEmpty(underline) && underline == 'true'){ + <div class="hr-line-dashed"></div> +@} + + diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/button.tag b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/button.tag new file mode 100644 index 0000000..86bb011 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/button.tag @@ -0,0 +1,26 @@ +@/* + 按钮标签中各个参数的说明: + + btnType : 按钮的类型决定了颜色(default-灰色,primary-绿色,success-蓝色,info-淡蓝色,warning-黄色,danger-红色,white-白色) + space : 按钮左侧是否有间隔(true/false) + clickFun : 点击按钮所执行的方法 + icon : 按钮上的图标的样式 + name : 按钮名称 +@*/ + +@var spaceCss = ""; +@var btnType = ""; +@if(isEmpty(space) || space == "false"){ +@ spaceCss = ""; +@}else{ +@ spaceCss = "button-margin"; +@} +@if(isEmpty(btnCss)){ +@ btnType = "primary"; +@}else{ +@ btnType = btnCss; +@} +<button type="button" class="btn btn-${btnType} ${spaceCss}" onclick="${clickFun!}" id="${id!}"> + <i class="fa ${icon}"></i> ${name} +</button> + diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/input.tag b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/input.tag new file mode 100644 index 0000000..bb19b00 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/input.tag @@ -0,0 +1,51 @@ +@/* + 表单中input框标签中各个参数的说明: + + hidden : input hidden框的id + id : input框id + name : input框名称 + readonly : readonly属性 + clickFun : 点击事件的方法名 + style : 附加的css属性 +@*/ +<div class="form-group"> + <label class="col-sm-3 control-label">${name}</label> + <div class="col-sm-9"> + <input class="form-control" id="${id}" name="${id}" + @if(isNotEmpty(value)){ + value="${tool.dateType(value)}" + @} + @if(isNotEmpty(type)){ + type="${type}" + @}else{ + type="text" + @} + @if(isNotEmpty(readonly)){ + readonly="${readonly}" + @} + @if(isNotEmpty(clickFun)){ + onclick="${clickFun}" + @} + @if(isNotEmpty(style)){ + style="${style}" + @} + @if(isNotEmpty(disabled)){ + disabled="${disabled}" + @} + > + @if(isNotEmpty(hidden)){ + <input class="form-control" type="hidden" id="${hidden}" value="${hiddenValue!}"> + @} + + @if(isNotEmpty(selectFlag)){ + <div id="${selectId}" style="display: none; position: absolute; z-index: 200;"> + <ul id="${selectTreeId}" class="ztree tree-box" style="${selectStyle!}"></ul> + </div> + @} + </div> +</div> +@if(isNotEmpty(underline) && underline == 'true'){ + <div class="hr-line-dashed"></div> +@} + + diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/select.tag b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/select.tag new file mode 100644 index 0000000..15e6def --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/select.tag @@ -0,0 +1,22 @@ +@/* + select标签中各个参数的说明: + name : select的名称 + id : select的id + underline : 是否带分割线 +@*/ +<div class="form-group"> + <label class="col-sm-3 control-label">${name}</label> + <div class="col-sm-9"> + <select class="form-control" id="${id}" name="${id}"> + ${tagBody!} + </select> + @if(isNotEmpty(hidden)){ + <input class="form-control" type="hidden" id="${hidden}" value="${hiddenValue!}"> + @} + </div> +</div> +@if(isNotEmpty(underline) && underline == 'true'){ + <div class="hr-line-dashed"></div> +@} + + diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/table.tag b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/table.tag new file mode 100644 index 0000000..3760417 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/table.tag @@ -0,0 +1,12 @@ +@/* + 表格标签的参数说明: + + id : table表格的id +@*/ +<table id="${id}" data-mobile-responsive="true" data-click-to-select="true"> + <thead> + <tr> + <th data-field="selectItem" data-checkbox="true"></th> + </tr> + </thead> +</table> \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/tag_tips b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/tag_tips new file mode 100644 index 0000000..3a5d5d4 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/tag_tips @@ -0,0 +1,22 @@ +1 dictSelector(字典选择器) + 此标签是为了方便在前台form表单中使用系统中维护的字典而开发的,具体说明如下: +1.1 标签样例 + <#dictSelector id="sex" name ="sex" code="sys_sex" readonly="readonly" label="性别" underline="true" value="${user.sex}" /> +1.2 属性说明 + id: (非必须) 控件的id + name: (非必须) 控件的name + code:(必须) 字典类型编码,根据code的值去后台查询该类型的字典。 + type:(非必须) 控件类型,可选项为[select,radio,checkbox],标签会根据填写的类型,生成不同的控件。 + searchnum:(非必须)下拉框达到多少个,开启搜索框,默认10个,type为select起效。 + label:(非必须) 字典属性名称 + width:(非必须) 控件的宽度单位为px,type为select起效。 + value: (非必须) 控件默认值,多选时值要用,分隔。 + placeholder:(非必须) 控件提示信息,type为select起效。 + multiple:(非必须) 是否开启多选,可选值[true,false],默认为false,type为select起效。 + underline:(非必须) 是否显示分割线,可选值[true,false],默认为false。 + onchange:(非必须) onchange事件方法名称,会传入更改后的值作为参数,例:onchange="myOnChange" function myOnChange(newVal){}。 + readonly:(非必须)只读控件,可选值[true,false],默认false + disabled:(非必须) 禁用控件,可选值[true,false],默认false + + + diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/index.html b/user/guns-admin/src/main/webapp/WEB-INF/view/index.html new file mode 100644 index 0000000..c04cf7e --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/index.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="renderer" content="webkit"> + <title>Guns - 主页</title> + <link rel="shortcut icon" href="${ctxPath}/static/favicon.ico"> + <link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> + <link href="${ctxPath}/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet"> + <link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet"> +</head> + +<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden"> + <div id="wrapper"> + + <!--左侧导航开始--> + @include("/common/_tab.html"){} + <!--左侧导航结束--> + + <!--右侧部分开始--> + @include("/common/_right.html"){} + <!--右侧部分结束--> + + <!--右侧边栏开始--> + @include("/common/_theme.html"){} + <!--右侧边栏结束--> + + </div> + + <!-- 全局js --> + <script src="${ctxPath}/static/js/jquery.min.js?v=2.1.4"></script> + <script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script> + <script src="${ctxPath}/static/js/plugins/metisMenu/jquery.metisMenu.js"></script> + <script src="${ctxPath}/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script> + <script src="${ctxPath}/static/js/plugins/layer/layer.js"></script> + + <!-- 自定义js --> + <script src="${ctxPath}/static/js/hplus.js?v=4.1.0"></script> + <script type="text/javascript" src="${ctxPath}/static/js/contabs.js"></script> + + <!-- 第三方插件 --> + <script src="${ctxPath}/static/js/plugins/pace/pace.min.js"></script> + +</body> + +</html> diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/login.html b/user/guns-admin/src/main/webapp/WEB-INF/view/login.html new file mode 100644 index 0000000..abc8e55 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/login.html @@ -0,0 +1,70 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Guns - 登录</title> + + <link rel="shortcut icon" href="${ctxPath}/static/favicon.ico"> + <link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> + <link href="${ctxPath}/static/css/font-awesome.css?v=4.4.0" rel="stylesheet"> + <link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet"> + <script>if (window.top !== window.self) { + window.top.location = window.location; + }</script> + <script src="${ctxPath}/static/js/jquery.min.js?v=2.1.4"></script> + <script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script> +</head> + +<body class="gray-bg"> + +<div class="middle-box text-center loginscreen"> + <div style="padding: 100px 0px;"> + <div> + <h1 class="logo-name">GS</h1> + </div> + <h3>欢迎使用 Guns</h3> + <br/> + <h4 style="color: red;">${tips!}</h4> + <form class="m-t" role="form" action="${ctxPath}/login" method="post"> + <div class="form-group"> + <input type="text" name="username" class="form-control" placeholder="用户名" required=""> + </div> + <div class="form-group"> + <input type="password" name="password" class="form-control" placeholder="密码" required=""> + </div> + @if(kaptcha.getKaptchaOnOff() == true){ + <div class="form-group" style="float: left;"> + <div class="col-sm-8" style="padding-left: 0px; padding-right: 0px;"> + <input class="form-control" type="text" name="kaptcha" placeholder="验证码" required=""> + </div> + <div class="col-sm-4" style="padding-left: 0px; padding-right: 0px;"> + <img src="${ctxPath}/kaptcha" id="kaptcha" width="100%" height="100%"/> + </div> + </div> + @} + <div class="form-group" style="float: left;"> + <div class="checkbox" style="text-align: left"> + <label> + <input type="checkbox" name="remember" style="margin-top: 2px;">记住我 + </label> + </div> + </div> + <button type="submit" class="btn btn-primary block full-width m-b">登 录</button> + </p> + </form> + </div> +</div> + +<script> + $(function () { + $("#kaptcha").on('click', function () { + $("#kaptcha").attr('src', '${ctxPath}/kaptcha?' + Math.floor(Math.random() * 100)).fadeIn(); + }); + }); +</script> + +</body> + +</html> diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/code/code.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/code/code.html new file mode 100644 index 0000000..cacd239 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/code/code.html @@ -0,0 +1,47 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-6 col-sm-offset-3"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>代码生成</h5> + </div> + <div class="ibox-content"> + <div class="form-horizontal"> + <div class="form-group"> + <label class="col-sm-2 control-label">模块英文名称</label> + <div class="col-sm-10"> + <input type="text" class="form-control" id="moduleName"> <span class="help-block m-b-none">例如:system</span> + </div> + </div> + <div class="form-group"> + <label class="col-sm-2 control-label">业务名称</label> + <div class="col-sm-10"> + <input type="text" class="form-control" id="bizChName"> <span class="help-block m-b-none">例如:测试</span> + </div> + </div> + <div class="hr-line-dashed"></div> + <div class="form-group"> + <label class="col-sm-2 control-label">业务英文名称</label> + <div class="col-sm-10"> + <input type="text" class="form-control" id="bizEnName"> <span class="help-block m-b-none">例如:test</span> + </div> + </div> + <div class="hr-line-dashed"></div> + <div class="form-group"> + <label class="col-sm-2 control-label">输出路径</label> + <div class="col-sm-10"> + <input type="text" class="form-control" id="path"> <span class="help-block m-b-none">默认路径为D:\ideaSpace\guns,可修改为您的项目的路径</span> + </div> + </div> + <div class="form-group"> + <div class="col-sm-4 col-sm-offset-2"> + <button class="btn btn-primary" onclick="Code.generate()">代码生成</button> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/code/code.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept.html new file mode 100644 index 0000000..a0570a2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept.html @@ -0,0 +1,38 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>部门管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <#NameCon id="condition" name="名称" /> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="Dept.search()"/> + </div> + </div> + <div class="hidden-xs" id="DeptTableToolbar" role="group"> + @if(shiro.hasPermission("/dept/add")){ + <#button name="添加" icon="fa-plus" clickFun="Dept.openAddDept()"/> + @} + @if(shiro.hasPermission("/dept/update")){ + <#button name="修改" icon="fa-plus" clickFun="Dept.openDeptDetail()" space="true"/> + @} + @if(shiro.hasPermission("/dept/delete")){ + <#button name="删除" icon="fa-plus" clickFun="Dept.delete()" space="true"/> + @} + </div> + <#table id="DeptTable"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/dept/dept.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_add.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_add.html new file mode 100644 index 0000000..6dfc704 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_add.html @@ -0,0 +1,42 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="deptInfoForm"> + + <input type="hidden" id="id" value=""> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#input id="simplename" name="部门名称" underline="true"/> + + <#input id="fullname" name="部门全称" underline="true"/> + + <#input id="tips" name="备注" underline="true"/> + </div> + <div class="col-sm-6"> + <#input id="num" name="排序" underline="true"/> + + <#input id="pName" name="上级部门" readonly="readonly" hidden="pid" + clickFun="DeptInfoDlg.showDeptSelectTree(); return false;" + style="background-color: #ffffff !important;"/> + </div> + </div> + + <!-- 父级部门的选择框 --> + <div id="parentDeptMenu" class="menuContent" + style="display: none; position: absolute; z-index: 200;"> + <ul id="parentDeptMenuTree" class="ztree tree-box" style="width: 245px !important;"></ul> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="DeptInfoDlg.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="DeptInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="${ctxPath}/static/modular/system/dept/dept_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_edit.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_edit.html new file mode 100644 index 0000000..15c82f8 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_edit.html @@ -0,0 +1,43 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="deptInfoForm"> + + <input type="hidden" id="id" value="${dept.id}"> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#input id="simplename" name="部门名称" underline="true" value="${dept.simplename}"/> + + <#input id="fullname" name="部门全称" underline="true" value="${dept.fullname}"/> + + <#input id="tips" name="备注" underline="true" value="${dept.tips}"/> + </div> + <div class="col-sm-6"> + <#input id="num" name="排序" underline="true" value="${dept.num}"/> + + <#input id="pName" name="上级部门" readonly="readonly" hidden="pid" + hiddenValue="${dept.pid}" value="${pName}" + clickFun="DeptInfoDlg.showDeptSelectTree(); return false;" + style="background-color: #ffffff !important;"/> + </div> + </div> + + <!-- 父级部门的选择框 --> + <div id="parentDeptMenu" class="menuContent" + style="display: none; position: absolute; z-index: 200;"> + <ul id="parentDeptMenuTree" class="ztree tree-box" style="width: 245px !important;"></ul> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="DeptInfoDlg.editSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="DeptInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="${ctxPath}/static/modular/system/dept/dept_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict.html new file mode 100644 index 0000000..2bf81ee --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict.html @@ -0,0 +1,38 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>字典管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <#NameCon id="condition" name="名称" /> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="Dict.search()"/> + </div> + </div> + <div class="hidden-xs" id="DictTableToolbar" role="group"> + @if(shiro.hasPermission("/dict/add")){ + <#button name="添加" icon="fa-plus" clickFun="Dict.openAddDict()"/> + @} + @if(shiro.hasPermission("/dict/update")){ + <#button name="修改" icon="fa-plus" clickFun="Dict.openDictDetail()" space="true"/> + @} + @if(shiro.hasPermission("/dict/delete")){ + <#button name="删除" icon="fa-plus" clickFun="Dict.delete()" space="true"/> + @} + </div> + <#table id="DictTable"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/dict/dict.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_add.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_add.html new file mode 100644 index 0000000..47352a5 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_add.html @@ -0,0 +1,64 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal"> + + <input type="hidden" id="id" value=""> + + <div class="row"> + <div class="col-sm-12" id="itemsArea"> + <div class="form-group"> + <label class="col-sm-2 control-label">类型编码</label> + <div class="col-sm-2"> + <input class="form-control" id="dictCode" type="text"> + </div> + <label class="col-sm-2 control-label">类型名称</label> + <div class="col-sm-2"> + <input class="form-control" id="dictName" type="text"> + </div> + + <div class="col-sm-2"> + <#button btnCss="info" name="增加" icon="fa-plus" clickFun="DictInfoDlg.addItem()"/> + </div> + </div> + <div class="form-group"> + <label class="col-sm-2 control-label">备注</label> + <div class="col-sm-8"> + <input class="form-control" id="dictTips" type="text"> + </div> + </div> + <div class="hr-line-dashed"></div> + + </div> + </div> + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="DictInfoDlg.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="DictInfoDlg.close()"/> + </div> + </div> + </div> + </div> + + <script type="text/template" id="itemTemplate"> + <div class="form-group" name="dictItem" id="dictItem"> + <label class="col-sm-1 control-label">值</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemCode"> + </div> + <label class="col-sm-1 control-label" >名称</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemName"> + </div> + <label class="col-sm-1 control-label" >序号</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemNum"> + </div> + <div class="col-sm-2"> + <#button btnCss="danger" name="删除" id="cancel" icon="fa-remove" clickFun="DictInfoDlg.deleteItem(event)"/> + </div> + </div> + </script> + + <script src="${ctxPath}/static/modular/system/dict/dict_info.js"></script> + @} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_edit.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_edit.html new file mode 100644 index 0000000..aca3d70 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_edit.html @@ -0,0 +1,86 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal"> + + <input type="hidden" id="id" value=""> + + <div class="row"> + <div class="col-sm-12" id="itemsArea"> + <input type="hidden" id="itemSize" value="${subDicts.~size!0}" /> + <div class="form-group"> + + <label class="col-sm-2 control-label">类型编码</label> + <div class="col-sm-2"> + <input class="form-control" id="dictCode" type="text" value="${dict.code}"> + </div> + + <label class="col-sm-2 control-label">类型名称</label> + <div class="col-sm-2"> + <input class="form-control" id="dictName" type="text" value="${dict.name}"> + <input type="hidden" id="dictId" value="${dict.id}"> + </div> + + <div class="col-sm-2"> + <#button btnCss="info" name="增加" icon="fa-plus" clickFun="DictInfoDlg.addItem()"/> + </div> + </div> + <div class="form-group"> + <label class="col-sm-2 control-label">备注</label> + <div class="col-sm-8"> + <input class="form-control" id="dictTips" type="text" value="${dict.tips}"> + </div> + </div> + <div class="hr-line-dashed"></div> + @for(item in subDicts){ + <div class="form-group" name="dictItem" id="dictItem${itemLP.index}"> + <label class="col-sm-1 control-label">值</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemCode" value="${item.code}"> + </div> + <label class="col-sm-1 control-label" >名称</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemName" value="${item.name}"> + </div> + <label class="col-sm-1 control-label" >序号</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemNum" value="${item.num}"> + </div> + <div class="col-sm-2"> + <#button btnCss="danger" name="删除" id="cancel" icon="fa-remove" clickFun="DictInfoDlg.deleteItem(event)"/> + </div> + </div> + @} + </input> + </div> + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="DictInfoDlg.editSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="DictInfoDlg.close()"/> + </div> + </div> + </div> + </div> + + <script type="text/template" id="itemTemplate"> + <div class="form-group" name="dictItem" id="dictItem"> + <label class="col-sm-1 control-label">值</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemCode"> + </div> + <label class="col-sm-1 control-label" >名称</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemName"> + </div> + <label class="col-sm-1 control-label" >序号</label> + <div class="col-sm-2"> + <input class="form-control" type="text" name="itemNum"> + </div> + <div class="col-sm-2"> + <#button btnCss="danger" name="删除" id="cancel" icon="fa-remove" clickFun="DictInfoDlg.deleteItem(event)"/> + </div> + </div> + </script> + + <script src="${ctxPath}/static/modular/system/dict/dict_info.js"></script> + @} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/log/log.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/log/log.html new file mode 100644 index 0000000..9b396c2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/log/log.html @@ -0,0 +1,46 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>业务日志</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-2"> + <#TimeCon id="beginTime" name="开始时间" isTime="false" pattern="YYYY-MM-DD" /> + </div> + <div class="col-sm-2"> + <#TimeCon id="endTime" name="结束时间" isTime="false" pattern="YYYY-MM-DD" /> + </div> + <div class="col-sm-2"> + <#NameCon id="logName" name="日志名称" /> + </div> + <div class="col-sm-2"> + <#SelectCon id="logType" name="日志类型" > + <option value="0">全部</option> + <option value="1">业务日志</option> + <option value="2">异常日志</option> + </#SelectCon> + </div> + <div class="col-sm-2"> + <#button name="搜索" icon="fa-search" clickFun="OptLog.search()"/> + </div> + </div> + <div class="hidden-xs" id="OptLogTableToolbar" role="group"> + <#button name="查看详情" icon="fa-plus" clickFun="OptLog.detail()"/> + @if(shiro.hasPermission("/log/delLog")){ + <#button name="清空日志" icon="fa-plus" clickFun="OptLog.delLog()" space="true"/> + @} + </div> + <#table id="OptLogTable"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/log/log.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/log/login_log.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/log/login_log.html new file mode 100644 index 0000000..bbf0bd1 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/log/login_log.html @@ -0,0 +1,36 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>登录日志</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <#TimeCon id="beginTime" name="开始时间" isTime="false" pattern="YYYY-MM-DD" /> + </div> + <div class="col-sm-3"> + <#TimeCon id="endTime" name="结束时间" isTime="false" pattern="YYYY-MM-DD" /> + </div> + <div class="col-sm-3"> + <#NameCon id="logName" name="日志名称" /> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="LoginLog.search()"/> + </div> + </div> + <div class="hidden-xs" id="LoginLogTableToolbar" role="group"> + <#button name="清空日志" icon="fa-plus" clickFun="LoginLog.delLog()"/> + </div> + <#table id="LoginLogTable"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/log/login_log.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu.html new file mode 100644 index 0000000..b0e89a7 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu.html @@ -0,0 +1,41 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>菜单管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <#NameCon id="menuName" name="菜单名称" /> + </div> + <div class="col-sm-3"> + <#NameCon id="level" name="层级" /> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="Menu.search()"/> + </div> + </div> + <div class="hidden-xs" id="menuTableToolbar" role="group"> + @if(shiro.hasPermission("/menu/add")){ + <#button name="添加" icon="fa-plus" clickFun="Menu.openAddMenu()"/> + @} + @if(shiro.hasPermission("/menu/edit")){ + <#button name="修改" icon="fa-edit" clickFun="Menu.openChangeMenu()" space="true"/> + @} + @if(shiro.hasPermission("/menu/remove")){ + <#button name="删除" icon="fa-remove" clickFun="Menu.delMenu()" space="true"/> + @} + </div> + <#table id="menuTable"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/menu/menu.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_add.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_add.html new file mode 100644 index 0000000..7eae700 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_add.html @@ -0,0 +1,40 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="menuInfoForm"> + + <input type="hidden" id="id" value=""> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#input id="name" name="名称" underline="true" /> + <#input id="code" name="菜单编号" underline="true" /> + <#input id="pcodeName" name="父级编号" underline="true" + hidden="pcode" readonly="readonly" + clickFun="MenuInfoDlg.showMenuSelectTree(); return false;" + style="background-color: #ffffff !important;" + selectFlag="true" selectId="pcodeTreeDiv" selectTreeId="pcodeTree" selectStyle="width:244px !important;"/> + <#select id="ismenu" name="是否是菜单"> + <option value="1">是</option> + <option value="0">不是</option> + </#select> + </div> + <div class="col-sm-6"> + <#input id="url" name="请求地址" underline="true" /> + <#input id="num" name="排序" underline="true" /> + <#input id="icon" name="图标" underline="false" /> + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="MenuInfoDlg.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="MenuInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="${ctxPath}/static/modular/system/menu/menu_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_edit.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_edit.html new file mode 100644 index 0000000..5942194 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_edit.html @@ -0,0 +1,42 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="menuInfoForm"> + + <input type="hidden" id="id" value="${menu.id}"> + <input type="hidden" id="ismenuValue" value="${menu.ismenu}"> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#input id="name" name="名称" value="${menu.name}" underline="true" /> + <#input id="code" name="菜单编号" value="${menu.code}" underline="true" /> + <#input id="pcodeName" name="父级编号" value="${menu.pcodeName}" underline="true" + hidden="pcode" readonly="readonly" hiddenValue="${menu.pcode}" + clickFun="MenuInfoDlg.showMenuSelectTree(); return false;" + style="background-color: #ffffff !important;" + selectFlag="true" selectId="pcodeTreeDiv" selectTreeId="pcodeTree" selectStyle="width:244px !important;"/> + <#select id="ismenu" name="是否是菜单"> + <option value="1">是</option> + <option value="0">不是</option> + </#select> + + </div> + <div class="col-sm-6"> + <#input id="url" name="请求地址" value="${menu.url}" underline="true" /> + <#input id="num" name="排序" value="${menu.num}" underline="true" /> + <#input id="icon" name="图标" underline="false" value="${menu.icon}"/> + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="MenuInfoDlg.editSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="MenuInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="${ctxPath}/static/modular/system/menu/menu_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice.html new file mode 100644 index 0000000..f373984 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice.html @@ -0,0 +1,38 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>通知管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <#NameCon id="condition" name="名称" /> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="Notice.search()"/> + </div> + </div> + <div class="hidden-xs" id="NoticeTableToolbar" role="group"> + @if(shiro.hasPermission("/notice/add")){ + <#button name="添加" icon="fa-plus" clickFun="Notice.openAddNotice()"/> + @} + @if(shiro.hasPermission("/notice/update")){ + <#button name="修改" icon="fa-plus" clickFun="Notice.openNoticeDetail()" space="true"/> + @} + @if(shiro.hasPermission("/notice/delete")){ + <#button name="删除" icon="fa-plus" clickFun="Notice.delete()" space="true"/> + @} + </div> + <#table id="NoticeTable"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/notice/notice.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_add.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_add.html new file mode 100644 index 0000000..81787e7 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_add.html @@ -0,0 +1,39 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="noticeInfoForm"> + + <input type="hidden" id="id" value=""> + + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-1 control-label">标题</label> + <div class="col-sm-11"> + <input class="form-control" id="title" name="title" type="text"> + + </div> + </div> + <div class="form-group"> + <label class="col-sm-1 control-label">内容</label> + <div class="col-sm-11"> + <div id="editor" class="editorHeight"> + </div> + </div> + </div> + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="NoticeInfoDlg.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="NoticeInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script type="text/javascript" src="//unpkg.com/wangeditor/release/wangEditor.min.js"></script> +<script src="${ctxPath}/static/modular/system/notice/notice_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_edit.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_edit.html new file mode 100644 index 0000000..051600c --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_edit.html @@ -0,0 +1,39 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="noticeInfoForm"> + + <input type="hidden" id="id" value="${notice.id}"> + <input type="hidden" id="contentVal" value='${notice.content}'> + + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-1 control-label">标题</label> + <div class="col-sm-11"> + <input class="form-control" id="title" name="title" type="text" value="${notice.title}"> + + </div> + </div> + <div class="form-group"> + <label class="col-sm-1 control-label">内容</label> + <div class="col-sm-11"> + <div id="editor" class="editorHeight"> + </div> + </div> + </div> + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="NoticeInfoDlg.editSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="NoticeInfoDlg.close()"/> + </div> + </div> + </div> + </div> +</div> +<script type="text/javascript" src="${ctxPath}/static/js/plugins/wangEditor/wangEditor.js"></script> +<script src="${ctxPath}/static/modular/system/notice/notice_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role.html new file mode 100644 index 0000000..316cf85 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role.html @@ -0,0 +1,41 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>角色管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <#NameCon id="roleName" name="角色名称" /> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="Role.search()"/> + </div> + </div> + <div class="hidden-xs" id="roleTableToolbar" role="group"> + @if(shiro.hasPermission("/role/add")){ + <#button name="添加" icon="fa-plus" clickFun="Role.openAddRole()" /> + @} + @if(shiro.hasPermission("/role/edit")){ + <#button name="修改" icon="fa-edit" clickFun="Role.openChangeRole()" space="true"/> + @} + @if(shiro.hasPermission("/role/remove")){ + <#button name="删除" icon="fa-remove" clickFun="Role.delRole()" space="true"/> + @} + @if(shiro.hasPermission("/role/setAuthority")){ + <#button name="权限配置" icon="fa-user-secret" clickFun="Role.assign()" space="true"/> + @} + </div> + <#table id="roleTable"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/role/role.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_add.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_add.html new file mode 100644 index 0000000..3ebc8c7 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_add.html @@ -0,0 +1,47 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="roleInfoForm"> + + <input type="hidden" id="id" value=""> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#input id="name" name="角色名称" underline="true"/> + <#input id="pName" name="上级名称" underline="true" hidden="pid" readonly="readonly" + clickFun="RolInfoDlg.showPNameSelectTree(); return false;" + style="background-color: #ffffff !important;"/> + <#input id="deptName" name="部门名称" hidden="deptid" readonly="readonly" + clickFun="RolInfoDlg.showDeptSelectTree(); return false;" + style="background-color: #ffffff !important;"/> + </div> + <div class="col-sm-6"> + <#input id="tips" name="别名" underline="true"/> + <#input id="num" name="排序"/> + </div> + </div> + + <!-- 这是部门下拉框 --> + <div id="deptContent" class="menuContent" + style="display: none; position: absolute; z-index: 200;"> + <ul id="deptTree" class="ztree tree-box" style="width: 250px !important;"></ul> + </div> + + <!-- 这是父级菜单下拉框 --> + <div id="pNameContent" class="menuContent" + style="display: none; position: absolute; z-index: 200;"> + <ul id="pNameTree" class="ztree tree-box" style="width: 250px !important;"></ul> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="RolInfoDlg.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="RolInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="${ctxPath}/static/modular/system/role/role_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_assign.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_assign.html new file mode 100644 index 0000000..628a27b --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_assign.html @@ -0,0 +1,75 @@ +@layout("/common/_container.html"){ + + +<script type="text/javascript"> + $(function () { + var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 + + $("#btn_close").bind("click", function () { + parent.layer.close(index); + }); + + $("#btn_save").bind("click", function () { + var ids = Feng.zTreeCheckedNodes("zTree"); + var ajax = new $ax(Feng.ctxPath + "/role/setAuthority", function (data) { + Feng.success("分配角色成功!"); + window.parent.Role.table.refresh(); + parent.layer.close(index); + }, function (data) { + Feng.error("分配角色失败!" + + data.responseJSON.message + "!"); + }); + ajax.set("roleId", "${roleId}"); + ajax.set("ids", ids); + ajax.start(); + }); + + initZtree(); + }); + + function initZtree() { + var setting = { + check: { + enable: true, + chkboxType: { "Y": "ps", "N": "ps" } + }, + data: { + simpleData: { + enable: true + } + } + }; + + var ztree = new $ZTree("zTree", "/menu/menuTreeListByRoleId/" + + "${roleId}"); + ztree.setSettings(setting); + ztree.init(); + } +</script> + + +<!-- 配置grid --> +<div class="container" style="padding: 0px 10px !important;margin-top: -10px;text-align: center !important;"> + <div class="row"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>${roleName!}</h5> + </div> + <div class="ibox-content"> + <ul id="zTree" class="ztree"></ul> + </div> + </div> + </div> + <div class="row"> + <div class="col-md-12"> + <button class="btn btn-sm btn-info" type="button" id="btn_save"> + <i class="ace-icon fa fa-check bigger-110"></i>保存 + </button> + + <button class="btn btn-sm btn-danger" type="button" id="btn_close"> + <i class="ace-icon fa fa-close bigger-110"></i>关闭 + </button> + </div> + </div> +</div> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_edit.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_edit.html new file mode 100644 index 0000000..4bb543d --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_edit.html @@ -0,0 +1,47 @@ + @layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="roleInfoForm"> + + <input type="hidden" id="id" value="${role.id}"> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#input id="name" name="角色名称" underline="true" value="${role.name}"/> + <#input id="pName" name="上级名称" underline="true" hidden="pid" hiddenValue="${role.pid}" readonly="readonly" value="${pName}" + clickFun="RolInfoDlg.showPNameSelectTree(); return false;" + style="background-color: #ffffff !important;"/> + <#input id="deptName" name="部门名称" hidden="deptid" hiddenValue="${role.deptid}" readonly="readonly" value="${deptName}" + clickFun="RolInfoDlg.showDeptSelectTree(); return false;" + style="background-color: #ffffff !important;"/> + </div> + <div class="col-sm-6"> + <#input id="tips" name="别名" underline="true" value="${role.tips}"/> + <#input id="num" name="排序" value="${role.num}"/> + </div> + </div> + + <!-- 这是部门下拉框 --> + <div id="deptContent" class="menuContent" + style="display: none; position: absolute; z-index: 200;"> + <ul id="deptTree" class="ztree tree-box" style="width: 250px !important;"></ul> + </div> + + <!-- 这是父级菜单下拉框 --> + <div id="pNameContent" class="menuContent" + style="display: none; position: absolute; z-index: 200;"> + <ul id="pNameTree" class="ztree tree-box" style="width: 250px !important;"></ul> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="RolInfoDlg.editSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="RolInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="${ctxPath}/static/modular/system/role/role_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user.html new file mode 100644 index 0000000..f823853 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user.html @@ -0,0 +1,85 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>用户管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-lg-2 col-sm-3"> + <div class="panel panel-default"> + <div class="panel-heading">组织机构</div> + <div class="panel-body dept-tree"> + <ul id="deptTree" class="ztree"></ul> + </div> + </div> + </div> + <div class="col-lg-10 col-sm-9"> + <div class="row"> + <div class="col-lg-10 col-sm-9"> + <div class="row"> + <div class="col-lg-4 col-sm-12"> + <#NameCon id="name" name="用户名称" placeholder="帐号/姓名/手机号"/> + </div> + <div class="col-lg-4 col-sm-6"> + <#TimeCon id="beginTime" name="注册开始日期" isTime="false"/> + </div> + <div class="col-lg-4 col-sm-6"> + <#TimeCon id="endTime" name="注册结束日期" isTime="false"/> + </div> + </div> + </div> + <div class="col-lg-2 col-sm-3"> + <div class="row"> + <div class="col-lg-12 col-sm-12"> + <#button name="搜索" icon="fa-search" clickFun="MgrUser.search()"/> + <#button name="重置" icon="fa-trash" clickFun="MgrUser.resetSearch()" space="true"/> + </div> + </div> + </div> + </div> + <div class="hidden-xs" id="managerTableToolbar" role="group"> + @if(shiro.hasPermission("/mgr/add")){ + <#button name="添加" icon="fa-plus" clickFun="MgrUser.openAddMgr()"/> + @} + @if(shiro.hasPermission("/mgr/edit")){ + <#button name="修改" icon="fa-edit" clickFun="MgrUser.openChangeUser()" space="true"/> + @} + @if(shiro.hasPermission("/mgr/delete")){ + <#button name="删除" icon="fa-remove" clickFun="MgrUser.delMgrUser()" space="true"/> + @} + @if(shiro.hasPermission("/mgr/reset")){ + <#button name="重置密码" icon="fa-refresh" clickFun="MgrUser.resetPwd()" space="true"/> + @} + @if(shiro.hasPermission("/mgr/freeze")){ + <#button name="冻结" icon="fa-warning" clickFun="MgrUser.freezeAccount()" space="true"/> + @} + @if(shiro.hasPermission("/mgr/unfreeze")){ + <#button name="解除冻结" icon="fa-check-circle" clickFun="MgrUser.unfreeze()" space="true"/> + @} + @if(shiro.hasPermission("/mgr/setRole")){ + <#button name="角色分配" icon="fa-user-secret" clickFun="MgrUser.roleAssign()" space="true"/> + @} + </div> + <#table id="managerTable"/> + </div> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/user/user.js"></script> +<script> + laydate.render({ + elem: '#beginTime' + }); + laydate.render({ + elem: '#endTime' + }); +</script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_add.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_add.html new file mode 100644 index 0000000..a5a76cb --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_add.html @@ -0,0 +1,63 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="userInfoForm"> + + <input type="hidden" id="id" value=""> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#input id="account" name="账户" underline="true"/> + + <#select id="sex" name="性别" underline="true"> + <option value="1">男</option> + <option value="2">女</option> + </#select> + + <#input id="password" name="密码" underline="true" type="password"/> + + <#input id="roleid" name="角色" underline="true" disabled="disabled"/> + + <#input id="email" name="邮箱" type="email"/> + + </div> + <div class="col-sm-6"> + <div id="driverInfoContent"> + <#input id="name" name="姓名" underline="true"/> + + <#input id="birthday" name="出生日期" underline="true" type="text"/> + + <#input id="rePassword" name="确认密码" type="password" underline="true"/> + + <#input id="citySel" name="部门" underline="true" readonly="readonly" hidden="deptid" + clickFun="UserInfoDlg.showDeptSelectTree(); return false;" + style="background-color: #ffffff !important;"/> + + <#input id="phone" name="电话"/> + </div> + </div> + </div> + + <!-- 这是部门选择的下拉框 --> + <div id="menuContent" class="menuContent" + style="display: none; position: absolute; z-index: 200;"> + <ul id="treeDemo" class="ztree tree-box" style="width: 249px !important;"></ul> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="UserInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="${ctxPath}/static/modular/system/user/user_info.js"></script> +<script> + laydate.render({ + elem: '#birthday' + }); +</script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_chpwd.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_chpwd.html new file mode 100644 index 0000000..a376cc2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_chpwd.html @@ -0,0 +1,34 @@ +@layout("/common/_container.html"){ +<div class="col-sm-4 col-sm-offset-4"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>修改密码</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-content" style="border:none !important; "> + <div class="form-horizontal"> + <div class="row"> + <div class="col-sm-12"> + <#input id="oldPwd" name="原密码" underline="true" type="password"/> + <#input id="newPwd" name="新密码" underline="true" type="password"/> + <#input id="rePwd" name="新密码验证" type="password"/> + </div> + </div> + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.chPwd()"/> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/user/user_info.js"></script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_edit.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_edit.html new file mode 100644 index 0000000..437a9d3 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_edit.html @@ -0,0 +1,60 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="userInfoForm"> + + <input type="hidden" id="id" value="${user.id}"> + <input type="hidden" id="sexValue" value="${user.sex}"> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#input id="account" name="账户" underline="true" value="${user.account}"/> + + <#select id="sex" name="性别" underline="true"> + <option value="1">男</option> + <option value="2">女</option> + </#select> + + <#input id="roleid" name="角色" underline="true" value="${roleName}" disabled="disabled"/> + + <#input id="email" name="邮箱" type="email" value="${user.email}"/> + </div> + <div class="col-sm-6"> + <div id="driverInfoContent"> + <#input id="name" name="姓名" underline="true" value="${user.name}"/> + + <#input id="birthday" name="出生日期" underline="true" type="text" + value="${user.birthday}"/> + + <#input id="citySel" name="部门" underline="true" readonly="readonly" hidden="deptid" hiddenValue="${user.deptid}" value="${deptName}" + clickFun="UserInfoDlg.showDeptSelectTree(); return false;" + style="background-color: #ffffff !important;"/> + + <#input id="phone" name="电话" value="${user.phone}"/> + </div> + </div> + </div> + + <!-- 这是部门选择的下拉框 --> + <div id="menuContent" class="menuContent" + style="display: none; position: absolute; z-index: 200;"> + <ul id="treeDemo" class="ztree tree-box" style="width: 249px !important;"></ul> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.editSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="UserInfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="${ctxPath}/static/modular/system/user/user_info.js"></script> +<script> + laydate.render({ + elem: '#birthday' + }); +</script> +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_roleassign.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_roleassign.html new file mode 100644 index 0000000..8131bc8 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_roleassign.html @@ -0,0 +1,79 @@ +@layout("/common/_container.html"){ + + +<script type="text/javascript"> + $(function () { + + var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 + + $("#btn_close").bind("click", function () { + parent.layer.close(index); + }); + + $("#btn_save").bind("click", function () { + var ids = Feng.zTreeCheckedNodes("zTree"); + var ajax = new $ax(Feng.ctxPath + "/mgr/setRole", function (data) { + Feng.success("分配角色成功!"); + window.parent.MgrUser.table.refresh(); + parent.layer.close(index); + }, function (data) { + Feng.error("分配角色失败!" + data.responseJSON.message + "!"); + }); + ajax.set("roleIds", ids); + ajax.set("userId", "${userId}"); + ajax.start(); + }); + + initZtree(); + }); + + function initZtree() { + var setting = { + check: { + enable: true, + chkboxType: { + "Y": "", + "N": "" + } + }, + data: { + simpleData: { + enable: true + } + } + }; + + var ztree = new $ZTree("zTree", "/role/roleTreeListByUserId/${userId}"); + ztree.setSettings(setting); + ztree.init(); + } +</script> + + +<!-- 配置grid --> +<div class="container" + style="padding: 0px 10px !important; margin-top: -10px; text-align: center !important;"> + <div class="row"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>${userAccount!}</h5> + </div> + <div class="ibox-content"> + <ul id="zTree" class="ztree"></ul> + </div> + </div> + </div> + <div class="row"> + <div class="col-md-12"> + <button class="btn btn-sm btn-info" type="button" id="btn_save"> + <i class="ace-icon fa fa-check bigger-110"></i> 保存 + </button> + + <button class="btn btn-sm btn-danger" type="button" id="btn_close"> + <i class="ace-icon fa fa-close bigger-110"></i> 关闭 + </button> + </div> + </div> +</div> + +@} diff --git a/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_view.html b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_view.html new file mode 100644 index 0000000..fcbe512 --- /dev/null +++ b/user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_view.html @@ -0,0 +1,75 @@ +@layout("/common/_container.html"){ +<div class="col-sm-6 col-sm-offset-3"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>用户管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-content" style="border:none !important; "> + <div class="form-horizontal" id="userInfoForm"> + + <input type="hidden" id="id" value="${user.id}"> + <input type="hidden" id="sexValue" value="${user.sex}"> + + <div class="row"> + <div class="col-sm-6 b-r"> + <#avatar id="avatar" name="头像" underline="true" avatarImg="${user.avatar}"/> + + <#input id="account" name="账户" underline="true" value="${user.account}" disabled="disabled" /> + + <#select id="sex" name="性别" underline="true" value="${user.sex}"> + <option value="1">男</option> + <option value="2">女</option> + </#select> + + <#input id="roleid" name="角色" underline="true" value="${roleName}" disabled="disabled"/> + + <#input id="email" name="邮箱" type="email" value="${user.email}"/> + </div> + + <div class="col-sm-6"> + <div id="driverInfoContent"> + <#input id="name" name="姓名" underline="true" value="${user.name}"/> + + <#input id="birthday" name="出生日期" underline="true" type="text" + value="${user.birthday}"/> + + <#input id="citySel" name="部门" underline="true" readonly="readonly" value="${deptName}" + hidden="deptid" hiddenValue="${user.deptid}" + clickFun="UserInfoDlg.showInfoDeptSelectTree(); return false;" + style="background-color: #ffffff !important;" + selectFlag="true" selectId="menuContent" selectTreeId="treeDemo" selectStyle="width:250px !important;"/> + + <#input id="phone" name="电话" value="${user.phone}"/> + </div> + </div> + </div> + + <div class="progress progress-striped" id="progressTipArea" style="margin-top: 20px;"> + <div id="progressBar" style="width: 0%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" class="progress-bar progress-bar-info"> + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.editSubmit()"/> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/user/user_info.js"></script> +<script> + laydate.render({ + elem: '#birthday' + }); +</script> +@} diff --git a/user/guns-admin/src/main/webapp/static/css/_fstyle.css b/user/guns-admin/src/main/webapp/static/css/_fstyle.css new file mode 100644 index 0000000..3b2ded1 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/_fstyle.css @@ -0,0 +1,65 @@ +.button-margin { + margin-left: 15px !important; +} + +.input-none-margin { + margin: 0px !important; +} + +.btn-margin-left { + margin-left: 15px !important; +} + +.table-head { + float: left; + width: 100%; + height: auto; +} + +.head-scu-label { + margin-top: 35px; +} + +.head-scu-btn { + margin-top: 68px; +} + +.line-margin { + margin: 8px 0 !important; +} + +.be-driver-checkbox { + margin-top: 7px; +} + +.btn-group-m-t { + margin-top: 20px; +} + +.upload-btn { + white-space: nowrap; +} + +.tree-box { + border-radius: 0px !important; + box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2) !important; + background: rgb(250, 250, 250) none repeat scroll 0% 0% !important; + border: 1px solid rgb(204, 204, 204) !important; + overflow-y: scroll !important; + overflow-x: auto !important; + margin-top: 0px !important; + width: 224px !important; + max-height: 160px !important; + -moz-user-select: none !important; +} +.dept-tree { + padding:10px +} + +.w-e-text-container{ + height: 150px !important; +} + +.editorHeight{ + height: 170px; +} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/css/bootstrap-rtl.css b/user/guns-admin/src/main/webapp/static/css/bootstrap-rtl.css new file mode 100644 index 0000000..30014e6 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/bootstrap-rtl.css @@ -0,0 +1,1468 @@ +/******************************************************************************* + * bootstrap-rtl (version 3.3.1) + * Author: Morteza Ansarinia (http://github.com/morteza) + * Created on: January 21,2015 + * Project: bootstrap-rtl + * Copyright: Unlicensed Public Domain + *******************************************************************************/ + +html { + direction: rtl; +} +body { + direction: rtl; +} +.list-unstyled { + padding-right: 0; + padding-left: initial; +} +.list-inline { + padding-right: 0; + padding-left: initial; + margin-right: -5px; + margin-left: 0; +} +dd { + margin-right: 0; + margin-left: initial; +} +@media (min-width: 768px) { + .dl-horizontal dt { + float: right; + clear: right; + text-align: left; + } + .dl-horizontal dd { + margin-right: 180px; + margin-left: 0; + } +} +blockquote { + border-right: 5px solid #eeeeee; + border-left: 0; +} +.blockquote-reverse, +blockquote.pull-left { + padding-left: 15px; + padding-right: 0; + border-left: 5px solid #eeeeee; + border-right: 0; + text-align: left; +} +.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { + position: relative; + min-height: 1px; + padding-left: 15px; + padding-right: 15px; +} +.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { + float: right; +} +.col-xs-12 { + width: 100%; +} +.col-xs-11 { + width: 91.66666667%; +} +.col-xs-10 { + width: 83.33333333%; +} +.col-xs-9 { + width: 75%; +} +.col-xs-8 { + width: 66.66666667%; +} +.col-xs-7 { + width: 58.33333333%; +} +.col-xs-6 { + width: 50%; +} +.col-xs-5 { + width: 41.66666667%; +} +.col-xs-4 { + width: 33.33333333%; +} +.col-xs-3 { + width: 25%; +} +.col-xs-2 { + width: 16.66666667%; +} +.col-xs-1 { + width: 8.33333333%; +} +.col-xs-pull-12 { + left: 100%; + right: auto; +} +.col-xs-pull-11 { + left: 91.66666667%; + right: auto; +} +.col-xs-pull-10 { + left: 83.33333333%; + right: auto; +} +.col-xs-pull-9 { + left: 75%; + right: auto; +} +.col-xs-pull-8 { + left: 66.66666667%; + right: auto; +} +.col-xs-pull-7 { + left: 58.33333333%; + right: auto; +} +.col-xs-pull-6 { + left: 50%; + right: auto; +} +.col-xs-pull-5 { + left: 41.66666667%; + right: auto; +} +.col-xs-pull-4 { + left: 33.33333333%; + right: auto; +} +.col-xs-pull-3 { + left: 25%; + right: auto; +} +.col-xs-pull-2 { + left: 16.66666667%; + right: auto; +} +.col-xs-pull-1 { + left: 8.33333333%; + right: auto; +} +.col-xs-pull-0 { + left: auto; + right: auto; +} +.col-xs-push-12 { + right: 100%; + left: 0; +} +.col-xs-push-11 { + right: 91.66666667%; + left: 0; +} +.col-xs-push-10 { + right: 83.33333333%; + left: 0; +} +.col-xs-push-9 { + right: 75%; + left: 0; +} +.col-xs-push-8 { + right: 66.66666667%; + left: 0; +} +.col-xs-push-7 { + right: 58.33333333%; + left: 0; +} +.col-xs-push-6 { + right: 50%; + left: 0; +} +.col-xs-push-5 { + right: 41.66666667%; + left: 0; +} +.col-xs-push-4 { + right: 33.33333333%; + left: 0; +} +.col-xs-push-3 { + right: 25%; + left: 0; +} +.col-xs-push-2 { + right: 16.66666667%; + left: 0; +} +.col-xs-push-1 { + right: 8.33333333%; + left: 0; +} +.col-xs-push-0 { + right: auto; + left: 0; +} +.col-xs-offset-12 { + margin-right: 100%; + margin-left: 0; +} +.col-xs-offset-11 { + margin-right: 91.66666667%; + margin-left: 0; +} +.col-xs-offset-10 { + margin-right: 83.33333333%; + margin-left: 0; +} +.col-xs-offset-9 { + margin-right: 75%; + margin-left: 0; +} +.col-xs-offset-8 { + margin-right: 66.66666667%; + margin-left: 0; +} +.col-xs-offset-7 { + margin-right: 58.33333333%; + margin-left: 0; +} +.col-xs-offset-6 { + margin-right: 50%; + margin-left: 0; +} +.col-xs-offset-5 { + margin-right: 41.66666667%; + margin-left: 0; +} +.col-xs-offset-4 { + margin-right: 33.33333333%; + margin-left: 0; +} +.col-xs-offset-3 { + margin-right: 25%; + margin-left: 0; +} +.col-xs-offset-2 { + margin-right: 16.66666667%; + margin-left: 0; +} +.col-xs-offset-1 { + margin-right: 8.33333333%; + margin-left: 0; +} +.col-xs-offset-0 { + margin-right: 0%; + margin-left: 0; +} +@media (min-width: 768px) { + .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { + float: right; + } + .col-sm-12 { + width: 100%; + } + .col-sm-11 { + width: 91.66666667%; + } + .col-sm-10 { + width: 83.33333333%; + } + .col-sm-9 { + width: 75%; + } + .col-sm-8 { + width: 66.66666667%; + } + .col-sm-7 { + width: 58.33333333%; + } + .col-sm-6 { + width: 50%; + } + .col-sm-5 { + width: 41.66666667%; + } + .col-sm-4 { + width: 33.33333333%; + } + .col-sm-3 { + width: 25%; + } + .col-sm-2 { + width: 16.66666667%; + } + .col-sm-1 { + width: 8.33333333%; + } + .col-sm-pull-12 { + left: 100%; + right: auto; + } + .col-sm-pull-11 { + left: 91.66666667%; + right: auto; + } + .col-sm-pull-10 { + left: 83.33333333%; + right: auto; + } + .col-sm-pull-9 { + left: 75%; + right: auto; + } + .col-sm-pull-8 { + left: 66.66666667%; + right: auto; + } + .col-sm-pull-7 { + left: 58.33333333%; + right: auto; + } + .col-sm-pull-6 { + left: 50%; + right: auto; + } + .col-sm-pull-5 { + left: 41.66666667%; + right: auto; + } + .col-sm-pull-4 { + left: 33.33333333%; + right: auto; + } + .col-sm-pull-3 { + left: 25%; + right: auto; + } + .col-sm-pull-2 { + left: 16.66666667%; + right: auto; + } + .col-sm-pull-1 { + left: 8.33333333%; + right: auto; + } + .col-sm-pull-0 { + left: auto; + right: auto; + } + .col-sm-push-12 { + right: 100%; + left: 0; + } + .col-sm-push-11 { + right: 91.66666667%; + left: 0; + } + .col-sm-push-10 { + right: 83.33333333%; + left: 0; + } + .col-sm-push-9 { + right: 75%; + left: 0; + } + .col-sm-push-8 { + right: 66.66666667%; + left: 0; + } + .col-sm-push-7 { + right: 58.33333333%; + left: 0; + } + .col-sm-push-6 { + right: 50%; + left: 0; + } + .col-sm-push-5 { + right: 41.66666667%; + left: 0; + } + .col-sm-push-4 { + right: 33.33333333%; + left: 0; + } + .col-sm-push-3 { + right: 25%; + left: 0; + } + .col-sm-push-2 { + right: 16.66666667%; + left: 0; + } + .col-sm-push-1 { + right: 8.33333333%; + left: 0; + } + .col-sm-push-0 { + right: auto; + left: 0; + } + .col-sm-offset-12 { + margin-right: 100%; + margin-left: 0; + } + .col-sm-offset-11 { + margin-right: 91.66666667%; + margin-left: 0; + } + .col-sm-offset-10 { + margin-right: 83.33333333%; + margin-left: 0; + } + .col-sm-offset-9 { + margin-right: 75%; + margin-left: 0; + } + .col-sm-offset-8 { + margin-right: 66.66666667%; + margin-left: 0; + } + .col-sm-offset-7 { + margin-right: 58.33333333%; + margin-left: 0; + } + .col-sm-offset-6 { + margin-right: 50%; + margin-left: 0; + } + .col-sm-offset-5 { + margin-right: 41.66666667%; + margin-left: 0; + } + .col-sm-offset-4 { + margin-right: 33.33333333%; + margin-left: 0; + } + .col-sm-offset-3 { + margin-right: 25%; + margin-left: 0; + } + .col-sm-offset-2 { + margin-right: 16.66666667%; + margin-left: 0; + } + .col-sm-offset-1 { + margin-right: 8.33333333%; + margin-left: 0; + } + .col-sm-offset-0 { + margin-right: 0%; + margin-left: 0; + } +} +@media (min-width: 992px) { + .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { + float: right; + } + .col-md-12 { + width: 100%; + } + .col-md-11 { + width: 91.66666667%; + } + .col-md-10 { + width: 83.33333333%; + } + .col-md-9 { + width: 75%; + } + .col-md-8 { + width: 66.66666667%; + } + .col-md-7 { + width: 58.33333333%; + } + .col-md-6 { + width: 50%; + } + .col-md-5 { + width: 41.66666667%; + } + .col-md-4 { + width: 33.33333333%; + } + .col-md-3 { + width: 25%; + } + .col-md-2 { + width: 16.66666667%; + } + .col-md-1 { + width: 8.33333333%; + } + .col-md-pull-12 { + left: 100%; + right: auto; + } + .col-md-pull-11 { + left: 91.66666667%; + right: auto; + } + .col-md-pull-10 { + left: 83.33333333%; + right: auto; + } + .col-md-pull-9 { + left: 75%; + right: auto; + } + .col-md-pull-8 { + left: 66.66666667%; + right: auto; + } + .col-md-pull-7 { + left: 58.33333333%; + right: auto; + } + .col-md-pull-6 { + left: 50%; + right: auto; + } + .col-md-pull-5 { + left: 41.66666667%; + right: auto; + } + .col-md-pull-4 { + left: 33.33333333%; + right: auto; + } + .col-md-pull-3 { + left: 25%; + right: auto; + } + .col-md-pull-2 { + left: 16.66666667%; + right: auto; + } + .col-md-pull-1 { + left: 8.33333333%; + right: auto; + } + .col-md-pull-0 { + left: auto; + right: auto; + } + .col-md-push-12 { + right: 100%; + left: 0; + } + .col-md-push-11 { + right: 91.66666667%; + left: 0; + } + .col-md-push-10 { + right: 83.33333333%; + left: 0; + } + .col-md-push-9 { + right: 75%; + left: 0; + } + .col-md-push-8 { + right: 66.66666667%; + left: 0; + } + .col-md-push-7 { + right: 58.33333333%; + left: 0; + } + .col-md-push-6 { + right: 50%; + left: 0; + } + .col-md-push-5 { + right: 41.66666667%; + left: 0; + } + .col-md-push-4 { + right: 33.33333333%; + left: 0; + } + .col-md-push-3 { + right: 25%; + left: 0; + } + .col-md-push-2 { + right: 16.66666667%; + left: 0; + } + .col-md-push-1 { + right: 8.33333333%; + left: 0; + } + .col-md-push-0 { + right: auto; + left: 0; + } + .col-md-offset-12 { + margin-right: 100%; + margin-left: 0; + } + .col-md-offset-11 { + margin-right: 91.66666667%; + margin-left: 0; + } + .col-md-offset-10 { + margin-right: 83.33333333%; + margin-left: 0; + } + .col-md-offset-9 { + margin-right: 75%; + margin-left: 0; + } + .col-md-offset-8 { + margin-right: 66.66666667%; + margin-left: 0; + } + .col-md-offset-7 { + margin-right: 58.33333333%; + margin-left: 0; + } + .col-md-offset-6 { + margin-right: 50%; + margin-left: 0; + } + .col-md-offset-5 { + margin-right: 41.66666667%; + margin-left: 0; + } + .col-md-offset-4 { + margin-right: 33.33333333%; + margin-left: 0; + } + .col-md-offset-3 { + margin-right: 25%; + margin-left: 0; + } + .col-md-offset-2 { + margin-right: 16.66666667%; + margin-left: 0; + } + .col-md-offset-1 { + margin-right: 8.33333333%; + margin-left: 0; + } + .col-md-offset-0 { + margin-right: 0%; + margin-left: 0; + } +} +@media (min-width: 1200px) { + .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { + float: right; + } + .col-lg-12 { + width: 100%; + } + .col-lg-11 { + width: 91.66666667%; + } + .col-lg-10 { + width: 83.33333333%; + } + .col-lg-9 { + width: 75%; + } + .col-lg-8 { + width: 66.66666667%; + } + .col-lg-7 { + width: 58.33333333%; + } + .col-lg-6 { + width: 50%; + } + .col-lg-5 { + width: 41.66666667%; + } + .col-lg-4 { + width: 33.33333333%; + } + .col-lg-3 { + width: 25%; + } + .col-lg-2 { + width: 16.66666667%; + } + .col-lg-1 { + width: 8.33333333%; + } + .col-lg-pull-12 { + left: 100%; + right: auto; + } + .col-lg-pull-11 { + left: 91.66666667%; + right: auto; + } + .col-lg-pull-10 { + left: 83.33333333%; + right: auto; + } + .col-lg-pull-9 { + left: 75%; + right: auto; + } + .col-lg-pull-8 { + left: 66.66666667%; + right: auto; + } + .col-lg-pull-7 { + left: 58.33333333%; + right: auto; + } + .col-lg-pull-6 { + left: 50%; + right: auto; + } + .col-lg-pull-5 { + left: 41.66666667%; + right: auto; + } + .col-lg-pull-4 { + left: 33.33333333%; + right: auto; + } + .col-lg-pull-3 { + left: 25%; + right: auto; + } + .col-lg-pull-2 { + left: 16.66666667%; + right: auto; + } + .col-lg-pull-1 { + left: 8.33333333%; + right: auto; + } + .col-lg-pull-0 { + left: auto; + right: auto; + } + .col-lg-push-12 { + right: 100%; + left: 0; + } + .col-lg-push-11 { + right: 91.66666667%; + left: 0; + } + .col-lg-push-10 { + right: 83.33333333%; + left: 0; + } + .col-lg-push-9 { + right: 75%; + left: 0; + } + .col-lg-push-8 { + right: 66.66666667%; + left: 0; + } + .col-lg-push-7 { + right: 58.33333333%; + left: 0; + } + .col-lg-push-6 { + right: 50%; + left: 0; + } + .col-lg-push-5 { + right: 41.66666667%; + left: 0; + } + .col-lg-push-4 { + right: 33.33333333%; + left: 0; + } + .col-lg-push-3 { + right: 25%; + left: 0; + } + .col-lg-push-2 { + right: 16.66666667%; + left: 0; + } + .col-lg-push-1 { + right: 8.33333333%; + left: 0; + } + .col-lg-push-0 { + right: auto; + left: 0; + } + .col-lg-offset-12 { + margin-right: 100%; + margin-left: 0; + } + .col-lg-offset-11 { + margin-right: 91.66666667%; + margin-left: 0; + } + .col-lg-offset-10 { + margin-right: 83.33333333%; + margin-left: 0; + } + .col-lg-offset-9 { + margin-right: 75%; + margin-left: 0; + } + .col-lg-offset-8 { + margin-right: 66.66666667%; + margin-left: 0; + } + .col-lg-offset-7 { + margin-right: 58.33333333%; + margin-left: 0; + } + .col-lg-offset-6 { + margin-right: 50%; + margin-left: 0; + } + .col-lg-offset-5 { + margin-right: 41.66666667%; + margin-left: 0; + } + .col-lg-offset-4 { + margin-right: 33.33333333%; + margin-left: 0; + } + .col-lg-offset-3 { + margin-right: 25%; + margin-left: 0; + } + .col-lg-offset-2 { + margin-right: 16.66666667%; + margin-left: 0; + } + .col-lg-offset-1 { + margin-right: 8.33333333%; + margin-left: 0; + } + .col-lg-offset-0 { + margin-right: 0%; + margin-left: 0; + } +} +caption { + text-align: right; +} +th { + text-align: right; +} +@media screen and (max-width: 767px) { + .table-responsive > .table-bordered { + border: 0; + } + .table-responsive > .table-bordered > thead > tr > th:first-child, + .table-responsive > .table-bordered > tbody > tr > th:first-child, + .table-responsive > .table-bordered > tfoot > tr > th:first-child, + .table-responsive > .table-bordered > thead > tr > td:first-child, + .table-responsive > .table-bordered > tbody > tr > td:first-child, + .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-right: 0; + border-left: initial; + } + .table-responsive > .table-bordered > thead > tr > th:last-child, + .table-responsive > .table-bordered > tbody > tr > th:last-child, + .table-responsive > .table-bordered > tfoot > tr > th:last-child, + .table-responsive > .table-bordered > thead > tr > td:last-child, + .table-responsive > .table-bordered > tbody > tr > td:last-child, + .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-left: 0; + border-right: initial; + } +} +.radio label, +.checkbox label { + padding-right: 20px; + padding-left: initial; +} +.radio input[type="radio"], +.radio-inline input[type="radio"], +.checkbox input[type="checkbox"], +.checkbox-inline input[type="checkbox"] { + margin-right: -20px; + margin-left: auto; +} +.radio-inline, +.checkbox-inline { + padding-right: 20px; + padding-left: 0; +} +.radio-inline + .radio-inline, +.checkbox-inline + .checkbox-inline { + margin-right: 10px; + margin-left: 0; +} +.has-feedback .form-control { + padding-left: 42.5px; + padding-right: 12px; +} +.form-control-feedback { + left: 0; + right: auto; +} +@media (min-width: 768px) { + .form-inline label { + padding-right: 0; + padding-left: initial; + } + .form-inline .radio input[type="radio"], + .form-inline .checkbox input[type="checkbox"] { + margin-right: 0; + margin-left: auto; + } +} +@media (min-width: 768px) { + .form-horizontal .control-label { + text-align: left; + } +} +.form-horizontal .has-feedback .form-control-feedback { + left: 15px; + right: auto; +} +.caret { + margin-right: 2px; + margin-left: 0; +} +.dropdown-menu { + right: 0; + left: auto; + float: left; + text-align: right; +} +.dropdown-menu.pull-right { + left: 0; + right: auto; + float: right; +} +.dropdown-menu-right { + left: auto; + right: 0; +} +.dropdown-menu-left { + left: 0; + right: auto; +} +@media (min-width: 768px) { + .navbar-right .dropdown-menu { + left: auto; + right: 0; + } + .navbar-right .dropdown-menu-left { + left: 0; + right: auto; + } +} +.btn-group > .btn, +.btn-group-vertical > .btn { + float: right; +} +.btn-group .btn + .btn, +.btn-group .btn + .btn-group, +.btn-group .btn-group + .btn, +.btn-group .btn-group + .btn-group { + margin-right: -1px; + margin-left: 0px; +} +.btn-toolbar { + margin-right: -5px; + margin-left: 0px; +} +.btn-toolbar .btn-group, +.btn-toolbar .input-group { + float: right; +} +.btn-toolbar > .btn, +.btn-toolbar > .btn-group, +.btn-toolbar > .input-group { + margin-right: 5px; + margin-left: 0px; +} +.btn-group > .btn:first-child { + margin-right: 0; +} +.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.btn-group > .btn:last-child:not(:first-child), +.btn-group > .dropdown-toggle:not(:first-child) { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.btn-group > .btn-group { + float: right; +} +.btn-group.btn-group-justified > .btn, +.btn-group.btn-group-justified > .btn-group { + float: none; +} +.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group > .btn-group:first-child > .btn:last-child, +.btn-group > .btn-group:first-child > .dropdown-toggle { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.btn-group > .btn-group:last-child > .btn:first-child { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.btn .caret { + margin-right: 0; +} +.btn-group-vertical > .btn + .btn, +.btn-group-vertical > .btn + .btn-group, +.btn-group-vertical > .btn-group + .btn, +.btn-group-vertical > .btn-group + .btn-group { + margin-top: -1px; + margin-right: 0; +} +.input-group .form-control { + float: right; +} +.input-group .form-control:first-child, +.input-group-addon:first-child, +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group > .btn, +.input-group-btn:first-child > .dropdown-toggle, +.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), +.input-group-btn:last-child > .btn-group:not(:last-child) > .btn { + border-bottom-right-radius: 4px; + border-top-right-radius: 4px; + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.input-group-addon:first-child { + border-right-width: 1px; + border-right-style: solid; + border-left: 0px; +} +.input-group .form-control:last-child, +.input-group-addon:last-child, +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group > .btn, +.input-group-btn:last-child > .dropdown-toggle, +.input-group-btn:first-child > .btn:not(:first-child), +.input-group-btn:first-child > .btn-group:not(:first-child) > .btn { + border-bottom-left-radius: 4px; + border-top-left-radius: 4px; + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.input-group-addon:last-child { + border-left-width: 1px; + border-left-style: solid; + border-right: 0px; +} +.input-group-btn > .btn + .btn { + margin-right: -1px; + margin-left: auto; +} +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group { + margin-left: -1px; + margin-right: auto; +} +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group { + margin-right: -1px; + margin-left: auto; +} +.nav { + padding-right: 0; + padding-left: initial; +} +.nav-tabs > li { + float: right; +} +.nav-tabs > li > a { + margin-left: auto; + margin-right: -2px; + border-radius: 4px 4px 0 0; +} +.nav-pills > li { + float: right; +} +.nav-pills > li > a { + border-radius: 4px; +} +.nav-pills > li + li { + margin-right: 2px; + margin-left: auto; +} +.nav-stacked > li { + float: none; +} +.nav-stacked > li + li { + margin-right: 0; + margin-left: auto; +} +.nav-justified > .dropdown .dropdown-menu { + right: auto; +} +.nav-tabs-justified > li > a { + margin-left: 0; + margin-right: auto; +} +@media (min-width: 768px) { + .nav-tabs-justified > li > a { + border-radius: 4px 4px 0 0; + } +} +@media (min-width: 768px) { + .navbar-header { + float: right; + } +} +.navbar-collapse { + padding-right: 15px; + padding-left: 15px; +} +.navbar-brand { + float: right; +} +@media (min-width: 768px) { + .navbar > .container .navbar-brand, + .navbar > .container-fluid .navbar-brand { + margin-right: -15px; + margin-left: auto; + } +} +.navbar-toggle { + float: left; + margin-left: 15px; + margin-right: auto; +} +@media (max-width: 767px) { + .navbar-nav .open .dropdown-menu > li > a, + .navbar-nav .open .dropdown-menu .dropdown-header { + padding: 5px 25px 5px 15px; + } +} +@media (min-width: 768px) { + .navbar-nav { + float: right; + } + .navbar-nav > li { + float: right; + } +} +@media (min-width: 768px) { + .navbar-left.flip { + float: right !important; + } + .navbar-right:last-child { + margin-left: -15px; + margin-right: auto; + } + .navbar-right.flip { + float: left !important; + margin-left: -15px; + margin-right: auto; + } + .navbar-right .dropdown-menu { + left: 0; + right: auto; + } +} +@media (min-width: 768px) { + .navbar-text { + float: right; + } + .navbar-text.navbar-right:last-child { + margin-left: 0; + margin-right: auto; + } +} +.pagination { + padding-right: 0; +} +.pagination > li > a, +.pagination > li > span { + float: right; + margin-right: -1px; + margin-left: 0px; +} +.pagination > li:first-child > a, +.pagination > li:first-child > span { + margin-left: 0; + border-bottom-right-radius: 4px; + border-top-right-radius: 4px; + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.pagination > li:last-child > a, +.pagination > li:last-child > span { + margin-right: -1px; + border-bottom-left-radius: 4px; + border-top-left-radius: 4px; + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.pager { + padding-right: 0; + padding-left: initial; +} +.pager .next > a, +.pager .next > span { + float: left; +} +.pager .previous > a, +.pager .previous > span { + float: right; +} +.nav-pills > li > a > .badge { + margin-left: 0px; + margin-right: 3px; +} +.list-group-item > .badge { + float: left; +} +.list-group-item > .badge + .badge { + margin-left: 5px; + margin-right: auto; +} +.alert-dismissable, +.alert-dismissible { + padding-left: 35px; + padding-right: 15px; +} +.alert-dismissable .close, +.alert-dismissible .close { + right: auto; + left: -21px; +} +.progress-bar { + float: right; +} +.media > .pull-left { + margin-right: 10px; +} +.media > .pull-left.flip { + margin-right: 0; + margin-left: 10px; +} +.media > .pull-right { + margin-left: 10px; +} +.media > .pull-right.flip { + margin-left: 0; + margin-right: 10px; +} +.media-right, +.media > .pull-right { + padding-right: 10px; + padding-left: initial; +} +.media-left, +.media > .pull-left { + padding-left: 10px; + padding-right: initial; +} +.media-list { + padding-right: 0; + padding-left: initial; + list-style: none; +} +.list-group { + padding-right: 0; + padding-left: initial; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { + border-top-right-radius: 3px; + border-top-left-radius: 0; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { + border-top-left-radius: 3px; + border-top-right-radius: 0; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { + border-bottom-left-radius: 3px; + border-top-right-radius: 0; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { + border-bottom-right-radius: 3px; + border-top-left-radius: 0; +} +.panel > .table-bordered > thead > tr > th:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:first-child, +.panel > .table-bordered > tbody > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, +.panel > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-bordered > thead > tr > td:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:first-child, +.panel > .table-bordered > tbody > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, +.panel > .table-bordered > tfoot > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-right: 0; + border-left: none; +} +.panel > .table-bordered > thead > tr > th:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:last-child, +.panel > .table-bordered > tbody > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, +.panel > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-bordered > thead > tr > td:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:last-child, +.panel > .table-bordered > tbody > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, +.panel > .table-bordered > tfoot > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: none; + border-left: 0; +} +.embed-responsive .embed-responsive-item, +.embed-responsive iframe, +.embed-responsive embed, +.embed-responsive object { + right: 0; + left: auto; +} +.close { + float: left; +} +.modal-footer { + text-align: left; +} +.modal-footer .btn + .btn { + margin-left: auto; + margin-right: 5px; +} +.modal-footer .btn-group .btn + .btn { + margin-right: -1px; + margin-left: auto; +} +.modal-footer .btn-block + .btn-block { + margin-right: 0; + margin-left: auto; +} +.popover { + left: auto; + text-align: right; +} +.popover.top > .arrow { + right: 50%; + left: auto; + margin-right: -11px; + margin-left: auto; +} +.popover.top > .arrow:after { + margin-right: -10px; + margin-left: auto; +} +.popover.bottom > .arrow { + right: 50%; + left: auto; + margin-right: -11px; + margin-left: auto; +} +.popover.bottom > .arrow:after { + margin-right: -10px; + margin-left: auto; +} +.carousel-control { + right: 0; + bottom: 0; +} +.carousel-control.left { + right: auto; + left: 0; + background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, 0.5) 0%), color-stop(rgba(0, 0, 0, 0.0001) 100%)); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); + background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); +} +.carousel-control.right { + left: auto; + right: 0; + background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, 0.0001) 0%), color-stop(rgba(0, 0, 0, 0.5) 100%)); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); + background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); +} +.carousel-control .icon-prev, +.carousel-control .glyphicon-chevron-left { + left: 50%; + right: auto; + margin-right: -10px; +} +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-right { + right: 50%; + left: auto; + margin-left: -10px; +} +.carousel-indicators { + right: 50%; + left: 0; + margin-right: -30%; + margin-left: 0; + padding-left: 0; +} +@media screen and (min-width: 768px) { + .carousel-control .glyphicon-chevron-left, + .carousel-control .icon-prev { + margin-left: 0; + margin-right: -15px; + } + .carousel-control .glyphicon-chevron-right, + .carousel-control .icon-next { + margin-left: 0; + margin-right: -15px; + } + .carousel-caption { + left: 20%; + right: 20%; + padding-bottom: 30px; + } +} +.pull-right.flip { + float: left !important; +} +.pull-left.flip { + float: right !important; +} +/*# sourceMappingURL=bootstrap-rtl.css.map */ diff --git a/user/guns-admin/src/main/webapp/static/css/bootstrap.min.css b/user/guns-admin/src/main/webapp/static/css/bootstrap.min.css new file mode 100644 index 0000000..f7bca0a --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/bootstrap.min.css @@ -0,0 +1,6 @@ +/*! + * Bootstrap v3.3.6 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control::-ms-expand{background-color:transparent;border:0}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled.focus,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled].focus,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled.focus,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled].focus,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled.focus,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled].focus,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled.focus,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled].focus,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled.focus,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled].focus,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{padding-right:15px;padding-left:15px;border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;filter:alpha(opacity=0);opacity:0;line-break:auto}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);background-color:rgba(0,0,0,0);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.modal-header:after,.modal-header:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.modal-header:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} +/*# sourceMappingURL=bootstrap.min.css.map */ diff --git a/user/guns-admin/src/main/webapp/static/css/font-awesome.css b/user/guns-admin/src/main/webapp/static/css/font-awesome.css new file mode 100644 index 0000000..880eb82 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/font-awesome.css @@ -0,0 +1,2026 @@ +/*! + * Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ +/* FONT PATH + * -------------------------- */ +@font-face { + font-family: 'FontAwesome'; + src: url('../fonts/fontawesome-webfont.eot?v=4.4.0'); + src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.4.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.4.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.4.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.4.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.4.0#fontawesomeregular') format('svg'); + font-weight: normal; + font-style: normal; +} +.fa { + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +/* makes the font 33% larger relative to the icon container */ +.fa-lg { + font-size: 1.33333333em; + line-height: 0.75em; + vertical-align: -15%; +} +.fa-2x { + font-size: 2em; +} +.fa-3x { + font-size: 3em; +} +.fa-4x { + font-size: 4em; +} +.fa-5x { + font-size: 5em; +} +.fa-fw { + width: 1.28571429em; + text-align: center; +} +.fa-ul { + padding-left: 0; + margin-left: 2.14285714em; + list-style-type: none; +} +.fa-ul > li { + position: relative; +} +.fa-li { + position: absolute; + left: -2.14285714em; + width: 2.14285714em; + top: 0.14285714em; + text-align: center; +} +.fa-li.fa-lg { + left: -1.85714286em; +} +.fa-border { + padding: .2em .25em .15em; + border: solid 0.08em #eeeeee; + border-radius: .1em; +} +.fa-pull-left { + float: left; +} +.fa-pull-right { + float: right; +} +.fa.fa-pull-left { + margin-right: .3em; +} +.fa.fa-pull-right { + margin-left: .3em; +} +/* Deprecated as of 4.4.0 */ +.pull-right { + float: right; +} +.pull-left { + float: left; +} +.fa.pull-left { + margin-right: .3em; +} +.fa.pull-right { + margin-left: .3em; +} +.fa-spin { + -webkit-animation: fa-spin 2s infinite linear; + animation: fa-spin 2s infinite linear; +} +.fa-pulse { + -webkit-animation: fa-spin 1s infinite steps(8); + animation: fa-spin 1s infinite steps(8); +} +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +.fa-rotate-90 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} +.fa-rotate-180 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} +.fa-rotate-270 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); + -webkit-transform: rotate(270deg); + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} +.fa-flip-horizontal { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1); + -webkit-transform: scale(-1, 1); + -ms-transform: scale(-1, 1); + transform: scale(-1, 1); +} +.fa-flip-vertical { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1); + -webkit-transform: scale(1, -1); + -ms-transform: scale(1, -1); + transform: scale(1, -1); +} +:root .fa-rotate-90, +:root .fa-rotate-180, +:root .fa-rotate-270, +:root .fa-flip-horizontal, +:root .fa-flip-vertical { + filter: none; +} +.fa-stack { + position: relative; + display: inline-block; + width: 2em; + height: 2em; + line-height: 2em; + vertical-align: middle; +} +.fa-stack-1x, +.fa-stack-2x { + position: absolute; + left: 0; + width: 100%; + text-align: center; +} +.fa-stack-1x { + line-height: inherit; +} +.fa-stack-2x { + font-size: 2em; +} +.fa-inverse { + color: #ffffff; +} +/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen + readers do not read off random characters that represent icons */ +.fa-glass:before { + content: "\f000"; +} +.fa-music:before { + content: "\f001"; +} +.fa-search:before { + content: "\f002"; +} +.fa-envelope-o:before { + content: "\f003"; +} +.fa-heart:before { + content: "\f004"; +} +.fa-star:before { + content: "\f005"; +} +.fa-star-o:before { + content: "\f006"; +} +.fa-user:before { + content: "\f007"; +} +.fa-film:before { + content: "\f008"; +} +.fa-th-large:before { + content: "\f009"; +} +.fa-th:before { + content: "\f00a"; +} +.fa-th-list:before { + content: "\f00b"; +} +.fa-check:before { + content: "\f00c"; +} +.fa-remove:before, +.fa-close:before, +.fa-times:before { + content: "\f00d"; +} +.fa-search-plus:before { + content: "\f00e"; +} +.fa-search-minus:before { + content: "\f010"; +} +.fa-power-off:before { + content: "\f011"; +} +.fa-signal:before { + content: "\f012"; +} +.fa-gear:before, +.fa-cog:before { + content: "\f013"; +} +.fa-trash-o:before { + content: "\f014"; +} +.fa-home:before { + content: "\f015"; +} +.fa-file-o:before { + content: "\f016"; +} +.fa-clock-o:before { + content: "\f017"; +} +.fa-road:before { + content: "\f018"; +} +.fa-download:before { + content: "\f019"; +} +.fa-arrow-circle-o-down:before { + content: "\f01a"; +} +.fa-arrow-circle-o-up:before { + content: "\f01b"; +} +.fa-inbox:before { + content: "\f01c"; +} +.fa-play-circle-o:before { + content: "\f01d"; +} +.fa-rotate-right:before, +.fa-repeat:before { + content: "\f01e"; +} +.fa-refresh:before { + content: "\f021"; +} +.fa-list-alt:before { + content: "\f022"; +} +.fa-lock:before { + content: "\f023"; +} +.fa-flag:before { + content: "\f024"; +} +.fa-headphones:before { + content: "\f025"; +} +.fa-volume-off:before { + content: "\f026"; +} +.fa-volume-down:before { + content: "\f027"; +} +.fa-volume-up:before { + content: "\f028"; +} +.fa-qrcode:before { + content: "\f029"; +} +.fa-barcode:before { + content: "\f02a"; +} +.fa-tag:before { + content: "\f02b"; +} +.fa-tags:before { + content: "\f02c"; +} +.fa-book:before { + content: "\f02d"; +} +.fa-bookmark:before { + content: "\f02e"; +} +.fa-print:before { + content: "\f02f"; +} +.fa-camera:before { + content: "\f030"; +} +.fa-font:before { + content: "\f031"; +} +.fa-bold:before { + content: "\f032"; +} +.fa-italic:before { + content: "\f033"; +} +.fa-text-height:before { + content: "\f034"; +} +.fa-text-width:before { + content: "\f035"; +} +.fa-align-left:before { + content: "\f036"; +} +.fa-align-center:before { + content: "\f037"; +} +.fa-align-right:before { + content: "\f038"; +} +.fa-align-justify:before { + content: "\f039"; +} +.fa-list:before { + content: "\f03a"; +} +.fa-dedent:before, +.fa-outdent:before { + content: "\f03b"; +} +.fa-indent:before { + content: "\f03c"; +} +.fa-video-camera:before { + content: "\f03d"; +} +.fa-photo:before, +.fa-image:before, +.fa-picture-o:before { + content: "\f03e"; +} +.fa-pencil:before { + content: "\f040"; +} +.fa-map-marker:before { + content: "\f041"; +} +.fa-adjust:before { + content: "\f042"; +} +.fa-tint:before { + content: "\f043"; +} +.fa-edit:before, +.fa-pencil-square-o:before { + content: "\f044"; +} +.fa-share-square-o:before { + content: "\f045"; +} +.fa-check-square-o:before { + content: "\f046"; +} +.fa-arrows:before { + content: "\f047"; +} +.fa-step-backward:before { + content: "\f048"; +} +.fa-fast-backward:before { + content: "\f049"; +} +.fa-backward:before { + content: "\f04a"; +} +.fa-play:before { + content: "\f04b"; +} +.fa-pause:before { + content: "\f04c"; +} +.fa-stop:before { + content: "\f04d"; +} +.fa-forward:before { + content: "\f04e"; +} +.fa-fast-forward:before { + content: "\f050"; +} +.fa-step-forward:before { + content: "\f051"; +} +.fa-eject:before { + content: "\f052"; +} +.fa-chevron-left:before { + content: "\f053"; +} +.fa-chevron-right:before { + content: "\f054"; +} +.fa-plus-circle:before { + content: "\f055"; +} +.fa-minus-circle:before { + content: "\f056"; +} +.fa-times-circle:before { + content: "\f057"; +} +.fa-check-circle:before { + content: "\f058"; +} +.fa-question-circle:before { + content: "\f059"; +} +.fa-info-circle:before { + content: "\f05a"; +} +.fa-crosshairs:before { + content: "\f05b"; +} +.fa-times-circle-o:before { + content: "\f05c"; +} +.fa-check-circle-o:before { + content: "\f05d"; +} +.fa-ban:before { + content: "\f05e"; +} +.fa-arrow-left:before { + content: "\f060"; +} +.fa-arrow-right:before { + content: "\f061"; +} +.fa-arrow-up:before { + content: "\f062"; +} +.fa-arrow-down:before { + content: "\f063"; +} +.fa-mail-forward:before, +.fa-share:before { + content: "\f064"; +} +.fa-expand:before { + content: "\f065"; +} +.fa-compress:before { + content: "\f066"; +} +.fa-plus:before { + content: "\f067"; +} +.fa-minus:before { + content: "\f068"; +} +.fa-asterisk:before { + content: "\f069"; +} +.fa-exclamation-circle:before { + content: "\f06a"; +} +.fa-gift:before { + content: "\f06b"; +} +.fa-leaf:before { + content: "\f06c"; +} +.fa-fire:before { + content: "\f06d"; +} +.fa-eye:before { + content: "\f06e"; +} +.fa-eye-slash:before { + content: "\f070"; +} +.fa-warning:before, +.fa-exclamation-triangle:before { + content: "\f071"; +} +.fa-plane:before { + content: "\f072"; +} +.fa-calendar:before { + content: "\f073"; +} +.fa-random:before { + content: "\f074"; +} +.fa-comment:before { + content: "\f075"; +} +.fa-magnet:before { + content: "\f076"; +} +.fa-chevron-up:before { + content: "\f077"; +} +.fa-chevron-down:before { + content: "\f078"; +} +.fa-retweet:before { + content: "\f079"; +} +.fa-shopping-cart:before { + content: "\f07a"; +} +.fa-folder:before { + content: "\f07b"; +} +.fa-folder-open:before { + content: "\f07c"; +} +.fa-arrows-v:before { + content: "\f07d"; +} +.fa-arrows-h:before { + content: "\f07e"; +} +.fa-bar-chart-o:before, +.fa-bar-chart:before { + content: "\f080"; +} +.fa-twitter-square:before { + content: "\f081"; +} +.fa-facebook-square:before { + content: "\f082"; +} +.fa-camera-retro:before { + content: "\f083"; +} +.fa-key:before { + content: "\f084"; +} +.fa-gears:before, +.fa-cogs:before { + content: "\f085"; +} +.fa-comments:before { + content: "\f086"; +} +.fa-thumbs-o-up:before { + content: "\f087"; +} +.fa-thumbs-o-down:before { + content: "\f088"; +} +.fa-star-half:before { + content: "\f089"; +} +.fa-heart-o:before { + content: "\f08a"; +} +.fa-sign-out:before { + content: "\f08b"; +} +.fa-linkedin-square:before { + content: "\f08c"; +} +.fa-thumb-tack:before { + content: "\f08d"; +} +.fa-external-link:before { + content: "\f08e"; +} +.fa-sign-in:before { + content: "\f090"; +} +.fa-trophy:before { + content: "\f091"; +} +.fa-github-square:before { + content: "\f092"; +} +.fa-upload:before { + content: "\f093"; +} +.fa-lemon-o:before { + content: "\f094"; +} +.fa-phone:before { + content: "\f095"; +} +.fa-square-o:before { + content: "\f096"; +} +.fa-bookmark-o:before { + content: "\f097"; +} +.fa-phone-square:before { + content: "\f098"; +} +.fa-twitter:before { + content: "\f099"; +} +.fa-facebook-f:before, +.fa-facebook:before { + content: "\f09a"; +} +.fa-github:before { + content: "\f09b"; +} +.fa-unlock:before { + content: "\f09c"; +} +.fa-credit-card:before { + content: "\f09d"; +} +.fa-feed:before, +.fa-rss:before { + content: "\f09e"; +} +.fa-hdd-o:before { + content: "\f0a0"; +} +.fa-bullhorn:before { + content: "\f0a1"; +} +.fa-bell:before { + content: "\f0f3"; +} +.fa-certificate:before { + content: "\f0a3"; +} +.fa-hand-o-right:before { + content: "\f0a4"; +} +.fa-hand-o-left:before { + content: "\f0a5"; +} +.fa-hand-o-up:before { + content: "\f0a6"; +} +.fa-hand-o-down:before { + content: "\f0a7"; +} +.fa-arrow-circle-left:before { + content: "\f0a8"; +} +.fa-arrow-circle-right:before { + content: "\f0a9"; +} +.fa-arrow-circle-up:before { + content: "\f0aa"; +} +.fa-arrow-circle-down:before { + content: "\f0ab"; +} +.fa-globe:before { + content: "\f0ac"; +} +.fa-wrench:before { + content: "\f0ad"; +} +.fa-tasks:before { + content: "\f0ae"; +} +.fa-filter:before { + content: "\f0b0"; +} +.fa-briefcase:before { + content: "\f0b1"; +} +.fa-arrows-alt:before { + content: "\f0b2"; +} +.fa-group:before, +.fa-users:before { + content: "\f0c0"; +} +.fa-chain:before, +.fa-link:before { + content: "\f0c1"; +} +.fa-cloud:before { + content: "\f0c2"; +} +.fa-flask:before { + content: "\f0c3"; +} +.fa-cut:before, +.fa-scissors:before { + content: "\f0c4"; +} +.fa-copy:before, +.fa-files-o:before { + content: "\f0c5"; +} +.fa-paperclip:before { + content: "\f0c6"; +} +.fa-save:before, +.fa-floppy-o:before { + content: "\f0c7"; +} +.fa-square:before { + content: "\f0c8"; +} +.fa-navicon:before, +.fa-reorder:before, +.fa-bars:before { + content: "\f0c9"; +} +.fa-list-ul:before { + content: "\f0ca"; +} +.fa-list-ol:before { + content: "\f0cb"; +} +.fa-strikethrough:before { + content: "\f0cc"; +} +.fa-underline:before { + content: "\f0cd"; +} +.fa-table:before { + content: "\f0ce"; +} +.fa-magic:before { + content: "\f0d0"; +} +.fa-truck:before { + content: "\f0d1"; +} +.fa-pinterest:before { + content: "\f0d2"; +} +.fa-pinterest-square:before { + content: "\f0d3"; +} +.fa-google-plus-square:before { + content: "\f0d4"; +} +.fa-google-plus:before { + content: "\f0d5"; +} +.fa-money:before { + content: "\f0d6"; +} +.fa-caret-down:before { + content: "\f0d7"; +} +.fa-caret-up:before { + content: "\f0d8"; +} +.fa-caret-left:before { + content: "\f0d9"; +} +.fa-caret-right:before { + content: "\f0da"; +} +.fa-columns:before { + content: "\f0db"; +} +.fa-unsorted:before, +.fa-sort:before { + content: "\f0dc"; +} +.fa-sort-down:before, +.fa-sort-desc:before { + content: "\f0dd"; +} +.fa-sort-up:before, +.fa-sort-asc:before { + content: "\f0de"; +} +.fa-envelope:before { + content: "\f0e0"; +} +.fa-linkedin:before { + content: "\f0e1"; +} +.fa-rotate-left:before, +.fa-undo:before { + content: "\f0e2"; +} +.fa-legal:before, +.fa-gavel:before { + content: "\f0e3"; +} +.fa-dashboard:before, +.fa-tachometer:before { + content: "\f0e4"; +} +.fa-comment-o:before { + content: "\f0e5"; +} +.fa-comments-o:before { + content: "\f0e6"; +} +.fa-flash:before, +.fa-bolt:before { + content: "\f0e7"; +} +.fa-sitemap:before { + content: "\f0e8"; +} +.fa-umbrella:before { + content: "\f0e9"; +} +.fa-paste:before, +.fa-clipboard:before { + content: "\f0ea"; +} +.fa-lightbulb-o:before { + content: "\f0eb"; +} +.fa-exchange:before { + content: "\f0ec"; +} +.fa-cloud-download:before { + content: "\f0ed"; +} +.fa-cloud-upload:before { + content: "\f0ee"; +} +.fa-user-md:before { + content: "\f0f0"; +} +.fa-stethoscope:before { + content: "\f0f1"; +} +.fa-suitcase:before { + content: "\f0f2"; +} +.fa-bell-o:before { + content: "\f0a2"; +} +.fa-coffee:before { + content: "\f0f4"; +} +.fa-cutlery:before { + content: "\f0f5"; +} +.fa-file-text-o:before { + content: "\f0f6"; +} +.fa-building-o:before { + content: "\f0f7"; +} +.fa-hospital-o:before { + content: "\f0f8"; +} +.fa-ambulance:before { + content: "\f0f9"; +} +.fa-medkit:before { + content: "\f0fa"; +} +.fa-fighter-jet:before { + content: "\f0fb"; +} +.fa-beer:before { + content: "\f0fc"; +} +.fa-h-square:before { + content: "\f0fd"; +} +.fa-plus-square:before { + content: "\f0fe"; +} +.fa-angle-double-left:before { + content: "\f100"; +} +.fa-angle-double-right:before { + content: "\f101"; +} +.fa-angle-double-up:before { + content: "\f102"; +} +.fa-angle-double-down:before { + content: "\f103"; +} +.fa-angle-left:before { + content: "\f104"; +} +.fa-angle-right:before { + content: "\f105"; +} +.fa-angle-up:before { + content: "\f106"; +} +.fa-angle-down:before { + content: "\f107"; +} +.fa-desktop:before { + content: "\f108"; +} +.fa-laptop:before { + content: "\f109"; +} +.fa-tablet:before { + content: "\f10a"; +} +.fa-mobile-phone:before, +.fa-mobile:before { + content: "\f10b"; +} +.fa-circle-o:before { + content: "\f10c"; +} +.fa-quote-left:before { + content: "\f10d"; +} +.fa-quote-right:before { + content: "\f10e"; +} +.fa-spinner:before { + content: "\f110"; +} +.fa-circle:before { + content: "\f111"; +} +.fa-mail-reply:before, +.fa-reply:before { + content: "\f112"; +} +.fa-github-alt:before { + content: "\f113"; +} +.fa-folder-o:before { + content: "\f114"; +} +.fa-folder-open-o:before { + content: "\f115"; +} +.fa-smile-o:before { + content: "\f118"; +} +.fa-frown-o:before { + content: "\f119"; +} +.fa-meh-o:before { + content: "\f11a"; +} +.fa-gamepad:before { + content: "\f11b"; +} +.fa-keyboard-o:before { + content: "\f11c"; +} +.fa-flag-o:before { + content: "\f11d"; +} +.fa-flag-checkered:before { + content: "\f11e"; +} +.fa-terminal:before { + content: "\f120"; +} +.fa-code:before { + content: "\f121"; +} +.fa-mail-reply-all:before, +.fa-reply-all:before { + content: "\f122"; +} +.fa-star-half-empty:before, +.fa-star-half-full:before, +.fa-star-half-o:before { + content: "\f123"; +} +.fa-location-arrow:before { + content: "\f124"; +} +.fa-crop:before { + content: "\f125"; +} +.fa-code-fork:before { + content: "\f126"; +} +.fa-unlink:before, +.fa-chain-broken:before { + content: "\f127"; +} +.fa-question:before { + content: "\f128"; +} +.fa-info:before { + content: "\f129"; +} +.fa-exclamation:before { + content: "\f12a"; +} +.fa-superscript:before { + content: "\f12b"; +} +.fa-subscript:before { + content: "\f12c"; +} +.fa-eraser:before { + content: "\f12d"; +} +.fa-puzzle-piece:before { + content: "\f12e"; +} +.fa-microphone:before { + content: "\f130"; +} +.fa-microphone-slash:before { + content: "\f131"; +} +.fa-shield:before { + content: "\f132"; +} +.fa-calendar-o:before { + content: "\f133"; +} +.fa-fire-extinguisher:before { + content: "\f134"; +} +.fa-rocket:before { + content: "\f135"; +} +.fa-maxcdn:before { + content: "\f136"; +} +.fa-chevron-circle-left:before { + content: "\f137"; +} +.fa-chevron-circle-right:before { + content: "\f138"; +} +.fa-chevron-circle-up:before { + content: "\f139"; +} +.fa-chevron-circle-down:before { + content: "\f13a"; +} +.fa-html5:before { + content: "\f13b"; +} +.fa-css3:before { + content: "\f13c"; +} +.fa-anchor:before { + content: "\f13d"; +} +.fa-unlock-alt:before { + content: "\f13e"; +} +.fa-bullseye:before { + content: "\f140"; +} +.fa-ellipsis-h:before { + content: "\f141"; +} +.fa-ellipsis-v:before { + content: "\f142"; +} +.fa-rss-square:before { + content: "\f143"; +} +.fa-play-circle:before { + content: "\f144"; +} +.fa-ticket:before { + content: "\f145"; +} +.fa-minus-square:before { + content: "\f146"; +} +.fa-minus-square-o:before { + content: "\f147"; +} +.fa-level-up:before { + content: "\f148"; +} +.fa-level-down:before { + content: "\f149"; +} +.fa-check-square:before { + content: "\f14a"; +} +.fa-pencil-square:before { + content: "\f14b"; +} +.fa-external-link-square:before { + content: "\f14c"; +} +.fa-share-square:before { + content: "\f14d"; +} +.fa-compass:before { + content: "\f14e"; +} +.fa-toggle-down:before, +.fa-caret-square-o-down:before { + content: "\f150"; +} +.fa-toggle-up:before, +.fa-caret-square-o-up:before { + content: "\f151"; +} +.fa-toggle-right:before, +.fa-caret-square-o-right:before { + content: "\f152"; +} +.fa-euro:before, +.fa-eur:before { + content: "\f153"; +} +.fa-gbp:before { + content: "\f154"; +} +.fa-dollar:before, +.fa-usd:before { + content: "\f155"; +} +.fa-rupee:before, +.fa-inr:before { + content: "\f156"; +} +.fa-cny:before, +.fa-rmb:before, +.fa-yen:before, +.fa-jpy:before { + content: "\f157"; +} +.fa-ruble:before, +.fa-rouble:before, +.fa-rub:before { + content: "\f158"; +} +.fa-won:before, +.fa-krw:before { + content: "\f159"; +} +.fa-bitcoin:before, +.fa-btc:before { + content: "\f15a"; +} +.fa-file:before { + content: "\f15b"; +} +.fa-file-text:before { + content: "\f15c"; +} +.fa-sort-alpha-asc:before { + content: "\f15d"; +} +.fa-sort-alpha-desc:before { + content: "\f15e"; +} +.fa-sort-amount-asc:before { + content: "\f160"; +} +.fa-sort-amount-desc:before { + content: "\f161"; +} +.fa-sort-numeric-asc:before { + content: "\f162"; +} +.fa-sort-numeric-desc:before { + content: "\f163"; +} +.fa-thumbs-up:before { + content: "\f164"; +} +.fa-thumbs-down:before { + content: "\f165"; +} +.fa-youtube-square:before { + content: "\f166"; +} +.fa-youtube:before { + content: "\f167"; +} +.fa-xing:before { + content: "\f168"; +} +.fa-xing-square:before { + content: "\f169"; +} +.fa-youtube-play:before { + content: "\f16a"; +} +.fa-dropbox:before { + content: "\f16b"; +} +.fa-stack-overflow:before { + content: "\f16c"; +} +.fa-instagram:before { + content: "\f16d"; +} +.fa-flickr:before { + content: "\f16e"; +} +.fa-adn:before { + content: "\f170"; +} +.fa-bitbucket:before { + content: "\f171"; +} +.fa-bitbucket-square:before { + content: "\f172"; +} +.fa-tumblr:before { + content: "\f173"; +} +.fa-tumblr-square:before { + content: "\f174"; +} +.fa-long-arrow-down:before { + content: "\f175"; +} +.fa-long-arrow-up:before { + content: "\f176"; +} +.fa-long-arrow-left:before { + content: "\f177"; +} +.fa-long-arrow-right:before { + content: "\f178"; +} +.fa-apple:before { + content: "\f179"; +} +.fa-windows:before { + content: "\f17a"; +} +.fa-android:before { + content: "\f17b"; +} +.fa-linux:before { + content: "\f17c"; +} +.fa-dribbble:before { + content: "\f17d"; +} +.fa-skype:before { + content: "\f17e"; +} +.fa-foursquare:before { + content: "\f180"; +} +.fa-trello:before { + content: "\f181"; +} +.fa-female:before { + content: "\f182"; +} +.fa-male:before { + content: "\f183"; +} +.fa-gittip:before, +.fa-gratipay:before { + content: "\f184"; +} +.fa-sun-o:before { + content: "\f185"; +} +.fa-moon-o:before { + content: "\f186"; +} +.fa-archive:before { + content: "\f187"; +} +.fa-bug:before { + content: "\f188"; +} +.fa-vk:before { + content: "\f189"; +} +.fa-weibo:before { + content: "\f18a"; +} +.fa-renren:before { + content: "\f18b"; +} +.fa-pagelines:before { + content: "\f18c"; +} +.fa-stack-exchange:before { + content: "\f18d"; +} +.fa-arrow-circle-o-right:before { + content: "\f18e"; +} +.fa-arrow-circle-o-left:before { + content: "\f190"; +} +.fa-toggle-left:before, +.fa-caret-square-o-left:before { + content: "\f191"; +} +.fa-dot-circle-o:before { + content: "\f192"; +} +.fa-wheelchair:before { + content: "\f193"; +} +.fa-vimeo-square:before { + content: "\f194"; +} +.fa-turkish-lira:before, +.fa-try:before { + content: "\f195"; +} +.fa-plus-square-o:before { + content: "\f196"; +} +.fa-space-shuttle:before { + content: "\f197"; +} +.fa-slack:before { + content: "\f198"; +} +.fa-envelope-square:before { + content: "\f199"; +} +.fa-wordpress:before { + content: "\f19a"; +} +.fa-openid:before { + content: "\f19b"; +} +.fa-institution:before, +.fa-bank:before, +.fa-university:before { + content: "\f19c"; +} +.fa-mortar-board:before, +.fa-graduation-cap:before { + content: "\f19d"; +} +.fa-yahoo:before { + content: "\f19e"; +} +.fa-google:before { + content: "\f1a0"; +} +.fa-reddit:before { + content: "\f1a1"; +} +.fa-reddit-square:before { + content: "\f1a2"; +} +.fa-stumbleupon-circle:before { + content: "\f1a3"; +} +.fa-stumbleupon:before { + content: "\f1a4"; +} +.fa-delicious:before { + content: "\f1a5"; +} +.fa-digg:before { + content: "\f1a6"; +} +.fa-pied-piper:before { + content: "\f1a7"; +} +.fa-pied-piper-alt:before { + content: "\f1a8"; +} +.fa-drupal:before { + content: "\f1a9"; +} +.fa-joomla:before { + content: "\f1aa"; +} +.fa-language:before { + content: "\f1ab"; +} +.fa-fax:before { + content: "\f1ac"; +} +.fa-building:before { + content: "\f1ad"; +} +.fa-child:before { + content: "\f1ae"; +} +.fa-paw:before { + content: "\f1b0"; +} +.fa-spoon:before { + content: "\f1b1"; +} +.fa-cube:before { + content: "\f1b2"; +} +.fa-cubes:before { + content: "\f1b3"; +} +.fa-behance:before { + content: "\f1b4"; +} +.fa-behance-square:before { + content: "\f1b5"; +} +.fa-steam:before { + content: "\f1b6"; +} +.fa-steam-square:before { + content: "\f1b7"; +} +.fa-recycle:before { + content: "\f1b8"; +} +.fa-automobile:before, +.fa-car:before { + content: "\f1b9"; +} +.fa-cab:before, +.fa-taxi:before { + content: "\f1ba"; +} +.fa-tree:before { + content: "\f1bb"; +} +.fa-spotify:before { + content: "\f1bc"; +} +.fa-deviantart:before { + content: "\f1bd"; +} +.fa-soundcloud:before { + content: "\f1be"; +} +.fa-database:before { + content: "\f1c0"; +} +.fa-file-pdf-o:before { + content: "\f1c1"; +} +.fa-file-word-o:before { + content: "\f1c2"; +} +.fa-file-excel-o:before { + content: "\f1c3"; +} +.fa-file-powerpoint-o:before { + content: "\f1c4"; +} +.fa-file-photo-o:before, +.fa-file-picture-o:before, +.fa-file-image-o:before { + content: "\f1c5"; +} +.fa-file-zip-o:before, +.fa-file-archive-o:before { + content: "\f1c6"; +} +.fa-file-sound-o:before, +.fa-file-audio-o:before { + content: "\f1c7"; +} +.fa-file-movie-o:before, +.fa-file-video-o:before { + content: "\f1c8"; +} +.fa-file-code-o:before { + content: "\f1c9"; +} +.fa-vine:before { + content: "\f1ca"; +} +.fa-codepen:before { + content: "\f1cb"; +} +.fa-jsfiddle:before { + content: "\f1cc"; +} +.fa-life-bouy:before, +.fa-life-buoy:before, +.fa-life-saver:before, +.fa-support:before, +.fa-life-ring:before { + content: "\f1cd"; +} +.fa-circle-o-notch:before { + content: "\f1ce"; +} +.fa-ra:before, +.fa-rebel:before { + content: "\f1d0"; +} +.fa-ge:before, +.fa-empire:before { + content: "\f1d1"; +} +.fa-git-square:before { + content: "\f1d2"; +} +.fa-git:before { + content: "\f1d3"; +} +.fa-y-combinator-square:before, +.fa-yc-square:before, +.fa-hacker-news:before { + content: "\f1d4"; +} +.fa-tencent-weibo:before { + content: "\f1d5"; +} +.fa-qq:before { + content: "\f1d6"; +} +.fa-wechat:before, +.fa-weixin:before { + content: "\f1d7"; +} +.fa-send:before, +.fa-paper-plane:before { + content: "\f1d8"; +} +.fa-send-o:before, +.fa-paper-plane-o:before { + content: "\f1d9"; +} +.fa-history:before { + content: "\f1da"; +} +.fa-circle-thin:before { + content: "\f1db"; +} +.fa-header:before { + content: "\f1dc"; +} +.fa-paragraph:before { + content: "\f1dd"; +} +.fa-sliders:before { + content: "\f1de"; +} +.fa-share-alt:before { + content: "\f1e0"; +} +.fa-share-alt-square:before { + content: "\f1e1"; +} +.fa-bomb:before { + content: "\f1e2"; +} +.fa-soccer-ball-o:before, +.fa-futbol-o:before { + content: "\f1e3"; +} +.fa-tty:before { + content: "\f1e4"; +} +.fa-binoculars:before { + content: "\f1e5"; +} +.fa-plug:before { + content: "\f1e6"; +} +.fa-slideshare:before { + content: "\f1e7"; +} +.fa-twitch:before { + content: "\f1e8"; +} +.fa-yelp:before { + content: "\f1e9"; +} +.fa-newspaper-o:before { + content: "\f1ea"; +} +.fa-wifi:before { + content: "\f1eb"; +} +.fa-calculator:before { + content: "\f1ec"; +} +.fa-paypal:before { + content: "\f1ed"; +} +.fa-google-wallet:before { + content: "\f1ee"; +} +.fa-cc-visa:before { + content: "\f1f0"; +} +.fa-cc-mastercard:before { + content: "\f1f1"; +} +.fa-cc-discover:before { + content: "\f1f2"; +} +.fa-cc-amex:before { + content: "\f1f3"; +} +.fa-cc-paypal:before { + content: "\f1f4"; +} +.fa-cc-stripe:before { + content: "\f1f5"; +} +.fa-bell-slash:before { + content: "\f1f6"; +} +.fa-bell-slash-o:before { + content: "\f1f7"; +} +.fa-trash:before { + content: "\f1f8"; +} +.fa-copyright:before { + content: "\f1f9"; +} +.fa-at:before { + content: "\f1fa"; +} +.fa-eyedropper:before { + content: "\f1fb"; +} +.fa-paint-brush:before { + content: "\f1fc"; +} +.fa-birthday-cake:before { + content: "\f1fd"; +} +.fa-area-chart:before { + content: "\f1fe"; +} +.fa-pie-chart:before { + content: "\f200"; +} +.fa-line-chart:before { + content: "\f201"; +} +.fa-lastfm:before { + content: "\f202"; +} +.fa-lastfm-square:before { + content: "\f203"; +} +.fa-toggle-off:before { + content: "\f204"; +} +.fa-toggle-on:before { + content: "\f205"; +} +.fa-bicycle:before { + content: "\f206"; +} +.fa-bus:before { + content: "\f207"; +} +.fa-ioxhost:before { + content: "\f208"; +} +.fa-angellist:before { + content: "\f209"; +} +.fa-cc:before { + content: "\f20a"; +} +.fa-shekel:before, +.fa-sheqel:before, +.fa-ils:before { + content: "\f20b"; +} +.fa-meanpath:before { + content: "\f20c"; +} +.fa-buysellads:before { + content: "\f20d"; +} +.fa-connectdevelop:before { + content: "\f20e"; +} +.fa-dashcube:before { + content: "\f210"; +} +.fa-forumbee:before { + content: "\f211"; +} +.fa-leanpub:before { + content: "\f212"; +} +.fa-sellsy:before { + content: "\f213"; +} +.fa-shirtsinbulk:before { + content: "\f214"; +} +.fa-simplybuilt:before { + content: "\f215"; +} +.fa-skyatlas:before { + content: "\f216"; +} +.fa-cart-plus:before { + content: "\f217"; +} +.fa-cart-arrow-down:before { + content: "\f218"; +} +.fa-diamond:before { + content: "\f219"; +} +.fa-ship:before { + content: "\f21a"; +} +.fa-user-secret:before { + content: "\f21b"; +} +.fa-motorcycle:before { + content: "\f21c"; +} +.fa-street-view:before { + content: "\f21d"; +} +.fa-heartbeat:before { + content: "\f21e"; +} +.fa-venus:before { + content: "\f221"; +} +.fa-mars:before { + content: "\f222"; +} +.fa-mercury:before { + content: "\f223"; +} +.fa-intersex:before, +.fa-transgender:before { + content: "\f224"; +} +.fa-transgender-alt:before { + content: "\f225"; +} +.fa-venus-double:before { + content: "\f226"; +} +.fa-mars-double:before { + content: "\f227"; +} +.fa-venus-mars:before { + content: "\f228"; +} +.fa-mars-stroke:before { + content: "\f229"; +} +.fa-mars-stroke-v:before { + content: "\f22a"; +} +.fa-mars-stroke-h:before { + content: "\f22b"; +} +.fa-neuter:before { + content: "\f22c"; +} +.fa-genderless:before { + content: "\f22d"; +} +.fa-facebook-official:before { + content: "\f230"; +} +.fa-pinterest-p:before { + content: "\f231"; +} +.fa-whatsapp:before { + content: "\f232"; +} +.fa-server:before { + content: "\f233"; +} +.fa-user-plus:before { + content: "\f234"; +} +.fa-user-times:before { + content: "\f235"; +} +.fa-hotel:before, +.fa-bed:before { + content: "\f236"; +} +.fa-viacoin:before { + content: "\f237"; +} +.fa-train:before { + content: "\f238"; +} +.fa-subway:before { + content: "\f239"; +} +.fa-medium:before { + content: "\f23a"; +} +.fa-yc:before, +.fa-y-combinator:before { + content: "\f23b"; +} +.fa-optin-monster:before { + content: "\f23c"; +} +.fa-opencart:before { + content: "\f23d"; +} +.fa-expeditedssl:before { + content: "\f23e"; +} +.fa-battery-4:before, +.fa-battery-full:before { + content: "\f240"; +} +.fa-battery-3:before, +.fa-battery-three-quarters:before { + content: "\f241"; +} +.fa-battery-2:before, +.fa-battery-half:before { + content: "\f242"; +} +.fa-battery-1:before, +.fa-battery-quarter:before { + content: "\f243"; +} +.fa-battery-0:before, +.fa-battery-empty:before { + content: "\f244"; +} +.fa-mouse-pointer:before { + content: "\f245"; +} +.fa-i-cursor:before { + content: "\f246"; +} +.fa-object-group:before { + content: "\f247"; +} +.fa-object-ungroup:before { + content: "\f248"; +} +.fa-sticky-note:before { + content: "\f249"; +} +.fa-sticky-note-o:before { + content: "\f24a"; +} +.fa-cc-jcb:before { + content: "\f24b"; +} +.fa-cc-diners-club:before { + content: "\f24c"; +} +.fa-clone:before { + content: "\f24d"; +} +.fa-balance-scale:before { + content: "\f24e"; +} +.fa-hourglass-o:before { + content: "\f250"; +} +.fa-hourglass-1:before, +.fa-hourglass-start:before { + content: "\f251"; +} +.fa-hourglass-2:before, +.fa-hourglass-half:before { + content: "\f252"; +} +.fa-hourglass-3:before, +.fa-hourglass-end:before { + content: "\f253"; +} +.fa-hourglass:before { + content: "\f254"; +} +.fa-hand-grab-o:before, +.fa-hand-rock-o:before { + content: "\f255"; +} +.fa-hand-stop-o:before, +.fa-hand-paper-o:before { + content: "\f256"; +} +.fa-hand-scissors-o:before { + content: "\f257"; +} +.fa-hand-lizard-o:before { + content: "\f258"; +} +.fa-hand-spock-o:before { + content: "\f259"; +} +.fa-hand-pointer-o:before { + content: "\f25a"; +} +.fa-hand-peace-o:before { + content: "\f25b"; +} +.fa-trademark:before { + content: "\f25c"; +} +.fa-registered:before { + content: "\f25d"; +} +.fa-creative-commons:before { + content: "\f25e"; +} +.fa-gg:before { + content: "\f260"; +} +.fa-gg-circle:before { + content: "\f261"; +} +.fa-tripadvisor:before { + content: "\f262"; +} +.fa-odnoklassniki:before { + content: "\f263"; +} +.fa-odnoklassniki-square:before { + content: "\f264"; +} +.fa-get-pocket:before { + content: "\f265"; +} +.fa-wikipedia-w:before { + content: "\f266"; +} +.fa-safari:before { + content: "\f267"; +} +.fa-chrome:before { + content: "\f268"; +} +.fa-firefox:before { + content: "\f269"; +} +.fa-opera:before { + content: "\f26a"; +} +.fa-internet-explorer:before { + content: "\f26b"; +} +.fa-tv:before, +.fa-television:before { + content: "\f26c"; +} +.fa-contao:before { + content: "\f26d"; +} +.fa-500px:before { + content: "\f26e"; +} +.fa-amazon:before { + content: "\f270"; +} +.fa-calendar-plus-o:before { + content: "\f271"; +} +.fa-calendar-minus-o:before { + content: "\f272"; +} +.fa-calendar-times-o:before { + content: "\f273"; +} +.fa-calendar-check-o:before { + content: "\f274"; +} +.fa-industry:before { + content: "\f275"; +} +.fa-map-pin:before { + content: "\f276"; +} +.fa-map-signs:before { + content: "\f277"; +} +.fa-map-o:before { + content: "\f278"; +} +.fa-map:before { + content: "\f279"; +} +.fa-commenting:before { + content: "\f27a"; +} +.fa-commenting-o:before { + content: "\f27b"; +} +.fa-houzz:before { + content: "\f27c"; +} +.fa-vimeo:before { + content: "\f27d"; +} +.fa-black-tie:before { + content: "\f27e"; +} +.fa-fonticons:before { + content: "\f280"; +} diff --git a/user/guns-admin/src/main/webapp/static/css/font-awesome.min.css b/user/guns-admin/src/main/webapp/static/css/font-awesome.min.css new file mode 100644 index 0000000..ee4e978 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.4.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.4.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.4.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.4.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.4.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.4.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"} diff --git a/user/guns-admin/src/main/webapp/static/css/login.css b/user/guns-admin/src/main/webapp/static/css/login.css new file mode 100644 index 0000000..bfe8cb6 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/login.css @@ -0,0 +1,93 @@ +html{height: 100%;} +body.signin { + background: #18c8f6; + height: auto; + background:url("../img/login-background.jpg") no-repeat center fixed; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; + color: rgba(255,255,255,.95); +} + +.signinpanel { + width: 750px; + margin: 10% auto 0 auto; +} + +.signinpanel .logopanel { + float: none; + width: auto; + padding: 0; + background: none; +} + +.signinpanel .signin-info ul { + list-style: none; + padding: 0; + margin: 20px 0; +} + +.signinpanel .form-control { + display: block; + margin-top: 15px; +} + +.signinpanel .uname { + background: #fff url(../img/user.png) no-repeat 95% center;color:#333; +} + +.signinpanel .pword { + background: #fff url(../img/locked.png) no-repeat 95% center;color:#333; +} + +.signinpanel .btn { + margin-top: 15px; +} + +.signinpanel form { + background: rgba(255, 255, 255, 0.2); + border: 1px solid rgba(255,255,255,.3); + -moz-box-shadow: 0 3px 0 rgba(12, 12, 12, 0.03); + -webkit-box-shadow: 0 3px 0 rgba(12, 12, 12, 0.03); + box-shadow: 0 3px 0 rgba(12, 12, 12, 0.03); + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + padding: 30px; +} + +.signup-footer{border-top: solid 1px rgba(255,255,255,.3);margin:20px 0;padding-top: 15px;} + +@media screen and (max-width: 768px) { + .signinpanel, + .signuppanel { + margin: 0 auto; + width: 420px!important; + padding: 20px; + } + .signinpanel form { + margin-top: 20px; + } + .signup-footer { + margin-bottom: 10px; + } + .signuppanel .form-control { + margin-bottom: 10px; + } + .signup-footer .pull-left, + .signup-footer .pull-right { + float: none !important; + text-align: center; + } + .signinpanel .signin-info ul { + display: none; + } +} +@media screen and (max-width: 320px) { + .signinpanel, + .signuppanel { + margin:0 20px; + width:auto; + } +} diff --git a/user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-1.png b/user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-1.png new file mode 100644 index 0000000..41c5c08 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-1.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-3.png b/user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-3.png new file mode 100644 index 0000000..7a80132 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-3.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/patterns/header-profile.png b/user/guns-admin/src/main/webapp/static/css/patterns/header-profile.png new file mode 100644 index 0000000..7dea7f2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/patterns/header-profile.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/patterns/shattered.png b/user/guns-admin/src/main/webapp/static/css/patterns/shattered.png new file mode 100644 index 0000000..90ed42b --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/patterns/shattered.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-table/bootstrap-table.min.css b/user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-table/bootstrap-table.min.css new file mode 100644 index 0000000..f65b308 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-table/bootstrap-table.min.css @@ -0,0 +1 @@ +.fixed-table-container .bs-checkbox,.fixed-table-container .no-records-found{text-align:center}.fixed-table-body thead th .th-inner,.table td,.table th{box-sizing:border-box}.bootstrap-table .table{margin-bottom:0!important;border-bottom:1px solid #ddd;border-collapse:collapse!important;border-radius:1px}.bootstrap-table .table:not(.table-condensed),.bootstrap-table .table:not(.table-condensed)>tbody>tr>td,.bootstrap-table .table:not(.table-condensed)>tbody>tr>th,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>td,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>th,.bootstrap-table .table:not(.table-condensed)>thead>tr>td{padding:8px}.bootstrap-table .table.table-no-bordered>tbody>tr>td,.bootstrap-table .table.table-no-bordered>thead>tr>th{border-right:2px solid transparent}.bootstrap-table .table.table-no-bordered>tbody>tr>td:last-child{border-right:none}.fixed-table-container{position:relative;clear:both;border:1px solid #ddd;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px}.fixed-table-container.table-no-bordered{border:1px solid transparent}.fixed-table-footer,.fixed-table-header{overflow:hidden}.fixed-table-footer{border-top:1px solid #ddd}.fixed-table-body{overflow-x:auto;overflow-y:auto;height:100%}.fixed-table-container table{width:100%}.fixed-table-container thead th{height:0;padding:0;margin:0;border-left:1px solid #ddd}.fixed-table-container thead th:focus{outline:transparent solid 0}.fixed-table-container thead th:first-child{border-left:none;border-top-left-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px}.fixed-table-container tbody td .th-inner,.fixed-table-container thead th .th-inner{padding:8px;line-height:24px;vertical-align:top;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fixed-table-container thead th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px}.fixed-table-container thead th .both{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC')}.fixed-table-container thead th .asc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==)}.fixed-table-container thead th .desc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII=)}.fixed-table-container th.detail{width:30px}.fixed-table-container tbody td{border-left:1px solid #ddd}.fixed-table-container tbody tr:first-child td{border-top:none}.fixed-table-container tbody td:first-child{border-left:none}.fixed-table-container tbody .selected td{background-color:#f5f5f5}.fixed-table-container .bs-checkbox .th-inner{padding:8px 0}.fixed-table-container input[type=radio],.fixed-table-container input[type=checkbox]{margin:0 auto!important}.fixed-table-pagination .pagination-detail,.fixed-table-pagination div.pagination{margin-top:10px;margin-bottom:10px}.fixed-table-pagination div.pagination .pagination{margin:0}.fixed-table-pagination .pagination a{padding:6px 12px;line-height:1.428571429}.fixed-table-pagination .pagination-info{line-height:34px;margin-right:5px}.fixed-table-pagination .btn-group{position:relative;display:inline-block;vertical-align:middle}.fixed-table-pagination .dropup .dropdown-menu{margin-bottom:0}.fixed-table-pagination .page-list{display:inline-block}.fixed-table-toolbar .columns-left{margin-right:5px}.fixed-table-toolbar .columns-right{margin-left:5px}.fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429}.fixed-table-toolbar .bs-bars,.fixed-table-toolbar .columns,.fixed-table-toolbar .search{position:relative;margin-top:10px;margin-bottom:10px;line-height:34px}.fixed-table-pagination li.disabled a{pointer-events:none;cursor:default}.fixed-table-loading{display:none;position:absolute;top:42px;right:0;bottom:0;left:0;z-index:99;background-color:#fff;text-align:center}.fixed-table-body .card-view .title{font-weight:700;display:inline-block;min-width:30%;text-align:left!important}.table td,.table th{vertical-align:middle}.fixed-table-toolbar .dropdown-menu{text-align:left;max-height:300px;overflow:auto}.fixed-table-toolbar .btn-group>.btn-group{display:inline-block;margin-left:-1px!important}.fixed-table-toolbar .btn-group>.btn-group>.btn{border-radius:0}.fixed-table-toolbar .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.fixed-table-toolbar .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .table>thead>tr>th{vertical-align:bottom;border-bottom:1px solid #ddd}.bootstrap-table .table thead>tr>th{padding:0;margin:0}.bootstrap-table .fixed-table-footer tbody>tr>td{padding:0!important}.bootstrap-table .fixed-table-footer .table{border-bottom:none;border-radius:0;padding:0!important}.bootstrap-table .pull-right .dropdown-menu{right:0;left:auto}p.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden}.fixed-table-pagination:after,.fixed-table-toolbar:after{content:"";display:block;clear:both} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-treetable/bootstrap-treetable.css b/user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-treetable/bootstrap-treetable.css new file mode 100644 index 0000000..ab08de5 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-treetable/bootstrap-treetable.css @@ -0,0 +1,10 @@ +.treetable-indent {width:16px; height: 16px; display: inline-block; position: relative;} +.treetable-expander {width:16px; height: 16px; display: inline-block; position: relative; cursor: pointer;} +.treetable-selected{background: #f5f5f5 !important;} +.treetable-table{border:0 !important;margin-bottom:0} +.treetable-table tbody {display:block;height:auto;overflow-y:auto;} +.treetable-table thead, .treetable-table tbody tr {display:table;width:100%;table-layout:fixed;} +.treetable-thead th{line-height:40px;border: 0 !important;background:#fff !important;border-radius: 4px;border-left:1px solid #e7eaec !important;border-bottom:2px solid #e7eaec !important;text-align: center;} +.treetable-thead tr :first-child{border-left:0 !important} +.treetable-tbody td{border: 0 !important;border-left:1px solid #e7eaec !important;border-bottom:1px solid #e7eaec !important;} +.treetable-tbody tr :first-child{border-left:0 !important} diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite.png b/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite.png new file mode 100644 index 0000000..3611ae4 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite@2x.png b/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite@2x.png new file mode 100644 index 0000000..ffe4d7d --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite@2x.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen.css b/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen.css new file mode 100644 index 0000000..edd6767 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen.css @@ -0,0 +1,423 @@ +/*! +Chosen, a Select Box Enhancer for jQuery and Prototype +by Patrick Filler for Harvest, http://getharvest.com + +Version 1.1.0 +Full source at https://github.com/harvesthq/chosen +Copyright (c) 2011 Harvest http://getharvest.com + +MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md +This file is generated by `grunt build`, do not edit it by hand. +*/ + +/* @group Base */ +.chosen-container { + position: relative; + display: inline-block; + vertical-align: middle; + font-size: 13px; + zoom: 1; + *display: inline; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +.chosen-container .chosen-drop { + position: absolute; + top: 100%; + left: -9999px; + z-index: 1010; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + border: 1px solid #aaa; + border-top: 0; + background: #fff; + box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); +} +.chosen-container.chosen-with-drop .chosen-drop { + left: 0; +} +.chosen-container a { + cursor: pointer; +} + +/* @end */ +/* @group Single Chosen */ +.chosen-container-single .chosen-single { + position: relative; + display: block; + overflow: hidden; + padding: 0 0 0 8px; + height: 23px; + border: 1px solid #aaa; + border-radius: 5px; + background-color: #fff; + background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4)); + background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-clip: padding-box; + box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1); + color: #444; + text-decoration: none; + white-space: nowrap; + line-height: 24px; +} +.chosen-container-single .chosen-default { + color: #999; +} +.chosen-container-single .chosen-single span { + display: block; + overflow: hidden; + margin-right: 26px; + text-overflow: ellipsis; + white-space: nowrap; +} +.chosen-container-single .chosen-single-with-deselect span { + margin-right: 38px; +} +.chosen-container-single .chosen-single abbr { + position: absolute; + top: 6px; + right: 26px; + display: block; + width: 12px; + height: 12px; + background: url('chosen-sprite.png') -42px 1px no-repeat; + font-size: 1px; +} +.chosen-container-single .chosen-single abbr:hover { + background-position: -42px -10px; +} +.chosen-container-single.chosen-disabled .chosen-single abbr:hover { + background-position: -42px -10px; +} +.chosen-container-single .chosen-single div { + position: absolute; + top: 0; + right: 0; + display: block; + width: 18px; + height: 100%; +} +.chosen-container-single .chosen-single div b { + display: block; + width: 100%; + height: 100%; + background: url('chosen-sprite.png') no-repeat 0px 7px; +} +.chosen-container-single .chosen-search { + position: relative; + z-index: 1010; + margin: 0; + padding: 3px 4px; + white-space: nowrap; +} +.chosen-container-single .chosen-search input[type="text"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 1px 0; + padding: 4px 20px 4px 5px; + width: 100%; + height: auto; + outline: 0; + border: 1px solid #aaa; + background: white url('chosen-sprite.png') no-repeat 100% -20px; + background: url('chosen-sprite.png') no-repeat 100% -20px; + font-size: 1em; + font-family: sans-serif; + line-height: normal; + border-radius: 0; +} +.chosen-container-single .chosen-drop { + margin-top: -1px; + border-radius: 0 0 4px 4px; + background-clip: padding-box; +} +.chosen-container-single.chosen-container-single-nosearch .chosen-search { + position: absolute; + left: -9999px; +} + +/* @end */ +/* @group Results */ +.chosen-container .chosen-results { + position: relative; + overflow-x: hidden; + overflow-y: auto; + margin: 0 4px 4px 0; + padding: 0 0 0 4px; + max-height: 240px; + -webkit-overflow-scrolling: touch; +} +.chosen-container .chosen-results li { + display: none; + margin: 0; + padding: 5px 6px; + list-style: none; + line-height: 15px; + -webkit-touch-callout: none; +} +.chosen-container .chosen-results li.active-result { + display: list-item; + cursor: pointer; +} +.chosen-container .chosen-results li.disabled-result { + display: list-item; + color: #ccc; + cursor: default; +} +.chosen-container .chosen-results li.highlighted { + background-color: #3875d7; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc)); + background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: linear-gradient(#3875d7 20%, #2a62bc 90%); + color: #fff; +} +.chosen-container .chosen-results li.no-results { + display: list-item; + background: #f4f4f4; +} +.chosen-container .chosen-results li.group-result { + display: list-item; + font-weight: bold; + cursor: default; +} +.chosen-container .chosen-results li.group-option { + padding-left: 15px; +} +.chosen-container .chosen-results li em { + font-style: normal; + text-decoration: underline; +} + +/* @end */ +/* @group Multi Chosen */ +.chosen-container-multi .chosen-choices { + -moz-box-sizing: border-box; + background-color: #FFFFFF; + border: 1px solid #CBD5DD; + border-radius: 2px; + cursor: text; + height: auto !important; + margin: 0; + min-height: 30px; + overflow: hidden; + padding: 2px; + position: relative; + width: 100%; +} +.chosen-container-multi .chosen-choices li { + float: left; + list-style: none; +} +.chosen-container-multi .chosen-choices li.search-field { + margin: 0; + padding: 0; + white-space: nowrap; +} +.chosen-container-multi .chosen-choices li.search-field input[type="text"] { + margin: 1px 0; + padding: 5px; + height: 25px; + outline: 0; + border: 0 !important; + background: transparent !important; + box-shadow: none; + color: #666; + font-size: 100%; + font-family: sans-serif; + line-height: normal; + border-radius: 0; +} +.chosen-container-multi .chosen-choices li.search-field .default { + color: #999; +} +.chosen-container-multi .chosen-choices li.search-choice { + position: relative; + margin: 3px 0 3px 5px; + padding: 3px 20px 3px 5px; + border: 1px solid #aaa; + border-radius: 3px; + background-color: #e4e4e4; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-clip: padding-box; + box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05); + color: #333; + line-height: 13px; + cursor: default; +} +.chosen-container-multi .chosen-choices li.search-choice .search-choice-close { + position: absolute; + top: 4px; + right: 3px; + display: block; + width: 12px; + height: 12px; + background: url('chosen-sprite.png') -42px 1px no-repeat; + font-size: 1px; +} +.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover { + background-position: -42px -10px; +} +.chosen-container-multi .chosen-choices li.search-choice-disabled { + padding-right: 5px; + border: 1px solid #ccc; + background-color: #e4e4e4; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + color: #666; +} +.chosen-container-multi .chosen-choices li.search-choice-focus { + background: #d4d4d4; +} +.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close { + background-position: -42px -10px; +} +.chosen-container-multi .chosen-results { + margin: 0; + padding: 0; +} +.chosen-container-multi .chosen-drop .result-selected { + display: list-item; + color: #ccc; + cursor: default; +} + +/* @end */ +/* @group Active */ +.chosen-container-active .chosen-single { + border: 1px solid #5897fb; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); +} +.chosen-container-active.chosen-with-drop .chosen-single { + border: 1px solid #aaa; + -moz-border-radius-bottomright: 0; + border-bottom-right-radius: 0; + -moz-border-radius-bottomleft: 0; + border-bottom-left-radius: 0; +} +.chosen-container-active.chosen-with-drop .chosen-single div { + border-left: none; + background: transparent; +} +.chosen-container-active.chosen-with-drop .chosen-single div b { + background-position: -18px 7px; +} +.chosen-container-active .chosen-choices { + border: 1px solid #5897fb; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); +} +.chosen-container-active .chosen-choices li.search-field input[type="text"] { + color: #111 !important; +} + +/* @end */ +/* @group Disabled Support */ +.chosen-disabled { + opacity: 0.5 !important; + cursor: default; +} +.chosen-disabled .chosen-single { + cursor: default; +} +.chosen-disabled .chosen-choices .search-choice .search-choice-close { + cursor: default; +} + +/* @end */ +/* @group Right to Left */ +.chosen-rtl { + text-align: right; +} +.chosen-rtl .chosen-single { + overflow: visible; + padding: 0 8px 0 0; +} +.chosen-rtl .chosen-single span { + margin-right: 0; + margin-left: 26px; + direction: rtl; +} +.chosen-rtl .chosen-single-with-deselect span { + margin-left: 38px; +} +.chosen-rtl .chosen-single div { + right: auto; + left: 3px; +} +.chosen-rtl .chosen-single abbr { + right: auto; + left: 26px; +} +.chosen-rtl .chosen-choices li { + float: right; +} +.chosen-rtl .chosen-choices li.search-field input[type="text"] { + direction: rtl; +} +.chosen-rtl .chosen-choices li.search-choice { + margin: 3px 5px 3px 0; + padding: 3px 5px 3px 19px; +} +.chosen-rtl .chosen-choices li.search-choice .search-choice-close { + right: auto; + left: 4px; +} +.chosen-rtl.chosen-container-single-nosearch .chosen-search, +.chosen-rtl .chosen-drop { + left: 9999px; +} +.chosen-rtl.chosen-container-single .chosen-results { + margin: 0 0 4px 4px; + padding: 0 4px 0 0; +} +.chosen-rtl .chosen-results li.group-option { + padding-right: 15px; + padding-left: 0; +} +.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div { + border-right: none; +} +.chosen-rtl .chosen-search input[type="text"] { + padding: 4px 5px 4px 20px; + background: white url('chosen-sprite.png') no-repeat -30px -20px; + background: url('chosen-sprite.png') no-repeat -30px -20px; + direction: rtl; +} +.chosen-rtl.chosen-container-single .chosen-single div b { + background-position: 6px 2px; +} +.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b { + background-position: -12px 2px; +} + +/* @end */ +/* @group Retina compatibility */ +@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) { + .chosen-rtl .chosen-search input[type="text"], + .chosen-container-single .chosen-single abbr, + .chosen-container-single .chosen-single div b, + .chosen-container-single .chosen-search input[type="text"], + .chosen-container-multi .chosen-choices .search-choice .search-choice-close, + .chosen-container .chosen-results-scroll-down span, + .chosen-container .chosen-results-scroll-up span { + background-image: url('chosen-sprite@2x.png') !important; + background-size: 52px 37px !important; + background-repeat: no-repeat !important; + } +} +/* @end */ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/custom.css b/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/custom.css new file mode 100644 index 0000000..84e950b --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/custom.css @@ -0,0 +1,59 @@ +/* iCheck plugin Square skin, green +----------------------------------- */ +.icheckbox_square-green, +.iradio_square-green { + display: inline-block; + *display: inline; + vertical-align: middle; + margin: 0; + padding: 0; + width: 22px; + height: 22px; + background: url(green.png) no-repeat; + border: none; + cursor: pointer; +} + +.icheckbox_square-green { + background-position: 0 0; +} +.icheckbox_square-green.hover { + background-position: -24px 0; +} +.icheckbox_square-green.checked { + background-position: -48px 0; +} +.icheckbox_square-green.disabled { + background-position: -72px 0; + cursor: default; +} +.icheckbox_square-green.checked.disabled { + background-position: -96px 0; +} + +.iradio_square-green { + background-position: -120px 0; +} +.iradio_square-green.hover { + background-position: -144px 0; +} +.iradio_square-green.checked { + background-position: -168px 0; +} +.iradio_square-green.disabled { + background-position: -192px 0; + cursor: default; +} +.iradio_square-green.checked.disabled { + background-position: -216px 0; +} + +/* HiDPI support */ +@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) { + .icheckbox_square-green, + .iradio_square-green { + background-image: url(green@2x.png); + -webkit-background-size: 240px 24px; + background-size: 240px 24px; + } +} diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green.png b/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green.png new file mode 100644 index 0000000..cf62300 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green@2x.png b/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green@2x.png new file mode 100644 index 0000000..3bda5be --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green@2x.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/images/sprite-skin-flat.png b/user/guns-admin/src/main/webapp/static/css/plugins/images/sprite-skin-flat.png new file mode 100644 index 0000000..8356fc5 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/images/sprite-skin-flat.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/validate/bootstrapValidator.min.css b/user/guns-admin/src/main/webapp/static/css/plugins/validate/bootstrapValidator.min.css new file mode 100644 index 0000000..62d7b59 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/validate/bootstrapValidator.min.css @@ -0,0 +1,12 @@ +/*! + * BootstrapValidator (http://bootstrapvalidator.com) + * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3 + * + * @version v0.5.3, built on 2014-11-05 9:14:18 PM + * @author https://twitter.com/nghuuphuoc + * @copyright (c) 2013 - 2014 Nguyen Huu Phuoc + * @license Commercial: http://bootstrapvalidator.com/license/ + * Non-commercial: http://creativecommons.org/licenses/by-nc-nd/3.0/ + */ + +.bv-form .help-block{margin-bottom:0}.bv-form .tooltip-inner{text-align:left}.nav-tabs li.bv-tab-success>a{color:#3c763d}.nav-tabs li.bv-tab-error>a{color:#a94442}.bv-form .bv-icon-no-label{top:0}.bv-form .bv-icon-input-group{top:0;z-index:100} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/webuploader/webuploader.css b/user/guns-admin/src/main/webapp/static/css/plugins/webuploader/webuploader.css new file mode 100644 index 0000000..f445e0d --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/webuploader/webuploader.css @@ -0,0 +1,30 @@ +.webuploader-container { + position: relative; +} +.webuploader-element-invisible { + position: absolute !important; + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px,1px,1px,1px); +} +.webuploader-pick { + position: relative; + display: inline-block; + cursor: pointer; + background: #1ab394; + padding: 6px 12px; + color: #fff; + text-align: center; + border-radius: 3px; + overflow: hidden; + font-size: 14px; + font-weight: 400; +} +.webuploader-pick-hover { + background: #18ab8d; +} + +.webuploader-pick-disable { + opacity: 0.6; + pointer-events:none; +} + diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/demo.css b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/demo.css new file mode 100644 index 0000000..f6dba0d --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/demo.css @@ -0,0 +1,33 @@ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;} +body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #f0f6e4 \9;} +h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, sans-serif;padding-bottom: 5px;} +h1 {font-size: 24px;line-height: 34px;text-align: center;} +h2 {font-size: 14px;line-height: 24px;padding-top: 5px;} +h6 {font-weight: normal;font-size: 12px;letter-spacing: 1px;line-height: 24px;text-align: center;} +a {color:#3C6E31;text-decoration: underline;} +a:hover {background-color:#3C6E31;color:white;} +input.radio {margin: 0 2px 0 8px;} +input.radio.first {margin-left:0;} +input.empty {color: lightgray;} +code {color: #2f332a;} +.highlight_red {color:#A60000;} +.highlight_green {color:#A7F43D;} +li {list-style: circle;font-size: 12px;} +li.title {list-style: none;} +ul.list {margin-left: 17px;} + +div.content_wrap {width: 600px;height:380px;} +div.content_wrap div.left{float: left;width: 250px;} +div.content_wrap div.right{float: right;width: 340px;} +div.zTreeDemoBackground {width:250px;height:362px;text-align:left;} + +ul.ztree {margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;} +ul.log {border: 1px solid #617775;background: #f0f6e4;width:300px;height:170px;overflow: hidden;} +ul.log.small {height:45px;} +ul.log li {color: #666666;list-style: none;padding-left: 10px;} +ul.log li.dark {background-color: #E3E3E3;} + +/* ruler */ +div.ruler {height:20px; width:220px; background-color:#f0f6e4;border: 1px solid #333; margin-bottom: 5px; cursor: pointer} +div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_close.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_close.png new file mode 100644 index 0000000..68ccb3c --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_close.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_open.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_open.png new file mode 100644 index 0000000..d6ff36d --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_open.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/2.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/2.png new file mode 100644 index 0000000..9eff506 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/2.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/3.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/3.png new file mode 100644 index 0000000..d7ba6d0 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/3.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/4.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/4.png new file mode 100644 index 0000000..753e2bf --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/4.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/5.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/5.png new file mode 100644 index 0000000..0c5eccd --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/5.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/6.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/6.png new file mode 100644 index 0000000..070b835 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/6.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/7.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/7.png new file mode 100644 index 0000000..532b037 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/7.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/8.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/8.png new file mode 100644 index 0000000..a8f3a86 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/8.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/9.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/9.png new file mode 100644 index 0000000..4db73cd --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/9.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/line_conn.gif b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/line_conn.gif new file mode 100644 index 0000000..d561d36 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/line_conn.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/loading.gif b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/loading.gif new file mode 100644 index 0000000..e8c2892 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/loading.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.gif b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.gif new file mode 100644 index 0000000..50c94fd --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.png b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.png new file mode 100644 index 0000000..ffda01e --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/css/plugins/ztree/zTreeStyle.css b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/zTreeStyle.css new file mode 100644 index 0000000..4a1705b --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/plugins/ztree/zTreeStyle.css @@ -0,0 +1,97 @@ +/*------------------------------------- +zTree Style + +version: 3.5.19 +author: Hunter.z +email: hunter.z@263.net +website: http://code.google.com/p/jquerytree/ + +-------------------------------------*/ + +.ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif} +.ztree {margin:0; padding:5px; color:#333} +.ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0} +.ztree li ul{ margin:0; padding:0 0 0 18px} +.ztree li ul.line{ background:url(./img/line_conn.gif) 0 0 repeat-y;} + +.ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:17px; color:#333; background-color: transparent; + text-decoration:none; vertical-align:top; display: inline-block} +.ztree li a:hover {text-decoration:underline} +.ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;} +.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;} +.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#316AC5; color:white; height:16px; border:1px #316AC5 solid; + opacity:0.8; filter:alpha(opacity=80)} +.ztree li a.tmpTargetNode_prev {} +.ztree li a.tmpTargetNode_next {} +.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0; + font-size:12px; border:1px #7EC4CC solid; *border:0px} +.ztree li span {line-height:16px; margin-right:2px} +.ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle; + border:0 none; cursor: pointer;outline:none; + background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; + background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")} + +.ztree li span.button.chk {width:13px; height:13px; margin:0 3px 0 0; cursor: auto} +.ztree li span.button.chk.checkbox_false_full {background-position:0 0} +.ztree li span.button.chk.checkbox_false_full_focus {background-position:0 -14px} +.ztree li span.button.chk.checkbox_false_part {background-position:0 -28px} +.ztree li span.button.chk.checkbox_false_part_focus {background-position:0 -42px} +.ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px} +.ztree li span.button.chk.checkbox_true_full {background-position:-14px 0} +.ztree li span.button.chk.checkbox_true_full_focus {background-position:-14px -14px} +.ztree li span.button.chk.checkbox_true_part {background-position:-14px -28px} +.ztree li span.button.chk.checkbox_true_part_focus {background-position:-14px -42px} +.ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px} +.ztree li span.button.chk.radio_false_full {background-position:-28px 0} +.ztree li span.button.chk.radio_false_full_focus {background-position:-28px -14px} +.ztree li span.button.chk.radio_false_part {background-position:-28px -28px} +.ztree li span.button.chk.radio_false_part_focus {background-position:-28px -42px} +.ztree li span.button.chk.radio_false_disable {background-position:-28px -56px} +.ztree li span.button.chk.radio_true_full {background-position:-42px 0} +.ztree li span.button.chk.radio_true_full_focus {background-position:-42px -14px} +.ztree li span.button.chk.radio_true_part {background-position:-42px -28px} +.ztree li span.button.chk.radio_true_part_focus {background-position:-42px -42px} +.ztree li span.button.chk.radio_true_disable {background-position:-42px -56px} + +.ztree li span.button.switch {width:18px; height:18px} +.ztree li span.button.root_open{background-position:-92px -54px} +.ztree li span.button.root_close{background-position:-74px -54px} +.ztree li span.button.roots_open{background-position:-92px 0} +.ztree li span.button.roots_close{background-position:-74px 0} +.ztree li span.button.center_open{background-position:-92px -18px} +.ztree li span.button.center_close{background-position:-74px -18px} +.ztree li span.button.bottom_open{background-position:-92px -36px} +.ztree li span.button.bottom_close{background-position:-74px -36px} +.ztree li span.button.noline_open{background-position:-92px -72px} +.ztree li span.button.noline_close{background-position:-74px -72px} +.ztree li span.button.root_docu{ background:none;} +.ztree li span.button.roots_docu{background-position:-56px 0} +.ztree li span.button.center_docu{background-position:-56px -18px} +.ztree li span.button.bottom_docu{background-position:-56px -36px} +.ztree li span.button.noline_docu{ background:none;} + +.ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle} +.ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle} + +.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle} + +ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)} + +span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute; + background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; + background-position:-110px -80px; background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")} + +ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)} +.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute} + +/* level style*/ +/*.ztree li span.button.level0 { + display:none; +} +.ztree li ul.level0 { + padding:0; + background:none; +}*/ \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/css/style.css b/user/guns-admin/src/main/webapp/static/css/style.css new file mode 100644 index 0000000..198d105 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/css/style.css @@ -0,0 +1,7897 @@ +/* + * + * H+ - 后台主题UI框架 + * version 4.0 + * +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: 100; +} + +h1 { + font-size: 30px; +} + +h2 { + font-size: 24px; +} + +h3 { + font-size: 16px; +} + +h4 { + font-size: 14px; +} + +h5 { + font-size: 12px; +} + +h6 { + font-size: 10px; +} + +h3, +h4, +h5 { + margin-top: 5px; + font-weight: 600; +} + +a:focus { + outline: none; +} + +.nav > li > a { + color: #a7b1c2; + font-weight: 600; + padding: 14px 20px 14px 25px; +} + +.nav li>a { + display: block; + /*white-space: nowrap;*/ +} + +.nav.navbar-right > li > a { + color: #999c9e; +} + +.nav > li.active > a { + color: #ffffff; +} + +.navbar-default .nav > li > a:hover, +.navbar-default .nav > li > a:focus { + background-color: #293846; + color: white; +} + +.nav .open > a, +.nav .open > a:hover, +.nav .open > a:focus { + background: #fff; +} + +.nav > li > a i { + margin-right: 6px; +} + +.navbar { + border: 0; +} + +.navbar-default { + background-color: transparent; + border-color: #2f4050; + position: relative; +} + +.navbar-top-links li { + display: inline-block; +} + +.navbar-top-links li:last-child { + margin-right: 30px; +} + +body.body-small .navbar-top-links li:last-child { + margin-right: 10px; +} + +.navbar-top-links li a { + padding: 20px 10px; + min-height: 50px; +} + +.dropdown-menu { + border: medium none; + display: none; + float: left; + font-size: 12px; + left: 0; + list-style: none outside none; + padding: 0; + position: absolute; + text-shadow: none; + top: 100%; + z-index: 1000; + border-radius: 0; + box-shadow: 0 0 3px rgba(86, 96, 117, 0.3); +} + +.dropdown-menu > li > a { + border-radius: 3px; + color: inherit; + line-height: 25px; + margin: 4px; + text-align: left; + font-weight: normal; +} + +.dropdown-menu > li > a.font-bold { + font-weight: 600; +} + +.navbar-top-links .dropdown-menu li { + display: block; +} + +.navbar-top-links .dropdown-menu li:last-child { + margin-right: 0; +} + +.navbar-top-links .dropdown-menu li a { + padding: 3px 20px; + min-height: 0; +} + +.navbar-top-links .dropdown-menu li a div { + white-space: normal; +} + +.navbar-top-links .dropdown-messages, +.navbar-top-links .dropdown-tasks, +.navbar-top-links .dropdown-alerts { + width: 310px; + min-width: 0; +} + +.navbar-top-links .dropdown-messages { + margin-left: 5px; +} + +.navbar-top-links .dropdown-tasks { + margin-left: -59px; +} + +.navbar-top-links .dropdown-alerts { + margin-left: -123px; +} + +.navbar-top-links .dropdown-user { + right: 0; + left: auto; +} + +.dropdown-messages, +.dropdown-alerts { + padding: 10px 10px 10px 10px; +} + +.dropdown-messages li a, +.dropdown-alerts li a { + font-size: 12px; +} + +.dropdown-messages li em, +.dropdown-alerts li em { + font-size: 10px; +} + +.nav.navbar-top-links .dropdown-alerts a { + font-size: 12px; +} + +.nav-header { + padding: 33px 25px; + background: url("patterns/header-profile.png") no-repeat; +} + +.pace-done .nav-header { + -webkit-transition: all 0.5s; + transition: all 0.5s; +} + +.nav > li.active { + border-left: 4px solid #19aa8d; + background: #293846; +} + +.nav.nav-second-level > li.active { + border: none; +} + +.nav.nav-second-level.collapse[style] { + height: auto !important; +} + +.nav-header a { + color: #DFE4ED; +} + +.nav-header .text-muted { + color: #8095a8; +} + +.minimalize-styl-2 { + padding: 4px 12px; + margin: 14px 5px 5px 20px; + font-size: 14px; + float: left; +} + +.navbar-form-custom { + float: left; + height: 50px; + padding: 0; + width: 200px; + display: inline-table; +} + +.navbar-form-custom .form-group { + margin-bottom: 0; +} + +.nav.navbar-top-links a { + font-size: 14px; +} + +.navbar-form-custom .form-control { + background: none repeat scroll 0 0 rgba(0, 0, 0, 0); + border: medium none; + font-size: 14px; + height: 60px; + margin: 0; + z-index: 2000; +} + +.count-info .label { + line-height: 12px; + padding: 1px 5px; + position: absolute; + right: 6px; + top: 12px; +} + +.arrow { + float: right; + margin-top: 2px; +} + +.fa.arrow:before { + content: "\f104"; +} + +.active > a > .fa.arrow:before { + content: "\f107"; +} + +.nav-second-level li, +.nav-third-level li { + border-bottom: none !important; +} + +.nav-second-level li a { + padding: 7px 15px 7px 10px; + padding-left: 52px; +} + +.nav-third-level li a { + padding-left: 62px; +} + +.nav-second-level li:last-child { + margin-bottom: 10px; +} + +body:not(.fixed-sidebar):not(.canvas-menu).mini-navbar .nav li:hover > .nav-second-level, +.mini-navbar .nav li:focus > .nav-second-level { + display: block; + border-radius: 0 2px 2px 0; + min-width: 140px; + height: auto; +} + +body.mini-navbar .navbar-default .nav > li > .nav-second-level li a { + font-size: 12px; + border-radius: 0 2px 2px 0; +} + +.fixed-nav .slimScrollDiv #side-menu { + padding-bottom: 60px; + position: relative; +} + +.slimScrollDiv >* { + overflow: hidden; +} + +.mini-navbar .nav-second-level li a { + padding: 10px 10px 10px 15px; +} + +.canvas-menu.mini-navbar .nav-second-level { + background: #293846; +} + +.mini-navbar li.active .nav-second-level { + left: 65px; +} + +.navbar-default .special_link a { + background: #1ab394; + color: white; +} + +.navbar-default .special_link a:hover { + background: #17987e !important; + color: white; +} + +.navbar-default .special_link a span.label { + background: #fff; + color: #1ab394; +} + +.navbar-default .landing_link a { + background: #1cc09f; + color: white; +} + +.navbar-default .landing_link a:hover { + background: #1ab394 !important; + color: white; +} + +.navbar-default .landing_link a span.label { + background: #fff; + color: #1cc09f; +} + +.logo-element { + text-align: center; + font-size: 18px; + font-weight: 600; + color: white; + display: none; + padding: 18px 0; +} + +.pace-done .navbar-static-side, +.pace-done .nav-header, +.pace-done li.active, +.pace-done #page-wrapper, +.pace-done .footer { + -webkit-transition: all 0.5s; + transition: all 0.5s; +} + +.navbar-fixed-top { + background: #fff; + -webkit-transition-duration: 0.5s; + transition-duration: 0.5s; + z-index: 2030; +} + +.navbar-fixed-top, +.navbar-static-top { + background: #f3f3f4; +} + +.fixed-nav #wrapper { + padding-top: 60px; + box-sizing: border-box; +} + +.fixed-nav .minimalize-styl-2 { + margin: 14px 5px 5px 15px; +} + +.body-small .navbar-fixed-top { + margin-left: 0px; +} + +body.mini-navbar .navbar-static-side { + width: 70px; +} + +body.mini-navbar .profile-element, +body.mini-navbar .nav-label, +body.mini-navbar .navbar-default .nav li a span { + display: none; +} + +body.canvas-menu .profile-element { + display: block; +} + +body:not(.fixed-sidebar):not(.canvas-menu).mini-navbar .nav-second-level { + display: none; +} + +body.mini-navbar .navbar-default .nav > li > a { + font-size: 16px; +} + +body.mini-navbar .logo-element { + display: block; +} + +body.canvas-menu .logo-element { + display: none; +} + +body.mini-navbar .nav-header { + padding: 0; + background-color: #1ab394; +} + +body.canvas-menu .nav-header { + padding: 33px 25px; +} + +body.mini-navbar #page-wrapper { + margin: 0 0 0 70px; +} + +body.canvas-menu.mini-navbar #page-wrapper, +body.canvas-menu.mini-navbar .footer { + margin: 0 0 0 0; +} + +body.fixed-sidebar .navbar-static-side, +body.canvas-menu .navbar-static-side { + position: fixed; + width: 220px; + z-index: 2001; + height: 100%; +} + +body.fixed-sidebar.mini-navbar .navbar-static-side { + width: 70px; +} + +body.fixed-sidebar.mini-navbar #page-wrapper { + margin: 0 0 0 70px; +} + +body.body-small.fixed-sidebar.mini-navbar #page-wrapper { + margin: 0 0 0 70px; +} + +body.body-small.fixed-sidebar.mini-navbar .navbar-static-side { + width: 70px; +} + +.fixed-sidebar.mini-navbar .nav li> .nav-second-level { + display: none; +} + +.fixed-sidebar.mini-navbar .nav li.active { + border-left-width: 0; +} + +.fixed-sidebar.mini-navbar .nav li:hover > .nav-second-level, +.canvas-menu.mini-navbar .nav li:hover > .nav-second-level { + position: absolute; + left: 70px; + top: 0px; + background-color: #2f4050; + padding: 10px 10px 0 10px; + font-size: 12px; + display: block; + min-width: 140px; + border-radius: 2px; +} + +body.fixed-sidebar.mini-navbar .navbar-default .nav > li > .nav-second-level li a { + font-size: 12px; + border-radius: 3px; +} + +body.canvas-menu.mini-navbar .navbar-default .nav > li > .nav-second-level li a { + font-size: 13px; + border-radius: 3px; +} + +.fixed-sidebar.mini-navbar .nav-second-level li a, +.canvas-menu.mini-navbar .nav-second-level li a { + padding: 10px 10px 10px 15px; +} + +.fixed-sidebar.mini-navbar .nav-second-level, +.canvas-menu.mini-navbar .nav-second-level { + position: relative; + padding: 0; + font-size: 13px; +} + +.fixed-sidebar.mini-navbar li.active .nav-second-level, +.canvas-menu.mini-navbar li.active .nav-second-level { + left: 0px; +} + +body.canvas-menu nav.navbar-static-side { + z-index: 2001; + background: #2f4050; + height: 100%; + position: fixed; + display: none; +} + +body.canvas-menu.mini-navbar nav.navbar-static-side { + display: block; + width: 70px; +} + +.top-navigation #page-wrapper { + margin-left: 0; +} + +.top-navigation .navbar-nav .dropdown-menu > .active > a { + background: white; + color: #1ab394; + font-weight: bold; +} + +.white-bg .navbar-fixed-top, +.white-bg .navbar-static-top { + background: #fff; +} + +.top-navigation .navbar { + margin-bottom: 0; +} + +.top-navigation .nav > li > a { + padding: 15px 20px; + color: #676a6c; +} + +.top-navigation .nav > li a:hover, +.top-navigation .nav > li a:focus { + background: #fff; + color: #1ab394; +} + +.top-navigation .nav > li.active { + background: #fff; + border: none; +} + +.top-navigation .nav > li.active > a { + color: #1ab394; +} + +.top-navigation .navbar-right { + padding-right: 10px; +} + +.top-navigation .navbar-nav .dropdown-menu { + box-shadow: none; + border: 1px solid #e7eaec; +} + +.top-navigation .dropdown-menu > li > a { + margin: 0; + padding: 7px 20px; +} + +.navbar .dropdown-menu { + margin-top: 0px; +} + +.top-navigation .navbar-brand { + background: #1ab394; + color: #fff; + padding: 15px 25px; +} + +.top-navigation .navbar-top-links li:last-child { + margin-right: 0; +} + +.top-navigation.mini-navbar #page-wrapper, +.top-navigation.body-small.fixed-sidebar.mini-navbar #page-wrapper, +.mini-navbar .top-navigation #page-wrapper, +.body-small.fixed-sidebar.mini-navbar .top-navigation #page-wrapper, +.canvas-menu #page-wrapper { + margin: 0; +} + +.top-navigation.fixed-nav #wrapper, +.fixed-nav #wrapper.top-navigation { + margin-top: 50px; +} + +.top-navigation .footer.fixed { + margin-left: 0 !important; +} + +.top-navigation .wrapper.wrapper-content { + padding: 40px; +} + +.top-navigation.body-small .wrapper.wrapper-content, +.body-small .top-navigation .wrapper.wrapper-content { + padding: 40px 0px 40px 0px; +} + +.navbar-toggle { + background-color: #1ab394; + color: #fff; + padding: 6px 12px; + font-size: 14px; +} + +.top-navigation .navbar-nav .open .dropdown-menu > li > a, +.top-navigation .navbar-nav .open .dropdown-menu .dropdown-header { + padding: 10px 15px 10px 20px; +} + +@media (max-width: 768px) { + .top-navigation .navbar-header { + display: block; + float: none; + } +} + +.menu-visible-lg, +.menu-visible-md { + display: none !important; +} + +@media (min-width: 1200px) { + .menu-visible-lg { + display: block !important; + } +} + +@media (min-width: 992px) { + .menu-visible-md { + display: block !important; + } +} + +@media (max-width: 767px) { + .menu-visible-md { + display: block !important; + } + .menu-visible-lg { + display: block !important; + } +} + +.btn { + border-radius: 3px; +} + +.float-e-margins .btn { + margin-bottom: 5px; +} + +.btn-w-m { + min-width: 120px; +} + +.btn-primary.btn-outline { + color: #1ab394; +} + +.btn-success.btn-outline { + color: #1c84c6; +} + +.btn-info.btn-outline { + color: #23c6c8; +} + +.btn-warning.btn-outline { + color: #f8ac59; +} + +.btn-danger.btn-outline { + color: #ed5565; +} + +.btn-primary.btn-outline:hover, +.btn-success.btn-outline:hover, +.btn-info.btn-outline:hover, +.btn-warning.btn-outline:hover, +.btn-danger.btn-outline:hover { + color: #fff; +} + +.btn-primary { + background-color: #1ab394; + border-color: #1ab394; + color: #FFFFFF; +} + +.btn-primary:hover, +.btn-primary:focus, +.btn-primary:active, +.btn-primary.active, +.open .dropdown-toggle.btn-primary { + background-color: #18a689; + border-color: #18a689; + color: #FFFFFF; +} + +.btn-primary:active, +.btn-primary.active, +.open .dropdown-toggle.btn-primary { + background-image: none; +} + +.btn-primary.disabled, +.btn-primary.disabled:hover, +.btn-primary.disabled:focus, +.btn-primary.disabled:active, +.btn-primary.disabled.active, +.btn-primary[disabled], +.btn-primary[disabled]:hover, +.btn-primary[disabled]:focus, +.btn-primary[disabled]:active, +.btn-primary.active[disabled], +fieldset[disabled] .btn-primary, +fieldset[disabled] .btn-primary:hover, +fieldset[disabled] .btn-primary:focus, +fieldset[disabled] .btn-primary:active, +fieldset[disabled] .btn-primary.active { + background-color: #1dc5a3; + border-color: #1dc5a3; +} + +.btn-success { + background-color: #1c84c6; + border-color: #1c84c6; + color: #FFFFFF; +} + +.btn-success:hover, +.btn-success:focus, +.btn-success:active, +.btn-success.active, +.open .dropdown-toggle.btn-success { + background-color: #1a7bb9; + border-color: #1a7bb9; + color: #FFFFFF; +} + +.btn-success:active, +.btn-success.active, +.open .dropdown-toggle.btn-success { + background-image: none; +} + +.btn-success.disabled, +.btn-success.disabled:hover, +.btn-success.disabled:focus, +.btn-success.disabled:active, +.btn-success.disabled.active, +.btn-success[disabled], +.btn-success[disabled]:hover, +.btn-success[disabled]:focus, +.btn-success[disabled]:active, +.btn-success.active[disabled], +fieldset[disabled] .btn-success, +fieldset[disabled] .btn-success:hover, +fieldset[disabled] .btn-success:focus, +fieldset[disabled] .btn-success:active, +fieldset[disabled] .btn-success.active { + background-color: #1f90d8; + border-color: #1f90d8; +} + +.btn-info { + background-color: #23c6c8; + border-color: #23c6c8; + color: #FFFFFF; +} + +.btn-info:hover, +.btn-info:focus, +.btn-info:active, +.btn-info.active, +.open .dropdown-toggle.btn-info { + background-color: #21b9bb; + border-color: #21b9bb; + color: #FFFFFF; +} + +.btn-info:active, +.btn-info.active, +.open .dropdown-toggle.btn-info { + background-image: none; +} + +.btn-info.disabled, +.btn-info.disabled:hover, +.btn-info.disabled:focus, +.btn-info.disabled:active, +.btn-info.disabled.active, +.btn-info[disabled], +.btn-info[disabled]:hover, +.btn-info[disabled]:focus, +.btn-info[disabled]:active, +.btn-info.active[disabled], +fieldset[disabled] .btn-info, +fieldset[disabled] .btn-info:hover, +fieldset[disabled] .btn-info:focus, +fieldset[disabled] .btn-info:active, +fieldset[disabled] .btn-info.active { + background-color: #26d7d9; + border-color: #26d7d9; +} + +.btn-default { + background-color: #c2c2c2; + border-color: #c2c2c2; + color: #FFFFFF; +} + +.btn-default:hover, +.btn-default:focus, +.btn-default:active, +.btn-default.active, +.open .dropdown-toggle.btn-default { + background-color: #bababa; + border-color: #bababa; + color: #FFFFFF; +} + +.btn-default:active, +.btn-default.active, +.open .dropdown-toggle.btn-default { + background-image: none; +} + +.btn-default.disabled, +.btn-default.disabled:hover, +.btn-default.disabled:focus, +.btn-default.disabled:active, +.btn-default.disabled.active, +.btn-default[disabled], +.btn-default[disabled]:hover, +.btn-default[disabled]:focus, +.btn-default[disabled]:active, +.btn-default.active[disabled], +fieldset[disabled] .btn-default, +fieldset[disabled] .btn-default:hover, +fieldset[disabled] .btn-default:focus, +fieldset[disabled] .btn-default:active, +fieldset[disabled] .btn-default.active { + background-color: #cccccc; + border-color: #cccccc; +} + +.btn-warning { + background-color: #f8ac59; + border-color: #f8ac59; + color: #FFFFFF; +} + +.btn-warning:hover, +.btn-warning:focus, +.btn-warning:active, +.btn-warning.active, +.open .dropdown-toggle.btn-warning { + background-color: #f7a54a; + border-color: #f7a54a; + color: #FFFFFF; +} + +.btn-warning:active, +.btn-warning.active, +.open .dropdown-toggle.btn-warning { + background-image: none; +} + +.btn-warning.disabled, +.btn-warning.disabled:hover, +.btn-warning.disabled:focus, +.btn-warning.disabled:active, +.btn-warning.disabled.active, +.btn-warning[disabled], +.btn-warning[disabled]:hover, +.btn-warning[disabled]:focus, +.btn-warning[disabled]:active, +.btn-warning.active[disabled], +fieldset[disabled] .btn-warning, +fieldset[disabled] .btn-warning:hover, +fieldset[disabled] .btn-warning:focus, +fieldset[disabled] .btn-warning:active, +fieldset[disabled] .btn-warning.active { + background-color: #f9b66d; + border-color: #f9b66d; +} + +.btn-danger { + background-color: #ed5565; + border-color: #ed5565; + color: #FFFFFF; +} + +.btn-danger:hover, +.btn-danger:focus, +.btn-danger:active, +.btn-danger.active, +.open .dropdown-toggle.btn-danger { + background-color: #ec4758; + border-color: #ec4758; + color: #FFFFFF; +} + +.btn-danger:active, +.btn-danger.active, +.open .dropdown-toggle.btn-danger { + background-image: none; +} + +.btn-danger.disabled, +.btn-danger.disabled:hover, +.btn-danger.disabled:focus, +.btn-danger.disabled:active, +.btn-danger.disabled.active, +.btn-danger[disabled], +.btn-danger[disabled]:hover, +.btn-danger[disabled]:focus, +.btn-danger[disabled]:active, +.btn-danger.active[disabled], +fieldset[disabled] .btn-danger, +fieldset[disabled] .btn-danger:hover, +fieldset[disabled] .btn-danger:focus, +fieldset[disabled] .btn-danger:active, +fieldset[disabled] .btn-danger.active { + background-color: #ef6776; + border-color: #ef6776; +} + +.btn-link { + color: inherit; +} + +.btn-link:hover, +.btn-link:focus, +.btn-link:active, +.btn-link.active, +.open .dropdown-toggle.btn-link { + color: #1ab394; + text-decoration: none; +} + +.btn-link:active, +.btn-link.active, +.open .dropdown-toggle.btn-link { + background-image: none; +} + +.btn-link.disabled, +.btn-link.disabled:hover, +.btn-link.disabled:focus, +.btn-link.disabled:active, +.btn-link.disabled.active, +.btn-link[disabled], +.btn-link[disabled]:hover, +.btn-link[disabled]:focus, +.btn-link[disabled]:active, +.btn-link.active[disabled], +fieldset[disabled] .btn-link, +fieldset[disabled] .btn-link:hover, +fieldset[disabled] .btn-link:focus, +fieldset[disabled] .btn-link:active, +fieldset[disabled] .btn-link.active { + color: #cacaca; +} + +.btn-white { + color: inherit; + background: white; + border: 1px solid #e7eaec; +} + +.btn-white:hover, +.btn-white:focus, +.btn-white:active, +.btn-white.active, +.open .dropdown-toggle.btn-white { + color: inherit; + border: 1px solid #d2d2d2; +} + +.btn-white:active, +.btn-white.active { + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15) inset; +} + +.btn-white:active, +.btn-white.active, +.open .dropdown-toggle.btn-white { + background-image: none; +} + +.btn-white.disabled, +.btn-white.disabled:hover, +.btn-white.disabled:focus, +.btn-white.disabled:active, +.btn-white.disabled.active, +.btn-white[disabled], +.btn-white[disabled]:hover, +.btn-white[disabled]:focus, +.btn-white[disabled]:active, +.btn-white.active[disabled], +fieldset[disabled] .btn-white, +fieldset[disabled] .btn-white:hover, +fieldset[disabled] .btn-white:focus, +fieldset[disabled] .btn-white:active, +fieldset[disabled] .btn-white.active { + color: #cacaca; +} + +.form-control, +.form-control:focus, +.has-error .form-control:focus, +.has-success .form-control:focus, +.has-warning .form-control:focus, +.navbar-collapse, +.navbar-form, +.navbar-form-custom .form-control:focus, +.navbar-form-custom .form-control:hover, +.open .btn.dropdown-toggle, +.panel, +.popover, +.progress, +.progress-bar { + box-shadow: none; +} + +.btn-outline { + color: inherit; + background-color: transparent; + -webkit-transition: all .5s; + transition: all .5s; +} + +.btn-rounded { + border-radius: 50px; +} + +.btn-large-dim { + width: 90px; + height: 90px; + font-size: 42px; +} + +button.dim { + display: inline-block; + color: #fff; + text-decoration: none; + text-transform: uppercase; + text-align: center; + padding-top: 6px; + margin-right: 10px; + position: relative; + cursor: pointer; + border-radius: 5px; + font-weight: 600; + margin-bottom: 20px !important; +} + +button.dim:active { + top: 3px; +} + +button.btn-primary.dim { + box-shadow: inset 0px 0px 0px #16987e, 0px 5px 0px 0px #16987e, 0px 10px 5px #999999; +} + +button.btn-primary.dim:active { + box-shadow: inset 0px 0px 0px #16987e, 0px 2px 0px 0px #16987e, 0px 5px 3px #999999; +} + +button.btn-default.dim { + box-shadow: inset 0px 0px 0px #b3b3b3, 0px 5px 0px 0px #b3b3b3, 0px 10px 5px #999999; +} + +button.btn-default.dim:active { + box-shadow: inset 0px 0px 0px #b3b3b3, 0px 2px 0px 0px #b3b3b3, 0px 5px 3px #999999; +} + +button.btn-warning.dim { + box-shadow: inset 0px 0px 0px #f79d3c, 0px 5px 0px 0px #f79d3c, 0px 10px 5px #999999; +} + +button.btn-warning.dim:active { + box-shadow: inset 0px 0px 0px #f79d3c, 0px 2px 0px 0px #f79d3c, 0px 5px 3px #999999; +} + +button.btn-info.dim { + box-shadow: inset 0px 0px 0px #1eacae, 0px 5px 0px 0px #1eacae, 0px 10px 5px #999999; +} + +button.btn-info.dim:active { + box-shadow: inset 0px 0px 0px #1eacae, 0px 2px 0px 0px #1eacae, 0px 5px 3px #999999; +} + +button.btn-success.dim { + box-shadow: inset 0px 0px 0px #1872ab, 0px 5px 0px 0px #1872ab, 0px 10px 5px #999999; +} + +button.btn-success.dim:active { + box-shadow: inset 0px 0px 0px #1872ab, 0px 2px 0px 0px #1872ab, 0px 5px 3px #999999; +} + +button.btn-danger.dim { + box-shadow: inset 0px 0px 0px #ea394c, 0px 5px 0px 0px #ea394c, 0px 10px 5px #999999; +} + +button.btn-danger.dim:active { + box-shadow: inset 0px 0px 0px #ea394c, 0px 2px 0px 0px #ea394c, 0px 5px 3px #999999; +} + +button.dim:before { + font-size: 50px; + line-height: 1em; + font-weight: normal; + color: #fff; + display: block; + padding-top: 10px; +} + +button.dim:active:before { + top: 7px; + font-size: 50px; +} + +.label { + background-color: #d1dade; + color: #5e5e5e; + font-size: 10px; + font-weight: 600; + padding: 3px 8px; + text-shadow: none; +} + +.badge { + background-color: #d1dade; + color: #5e5e5e; + font-size: 11px; + font-weight: 600; + padding-bottom: 4px; + padding-left: 6px; + padding-right: 6px; + text-shadow: none; +} + +.label-primary, +.badge-primary { + background-color: #1ab394; + color: #FFFFFF; +} + +.label-success, +.badge-success { + background-color: #1c84c6; + color: #FFFFFF; +} + +.label-warning, +.badge-warning { + background-color: #f8ac59; + color: #FFFFFF; +} + +.label-warning-light, +.badge-warning-light { + background-color: #f8ac59; + color: #ffffff; +} + +.label-danger, +.badge-danger { + background-color: #ed5565; + color: #FFFFFF; +} + +.label-info, +.badge-info { + background-color: #23c6c8; + color: #FFFFFF; +} + +.label-inverse, +.badge-inverse { + background-color: #262626; + color: #FFFFFF; +} + +.label-white, +.badge-white { + background-color: #FFFFFF; + color: #5E5E5E; +} + +.label-white, +.badge-disable { + background-color: #2A2E36; + color: #8B91A0; +} + + +/* TOOGLE SWICH */ + +.onoffswitch { + position: relative; + width: 64px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} + +.onoffswitch-checkbox { + display: none; +} + +.onoffswitch-label { + display: block; + overflow: hidden; + cursor: pointer; + border: 2px solid #1ab394; + border-radius: 2px; +} + +.onoffswitch-inner { + width: 200%; + margin-left: -100%; + -webkit-transition: margin 0.3s ease-in 0s; + transition: margin 0.3s ease-in 0s; +} + +.onoffswitch-inner:before, +.onoffswitch-inner:after { + float: left; + width: 50%; + height: 20px; + padding: 0; + line-height: 20px; + font-size: 12px; + color: white; + font-family: Trebuchet, Arial, sans-serif; + font-weight: bold; + box-sizing: border-box; +} + +.onoffswitch-inner:before { + content: "ON"; + padding-left: 10px; + background-color: #1ab394; + color: #FFFFFF; +} + +.onoffswitch-inner:after { + content: "OFF"; + padding-right: 10px; + background-color: #FFFFFF; + color: #999999; + text-align: right; +} + +.onoffswitch-switch { + width: 20px; + margin: 0px; + background: #FFFFFF; + border: 2px solid #1ab394; + border-radius: 2px; + position: absolute; + top: 0; + bottom: 0; + right: 44px; + -webkit-transition: all 0.3s ease-in 0s; + transition: all 0.3s ease-in 0s; +} + +.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner { + margin-left: 0; +} + +.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch { + right: 0px; +} + + +/* CHOSEN PLUGIN */ + +.chosen-container-single .chosen-single { + background: #ffffff; + box-shadow: none; + -moz-box-sizing: border-box; + background-color: #FFFFFF; + border: 1px solid #CBD5DD; + border-radius: 2px; + cursor: text; + height: auto !important; + margin: 0; + min-height: 30px; + overflow: hidden; + padding: 4px 12px; + position: relative; + width: 100%; +} + +.chosen-container-multi .chosen-choices li.search-choice { + background: #f1f1f1; + border: 1px solid #ededed; + border-radius: 2px; + box-shadow: none; + color: #333333; + cursor: default; + line-height: 13px; + margin: 3px 0 3px 5px; + padding: 3px 20px 3px 5px; + position: relative; +} + + +/* PAGINATIN */ + +.pagination > .active > a, +.pagination > .active > span, +.pagination > .active > a:hover, +.pagination > .active > span:hover, +.pagination > .active > a:focus, +.pagination > .active > span:focus { + background-color: #f4f4f4; + border-color: #DDDDDD; + color: inherit; + cursor: default; + z-index: 2; +} + +.pagination > li > a, +.pagination > li > span { + background-color: #FFFFFF; + border: 1px solid #DDDDDD; + color: inherit; + float: left; + line-height: 1.42857; + margin-left: -1px; + padding: 4px 10px; + position: relative; + text-decoration: none; +} + + +/* TOOLTIPS */ + +.tooltip-inner { + background-color: #2F4050; +} + +.tooltip.top .tooltip-arrow { + border-top-color: #2F4050; +} + +.tooltip.right .tooltip-arrow { + border-right-color: #2F4050; +} + +.tooltip.bottom .tooltip-arrow { + border-bottom-color: #2F4050; +} + +.tooltip.left .tooltip-arrow { + border-left-color: #2F4050; +} + + +/* EASY PIE CHART*/ + +.easypiechart { + position: relative; + text-align: center; +} + +.easypiechart .h2 { + margin-left: 10px; + margin-top: 10px; + display: inline-block; +} + +.easypiechart canvas { + top: 0; + left: 0; +} + +.easypiechart .easypie-text { + line-height: 1; + position: absolute; + top: 33px; + width: 100%; + z-index: 1; +} + +.easypiechart img { + margin-top: -4px; +} + +.jqstooltip { + box-sizing: content-box; +} + + +/* FULLCALENDAR */ + +.fc-state-default { + background-color: #ffffff; + background-image: none; + background-repeat: repeat-x; + box-shadow: none; + color: #333333; + text-shadow: none; +} + +.fc-state-default { + border: 1px solid; +} + +.fc-button { + color: inherit; + border: 1px solid #e7eaec; + cursor: pointer; + display: inline-block; + height: 1.9em; + line-height: 1.9em; + overflow: hidden; + padding: 0 0.6em; + position: relative; + white-space: nowrap; +} + +.fc-state-active { + background-color: #1ab394; + border-color: #1ab394; + color: #ffffff; +} + +.fc-header-title h2 { + font-size: 16px; + font-weight: 600; + color: inherit; +} + +.fc-content .fc-widget-header, +.fc-content .fc-widget-content { + border-color: #e7eaec; + font-weight: normal; +} + +.fc-border-separate tbody { + background-color: #F8F8F8; +} + +.fc-state-highlight { + background: none repeat scroll 0 0 #FCF8E3; +} + +.external-event { + padding: 5px 10px; + border-radius: 2px; + cursor: pointer; + margin-bottom: 5px; +} + +.fc-ltr .fc-event-hori.fc-event-end, +.fc-rtl .fc-event-hori.fc-event-start { + border-radius: 2px; +} + +.fc-event, +.fc-agenda .fc-event-time, +.fc-event a { + padding: 4px 6px; + background-color: #1ab394; + /* background color */ + border-color: #1ab394; + /* border color */ +} + +.fc-event-time, +.fc-event-title { + color: #717171; + padding: 0 1px; +} + +.ui-calendar .fc-event-time, +.ui-calendar .fc-event-title { + color: #fff; +} + + +/* Chat */ + +.chat-activity-list .chat-element { + border-bottom: 1px solid #e7eaec; +} + +.chat-element:first-child { + margin-top: 0; +} + +.chat-element { + padding-bottom: 15px; +} + +.chat-element, +.chat-element .media { + margin-top: 15px; +} + +.chat-element, +.media-body { + overflow: hidden; +} + +.media-body { + display: block; + width: auto; +} + +.chat-element > .pull-left { + margin-right: 10px; +} + +.chat-element img.img-circle, +.dropdown-messages-box img.img-circle { + width: 38px; + height: 38px; +} + +.chat-element .well { + border: 1px solid #e7eaec; + box-shadow: none; + margin-top: 10px; + margin-bottom: 5px; + padding: 10px 20px; + font-size: 11px; + line-height: 16px; +} + +.chat-element .actions { + margin-top: 10px; +} + +.chat-element .photos { + margin: 10px 0; +} + +.right.chat-element > .pull-right { + margin-left: 10px; +} + +.chat-photo { + max-height: 180px; + border-radius: 4px; + overflow: hidden; + margin-right: 10px; + margin-bottom: 10px; +} + +.chat { + margin: 0; + padding: 0; + list-style: none; +} + +.chat li { + margin-bottom: 10px; + padding-bottom: 5px; + border-bottom: 1px dotted #B3A9A9; +} + +.chat li.left .chat-body { + margin-left: 60px; +} + +.chat li.right .chat-body { + margin-right: 60px; +} + +.chat li .chat-body p { + margin: 0; + color: #777777; +} + +.panel .slidedown .glyphicon, +.chat .glyphicon { + margin-right: 5px; +} + +.chat-panel .panel-body { + height: 350px; + overflow-y: scroll; +} + + +/* LIST GROUP */ + +a.list-group-item.active, +a.list-group-item.active:hover, +a.list-group-item.active:focus { + background-color: #1ab394; + border-color: #1ab394; + color: #FFFFFF; + z-index: 2; +} + +.list-group-item-heading { + margin-top: 10px; +} + +.list-group-item-text { + margin: 0 0 10px; + color: inherit; + font-size: 12px; + line-height: inherit; +} + +.no-padding .list-group-item { + border-left: none; + border-right: none; + border-bottom: none; +} + +.no-padding .list-group-item:first-child { + border-left: none; + border-right: none; + border-bottom: none; + border-top: none; +} + +.no-padding .list-group { + margin-bottom: 0; +} + +.list-group-item { + background-color: inherit; + border: 1px solid #e7eaec; + display: block; + margin-bottom: -1px; + padding: 10px 15px; + position: relative; +} + +.elements-list .list-group-item { + border-left: none; + border-right: none; + /*border-top: none;*/ + padding: 15px 25px; +} + +.elements-list .list-group-item:first-child { + border-left: none; + border-right: none; + border-top: none !important; +} + +.elements-list .list-group { + margin-bottom: 0; +} + +.elements-list a { + color: inherit; +} + +.elements-list .list-group-item.active, +.elements-list .list-group-item:hover { + background: #f3f3f4; + color: inherit; + border-color: #e7eaec; + /*border-bottom: 1px solid #e7eaec;*/ + /*border-top: 1px solid #e7eaec;*/ + border-radius: 0; +} + +.elements-list li.active { + -webkit-transition: none; + transition: none; +} + +.element-detail-box { + padding: 25px; +} + + +/* FLOT CHART */ + +.flot-chart { + display: block; + height: 200px; +} + +.widget .flot-chart.dashboard-chart { + display: block; + height: 120px; + margin-top: 40px; +} + +.flot-chart.dashboard-chart { + display: block; + height: 180px; + margin-top: 40px; +} + +.flot-chart-content { + width: 100%; + height: 100%; +} + +.flot-chart-pie-content { + width: 200px; + height: 200px; + margin: auto; +} + +.jqstooltip { + position: absolute; + display: block; + left: 0px; + top: 0px; + visibility: hidden; + background: #2b303a; + background-color: rgba(43, 48, 58, 0.8); + color: white; + text-align: left; + white-space: nowrap; + z-index: 10000; + padding: 5px 5px 5px 5px; + min-height: 22px; + border-radius: 3px; +} + +.jqsfield { + color: white; + text-align: left; +} + +.h-200 { + min-height: 200px; +} + +.legendLabel { + padding-left: 5px; +} + +.stat-list li:first-child { + margin-top: 0; +} + +.stat-list { + list-style: none; + padding: 0; + margin: 0; +} + +.stat-percent { + float: right; +} + +.stat-list li { + margin-top: 15px; + position: relative; +} + + +/* DATATABLES */ + +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + background: transparent; +} + +table.dataTable thead .sorting_asc:after { + float: right; + font-family: fontawesome; +} + +table.dataTable thead .sorting_desc:after { + content: "\f0dd"; + float: right; + font-family: fontawesome; +} + +table.dataTable thead .sorting:after { + content: "\f0dc"; + float: right; + font-family: fontawesome; + color: rgba(50, 50, 50, 0.5); +} + +.dataTables_wrapper { + padding-bottom: 30px; +} + + +/* CIRCLE */ + +.img-circle { + border-radius: 50%; +} + +.btn-circle { + width: 30px; + height: 30px; + padding: 6px 0; + border-radius: 15px; + text-align: center; + font-size: 12px; + line-height: 1.428571429; +} + +.btn-circle.btn-lg { + width: 50px; + height: 50px; + padding: 10px 16px; + border-radius: 25px; + font-size: 18px; + line-height: 1.33; +} + +.btn-circle.btn-xl { + width: 70px; + height: 70px; + padding: 10px 16px; + border-radius: 35px; + font-size: 24px; + line-height: 1.33; +} + +.show-grid [class^="col-"] { + padding-top: 10px; + padding-bottom: 10px; + border: 1px solid #ddd; + background-color: #eee !important; +} + +.show-grid { + margin: 15px 0; +} + + +/* ANIMATION */ + +.css-animation-box h1 { + font-size: 44px; +} + +.animation-efect-links a { + padding: 4px 6px; + font-size: 12px; +} + +#animation_box { + background-color: #f9f8f8; + border-radius: 16px; + width: 80%; + margin: 0 auto; + padding-top: 80px; +} + +.animation-text-box { + position: absolute; + margin-top: 40px; + left: 50%; + margin-left: -100px; + width: 200px; +} + +.animation-text-info { + position: absolute; + margin-top: -60px; + left: 50%; + margin-left: -100px; + width: 200px; + font-size: 10px; +} + +.animation-text-box h2 { + font-size: 54px; + font-weight: 600; + margin-bottom: 5px; +} + +.animation-text-box p { + font-size: 12px; + text-transform: uppercase; +} + + +/* PEACE */ + +.pace { + -webkit-pointer-events: none; + pointer-events: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.pace-inactive { + display: none; +} + +.pace .pace-progress { + background: #1ab394; + position: fixed; + z-index: 2000; + top: 0; + width: 100%; + height: 2px; +} + +.pace-inactive { + display: none; +} + + +/* WIDGETS */ + +.widget { + border-radius: 5px; + padding: 15px 20px; + margin-bottom: 10px; + margin-top: 10px; +} + +.widget.style1 h2 { + font-size: 30px; +} + +.widget h2, +.widget h3 { + margin-top: 5px; + margin-bottom: 0; +} + +.widget-text-box { + padding: 20px; + border: 1px solid #e7eaec; + background: #ffffff; +} + +.widget-head-color-box { + border-radius: 5px 5px 0px 0px; + margin-top: 10px; +} + +.widget .flot-chart { + height: 100px; +} + +.vertical-align div { + display: inline-block; + vertical-align: middle; +} + +.vertical-align h2, +.vertical-align h3 { + margin: 0; +} + +.todo-list { + list-style: none outside none; + margin: 0; + padding: 0; + font-size: 14px; +} + +.todo-list.small-list { + font-size: 12px; +} + +.todo-list.small-list > li { + background: #f3f3f4; + border-left: none; + border-right: none; + border-radius: 4px; + color: inherit; + margin-bottom: 2px; + padding: 6px 6px 6px 12px; +} + +.todo-list.small-list .btn-xs, +.todo-list.small-list .btn-group-xs > .btn { + border-radius: 5px; + font-size: 10px; + line-height: 1.5; + padding: 1px 2px 1px 5px; +} + +.todo-list > li { + background: #f3f3f4; + border-left: 6px solid #e7eaec; + border-right: 6px solid #e7eaec; + border-radius: 4px; + color: inherit; + margin-bottom: 2px; + padding: 10px; +} + +.todo-list .handle { + cursor: move; + display: inline-block; + font-size: 16px; + margin: 0 5px; +} + +.todo-list > li .label { + font-size: 9px; + margin-left: 10px; +} + +.check-link { + font-size: 16px; +} + +.todo-completed { + text-decoration: line-through; +} + +.geo-statistic h1 { + font-size: 36px; + margin-bottom: 0; +} + +.glyphicon.fa { + font-family: "FontAwesome"; +} + + +/* INPUTS */ + +.inline { + display: inline-block !important; +} + +.input-s-sm { + width: 120px; +} + +.input-s { + width: 200px; +} + +.input-s-lg { + width: 250px; +} + +.i-checks { + padding-left: 0; +} + +.form-control, +.single-line { + background-color: #FFFFFF; + background-image: none; + border: 1px solid #e5e6e7; + border-radius: 1px; + color: inherit; + display: block; + padding: 6px 12px; + -webkit-transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s; + transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s; + width: 100%; + font-size: 14px; +} + +.form-control:focus, +.single-line:focus { + border-color: #1ab394 !important; +} + +.has-success .form-control { + border-color: #1ab394; +} + +.has-warning .form-control { + border-color: #f8ac59; +} + +.has-error .form-control { + border-color: #ed5565; +} + +.has-success .control-label { + color: #1ab394; +} + +.has-warning .control-label { + color: #f8ac59; +} + +.has-error .control-label { + color: #ed5565; +} + +.input-group-addon { + background-color: #fff; + border: 1px solid #E5E6E7; + border-radius: 1px; + color: inherit; + font-size: 14px; + font-weight: 400; + line-height: 1; + padding: 6px 12px; + text-align: center; +} + +.spinner-buttons.input-group-btn .btn-xs { + line-height: 1.13; +} + +.spinner-buttons.input-group-btn { + width: 20%; +} + +.noUi-connect { + background: none repeat scroll 0 0 #1ab394; + box-shadow: none; +} + +.slider_red .noUi-connect { + background: none repeat scroll 0 0 #ed5565; + box-shadow: none; +} + + +/* UI Sortable */ + +.ui-sortable .ibox-title { + cursor: move; +} + +.ui-sortable-placeholder { + border: 1px dashed #cecece !important; + visibility: visible !important; + background: #e7eaec; +} + +.ibox.ui-sortable-placeholder { + margin: 0px 0px 23px !important; +} + + +/* Tabs */ + +.tabs-container .panel-body { + background: #fff; + border: 1px solid #e7eaec; + border-radius: 2px; + padding: 20px; + position: relative; +} + +.tabs-container .nav-tabs > li.active > a, +.tabs-container .nav-tabs > li.active > a:hover, +.tabs-container .nav-tabs > li.active > a:focus { + border: 1px solid #e7eaec; + border-bottom-color: transparent; + background-color: #fff; +} + +.tabs-container .nav-tabs > li { + float: left; + margin-bottom: -1px; +} + +.tabs-container .tab-pane .panel-body { + border-top: none; +} + +.tabs-container .nav-tabs > li.active > a, +.tabs-container .nav-tabs > li.active > a:hover, +.tabs-container .nav-tabs > li.active > a:focus { + border: 1px solid #e7eaec; + border-bottom-color: transparent; +} + +.tabs-container .nav-tabs { + border-bottom: 1px solid #e7eaec; +} + +.tabs-container .tab-pane .panel-body { + border-top: none; +} + +.tabs-container .tabs-left .tab-pane .panel-body, +.tabs-container .tabs-right .tab-pane .panel-body { + border-top: 1px solid #e7eaec; +} + +.tabs-container .nav-tabs > li a:hover { + background: transparent; + border-color: transparent; +} + +.tabs-container .tabs-below > .nav-tabs, +.tabs-container .tabs-right > .nav-tabs, +.tabs-container .tabs-left > .nav-tabs { + border-bottom: 0; +} + +.tabs-container .tabs-left .panel-body { + position: static; +} + +.tabs-container .tabs-left > .nav-tabs, +.tabs-container .tabs-right > .nav-tabs { + width: 20%; +} + +.tabs-container .tabs-left .panel-body { + width: 80%; + margin-left: 20%; +} + +.tabs-container .tabs-right .panel-body { + width: 80%; + margin-right: 20%; +} + +.tabs-container .tab-content > .tab-pane, +.tabs-container .pill-content > .pill-pane { + display: none; +} + +.tabs-container .tab-content > .active, +.tabs-container .pill-content > .active { + display: block; +} + +.tabs-container .tabs-below > .nav-tabs { + border-top: 1px solid #e7eaec; +} + +.tabs-container .tabs-below > .nav-tabs > li { + margin-top: -1px; + margin-bottom: 0; +} + +.tabs-container .tabs-below > .nav-tabs > li > a { + border-radius: 0 0 4px 4px; +} + +.tabs-container .tabs-below > .nav-tabs > li > a:hover, +.tabs-container .tabs-below > .nav-tabs > li > a:focus { + border-top-color: #e7eaec; + border-bottom-color: transparent; +} + +.tabs-container .tabs-left > .nav-tabs > li, +.tabs-container .tabs-right > .nav-tabs > li { + float: none; +} + +.tabs-container .tabs-left > .nav-tabs > li > a, +.tabs-container .tabs-right > .nav-tabs > li > a { + min-width: 74px; + margin-right: 0; + margin-bottom: 3px; +} + +.tabs-container .tabs-left > .nav-tabs { + float: left; + margin-right: 19px; +} + +.tabs-container .tabs-left > .nav-tabs > li > a { + margin-right: -1px; + border-radius: 4px 0 0 4px; +} + +.tabs-container .tabs-left > .nav-tabs .active > a, +.tabs-container .tabs-left > .nav-tabs .active > a:hover, +.tabs-container .tabs-left > .nav-tabs .active > a:focus { + border-color: #e7eaec transparent #e7eaec #e7eaec; + *border-right-color: #ffffff; +} + +.tabs-container .tabs-right > .nav-tabs { + float: right; + margin-left: 19px; +} + +.tabs-container .tabs-right > .nav-tabs > li > a { + margin-left: -1px; + border-radius: 0 4px 4px 0; +} + +.tabs-container .tabs-right > .nav-tabs .active > a, +.tabs-container .tabs-right > .nav-tabs .active > a:hover, +.tabs-container .tabs-right > .nav-tabs .active > a:focus { + border-color: #e7eaec #e7eaec #e7eaec transparent; + *border-left-color: #ffffff; + z-index: 1; +} + + +/* SWITCHES */ + +.onoffswitch { + position: relative; + width: 54px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} + +.onoffswitch-checkbox { + display: none; +} + +.onoffswitch-label { + display: block; + overflow: hidden; + cursor: pointer; + border: 2px solid #1AB394; + border-radius: 3px; +} + +.onoffswitch-inner { + display: block; + width: 200%; + margin-left: -100%; + -webkit-transition: margin 0.3s ease-in 0s; + transition: margin 0.3s ease-in 0s; +} + +.onoffswitch-inner:before, +.onoffswitch-inner:after { + display: block; + float: left; + width: 50%; + height: 16px; + padding: 0; + line-height: 16px; + font-size: 10px; + color: white; + font-family: Trebuchet, Arial, sans-serif; + font-weight: bold; + box-sizing: border-box; +} + +.onoffswitch-inner:before { + content: "ON"; + padding-left: 7px; + background-color: #1AB394; + color: #FFFFFF; +} + +.onoffswitch-inner:after { + content: "OFF"; + padding-right: 7px; + background-color: #FFFFFF; + color: #919191; + text-align: right; +} + +.onoffswitch-switch { + display: block; + width: 18px; + margin: 0px; + background: #FFFFFF; + border: 2px solid #1AB394; + border-radius: 3px; + position: absolute; + top: 0; + bottom: 0; + right: 36px; + -webkit-transition: all 0.3s ease-in 0s; + transition: all 0.3s ease-in 0s; +} + +.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner { + margin-left: 0; +} + +.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch { + right: 0px; +} + + +/* Nestable list */ + +.dd { + position: relative; + display: block; + margin: 0; + padding: 0; + list-style: none; + font-size: 13px; + line-height: 20px; +} + +.dd-list { + display: block; + position: relative; + margin: 0; + padding: 0; + list-style: none; +} + +.dd-list .dd-list { + padding-left: 30px; +} + +.dd-collapsed .dd-list { + display: none; +} + +.dd-item, +.dd-empty, +.dd-placeholder { + display: block; + position: relative; + margin: 0; + padding: 0; + min-height: 20px; + font-size: 13px; + line-height: 20px; +} + +.dd-handle { + display: block; + margin: 5px 0; + padding: 5px 10px; + color: #333; + text-decoration: none; + border: 1px solid #e7eaec; + background: #f5f5f5; + border-radius: 3px; + box-sizing: border-box; + -moz-box-sizing: border-box; +} + +.dd-handle span { + font-weight: bold; +} + +.dd-handle:hover { + background: #f0f0f0; + cursor: pointer; + font-weight: bold; +} + +.dd-item > button { + display: block; + position: relative; + cursor: pointer; + float: left; + width: 25px; + height: 20px; + margin: 5px 0; + padding: 0; + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + border: 0; + background: transparent; + font-size: 12px; + line-height: 1; + text-align: center; + font-weight: bold; +} + +.dd-item > button:before { + content: '+'; + display: block; + position: absolute; + width: 100%; + text-align: center; + text-indent: 0; +} + +.dd-item > button[data-action="collapse"]:before { + content: '-'; +} + +#nestable2 .dd-item > button { + font-family: FontAwesome; + height: 34px; + width: 33px; + color: #c1c1c1; +} + +#nestable2 .dd-item > button:before { + content: "\f067"; +} + +#nestable2 .dd-item > button[data-action="collapse"]:before { + content: "\f068"; +} + +.dd-placeholder, +.dd-empty { + margin: 5px 0; + padding: 0; + min-height: 30px; + background: #f2fbff; + border: 1px dashed #b6bcbf; + box-sizing: border-box; + -moz-box-sizing: border-box; +} + +.dd-empty { + border: 1px dashed #bbb; + min-height: 100px; + background-color: #e5e5e5; + background-image: -webkit-linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff), -webkit-linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff); + background-image: linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff), linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff); + background-size: 60px 60px; + background-position: 0 0, 30px 30px; +} + +.dd-dragel { + position: absolute; + z-index: 9999; + pointer-events: none; +} + +.dd-dragel > .dd-item .dd-handle { + margin-top: 0; +} + +.dd-dragel .dd-handle { + box-shadow: 2px 4px 6px 0 rgba(0, 0, 0, 0.1); +} + + +/** +* Nestable Extras +*/ + +.nestable-lists { + display: block; + clear: both; + padding: 30px 0; + width: 100%; + border: 0; + border-top: 2px solid #ddd; + border-bottom: 2px solid #ddd; +} + +#nestable-menu { + padding: 0; + margin: 10px 0 20px 0; +} + +#nestable-output, +#nestable2-output { + width: 100%; + font-size: 0.75em; + line-height: 1.333333em; + font-family: lucida grande, lucida sans unicode, helvetica, arial, sans-serif; + padding: 5px; + box-sizing: border-box; + -moz-box-sizing: border-box; +} + +#nestable2 .dd-handle { + color: inherit; + border: 1px dashed #e7eaec; + background: #f3f3f4; + padding: 10px; +} + +#nestable2 .dd-handle:hover { + /*background: #bbb;*/ +} + +#nestable2 span.label { + margin-right: 10px; +} + +#nestable-output, +#nestable2-output { + font-size: 12px; + padding: 25px; + box-sizing: border-box; + -moz-box-sizing: border-box; +} + + +/* CodeMirror */ + +.CodeMirror { + border: 1px solid #eee; + height: auto; +} + +.CodeMirror-scroll { + overflow-y: hidden; + overflow-x: auto; +} + + +/* Google Maps */ + +.google-map { + height: 300px; +} + + +/* Validation */ + +label.error { + color: #cc5965; + display: inline-block; + margin-left: 5px; +} + +.form-control.error { + border: 1px dotted #cc5965; +} + + +/* ngGrid */ + +.gridStyle { + border: 1px solid #d4d4d4; + width: 100%; + height: 400px; +} + +.gridStyle2 { + border: 1px solid #d4d4d4; + width: 500px; + height: 300px; +} + +.ngH eaderCell { + border-right: none; + border-bottom: 1px solid #e7eaec; +} + +.ngCell { + border-right: none; +} + +.ngTopPanel { + background: #F5F5F6; +} + +.ngRow.even { + background: #f9f9f9; +} + +.ngRow.selected { + background: #EBF2F1; +} + +.ngRow { + border-bottom: 1px solid #e7eaec; +} + +.ngCell { + background-color: transparent; +} + +.ngHeaderCell { + border-right: none; +} + + +/* Toastr custom style */ + +#toast-container > .toast { + background-image: none !important; +} + +#toast-container > .toast:before { + position: fixed; + font-family: FontAwesome; + font-size: 24px; + line-height: 24px; + float: left; + color: #FFF; + padding-right: 0.5em; + margin: auto 0.5em auto -1.5em; +} + +#toast-container > div { + box-shadow: 0 0 3px #999; + opacity: .9; + -ms-filter: alpha(opacity=90); + filter: alpha(opacity=90); +} + +#toast-container >:hover { + box-shadow: 0 0 4px #999; + opacity: 1; + -ms-filter: alpha(opacity=100); + filter: alpha(opacity=100); + cursor: pointer; +} + +.toast { + background-color: #1ab394; +} + +.toast-success { + background-color: #1ab394; +} + +.toast-error { + background-color: #ed5565; +} + +.toast-info { + background-color: #23c6c8; +} + +.toast-warning { + background-color: #f8ac59; +} + +.toast-top-full-width { + margin-top: 20px; +} + +.toast-bottom-full-width { + margin-bottom: 20px; +} + + +/* Image cropper style */ + +.img-container, +.img-preview { + overflow: hidden; + text-align: center; + width: 100%; +} + +.img-preview-sm { + height: 130px; + width: 200px; +} + + +/* Forum styles */ + +.forum-post-container .media { + margin: 10px 10px 10px 10px; + padding: 20px 10px 20px 10px; + border-bottom: 1px solid #f1f1f1; +} + +.forum-avatar { + float: left; + margin-right: 20px; + text-align: center; + width: 110px; +} + +.forum-avatar .img-circle { + height: 48px; + width: 48px; +} + +.author-info { + color: #676a6c; + font-size: 11px; + margin-top: 5px; + text-align: center; +} + +.forum-post-info { + padding: 9px 12px 6px 12px; + background: #f9f9f9; + border: 1px solid #f1f1f1; +} + +.media-body > .media { + background: #f9f9f9; + border-radius: 3px; + border: 1px solid #f1f1f1; +} + +.forum-post-container .media-body .photos { + margin: 10px 0; +} + +.forum-photo { + max-width: 140px; + border-radius: 3px; +} + +.media-body > .media .forum-avatar { + width: 70px; + margin-right: 10px; +} + +.media-body > .media .forum-avatar .img-circle { + height: 38px; + width: 38px; +} + +.mid-icon { + font-size: 66px; +} + +.forum-item { + margin: 10px 0; + padding: 10px 0 20px; + border-bottom: 1px solid #f1f1f1; +} + +.views-number { + font-size: 24px; + line-height: 18px; + font-weight: 400; +} + +.forum-container, +.forum-post-container { + padding: 30px !important; +} + +.forum-item small { + color: #999; +} + +.forum-item .forum-sub-title { + color: #999; + margin-left: 50px; +} + +.forum-title { + margin: 15px 0 15px 0; +} + +.forum-info { + text-align: center; +} + +.forum-desc { + color: #999; +} + +.forum-icon { + float: left; + width: 30px; + margin-right: 20px; + text-align: center; +} + +a.forum-item-title { + color: inherit; + display: block; + font-size: 18px; + font-weight: 600; +} + +a.forum-item-title:hover { + color: inherit; +} + +.forum-icon .fa { + font-size: 30px; + margin-top: 8px; + color: #9b9b9b; +} + +.forum-item.active .fa { + color: #1ab394; +} + +.forum-item.active a.forum-item-title { + color: #1ab394; +} + +@media (max-width: 992px) { + .forum-info { + margin: 15px 0 10px 0px; + /* Comment this is you want to show forum info in small devices */ + display: none; + } + .forum-desc { + float: none !important; + } +} + + +/* New Timeline style */ + +.vertical-container { + /* this class is used to give a max-width to the element it is applied to, and center it horizontally when it reaches that max-width */ + width: 90%; + max-width: 1170px; + margin: 0 auto; +} + +.vertical-container::after { + /* clearfix */ + content: ''; + display: table; + clear: both; +} + +#vertical-timeline { + position: relative; + padding: 0; + margin-top: 2em; + margin-bottom: 2em; +} + +#vertical-timeline::before { + content: ''; + position: absolute; + top: 0; + left: 18px; + height: 100%; + width: 4px; + background: #f1f1f1; +} + +.vertical-timeline-content .btn { + float: right; +} + +#vertical-timeline.light-timeline:before { + background: #e7eaec; +} + +.dark-timeline .vertical-timeline-content:before { + border-color: transparent #f5f5f5 transparent transparent; +} + +.dark-timeline.center-orientation .vertical-timeline-content:before { + border-color: transparent transparent transparent #f5f5f5; +} + +.dark-timeline .vertical-timeline-block:nth-child(2n) .vertical-timeline-content:before, +.dark-timeline.center-orientation .vertical-timeline-block:nth-child(2n) .vertical-timeline-content:before { + border-color: transparent #f5f5f5 transparent transparent; +} + +.dark-timeline .vertical-timeline-content, +.dark-timeline.center-orientation .vertical-timeline-content { + background: #f5f5f5; +} + +@media only screen and (min-width: 1170px) { + #vertical-timeline.center-orientation { + margin-top: 3em; + margin-bottom: 3em; + } + #vertical-timeline.center-orientation:before { + left: 50%; + margin-left: -2px; + } +} + +@media only screen and (max-width: 1170px) { + .center-orientation.dark-timeline .vertical-timeline-content:before { + border-color: transparent #f5f5f5 transparent transparent; + } +} + +.vertical-timeline-block { + position: relative; + margin: 2em 0; +} + +.vertical-timeline-block:after { + content: ""; + display: table; + clear: both; +} + +.vertical-timeline-block:first-child { + margin-top: 0; +} + +.vertical-timeline-block:last-child { + margin-bottom: 0; +} + +@media only screen and (min-width: 1170px) { + .center-orientation .vertical-timeline-block { + margin: 4em 0; + } + .center-orientation .vertical-timeline-block:first-child { + margin-top: 0; + } + .center-orientation .vertical-timeline-block:last-child { + margin-bottom: 0; + } +} + +.vertical-timeline-icon { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 40px; + border-radius: 50%; + font-size: 16px; + border: 3px solid #f1f1f1; + text-align: center; +} + +.vertical-timeline-icon i { + display: block; + width: 24px; + height: 24px; + position: relative; + left: 50%; + top: 50%; + margin-left: -12px; + margin-top: -9px; +} + +@media only screen and (min-width: 1170px) { + .center-orientation .vertical-timeline-icon { + width: 50px; + height: 50px; + left: 50%; + margin-left: -25px; + -webkit-transform: translateZ(0); + -webkit-backface-visibility: hidden; + font-size: 19px; + } + .center-orientation .vertical-timeline-icon i { + margin-left: -12px; + margin-top: -10px; + } + .center-orientation .cssanimations .vertical-timeline-icon.is-hidden { + visibility: hidden; + } +} + +.vertical-timeline-content { + position: relative; + margin-left: 60px; + background: white; + border-radius: 0.25em; + padding: 1em; +} + +.vertical-timeline-content:after { + content: ""; + display: table; + clear: both; +} + +.vertical-timeline-content h2 { + font-weight: 400; + margin-top: 4px; +} + +.vertical-timeline-content p { + margin: 1em 0; + line-height: 1.6; +} + +.vertical-timeline-content .vertical-date { + float: left; + font-weight: 500; +} + +.vertical-date small { + color: #1ab394; + font-weight: 400; +} + +.vertical-timeline-content::before { + content: ''; + position: absolute; + top: 16px; + right: 100%; + height: 0; + width: 0; + border: 7px solid transparent; + border-right: 7px solid white; +} + +@media only screen and (min-width: 768px) { + .vertical-timeline-content h2 { + font-size: 18px; + } + .vertical-timeline-content p { + font-size: 13px; + } +} + +@media only screen and (min-width: 1170px) { + .center-orientation .vertical-timeline-content { + margin-left: 0; + padding: 1.6em; + width: 45%; + } + .center-orientation .vertical-timeline-content::before { + top: 24px; + left: 100%; + border-color: transparent; + border-left-color: white; + } + .center-orientation .vertical-timeline-content .btn { + float: left; + } + .center-orientation .vertical-timeline-content .vertical-date { + position: absolute; + width: 100%; + left: 122%; + top: 2px; + font-size: 14px; + } + .center-orientation .vertical-timeline-block:nth-child(even) .vertical-timeline-content { + float: right; + } + .center-orientation .vertical-timeline-block:nth-child(even) .vertical-timeline-content::before { + top: 24px; + left: auto; + right: 100%; + border-color: transparent; + border-right-color: white; + } + .center-orientation .vertical-timeline-block:nth-child(even) .vertical-timeline-content .btn { + float: right; + } + .center-orientation .vertical-timeline-block:nth-child(even) .vertical-timeline-content .vertical-date { + left: auto; + right: 122%; + text-align: right; + } + .center-orientation .cssanimations .vertical-timeline-content.is-hidden { + visibility: hidden; + } +} + +.sidebard-panel { + width: 220px; + background: #ebebed; + padding: 10px 20px; + position: absolute; + right: 0; +} + +.sidebard-panel .feed-element img.img-circle { + width: 32px; + height: 32px; +} + +.sidebard-panel .feed-element, +.media-body, +.sidebard-panel p { + font-size: 12px; +} + +.sidebard-panel .feed-element { + margin-top: 20px; + padding-bottom: 0; +} + +.sidebard-panel .list-group { + margin-bottom: 10px; +} + +.sidebard-panel .list-group .list-group-item { + padding: 5px 0; + font-size: 12px; + border: 0; +} + +.sidebar-content .wrapper, +.wrapper.sidebar-content { + padding-right: 240px !important; +} + +#right-sidebar { + background-color: #fff; + border-left: 1px solid #e7eaec; + border-top: 1px solid #e7eaec; + overflow: hidden; + position: fixed; + top: 60px; + width: 260px !important; + z-index: 1009; + bottom: 0; + right: -260px; +} + +#right-sidebar.sidebar-open { + right: 0; +} + +#right-sidebar.sidebar-open.sidebar-top { + top: 0; + border-top: none; +} + +.sidebar-container ul.nav-tabs { + border: none; +} + +.sidebar-container ul.nav-tabs.navs-4 li { + width: 25%; +} + +.sidebar-container ul.nav-tabs.navs-3 li { + width: 33.3333%; +} + +.sidebar-container ul.nav-tabs.navs-2 li { + width: 50%; +} + +.sidebar-container ul.nav-tabs li { + border: none; +} + +.sidebar-container ul.nav-tabs li a { + border: none; + padding: 12px 10px; + margin: 0; + border-radius: 0; + background: #2f4050; + color: #fff; + text-align: center; + border-right: 1px solid #334556; +} + +.sidebar-container ul.nav-tabs li.active a { + border: none; + background: #f9f9f9; + color: #676a6c; + font-weight: bold; +} + +.sidebar-container .nav-tabs > li.active > a:hover, +.sidebar-container .nav-tabs > li.active > a:focus { + border: none; +} + +.sidebar-container ul.sidebar-list { + margin: 0; + padding: 0; +} + +.sidebar-container ul.sidebar-list li { + border-bottom: 1px solid #e7eaec; + padding: 15px 20px; + list-style: none; + font-size: 12px; +} + +.sidebar-container .sidebar-message:nth-child(2n+2) { + background: #f9f9f9; +} + +.sidebar-container ul.sidebar-list li a { + text-decoration: none; + color: inherit; +} + +.sidebar-container .sidebar-content { + padding: 15px 20px; + font-size: 12px; +} + +.sidebar-container .sidebar-title { + background: #f9f9f9; + padding: 20px; + border-bottom: 1px solid #e7eaec; +} + +.sidebar-container .sidebar-title h3 { + margin-bottom: 3px; + padding-left: 2px; +} + +.sidebar-container .tab-content h4 { + margin-bottom: 5px; +} + +.sidebar-container .sidebar-message > a > .pull-left { + margin-right: 10px; +} + +.sidebar-container .sidebar-message > a { + text-decoration: none; + color: inherit; +} + +.sidebar-container .sidebar-message { + padding: 15px 20px; +} + +.sidebar-container .sidebar-message .message-avatar { + height: 38px; + width: 38px; + border-radius: 50%; +} + +.sidebar-container .setings-item { + padding: 15px 20px; + border-bottom: 1px solid #e7eaec; +} + +body { + font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + color: #676a6c; + overflow-x: hidden; +} + +html, +body { + height: 100%; +} + +body.full-height-layout #wrapper, +body.full-height-layout #page-wrapper { + height: 100%; +} + +#page-wrapper { + min-height: auto; +} + +body.boxed-layout { + background: url('patterns/shattered.png'); +} + +body.boxed-layout #wrapper { + background-color: #2f4050; + max-width: 1200px; + margin: 0 auto; +} + +.top-navigation.boxed-layout #wrapper, +.boxed-layout #wrapper.top-navigation { + max-width: 1300px !important; +} + +.block { + display: block; +} + +.clear { + display: block; + overflow: hidden; +} + +a { + cursor: pointer; +} + +a:hover, +a:focus { + text-decoration: none; +} + +.border-bottom { + border-bottom: 1px solid #e7eaec !important; +} + +.font-bold { + font-weight: 600; +} + +.font-noraml { + font-weight: 400; +} + +.text-uppercase { + text-transform: uppercase; +} + +.b-r { + border-right: 1px solid #e7eaec; +} + +.hr-line-dashed { + border-top: 1px dashed #e7eaec; + color: #ffffff; + background-color: #ffffff; + height: 1px; + margin: 20px 0; +} + +.hr-line-solid { + border-bottom: 1px solid #e7eaec; + background-color: rgba(0, 0, 0, 0); + border-style: solid !important; + margin-top: 15px; + margin-bottom: 15px; +} + +video { + width: 100% !important; + height: auto !important; +} + + +/* GALLERY */ + +.gallery > .row > div { + margin-bottom: 15px; +} + +.fancybox img { + margin-bottom: 5px; + /* Only for demo */ + width: 24%; +} + + +/* Summernote text editor */ + +.note-editor { + height: auto!important; + min-height: 100px; + border: solid 1px #e5e6e7; +} + + +/* MODAL */ + +.modal-content { + background-clip: padding-box; + background-color: #FFFFFF; + border: 1px solid rgba(0, 0, 0, 0); + border-radius: 4px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); + outline: 0 none; +} + +.modal-dialog { + z-index: 1200; +} + +.modal-body { + padding: 20px 30px 30px 30px; +} + +.inmodal .modal-body { + background: #f8fafb; +} + +.inmodal .modal-header { + padding: 30px 15px; + text-align: center; +} + +.animated.modal.fade .modal-dialog { + -webkit-transform: none; + -ms-transform: none; + transform: none; +} + +.inmodal .modal-title { + font-size: 26px; +} + +.inmodal .modal-icon { + font-size: 84px; + color: #e2e3e3; +} + +.modal-footer { + margin-top: 0; +} + + +/* WRAPPERS */ + +#wrapper { + width: 100%; + overflow-x: hidden; + background-color: #2f4050; +} + +.wrapper { + padding: 0 20px; +} + +.wrapper-content { + padding: 20px; +} + +#page-wrapper { + padding: 0 15px; + position: inherit; + margin: 0 0 0 220px; +} + +.title-action { + text-align: right; + padding-top: 30px; +} + +.ibox-content h1, +.ibox-content h2, +.ibox-content h3, +.ibox-content h4, +.ibox-content h5, +.ibox-title h1, +.ibox-title h2, +.ibox-title h3, +.ibox-title h4, +.ibox-title h5 { + margin-top: 5px; +} + +ul.unstyled, +ol.unstyled { + list-style: none outside none; + margin-left: 0; +} + +.big-icon { + font-size: 160px; + color: #e5e6e7; +} + + +/* FOOTER */ + +.footer { + background: none repeat scroll 0 0 white; + border-top: 1px solid #e7eaec; + overflow: hidden; + padding: 10px 20px; + margin: 0 -15px; + height: 36px; +} + +.footer.fixed_full { + position: fixed; + bottom: 0; + left: 0; + right: 0; + z-index: 1000; + padding: 10px 20px; + background: white; + border-top: 1px solid #e7eaec; +} + +.footer.fixed { + position: fixed; + bottom: 0; + left: 0; + right: 0; + z-index: 1000; + padding: 10px 20px; + background: white; + border-top: 1px solid #e7eaec; + margin-left: 220px; +} + +body.mini-navbar .footer.fixed, +body.body-small.mini-navbar .footer.fixed { + margin: 0 0 0 70px; +} + +body.mini-navbar.canvas-menu .footer.fixed, +body.canvas-menu .footer.fixed { + margin: 0 !important; +} + +body.fixed-sidebar.body-small.mini-navbar .footer.fixed { + margin: 0 0 0 220px; +} + +body.body-small .footer.fixed { + margin-left: 0px; +} + + +/* PANELS */ + +.page-heading { + border-top: 0; + padding: 0px 20px 20px; +} + +.panel-heading h1, +.panel-heading h2 { + margin-bottom: 5px; +} + + +/*CONTENTTABS*/ + +.content-tabs { + position: relative; + height: 42px; + background: #fafafa; + line-height: 40px; +} + +.content-tabs .roll-nav, +.page-tabs-list { + position: absolute; + width: 40px; + height: 40px; + text-align: center; + color: #999; + z-index: 2; + top: 0; +} + +.content-tabs .roll-left { + left: 0; + border-right: solid 1px #eee; +} + +.content-tabs .roll-right { + right: 0; + border-left: solid 1px #eee; +} + +.content-tabs button { + background: #fff; + border: 0; + height: 40px; + width: 40px; + outline: none; +} + +.content-tabs button:hover { + background: #fafafa; +} + +nav.page-tabs { + margin-left: 40px; + width: 100000px; + height: 40px; + overflow: hidden; +} + +nav.page-tabs .page-tabs-content { + float: left; +} + +.page-tabs a { + display: block; + float: left; + border-right: solid 1px #eee; + padding: 0 15px; +} + +.page-tabs a i:hover { + color: #c00; +} + +.page-tabs a:hover, +.content-tabs .roll-nav:hover { + color: #777; + background: #f2f2f2; + cursor: pointer; +} + +.roll-right.J_tabRight { + right: 140px; +} + +.roll-right.btn-group { + right: 60px; + width: 80px; + padding: 0; +} + +.roll-right.btn-group button { + width: 80px; +} + +.roll-right.J_tabExit { + background: #fff; + height: 40px; + width: 60px; + outline: none; +} + +.dropdown-menu-right { + left: auto; +} + +#content-main { + height: calc(100% - 140px); + overflow: hidden; +} + +.fixed-nav #content-main { + height: calc(100% - 80px); + overflow: hidden; +} + + +/* TABLES */ + +.table-bordered { + border: 1px solid #EBEBEB; +} + +.table-bordered > thead > tr > th, +.table-bordered > thead > tr > td { + background-color: #F5F5F6; + border-bottom-width: 1px; +} + +.table-bordered > thead > tr > th, +.table-bordered > tbody > tr > th, +.table-bordered > tfoot > tr > th, +.table-bordered > thead > tr > td, +.table-bordered > tbody > tr > td, +.table-bordered > tfoot > tr > td { + border: 1px solid #e7e7e7; +} + +.table > thead > tr > th { + border-bottom: 1px solid #DDDDDD; + vertical-align: bottom; +} + +.table > thead > tr > th, +.table > tbody > tr > th, +.table > tfoot > tr > th, +.table > thead > tr > td, +.table > tbody > tr > td, +.table > tfoot > tr > td { + border-top: 1px solid #e7eaec; + line-height: 1.42857; + padding: 8px; + vertical-align: middle; +} + + +/* PANELS */ + +.panel.blank-panel { + background: none; + margin: 0; +} + +.blank-panel .panel-heading { + padding-bottom: 0; +} + +.nav-tabs > li.active > a, +.nav-tabs > li.active > a:hover, +.nav-tabs > li.active > a:focus { + -moz-border-bottom-colors: none; + -moz-border-left-colors: none; + -moz-border-right-colors: none; + -moz-border-top-colors: none; + background: none; + border-color: #dddddd #dddddd rgba(0, 0, 0, 0); + border-bottom: #f3f3f4; + -webkit-border-image: none; + -o-border-image: none; + border-image: none; + border-style: solid; + border-width: 1px; + color: #555555; + cursor: default; +} + +.nav.nav-tabs li { + background: none; + border: none; +} + +.nav-tabs > li > a { + color: #A7B1C2; + font-weight: 600; + padding: 10px 20px 10px 25px; +} + +.nav-tabs > li > a:hover, +.nav-tabs > li > a:focus { + background-color: #e6e6e6; + color: #676a6c; +} + +.ui-tab .tab-content { + padding: 20px 0px; +} + + +/* GLOBAL */ + +.no-padding { + padding: 0 !important; +} + +.no-borders { + border: none !important; +} + +.no-margins { + margin: 0 !important; +} + +.no-top-border { + border-top: 0 !important; +} + +.ibox-content.text-box { + padding-bottom: 0px; + padding-top: 15px; +} + +.border-left-right { + border-left: 1px solid #e7eaec; + border-right: 1px solid #e7eaec; + border-top: none; + border-bottom: none; +} + +.border-left { + border-left: 1px solid #e7eaec; + border-right: none; + border-top: none; + border-bottom: none; +} + +.border-right { + border-left: none; + border-right: 1px solid #e7eaec; + border-top: none; + border-bottom: none; +} + +.full-width { + width: 100% !important; +} + +.link-block { + font-size: 12px; + padding: 10px; +} + +.nav.navbar-top-links .link-block a { + font-size: 12px; +} + +.link-block a { + font-size: 10px; + color: inherit; +} + +body.mini-navbar .branding { + display: none; +} + +img.circle-border { + border: 6px solid #FFFFFF; + border-radius: 50%; +} + +.branding { + float: left; + color: #FFFFFF; + font-size: 18px; + font-weight: 600; + padding: 17px 20px; + text-align: center; + background-color: #1ab394; +} + +.login-panel { + margin-top: 25%; +} + +.page-header { + padding: 20px 0 9px; + margin: 0 0 20px; + border-bottom: 1px solid #eeeeee; +} + +.fontawesome-icon-list { + margin-top: 22px; +} + +.fontawesome-icon-list .fa-hover a { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + display: block; + color: #222222; + line-height: 32px; + height: 32px; + padding-left: 10px; + border-radius: 4px; +} + +.fontawesome-icon-list .fa-hover a .fa { + width: 32px; + font-size: 14px; + display: inline-block; + text-align: right; + margin-right: 10px; +} + +.fontawesome-icon-list .fa-hover a:hover { + background-color: #1d9d74; + color: #ffffff; + text-decoration: none; +} + +.fontawesome-icon-list .fa-hover a:hover .fa { + font-size: 30px; + vertical-align: -6px; +} + +.fontawesome-icon-list .fa-hover a:hover .text-muted { + color: #bbe2d5; +} + +.feature-list .col-md-4 { + margin-bottom: 22px; +} + +.feature-list h4 .fa:before { + vertical-align: -10%; + font-size: 28px; + display: inline-block; + width: 1.07142857em; + text-align: center; + margin-right: 5px; +} + +.ui-draggable .ibox-title { + cursor: move; +} + +.breadcrumb { + background-color: #ffffff; + padding: 0; + margin-bottom: 0; +} + +.breadcrumb > li a { + color: inherit; +} + +.breadcrumb > .active { + color: inherit; +} + +code { + background-color: #F9F2F4; + border-radius: 4px; + color: #ca4440; + font-size: 90%; + padding: 2px 4px; + white-space: nowrap; +} + +.ibox { + clear: both; + margin-bottom: 25px; + margin-top: 0; + padding: 0; +} + +.ibox.collapsed .ibox-content { + display: none; +} + +.ibox.collapsed .fa.fa-chevron-up:before { + content: "\f078"; +} + +.ibox.collapsed .fa.fa-chevron-down:before { + content: "\f077"; +} + +.ibox:after, +.ibox:before { + display: table; +} + +.ibox-title { + -moz-border-bottom-colors: none; + -moz-border-left-colors: none; + -moz-border-right-colors: none; + -moz-border-top-colors: none; + background-color: #ffffff; + border-color: #e7eaec; + -webkit-border-image: none; + -o-border-image: none; + border-image: none; + border-style: solid solid none; + border-width: 4px 0px 0; + color: inherit; + margin-bottom: 0; + padding: 14px 15px 7px; + min-height: 48px; +} + +.ibox-content { + background-color: #ffffff; + color: inherit; + padding: 15px 20px 20px 20px; + border-color: #e7eaec; + -webkit-border-image: none; + -o-border-image: none; + border-image: none; + border-style: solid solid none; + border-width: 1px 0px; +} + +table.table-mail tr td { + padding: 12px; +} + +.table-mail .check-mail { + padding-left: 20px; +} + +.table-mail .mail-date { + padding-right: 20px; +} + +.star-mail, +.check-mail { + width: 40px; +} + +.unread td a, +.unread td { + font-weight: 600; + color: inherit; +} + +.read td a, +.read td { + font-weight: normal; + color: inherit; +} + +.unread td { + background-color: #f9f8f8; +} + +.ibox-content { + clear: both; +} + +.ibox-heading { + background-color: #f3f6fb; + border-bottom: none; +} + +.ibox-heading h3 { + font-weight: 200; + font-size: 24px; +} + +.ibox-title h5 { + display: inline-block; + font-size: 14px; + margin: 0 0 7px; + padding: 0; + text-overflow: ellipsis; + float: left; +} + +.ibox-title .label { + float: left; + margin-left: 4px; +} + +.ibox-tools { + display: inline-block; + float: right; + margin-top: 0; + position: relative; + padding: 0; +} + +.ibox-tools a { + cursor: pointer; + margin-left: 5px; + color: #c4c4c4; +} + +.ibox-tools a.btn-primary { + color: #fff; +} + +.ibox-tools .dropdown-menu > li > a { + padding: 4px 10px; + font-size: 12px; +} + +.ibox .open > .dropdown-menu { + left: auto; + right: 0; +} + + +/* BACKGROUNDS */ + +.gray-bg { + background-color: #f3f3f4; +} + +.white-bg { + background-color: #ffffff; +} + +.navy-bg { + background-color: #1ab394; + color: #ffffff; +} + +.blue-bg { + background-color: #1c84c6; + color: #ffffff; +} + +.lazur-bg { + background-color: #23c6c8; + color: #ffffff; +} + +.yellow-bg { + background-color: #f8ac59; + color: #ffffff; +} + +.red-bg { + background-color: #ed5565; + color: #ffffff; +} + +.black-bg { + background-color: #262626; +} + +.panel-primary { + border-color: #1ab394; +} + +.panel-primary > .panel-heading { + background-color: #1ab394; + border-color: #1ab394; +} + +.panel-success { + border-color: #1c84c6; +} + +.panel-success > .panel-heading { + background-color: #1c84c6; + border-color: #1c84c6; + color: #ffffff; +} + +.panel-info { + border-color: #23c6c8; +} + +.panel-info > .panel-heading { + background-color: #23c6c8; + border-color: #23c6c8; + color: #ffffff; +} + +.panel-warning { + border-color: #f8ac59; +} + +.panel-warning > .panel-heading { + background-color: #f8ac59; + border-color: #f8ac59; + color: #ffffff; +} + +.panel-danger { + border-color: #ed5565; +} + +.panel-danger > .panel-heading { + background-color: #ed5565; + border-color: #ed5565; + color: #ffffff; +} + +.progress-bar { + background-color: #1ab394; +} + +.progress-small, +.progress-small .progress-bar { + height: 10px; +} + +.progress-small, +.progress-mini { + margin-top: 5px; +} + +.progress-mini, +.progress-mini .progress-bar { + height: 5px; + margin-bottom: 0px; +} + +.progress-bar-navy-light { + background-color: #3dc7ab; +} + +.progress-bar-success { + background-color: #1c84c6; +} + +.progress-bar-info { + background-color: #23c6c8; +} + +.progress-bar-warning { + background-color: #f8ac59; +} + +.progress-bar-danger { + background-color: #ed5565; +} + +.panel-title { + font-size: inherit; +} + +.jumbotron { + border-radius: 6px; + padding: 40px; +} + +.jumbotron h1 { + margin-top: 0; +} + + +/* COLORS */ + +.text-navy { + color: #1ab394; +} + +.text-primary { + color: inherit; +} + +.text-success { + color: #1c84c6; +} + +.text-info { + color: #23c6c8; +} + +.text-warning { + color: #f8ac59; +} + +.text-danger { + color: #ed5565; +} + +.text-muted { + color: #888888; +} + +.simple_tag { + background-color: #f3f3f4; + border: 1px solid #e7eaec; + border-radius: 2px; + color: inherit; + font-size: 10px; + margin-right: 5px; + margin-top: 5px; + padding: 5px 12px; + display: inline-block; +} + +.img-shadow { + box-shadow: 0px 0px 3px 0px #919191; +} + + +/* For handle diferent bg color in AngularJS version */ + +.dashboards\.dashboard_2 nav.navbar, +.dashboards\.dashboard_3 nav.navbar, +.mailbox\.inbox nav.navbar, +.mailbox\.email_view nav.navbar, +.mailbox\.email_compose nav.navbar, +.dashboards\.dashboard_4_1 nav.navbar { + background: #fff; +} + + +/* For handle diferent bg color in MVC version */ + +.Dashboard_2 .navbar.navbar-static-top, +.Dashboard_3 .navbar.navbar-static-top, +.Dashboard_4_1 .navbar.navbar-static-top, +.ComposeEmail .navbar.navbar-static-top, +.EmailView .navbar.navbar-static-top, +.Inbox .navbar.navbar-static-top { + background: #fff; +} + +a.close-canvas-menu { + position: absolute; + top: 10px; + right: 15px; + z-index: 1011; + color: #a7b1c2; +} + +a.close-canvas-menu:hover { + color: #fff; +} + + +/* FULL HEIGHT */ + +.full-height { + height: 100%; +} + +.fh-breadcrumb { + height: calc(100% - 196px); + margin: 0 -15px; + position: relative; +} + +.fh-no-breadcrumb { + height: calc(100% - 99px); + margin: 0 -15px; + position: relative; +} + +.fh-column { + background: #fff; + height: 100%; + width: 240px; + float: left; +} + +.modal-backdrop { + z-index: 2040 !important; +} + +.modal { + z-index: 2050 !important; +} + +.spiner-example { + height: 200px; + padding-top: 70px; +} + + +/* MARGINS & PADDINGS */ + +.p-xxs { + padding: 5px; +} + +.p-xs { + padding: 10px; +} + +.p-sm { + padding: 15px; +} + +.p-m { + padding: 20px; +} + +.p-md { + padding: 25px; +} + +.p-lg { + padding: 30px; +} + +.p-xl { + padding: 40px; +} + +.m-xxs { + margin: 2px 4px; +} + +.m-xs { + margin: 5px; +} + +.m-sm { + margin: 10px; +} + +.m { + margin: 15px; +} + +.m-md { + margin: 20px; +} + +.m-lg { + margin: 30px; +} + +.m-xl { + margin: 50px; +} + +.m-n { + margin: 0 !important; +} + +.m-l-none { + margin-left: 0; +} + +.m-l-xs { + margin-left: 5px; +} + +.m-l-sm { + margin-left: 10px; +} + +.m-l { + margin-left: 15px; +} + +.m-l-md { + margin-left: 20px; +} + +.m-l-lg { + margin-left: 30px; +} + +.m-l-xl { + margin-left: 40px; +} + +.m-l-n-xxs { + margin-left: -1px; +} + +.m-l-n-xs { + margin-left: -5px; +} + +.m-l-n-sm { + margin-left: -10px; +} + +.m-l-n { + margin-left: -15px; +} + +.m-l-n-md { + margin-left: -20px; +} + +.m-l-n-lg { + margin-left: -30px; +} + +.m-l-n-xl { + margin-left: -40px; +} + +.m-t-none { + margin-top: 0; +} + +.m-t-xxs { + margin-top: 1px; +} + +.m-t-xs { + margin-top: 5px; +} + +.m-t-sm { + margin-top: 10px; +} + +.m-t { + margin-top: 15px; +} + +.m-t-md { + margin-top: 20px; +} + +.m-t-lg { + margin-top: 30px; +} + +.m-t-xl { + margin-top: 40px; +} + +.m-t-n-xxs { + margin-top: -1px; +} + +.m-t-n-xs { + margin-top: -5px; +} + +.m-t-n-sm { + margin-top: -10px; +} + +.m-t-n { + margin-top: -15px; +} + +.m-t-n-md { + margin-top: -20px; +} + +.m-t-n-lg { + margin-top: -30px; +} + +.m-t-n-xl { + margin-top: -40px; +} + +.m-r-none { + margin-right: 0; +} + +.m-r-xxs { + margin-right: 1px; +} + +.m-r-xs { + margin-right: 5px; +} + +.m-r-sm { + margin-right: 10px; +} + +.m-r { + margin-right: 15px; +} + +.m-r-md { + margin-right: 20px; +} + +.m-r-lg { + margin-right: 30px; +} + +.m-r-xl { + margin-right: 40px; +} + +.m-r-n-xxs { + margin-right: -1px; +} + +.m-r-n-xs { + margin-right: -5px; +} + +.m-r-n-sm { + margin-right: -10px; +} + +.m-r-n { + margin-right: -15px; +} + +.m-r-n-md { + margin-right: -20px; +} + +.m-r-n-lg { + margin-right: -30px; +} + +.m-r-n-xl { + margin-right: -40px; +} + +.m-b-none { + margin-bottom: 0; +} + +.m-b-xxs { + margin-bottom: 1px; +} + +.m-b-xs { + margin-bottom: 5px; +} + +.m-b-sm { + margin-bottom: 10px; +} + +.m-b { + margin-bottom: 15px; +} + +.m-b-md { + margin-bottom: 20px; +} + +.m-b-lg { + margin-bottom: 30px; +} + +.m-b-xl { + margin-bottom: 40px; +} + +.m-b-n-xxs { + margin-bottom: -1px; +} + +.m-b-n-xs { + margin-bottom: -5px; +} + +.m-b-n-sm { + margin-bottom: -10px; +} + +.m-b-n { + margin-bottom: -15px; +} + +.m-b-n-md { + margin-bottom: -20px; +} + +.m-b-n-lg { + margin-bottom: -30px; +} + +.m-b-n-xl { + margin-bottom: -40px; +} + +.space-15 { + margin: 15px 0; +} + +.space-20 { + margin: 20px 0; +} + +.space-25 { + margin: 25px 0; +} + +.space-30 { + margin: 30px 0; +} + +body.modal-open { + padding-right: inherit !important; +} + + +/* SEARCH PAGE */ + +.search-form { + margin-top: 10px; +} + +.search-result h3 { + margin-bottom: 0; + color: #1E0FBE; +} + +.search-result .search-link { + color: #006621; +} + +.search-result p { + font-size: 12px; + margin-top: 5px; +} + + +/* CONTACTS */ + +.contact-box { + background-color: #ffffff; + border: 1px solid #e7eaec; + padding: 20px; + margin-bottom: 20px; +} + +.contact-box a { + color: inherit; +} + + +/* INVOICE */ + +.invoice-table tbody > tr > td:last-child, +.invoice-table tbody > tr > td:nth-child(4), +.invoice-table tbody > tr > td:nth-child(3), +.invoice-table tbody > tr > td:nth-child(2) { + text-align: right; +} + +.invoice-table thead > tr > th:last-child, +.invoice-table thead > tr > th:nth-child(4), +.invoice-table thead > tr > th:nth-child(3), +.invoice-table thead > tr > th:nth-child(2) { + text-align: right; +} + +.invoice-total > tbody > tr > td:first-child { + text-align: right; +} + +.invoice-total > tbody > tr > td { + border: 0 none; +} + +.invoice-total > tbody > tr > td:last-child { + border-bottom: 1px solid #DDDDDD; + text-align: right; + width: 15%; +} + + +/* ERROR & LOGIN & LOCKSCREEN*/ + +.middle-box { + max-width: 400px; + z-index: 100; + margin: 0 auto; + padding-top: 40px; +} + +.lockscreen.middle-box { + width: 200px; + padding-top: 110px; +} + +.loginscreen.middle-box { + width: 300px; +} + +.loginColumns { + max-width: 800px; + margin: 0 auto; + padding: 100px 20px 20px 20px; +} + +.passwordBox { + max-width: 460px; + margin: 0 auto; + padding: 100px 20px 20px 20px; +} + +.logo-name { + color: #e6e6e6; + font-size: 180px; + font-weight: 800; + letter-spacing: -10px; + margin-bottom: 0px; +} + +.middle-box h1 { + font-size: 170px; +} + +.wrapper .middle-box { + margin-top: 140px; +} + +.lock-word { + z-index: 10; + position: absolute; + top: 110px; + left: 50%; + margin-left: -470px; +} + +.lock-word span { + font-size: 100px; + font-weight: 600; + color: #e9e9e9; + display: inline-block; +} + +.lock-word .first-word { + margin-right: 160px; +} + + +/* DASBOARD */ + +.dashboard-header { + border-top: 0; + padding: 20px 20px 20px 20px; +} + +.dashboard-header h2 { + margin-top: 10px; + font-size: 26px; +} + +.fist-item { + border-top: none !important; +} + +.statistic-box { + margin-top: 40px; +} + +.dashboard-header .list-group-item span.label { + margin-right: 10px; +} + +.list-group.clear-list .list-group-item { + border-top: 1px solid #e7eaec; + border-bottom: 0; + border-right: 0; + border-left: 0; + padding: 10px 0; +} + +ul.clear-list:first-child { + border-top: none !important; +} + + +/* Intimeline */ + +.timeline-item .date i { + position: absolute; + top: 0; + right: 0; + padding: 5px; + width: 30px; + text-align: center; + border-top: 1px solid #e7eaec; + border-bottom: 1px solid #e7eaec; + border-left: 1px solid #e7eaec; + background: #f8f8f8; +} + +.timeline-item .date { + text-align: right; + width: 110px; + position: relative; + padding-top: 30px; +} + +.timeline-item .content { + border-left: 1px solid #e7eaec; + border-top: 1px solid #e7eaec; + padding-top: 10px; + min-height: 100px; +} + +.timeline-item .content:hover { + background: #f6f6f6; +} + + +/* PIN BOARD */ + +ul.notes li, +ul.tag-list li { + list-style: none; +} + +ul.notes li h4 { + margin-top: 20px; + font-size: 16px; +} + +ul.notes li div { + text-decoration: none; + color: #000; + background: #ffc; + display: block; + height: 140px; + width: 140px; + padding: 1em; + position: relative; +} + +ul.notes li div small { + position: absolute; + top: 5px; + right: 5px; + font-size: 10px; +} + +ul.notes li div a { + position: absolute; + right: 10px; + bottom: 10px; + color: inherit; +} + +ul.notes li { + margin: 10px 40px 50px 0px; + float: left; +} + +ul.notes li div p { + font-size: 12px; +} + +ul.notes li div { + text-decoration: none; + color: #000; + background: #ffc; + display: block; + height: 140px; + width: 140px; + padding: 1em; + /* Firefox */ + /* Safari+Chrome */ + /* Opera */ + box-shadow: 5px 5px 2px rgba(33, 33, 33, 0.7); +} + +ul.notes li div { + -webkit-transform: rotate(-6deg); + -o-transform: rotate(-6deg); + -moz-transform: rotate(-6deg); +} + +ul.notes li:nth-child(even) div { + -o-transform: rotate(4deg); + -webkit-transform: rotate(4deg); + -moz-transform: rotate(4deg); + position: relative; + top: 5px; +} + +ul.notes li:nth-child(3n) div { + -o-transform: rotate(-3deg); + -webkit-transform: rotate(-3deg); + -moz-transform: rotate(-3deg); + position: relative; + top: -5px; +} + +ul.notes li:nth-child(5n) div { + -o-transform: rotate(5deg); + -webkit-transform: rotate(5deg); + -moz-transform: rotate(5deg); + position: relative; + top: -10px; +} + +ul.notes li div:hover, +ul.notes li div:focus { + -webkit-transform: scale(1.1); + -moz-transform: scale(1.1); + -o-transform: scale(1.1); + position: relative; + z-index: 5; +} + +ul.notes li div { + text-decoration: none; + color: #000; + background: #ffc; + display: block; + height: 210px; + width: 210px; + padding: 1em; + box-shadow: 5px 5px 7px rgba(33, 33, 33, 0.7); + -webkit-transition: -webkit-transform 0.15s linear; +} + + +/* FILE MANAGER */ + +.file-box { + float: left; + width: 220px; +} + +.file-manager h5 { + text-transform: uppercase; +} + +.file-manager { + list-style: none outside none; + margin: 0; + padding: 0; +} + +.folder-list li a { + color: #666666; + display: block; + padding: 5px 0; +} + +.folder-list li { + border-bottom: 1px solid #e7eaec; + display: block; +} + +.folder-list li i { + margin-right: 8px; + color: #3d4d5d; +} + +.category-list li a { + color: #666666; + display: block; + padding: 5px 0; +} + +.category-list li { + display: block; +} + +.category-list li i { + margin-right: 8px; + color: #3d4d5d; +} + +.category-list li a .text-navy { + color: #1ab394; +} + +.category-list li a .text-primary { + color: #1c84c6; +} + +.category-list li a .text-info { + color: #23c6c8; +} + +.category-list li a .text-danger { + color: #EF5352; +} + +.category-list li a .text-warning { + color: #F8AC59; +} + +.file-manager h5.tag-title { + margin-top: 20px; +} + +.tag-list li { + float: left; +} + +.tag-list li a { + font-size: 10px; + background-color: #f3f3f4; + padding: 5px 12px; + color: inherit; + border-radius: 2px; + border: 1px solid #e7eaec; + margin-right: 5px; + margin-top: 5px; + display: block; +} + +.file { + border: 1px solid #e7eaec; + padding: 0; + background-color: #ffffff; + position: relative; + margin-bottom: 20px; + margin-right: 20px; +} + +.file-manager .hr-line-dashed { + margin: 15px 0; +} + +.file .icon, +.file .image { + height: 100px; + overflow: hidden; +} + +.file .icon { + padding: 15px 10px; + text-align: center; +} + +.file-control { + color: inherit; + font-size: 11px; + margin-right: 10px; +} + +.file-control.active { + text-decoration: underline; +} + +.file .icon i { + font-size: 70px; + color: #dadada; +} + +.file .file-name { + padding: 10px; + background-color: #f8f8f8; + border-top: 1px solid #e7eaec; +} + +.file-name small { + color: #676a6c; +} + +.corner { + position: absolute; + display: inline-block; + width: 0; + height: 0; + line-height: 0; + border: 0.6em solid transparent; + border-right: 0.6em solid #f1f1f1; + border-bottom: 0.6em solid #f1f1f1; + right: 0em; + bottom: 0em; +} + +a.compose-mail { + padding: 8px 10px; +} + +.mail-search { + max-width: 300px; +} + + +/* PROFILE */ + +.profile-content { + border-top: none !important; +} + +.feed-activity-list .feed-element { + border-bottom: 1px solid #e7eaec; +} + +.feed-element:first-child { + margin-top: 0; +} + +.feed-element { + padding-bottom: 15px; +} + +.feed-element, +.feed-element .media { + margin-top: 15px; +} + +.feed-element, +.media-body { + overflow: hidden; +} + +.feed-element > .pull-left { + margin-right: 10px; +} + +.feed-element img.img-circle, +.dropdown-messages-box img.img-circle { + width: 38px; + height: 38px; +} + +.feed-element .well { + border: 1px solid #e7eaec; + box-shadow: none; + margin-top: 10px; + margin-bottom: 5px; + padding: 10px 20px; + font-size: 11px; + line-height: 16px; +} + +.feed-element .actions { + margin-top: 10px; +} + +.feed-element .photos { + margin: 10px 0; +} + +.feed-photo { + max-height: 180px; + border-radius: 4px; + overflow: hidden; + margin-right: 10px; + margin-bottom: 10px; +} + + +/* MAILBOX */ + +.mail-box { + background-color: #ffffff; + border: 1px solid #e7eaec; + border-top: 0; + padding: 0px; + margin-bottom: 20px; +} + +.mail-box-header { + background-color: #ffffff; + border: 1px solid #e7eaec; + border-bottom: 0; + padding: 30px 20px 20px 20px; +} + +.mail-box-header h2 { + margin-top: 0px; +} + +.mailbox-content .tag-list li a { + background: #ffffff; +} + +.mail-body { + border-top: 1px solid #e7eaec; + padding: 20px; +} + +.mail-text { + border-top: 1px solid #e7eaec; +} + +.mail-text .note-toolbar { + padding: 10px 15px; +} + +.mail-body .form-group { + margin-bottom: 5px; +} + +.mail-text .note-editor .note-toolbar { + background-color: #F9F8F8; +} + +.mail-attachment { + border-top: 1px solid #e7eaec; + padding: 20px; + font-size: 12px; +} + +.mailbox-content { + background: none; + border: none; + padding: 10px; +} + +.mail-ontact { + width: 23%; +} + + +/* PROJECTS */ + +.project-people, +.project-actions { + text-align: right; + vertical-align: middle; +} + +dd.project-people { + text-align: left; + margin-top: 5px; +} + +.project-people img { + width: 32px; + height: 32px; +} + +.project-title a { + font-size: 14px; + color: #676a6c; + font-weight: 600; +} + +.project-list table tr td { + border-top: none; + border-bottom: 1px solid #e7eaec; + padding: 15px 10px; + vertical-align: middle; +} + +.project-manager .tag-list li a { + font-size: 10px; + background-color: white; + padding: 5px 12px; + color: inherit; + border-radius: 2px; + border: 1px solid #e7eaec; + margin-right: 5px; + margin-top: 5px; + display: block; +} + +.project-files li a { + font-size: 11px; + color: #676a6c; + margin-left: 10px; + line-height: 22px; +} + + +/* FAQ */ + +.faq-item { + padding: 20px; + margin-bottom: 2px; + background: #fff; +} + +.faq-question { + font-size: 18px; + font-weight: 600; + color: #1ab394; + display: block; +} + +.faq-question:hover { + color: #179d82; +} + +.faq-answer { + margin-top: 10px; + background: #f3f3f4; + border: 1px solid #e7eaec; + border-radius: 3px; + padding: 15px; +} + +.faq-item .tag-item { + background: #f3f3f4; + padding: 2px 6px; + font-size: 10px; + text-transform: uppercase; +} + + +/* Chat view */ + +.message-input { + height: 90px !important; +} + +.chat-avatar { + white: 36px; + height: 36px; + float: left; + margin-right: 10px; +} + +.chat-user-name { + padding: 10px; +} + +.chat-user { + padding: 8px 10px; + border-bottom: 1px solid #e7eaec; +} + +.chat-user a { + color: inherit; +} + +.chat-view { + z-index: 20012; +} + +.chat-users, +.chat-statistic { + margin-left: -30px; +} + +@media (max-width: 992px) { + .chat-users, + .chat-statistic { + margin-left: 0px; + } +} + +.chat-view .ibox-content { + padding: 0; +} + +.chat-message { + padding: 10px 20px; +} + +.message-avatar { + height: 48px; + width: 48px; + border: 1px solid #e7eaec; + border-radius: 4px; + margin-top: 1px; +} + +.chat-discussion .chat-message:nth-child(2n+1) .message-avatar { + float: left; + margin-right: 10px; +} + +.chat-discussion .chat-message:nth-child(2n) .message-avatar { + float: right; + margin-left: 10px; +} + +.message { + background-color: #fff; + border: 1px solid #e7eaec; + text-align: left; + display: block; + padding: 10px 20px; + position: relative; + border-radius: 4px; +} + +.chat-discussion .chat-message:nth-child(2n+1) .message-date { + float: right; +} + +.chat-discussion .chat-message:nth-child(2n) .message-date { + float: left; +} + +.chat-discussion .chat-message:nth-child(2n+1) .message { + text-align: left; + margin-left: 55px; +} + +.chat-discussion .chat-message:nth-child(2n) .message { + text-align: right; + margin-right: 55px; +} + +.message-date { + font-size: 10px; + color: #888888; +} + +.message-content { + display: block; +} + +.chat-discussion { + background: #eee; + padding: 15px; + height: 400px; + overflow-y: auto; +} + +.chat-users { + overflow-y: auto; + height: 400px; +} + +.chat-message-form .form-group { + margin-bottom: 0; +} + + +/* jsTree */ + +.jstree-open > .jstree-anchor > .fa-folder:before { + content: "\f07c"; +} + +.jstree-default .jstree-icon.none { + width: 0; +} + + +/* CLIENTS */ + +.clients-list { + margin-top: 20px; +} + +.clients-list .tab-pane { + position: relative; + height: 600px; +} + +.client-detail { + position: relative; + height: 620px; +} + +.clients-list table tr td { + height: 46px; + vertical-align: middle; + border: none; +} + +.client-link { + font-weight: 600; + color: inherit; +} + +.client-link:hover { + color: inherit; +} + +.client-avatar { + width: 42px; +} + +.client-avatar img { + width: 28px; + height: 28px; + border-radius: 50%; +} + +.contact-type { + width: 20px; + color: #c1c3c4; +} + +.client-status { + text-align: left; +} + +.client-detail .vertical-timeline-content p { + margin: 0; +} + +.client-detail .vertical-timeline-icon.gray-bg { + color: #a7aaab; +} + +.clients-list .nav-tabs > li.active > a, +.clients-list .nav-tabs > li.active > a:hover, +.clients-list .nav-tabs > li.active > a:focus { + border-bottom: 1px solid #fff; +} + + +/* BLOG ARTICLE */ + +.blog h2 { + font-weight: 700; +} + +.blog h5 { + margin: 0 0 5px 0; +} + +.blog .btn { + margin: 0 0 5px 0; +} + +.article h1 { + font-size: 48px; + font-weight: 700; + color: #2F4050; +} + +.article p { + font-size: 15px; + line-height: 26px; +} + +.article-title { + text-align: center; + margin: 60px 0 40px 0; +} + +.article .ibox-content { + padding: 40px; +} + + +/* ISSUE TRACKER */ + +.issue-tracker .btn-link { + color: #1ab394; +} + +table.issue-tracker tbody tr td { + vertical-align: middle; + height: 50px; +} + +.issue-info { + width: 50%; +} + +.issue-info a { + font-weight: 600; + color: #676a6c; +} + +.issue-info small { + display: block; +} + + +/* TEAMS */ + +.team-members { + margin: 10px 0; +} + +.team-members img.img-circle { + width: 42px; + height: 42px; + margin-bottom: 5px; +} + + +/* AGILE BOARD */ + +.sortable-list { + padding: 10px 0; +} + +.agile-list { + list-style: none; + margin: 0; +} + +.agile-list li { + background: #FAFAFB; + border: 1px solid #e7eaec; + margin: 0px 0 10px 0; + padding: 10px; + border-radius: 2px; +} + +.agile-list li:hover { + cursor: pointer; + background: #fff; +} + +.agile-list li.warning-element { + border-left: 3px solid #f8ac59; +} + +.agile-list li.danger-element { + border-left: 3px solid #ed5565; +} + +.agile-list li.info-element { + border-left: 3px solid #1c84c6; +} + +.agile-list li.success-element { + border-left: 3px solid #1ab394; +} + +.agile-detail { + margin-top: 5px; + font-size: 12px; +} + + +/* DIFF */ + +ins { + background-color: #c6ffc6; + text-decoration: none; +} + +del { + background-color: #ffc6c6; +} + +#small-chat { + position: fixed; + bottom: 50px; + right: 26px; + z-index: 100; +} + +#small-chat .badge { + position: absolute; + top: -3px; + right: -4px; +} + +.open-small-chat { + height: 38px; + width: 38px; + display: block; + background: #1ab394; + padding: 9px 8px; + text-align: center; + color: #fff; + border-radius: 50%; +} + +.open-small-chat:hover { + color: white; + background: #1ab394; +} + +.small-chat-box { + display: none; + position: fixed; + bottom: 50px; + right: 80px; + background: #fff; + border: 1px solid #e7eaec; + width: 230px; + height: 320px; + border-radius: 4px; +} + +.small-chat-box.ng-small-chat { + display: block; +} + +.body-small .small-chat-box { + bottom: 70px; + right: 20px; +} + +.small-chat-box.active { + display: block; +} + +.small-chat-box .heading { + background: #2f4050; + padding: 8px 15px; + font-weight: bold; + color: #fff; +} + +.small-chat-box .chat-date { + opacity: 0.6; + font-size: 10px; + font-weight: normal; +} + +.small-chat-box .content { + padding: 15px 15px; +} + +.small-chat-box .content .author-name { + font-weight: bold; + margin-bottom: 3px; + font-size: 11px; +} + +.small-chat-box .content > div { + padding-bottom: 20px; +} + +.small-chat-box .content .chat-message { + padding: 5px 10px; + border-radius: 6px; + font-size: 11px; + line-height: 14px; + max-width: 80%; + background: #f3f3f4; + margin-bottom: 10px; +} + +.small-chat-box .content .chat-message.active { + background: #1ab394; + color: #fff; +} + +.small-chat-box .content .left { + text-align: left; + clear: both; +} + +.small-chat-box .content .left .chat-message { + float: left; +} + +.small-chat-box .content .right { + text-align: right; + clear: both; +} + +.small-chat-box .content .right .chat-message { + float: right; +} + +.small-chat-box .form-chat { + padding: 10px 10px; +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-rotating-plane"></div> + * + */ + +.sk-spinner-rotating-plane.sk-spinner { + width: 30px; + height: 30px; + background-color: #1ab394; + margin: 0 auto; + -webkit-animation: sk-rotatePlane 1.2s infinite ease-in-out; + animation: sk-rotatePlane 1.2s infinite ease-in-out; +} + +@-webkit-keyframes sk-rotatePlane { + 0% { + -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg); + transform: perspective(120px) rotateX(0deg) rotateY(0deg); + } + 50% { + -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg); + transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg); + } + 100% { + -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg); + transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg); + } +} + +@keyframes sk-rotatePlane { + 0% { + -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg); + transform: perspective(120px) rotateX(0deg) rotateY(0deg); + } + 50% { + -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg); + transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg); + } + 100% { + -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg); + transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-double-bounce"> + * <div class="sk-double-bounce1"></div> + * <div class="sk-double-bounce2"></div> + * </div> + * + */ + +.sk-spinner-double-bounce.sk-spinner { + width: 40px; + height: 40px; + position: relative; + margin: 0 auto; +} + +.sk-spinner-double-bounce .sk-double-bounce1, +.sk-spinner-double-bounce .sk-double-bounce2 { + width: 100%; + height: 100%; + border-radius: 50%; + background-color: #1ab394; + opacity: 0.6; + position: absolute; + top: 0; + left: 0; + -webkit-animation: sk-doubleBounce 2s infinite ease-in-out; + animation: sk-doubleBounce 2s infinite ease-in-out; +} + +.sk-spinner-double-bounce .sk-double-bounce2 { + -webkit-animation-delay: -1s; + animation-delay: -1s; +} + +@-webkit-keyframes sk-doubleBounce { + 0%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 50% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + +@keyframes sk-doubleBounce { + 0%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 50% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-wave"> + * <div class="sk-rect1"></div> + * <div class="sk-rect2"></div> + * <div class="sk-rect3"></div> + * <div class="sk-rect4"></div> + * <div class="sk-rect5"></div> + * </div> + * + */ + +.sk-spinner-wave.sk-spinner { + margin: 0 auto; + width: 50px; + height: 30px; + text-align: center; + font-size: 10px; +} + +.sk-spinner-wave div { + background-color: #1ab394; + height: 100%; + width: 6px; + display: inline-block; + -webkit-animation: sk-waveStretchDelay 1.2s infinite ease-in-out; + animation: sk-waveStretchDelay 1.2s infinite ease-in-out; +} + +.sk-spinner-wave .sk-rect2 { + -webkit-animation-delay: -1.1s; + animation-delay: -1.1s; +} + +.sk-spinner-wave .sk-rect3 { + -webkit-animation-delay: -1s; + animation-delay: -1s; +} + +.sk-spinner-wave .sk-rect4 { + -webkit-animation-delay: -0.9s; + animation-delay: -0.9s; +} + +.sk-spinner-wave .sk-rect5 { + -webkit-animation-delay: -0.8s; + animation-delay: -0.8s; +} + +@-webkit-keyframes sk-waveStretchDelay { + 0%, + 40%, + 100% { + -webkit-transform: scaleY(0.4); + transform: scaleY(0.4); + } + 20% { + -webkit-transform: scaleY(1); + transform: scaleY(1); + } +} + +@keyframes sk-waveStretchDelay { + 0%, + 40%, + 100% { + -webkit-transform: scaleY(0.4); + transform: scaleY(0.4); + } + 20% { + -webkit-transform: scaleY(1); + transform: scaleY(1); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-wandering-cubes"> + * <div class="sk-cube1"></div> + * <div class="sk-cube2"></div> + * </div> + * + */ + +.sk-spinner-wandering-cubes.sk-spinner { + margin: 0 auto; + width: 32px; + height: 32px; + position: relative; +} + +.sk-spinner-wandering-cubes .sk-cube1, +.sk-spinner-wandering-cubes .sk-cube2 { + background-color: #1ab394; + width: 10px; + height: 10px; + position: absolute; + top: 0; + left: 0; + -webkit-animation: sk-wanderingCubeMove 1.8s infinite ease-in-out; + animation: sk-wanderingCubeMove 1.8s infinite ease-in-out; +} + +.sk-spinner-wandering-cubes .sk-cube2 { + -webkit-animation-delay: -0.9s; + animation-delay: -0.9s; +} + +@-webkit-keyframes sk-wanderingCubeMove { + 25% { + -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5); + transform: translateX(42px) rotate(-90deg) scale(0.5); + } + 50% { + /* Hack to make FF rotate in the right direction */ + -webkit-transform: translateX(42px) translateY(42px) rotate(-179deg); + transform: translateX(42px) translateY(42px) rotate(-179deg); + } + 50.1% { + -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg); + transform: translateX(42px) translateY(42px) rotate(-180deg); + } + 75% { + -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); + transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); + } + 100% { + -webkit-transform: rotate(-360deg); + transform: rotate(-360deg); + } +} + +@keyframes sk-wanderingCubeMove { + 25% { + -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5); + transform: translateX(42px) rotate(-90deg) scale(0.5); + } + 50% { + /* Hack to make FF rotate in the right direction */ + -webkit-transform: translateX(42px) translateY(42px) rotate(-179deg); + transform: translateX(42px) translateY(42px) rotate(-179deg); + } + 50.1% { + -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg); + transform: translateX(42px) translateY(42px) rotate(-180deg); + } + 75% { + -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); + transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); + } + 100% { + -webkit-transform: rotate(-360deg); + transform: rotate(-360deg); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-pulse"></div> + * + */ + +.sk-spinner-pulse.sk-spinner { + width: 40px; + height: 40px; + margin: 0 auto; + background-color: #1ab394; + border-radius: 100%; + -webkit-animation: sk-pulseScaleOut 1s infinite ease-in-out; + animation: sk-pulseScaleOut 1s infinite ease-in-out; +} + +@-webkit-keyframes sk-pulseScaleOut { + 0% { + -webkit-transform: scale(0); + transform: scale(0); + } + 100% { + -webkit-transform: scale(1); + transform: scale(1); + opacity: 0; + } +} + +@keyframes sk-pulseScaleOut { + 0% { + -webkit-transform: scale(0); + transform: scale(0); + } + 100% { + -webkit-transform: scale(1); + transform: scale(1); + opacity: 0; + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-chasing-dots"> + * <div class="sk-dot1"></div> + * <div class="sk-dot2"></div> + * </div> + * + */ + +.sk-spinner-chasing-dots.sk-spinner { + margin: 0 auto; + width: 40px; + height: 40px; + position: relative; + text-align: center; + -webkit-animation: sk-chasingDotsRotate 2s infinite linear; + animation: sk-chasingDotsRotate 2s infinite linear; +} + +.sk-spinner-chasing-dots .sk-dot1, +.sk-spinner-chasing-dots .sk-dot2 { + width: 60%; + height: 60%; + display: inline-block; + position: absolute; + top: 0; + background-color: #1ab394; + border-radius: 100%; + -webkit-animation: sk-chasingDotsBounce 2s infinite ease-in-out; + animation: sk-chasingDotsBounce 2s infinite ease-in-out; +} + +.sk-spinner-chasing-dots .sk-dot2 { + top: auto; + bottom: 0px; + -webkit-animation-delay: -1s; + animation-delay: -1s; +} + +@-webkit-keyframes sk-chasingDotsRotate { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes sk-chasingDotsRotate { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@-webkit-keyframes sk-chasingDotsBounce { + 0%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 50% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + +@keyframes sk-chasingDotsBounce { + 0%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 50% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-three-bounce"> + * <div class="sk-bounce1"></div> + * <div class="sk-bounce2"></div> + * <div class="sk-bounce3"></div> + * </div> + * + */ + +.sk-spinner-three-bounce.sk-spinner { + margin: 0 auto; + width: 70px; + text-align: center; +} + +.sk-spinner-three-bounce div { + width: 18px; + height: 18px; + background-color: #1ab394; + border-radius: 100%; + display: inline-block; + -webkit-animation: sk-threeBounceDelay 1.4s infinite ease-in-out; + animation: sk-threeBounceDelay 1.4s infinite ease-in-out; + /* Prevent first frame from flickering when animation starts */ + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} + +.sk-spinner-three-bounce .sk-bounce1 { + -webkit-animation-delay: -0.32s; + animation-delay: -0.32s; +} + +.sk-spinner-three-bounce .sk-bounce2 { + -webkit-animation-delay: -0.16s; + animation-delay: -0.16s; +} + +@-webkit-keyframes sk-threeBounceDelay { + 0%, + 80%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 40% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + +@keyframes sk-threeBounceDelay { + 0%, + 80%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 40% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-circle"> + * <div class="sk-circle1 sk-circle"></div> + * <div class="sk-circle2 sk-circle"></div> + * <div class="sk-circle3 sk-circle"></div> + * <div class="sk-circle4 sk-circle"></div> + * <div class="sk-circle5 sk-circle"></div> + * <div class="sk-circle6 sk-circle"></div> + * <div class="sk-circle7 sk-circle"></div> + * <div class="sk-circle8 sk-circle"></div> + * <div class="sk-circle9 sk-circle"></div> + * <div class="sk-circle10 sk-circle"></div> + * <div class="sk-circle11 sk-circle"></div> + * <div class="sk-circle12 sk-circle"></div> + * </div> + * + */ + +.sk-spinner-circle.sk-spinner { + margin: 0 auto; + width: 22px; + height: 22px; + position: relative; +} + +.sk-spinner-circle .sk-circle { + width: 100%; + height: 100%; + position: absolute; + left: 0; + top: 0; +} + +.sk-spinner-circle .sk-circle:before { + content: ''; + display: block; + margin: 0 auto; + width: 20%; + height: 20%; + background-color: #1ab394; + border-radius: 100%; + -webkit-animation: sk-circleBounceDelay 1.2s infinite ease-in-out; + animation: sk-circleBounceDelay 1.2s infinite ease-in-out; + /* Prevent first frame from flickering when animation starts */ + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} + +.sk-spinner-circle .sk-circle2 { + -webkit-transform: rotate(30deg); + -ms-transform: rotate(30deg); + transform: rotate(30deg); +} + +.sk-spinner-circle .sk-circle3 { + -webkit-transform: rotate(60deg); + -ms-transform: rotate(60deg); + transform: rotate(60deg); +} + +.sk-spinner-circle .sk-circle4 { + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} + +.sk-spinner-circle .sk-circle5 { + -webkit-transform: rotate(120deg); + -ms-transform: rotate(120deg); + transform: rotate(120deg); +} + +.sk-spinner-circle .sk-circle6 { + -webkit-transform: rotate(150deg); + -ms-transform: rotate(150deg); + transform: rotate(150deg); +} + +.sk-spinner-circle .sk-circle7 { + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.sk-spinner-circle .sk-circle8 { + -webkit-transform: rotate(210deg); + -ms-transform: rotate(210deg); + transform: rotate(210deg); +} + +.sk-spinner-circle .sk-circle9 { + -webkit-transform: rotate(240deg); + -ms-transform: rotate(240deg); + transform: rotate(240deg); +} + +.sk-spinner-circle .sk-circle10 { + -webkit-transform: rotate(270deg); + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} + +.sk-spinner-circle .sk-circle11 { + -webkit-transform: rotate(300deg); + -ms-transform: rotate(300deg); + transform: rotate(300deg); +} + +.sk-spinner-circle .sk-circle12 { + -webkit-transform: rotate(330deg); + -ms-transform: rotate(330deg); + transform: rotate(330deg); +} + +.sk-spinner-circle .sk-circle2:before { + -webkit-animation-delay: -1.1s; + animation-delay: -1.1s; +} + +.sk-spinner-circle .sk-circle3:before { + -webkit-animation-delay: -1s; + animation-delay: -1s; +} + +.sk-spinner-circle .sk-circle4:before { + -webkit-animation-delay: -0.9s; + animation-delay: -0.9s; +} + +.sk-spinner-circle .sk-circle5:before { + -webkit-animation-delay: -0.8s; + animation-delay: -0.8s; +} + +.sk-spinner-circle .sk-circle6:before { + -webkit-animation-delay: -0.7s; + animation-delay: -0.7s; +} + +.sk-spinner-circle .sk-circle7:before { + -webkit-animation-delay: -0.6s; + animation-delay: -0.6s; +} + +.sk-spinner-circle .sk-circle8:before { + -webkit-animation-delay: -0.5s; + animation-delay: -0.5s; +} + +.sk-spinner-circle .sk-circle9:before { + -webkit-animation-delay: -0.4s; + animation-delay: -0.4s; +} + +.sk-spinner-circle .sk-circle10:before { + -webkit-animation-delay: -0.3s; + animation-delay: -0.3s; +} + +.sk-spinner-circle .sk-circle11:before { + -webkit-animation-delay: -0.2s; + animation-delay: -0.2s; +} + +.sk-spinner-circle .sk-circle12:before { + -webkit-animation-delay: -0.1s; + animation-delay: -0.1s; +} + +@-webkit-keyframes sk-circleBounceDelay { + 0%, + 80%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 40% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + +@keyframes sk-circleBounceDelay { + 0%, + 80%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 40% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-cube-grid"> + * <div class="sk-cube"></div> + * <div class="sk-cube"></div> + * <div class="sk-cube"></div> + * <div class="sk-cube"></div> + * <div class="sk-cube"></div> + * <div class="sk-cube"></div> + * <div class="sk-cube"></div> + * <div class="sk-cube"></div> + * <div class="sk-cube"></div> + * </div> + * + */ + +.sk-spinner-cube-grid { + /* + * Spinner positions + * 1 2 3 + * 4 5 6 + * 7 8 9 + */ +} + +.sk-spinner-cube-grid.sk-spinner { + width: 30px; + height: 30px; + margin: 0 auto; +} + +.sk-spinner-cube-grid .sk-cube { + width: 33%; + height: 33%; + background-color: #1ab394; + float: left; + -webkit-animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out; + animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(1) { + -webkit-animation-delay: 0.2s; + animation-delay: 0.2s; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(2) { + -webkit-animation-delay: 0.3s; + animation-delay: 0.3s; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(3) { + -webkit-animation-delay: 0.4s; + animation-delay: 0.4s; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(4) { + -webkit-animation-delay: 0.1s; + animation-delay: 0.1s; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(5) { + -webkit-animation-delay: 0.2s; + animation-delay: 0.2s; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(6) { + -webkit-animation-delay: 0.3s; + animation-delay: 0.3s; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(7) { + -webkit-animation-delay: 0s; + animation-delay: 0s; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(8) { + -webkit-animation-delay: 0.1s; + animation-delay: 0.1s; +} + +.sk-spinner-cube-grid .sk-cube:nth-child(9) { + -webkit-animation-delay: 0.2s; + animation-delay: 0.2s; +} + +@-webkit-keyframes sk-cubeGridScaleDelay { + 0%, + 70%, + 100% { + -webkit-transform: scale3D(1, 1, 1); + transform: scale3D(1, 1, 1); + } + 35% { + -webkit-transform: scale3D(0, 0, 1); + transform: scale3D(0, 0, 1); + } +} + +@keyframes sk-cubeGridScaleDelay { + 0%, + 70%, + 100% { + -webkit-transform: scale3D(1, 1, 1); + transform: scale3D(1, 1, 1); + } + 35% { + -webkit-transform: scale3D(0, 0, 1); + transform: scale3D(0, 0, 1); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-wordpress"> + * <span class="sk-inner-circle"></span> + * </div> + * + */ + +.sk-spinner-wordpress.sk-spinner { + background-color: #1ab394; + width: 30px; + height: 30px; + border-radius: 30px; + position: relative; + margin: 0 auto; + -webkit-animation: sk-innerCircle 1s linear infinite; + animation: sk-innerCircle 1s linear infinite; +} + +.sk-spinner-wordpress .sk-inner-circle { + display: block; + background-color: #fff; + width: 8px; + height: 8px; + position: absolute; + border-radius: 8px; + top: 5px; + left: 5px; +} + +@-webkit-keyframes sk-innerCircle { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes sk-innerCircle { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + + +/* + * Usage: + * + * <div class="sk-spinner sk-spinner-fading-circle"> + * <div class="sk-circle1 sk-circle"></div> + * <div class="sk-circle2 sk-circle"></div> + * <div class="sk-circle3 sk-circle"></div> + * <div class="sk-circle4 sk-circle"></div> + * <div class="sk-circle5 sk-circle"></div> + * <div class="sk-circle6 sk-circle"></div> + * <div class="sk-circle7 sk-circle"></div> + * <div class="sk-circle8 sk-circle"></div> + * <div class="sk-circle9 sk-circle"></div> + * <div class="sk-circle10 sk-circle"></div> + * <div class="sk-circle11 sk-circle"></div> + * <div class="sk-circle12 sk-circle"></div> + * </div> + * + */ + +.sk-spinner-fading-circle.sk-spinner { + margin: 0 auto; + width: 22px; + height: 22px; + position: relative; +} + +.sk-spinner-fading-circle .sk-circle { + width: 100%; + height: 100%; + position: absolute; + left: 0; + top: 0; +} + +.sk-spinner-fading-circle .sk-circle:before { + content: ''; + display: block; + margin: 0 auto; + width: 18%; + height: 18%; + background-color: #1ab394; + border-radius: 100%; + -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out; + animation: sk-circleFadeDelay 1.2s infinite ease-in-out; + /* Prevent first frame from flickering when animation starts */ + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} + +.sk-spinner-fading-circle .sk-circle2 { + -webkit-transform: rotate(30deg); + -ms-transform: rotate(30deg); + transform: rotate(30deg); +} + +.sk-spinner-fading-circle .sk-circle3 { + -webkit-transform: rotate(60deg); + -ms-transform: rotate(60deg); + transform: rotate(60deg); +} + +.sk-spinner-fading-circle .sk-circle4 { + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} + +.sk-spinner-fading-circle .sk-circle5 { + -webkit-transform: rotate(120deg); + -ms-transform: rotate(120deg); + transform: rotate(120deg); +} + +.sk-spinner-fading-circle .sk-circle6 { + -webkit-transform: rotate(150deg); + -ms-transform: rotate(150deg); + transform: rotate(150deg); +} + +.sk-spinner-fading-circle .sk-circle7 { + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.sk-spinner-fading-circle .sk-circle8 { + -webkit-transform: rotate(210deg); + -ms-transform: rotate(210deg); + transform: rotate(210deg); +} + +.sk-spinner-fading-circle .sk-circle9 { + -webkit-transform: rotate(240deg); + -ms-transform: rotate(240deg); + transform: rotate(240deg); +} + +.sk-spinner-fading-circle .sk-circle10 { + -webkit-transform: rotate(270deg); + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} + +.sk-spinner-fading-circle .sk-circle11 { + -webkit-transform: rotate(300deg); + -ms-transform: rotate(300deg); + transform: rotate(300deg); +} + +.sk-spinner-fading-circle .sk-circle12 { + -webkit-transform: rotate(330deg); + -ms-transform: rotate(330deg); + transform: rotate(330deg); +} + +.sk-spinner-fading-circle .sk-circle2:before { + -webkit-animation-delay: -1.1s; + animation-delay: -1.1s; +} + +.sk-spinner-fading-circle .sk-circle3:before { + -webkit-animation-delay: -1s; + animation-delay: -1s; +} + +.sk-spinner-fading-circle .sk-circle4:before { + -webkit-animation-delay: -0.9s; + animation-delay: -0.9s; +} + +.sk-spinner-fading-circle .sk-circle5:before { + -webkit-animation-delay: -0.8s; + animation-delay: -0.8s; +} + +.sk-spinner-fading-circle .sk-circle6:before { + -webkit-animation-delay: -0.7s; + animation-delay: -0.7s; +} + +.sk-spinner-fading-circle .sk-circle7:before { + -webkit-animation-delay: -0.6s; + animation-delay: -0.6s; +} + +.sk-spinner-fading-circle .sk-circle8:before { + -webkit-animation-delay: -0.5s; + animation-delay: -0.5s; +} + +.sk-spinner-fading-circle .sk-circle9:before { + -webkit-animation-delay: -0.4s; + animation-delay: -0.4s; +} + +.sk-spinner-fading-circle .sk-circle10:before { + -webkit-animation-delay: -0.3s; + animation-delay: -0.3s; +} + +.sk-spinner-fading-circle .sk-circle11:before { + -webkit-animation-delay: -0.2s; + animation-delay: -0.2s; +} + +.sk-spinner-fading-circle .sk-circle12:before { + -webkit-animation-delay: -0.1s; + animation-delay: -0.1s; +} + +@-webkit-keyframes sk-circleFadeDelay { + 0%, + 39%, + 100% { + opacity: 0; + } + 40% { + opacity: 1; + } +} + +@keyframes sk-circleFadeDelay { + 0%, + 39%, + 100% { + opacity: 0; + } + 40% { + opacity: 1; + } +} + +body.rtls { + /* Theme config */ +} + +body.rtls #page-wrapper { + margin: 0 220px 0 0; +} + +body.rtls .nav-second-level li a { + padding: 7px 35px 7px 10px; +} + +body.rtls .ibox-title h5 { + float: right; +} + +body.rtls .pull-right { + float: left !important; +} + +body.rtls .pull-left { + float: right !important; +} + +body.rtls .ibox-tools { + float: left; +} + +body.rtls .stat-percent { + float: left; +} + +body.rtls .navbar-right { + float: left !important; +} + +body.rtls .navbar-top-links li:last-child { + margin-left: 40px; + margin-right: 0; +} + +body.rtls .minimalize-styl-2 { + float: right; + margin: 14px 20px 5px 5px; +} + +body.rtls .feed-element > .pull-left { + margin-left: 10px; + margin-right: 0; +} + +body.rtls .timeline-item .date { + text-align: left; +} + +body.rtls .timeline-item .date i { + left: 0; + right: auto; +} + +body.rtls .timeline-item .content { + border-right: 1px solid #e7eaec; + border-left: none; +} + +body.rtls .toast-close-button { + float: left; +} + +body.rtls #toast-container > .toast:before { + margin: auto -1.5em auto 0.5em; +} + +body.rtls #toast-container > div { + padding: 15px 50px 15px 15px; +} + +body.rtls .center-orientation .vertical-timeline-icon i { + margin-left: 0; + margin-right: -12px; +} + +body.rtls .vertical-timeline-icon i { + right: 50%; + left: auto; + margin-left: auto; + margin-right: -12px; +} + +body.rtls .file-box { + float: right; +} + +body.rtls ul.notes li { + float: right; +} + +body.rtls .chat-users, +body.rtls .chat-statistic { + margin-right: -30px; + margin-left: auto; +} + +body.rtls .dropdown-menu > li > a { + text-align: right; +} + +body.rtls .b-r { + border-left: 1px solid #e7eaec; + border-right: none; +} + +body.rtls .dd-list .dd-list { + padding-right: 30px; + padding-left: 0; +} + +body.rtls .dd-item > button { + float: right; +} + +body.rtls .skin-setttings { + margin-right: 40px; + margin-left: 0; +} + +body.rtls .skin-setttings { + direction: ltr; +} + +body.rtls .footer.fixed { + margin-right: 220px; + margin-left: 0; +} + +@media (max-width: 992px) { + body.rtls .chat-users, + body.rtls .chat-statistic { + margin-right: 0px; + } +} + +body.rtls.mini-navbar .footer.fixed, +body.body-small.mini-navbar .footer.fixed { + margin: 0 70px 0 0; +} + +body.rtls.mini-navbar.fixed-sidebar .footer.fixed, +body.body-small.mini-navbar .footer.fixed { + margin: 0 0 0 0; +} + +body.rtls.top-navigation .navbar-toggle { + float: right; + margin-left: 15px; + margin-right: 15px; +} + +.body-small.rtls.top-navigation .navbar-header { + float: none; +} + +body.rtls.top-navigation #page-wrapper { + margin: 0; +} + +body.rtls.mini-navbar #page-wrapper { + margin: 0 70px 0 0; +} + +body.rtls.mini-navbar.fixed-sidebar #page-wrapper { + margin: 0 0 0 0; +} + +body.rtls.body-small.fixed-sidebar.mini-navbar #page-wrapper { + margin: 0 220px 0 0; +} + +body.rtls.body-small.fixed-sidebar.mini-navbar .navbar-static-side { + width: 220px; +} + +.body-small.rtls .navbar-fixed-top { + margin-right: 0px; +} + +.body-small.rtls .navbar-header { + float: right; +} + +body.rtls .navbar-top-links li:last-child { + margin-left: 20px; +} + +body.rtls .top-navigation #page-wrapper, +body.rtls.mini-navbar .top-navigation #page-wrapper, +body.rtls.mini-navbar.top-navigation #page-wrapper { + margin: 0; +} + +body.rtls .top-navigation .footer.fixed, +body.rtls.top-navigation .footer.fixed { + margin: 0; +} + +@media (max-width: 768px) { + body.rtls .navbar-top-links li:last-child { + margin-left: 20px; + } + .body-small.rtls #page-wrapper { + position: inherit; + margin: 0 0 0 0px; + min-height: 1000px; + } + .body-small.rtls .navbar-static-side { + display: none; + z-index: 2001; + position: absolute; + width: 70px; + } + .body-small.rtls.mini-navbar .navbar-static-side { + display: block; + } + .rtls.fixed-sidebar.body-small .navbar-static-side { + display: none; + z-index: 2001; + position: fixed; + width: 220px; + } + .rtls.fixed-sidebar.body-small.mini-navbar .navbar-static-side { + display: block; + } +} + +.rtls .ltr-support { + direction: ltr; +} + + +/* + * + * This is style for skin config + * Use only in demo theme + * +*/ + +.skin-setttings .title { + background: #efefef; + text-align: center; + text-transform: uppercase; + font-weight: 600; + display: block; + padding: 10px 15px; + font-size: 12px; +} + +.setings-item { + padding: 10px 30px; +} + +.setings-item.nb { + border: none; +} + +.setings-item.skin { + text-align: center; +} + +.setings-item .switch { + float: right; +} + +.skin-name a { + text-transform: uppercase; +} + +.setings-item a { + color: #fff; +} + +.default-skin, +.blue-skin, +.ultra-skin, +.yellow-skin { + text-align: center; +} + +.default-skin { + font-weight: 600; + background: #1ab394; +} + +.default-skin:hover { + background: #199d82; +} + +.blue-skin { + font-weight: 600; + background: url("patterns/header-profile-skin-1.png") repeat scroll 0 0; +} + +.blue-skin:hover { + background: #0d8ddb; +} + +.yellow-skin { + font-weight: 600; + background: url("patterns/header-profile-skin-3.png") repeat scroll 0 100%; +} + +.yellow-skin:hover { + background: #ce8735; +} + +.content-tabs { + border-bottom: solid 2px #2f4050; +} + +.page-tabs a { + color: #999; +} + +.page-tabs a i { + color: #ccc; +} + +.page-tabs a.active { + background: #2f4050; + color: #a7b1c2; +} + +.page-tabs a.active:hover, +.page-tabs a.active i:hover { + background: #293846; + color: #fff; +} + + +/* + * + * SKIN 1 - H+ - 后台主题UI框架 + * NAME - Blue light + * +*/ + +.skin-1 .minimalize-styl-2 { + margin: 14px 5px 5px 30px; +} + +.skin-1 .navbar-top-links li:last-child { + margin-right: 30px; +} + +.skin-1.fixed-nav .minimalize-styl-2 { + margin: 14px 5px 5px 15px; +} + +.skin-1 .spin-icon { + background: #0e9aef !important; +} + +.skin-1 .nav-header { + background: #0e9aef; + background: url('patterns/header-profile-skin-1.png'); +} + +.skin-1.mini-navbar .nav-second-level { + background: #3e495f; +} + +.skin-1 .breadcrumb { + background: transparent; +} + +.skin-1 .page-heading { + border: none; +} + +.skin-1 .nav > li.active { + background: #3a4459; +} + +.skin-1 .nav > li > a { + color: #9ea6b9; +} + +.skin-1 .nav > li.active > a { + color: #fff; +} + +.skin-1 .navbar-minimalize { + background: #0e9aef; + border-color: #0e9aef; +} + +body.skin-1 { + background: #3e495f; +} + +.skin-1 .navbar-static-top { + background: #ffffff; +} + +.skin-1 .dashboard-header { + background: transparent; + border-bottom: none !important; + border-top: none; + padding: 20px 30px 10px 30px; +} + +.fixed-nav.skin-1 .navbar-fixed-top { + background: #fff; +} + +.skin-1 .wrapper-content { + padding: 30px 15px; +} + +.skin-1 #page-wrapper { + background: #f4f6fa; +} + +.skin-1 .ibox-title, +.skin-1 .ibox-content { + border-width: 1px; +} + +.skin-1 .ibox-content:last-child { + border-style: solid solid solid solid; +} + +.skin-1 .nav > li.active { + border: none; +} + +.skin-1 .nav-header { + padding: 35px 25px 25px 25px; +} + +.skin-1 .nav-header a.dropdown-toggle { + color: #fff; + margin-top: 10px; +} + +.skin-1 .nav-header a.dropdown-toggle .text-muted { + color: #fff; + opacity: 0.8; +} + +.skin-1 .profile-element { + text-align: center; +} + +.skin-1 .img-circle { + border-radius: 5px; +} + +.skin-1 .navbar-default .nav > li > a:hover, +.skin-1 .navbar-default .nav > li > a:focus { + background: #39aef5; + color: #fff; +} + +.skin-1 .nav.nav-tabs > li.active > a { + color: #555; +} + +.skin-1 .content-tabs { + border-bottom: solid 2px #39aef5; +} + +.skin-1 .nav.nav-tabs > li.active { + background: transparent; +} + +.skin-1 .page-tabs a.active { + background: #39aef5; + color: #fff; +} + +.skin-1 .page-tabs a.active:hover, +.skin-1 .page-tabs a.active i:hover { + background: #0e9aef; + color: #fff; +} + + +/* + * + * SKIN 3 - H+ - 后台主题UI框架 + * NAME - Yellow/purple + * +*/ + +.skin-3 .minimalize-styl-2 { + margin: 14px 5px 5px 30px; +} + +.skin-3 .navbar-top-links li:last-child { + margin-right: 30px; +} + +.skin-3.fixed-nav .minimalize-styl-2 { + margin: 14px 5px 5px 15px; +} + +.skin-3 .spin-icon { + background: #ecba52 !important; +} + +body.boxed-layout.skin-3 #wrapper { + background: #3e2c42; +} + +.skin-3 .nav-header { + background: #ecba52; + background: url('patterns/header-profile-skin-3.png'); +} + +.skin-3.mini-navbar .nav-second-level { + background: #3e2c42; +} + +.skin-3 .breadcrumb { + background: transparent; +} + +.skin-3 .page-heading { + border: none; +} + +.skin-3 .nav > li.active { + background: #38283c; +} + +.fixed-nav.skin-3 .navbar-fixed-top { + background: #fff; +} + +.skin-3 .nav > li > a { + color: #948b96; +} + +.skin-3 .nav > li.active > a { + color: #fff; +} + +.skin-3 .navbar-minimalize { + background: #ecba52; + border-color: #ecba52; +} + +body.skin-3 { + background: #3e2c42; +} + +.skin-3 .navbar-static-top { + background: #ffffff; +} + +.skin-3 .dashboard-header { + background: transparent; + border-bottom: none !important; + border-top: none; + padding: 20px 30px 10px 30px; +} + +.skin-3 .wrapper-content { + padding: 30px 15px; +} + +.skin-3 #page-wrapper { + background: #f4f6fa; +} + +.skin-3 .ibox-title, +.skin-3 .ibox-content { + border-width: 1px; +} + +.skin-3 .ibox-content:last-child { + border-style: solid solid solid solid; +} + +.skin-3 .nav > li.active { + border: none; +} + +.skin-3 .nav-header { + padding: 35px 25px 25px 25px; +} + +.skin-3 .nav-header a.dropdown-toggle { + color: #fff; + margin-top: 10px; +} + +.skin-3 .nav-header a.dropdown-toggle .text-muted { + color: #fff; + opacity: 0.8; +} + +.skin-3 .profile-element { + text-align: center; +} + +.skin-3 .img-circle { + border-radius: 5px; +} + +.skin-3 .navbar-default .nav > li > a:hover, +.skin-3 .navbar-default .nav > li > a:focus { + background: #38283c; + color: #fff; +} + +.skin-3 .nav.nav-tabs > li.active > a { + color: #555; +} + +.skin-3 .nav.nav-tabs > li.active { + background: transparent; +} + +.skin-3 .content-tabs { + border-bottom: solid 2px #3e2c42; +} + +.skin-3 .nav.nav-tabs > li.active { + background: transparent; +} + +.skin-3 .page-tabs a.active { + background: #3e2c42; + color: #fff; +} + +.skin-3 .page-tabs a.active:hover, +.skin-3 .page-tabs a.active i:hover { + background: #38283c; + color: #fff; +} + +@media (min-width: 768px) { + .navbar-top-links .dropdown-messages, + .navbar-top-links .dropdown-tasks, + .navbar-top-links .dropdown-alerts { + margin-left: auto; + } +} + +@media (max-width: 768px) { + body.fixed-sidebar .navbar-static-side { + display: none; + } + body.fixed-sidebar.mini-navbar .navbar-static-side { + width: 70px; + } + .lock-word { + display: none; + } + .navbar-form-custom { + display: none; + } + .navbar-header { + display: inline; + float: left; + } + .sidebard-panel { + z-index: 2; + position: relative; + width: auto; + min-height: 100% !important; + } + .sidebar-content .wrapper { + padding-right: 0px; + z-index: 1; + } + .fixed-sidebar.body-small .navbar-static-side { + display: none; + z-index: 2001; + position: fixed; + width: 220px; + } + .fixed-sidebar.body-small.mini-navbar .navbar-static-side { + display: block; + } + .ibox-tools { + float: none; + text-align: right; + display: block; + } + .content-tabs { + display: none; + } + #content-main { + height: calc(100% - 100px); + } + .fixed-nav #content-main { + height: calc(100% - 38px); + } +} + +.navbar-static-side { + background: #2f4050; +} + +.nav-close { + padding: 10px; + display: block; + position: absolute; + right: 5px; + top: 5px; + font-size: 1.4em; + cursor: pointer; + z-index: 10; + display: none; + color: rgba(255, 255, 255, .3); +} + +@media (max-width: 350px) { + body.fixed-sidebar.mini-navbar .navbar-static-side { + width: 0; + } + .nav-close { + display: block; + } + #page-wrapper { + margin-left: 0!important; + } + .timeline-item .date { + text-align: left; + width: 110px; + position: relative; + padding-top: 30px; + } + .timeline-item .date i { + position: absolute; + top: 0; + left: 15px; + padding: 5px; + width: 30px; + text-align: center; + border: 1px solid #e7eaec; + background: #f8f8f8; + } + .timeline-item .content { + border-left: none; + border-top: 1px solid #e7eaec; + padding-top: 10px; + min-height: 100px; + } + .nav.navbar-top-links li.dropdown { + display: none; + } + .ibox-tools { + float: none; + text-align: left; + display: inline-block; + } +} + + +/*JQGRID*/ + +.ui-jqgrid-titlebar { + height: 40px; + line-height: 24px; + color: #676a6c; + background-color: #F9F9F9; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); +} + +.ui-jqgrid .ui-jqgrid-title { + float: left; + margin-left: 5px; + font-weight: 700; +} + +.ui-jqgrid .ui-jqgrid-titlebar { + position: relative; + border-left: 0px solid; + border-right: 0px solid; + border-top: 0px solid; +} + + +/* Social feed */ + +.social-feed-separated .social-feed-box { + margin-left: 62px; +} + +.social-feed-separated .social-avatar { + float: left; + padding: 0; +} + +.social-feed-separated .social-avatar img { + width: 52px; + height: 52px; + border: 1px solid #e7eaec; +} + +.social-feed-separated .social-feed-box .social-avatar { + padding: 15px 15px 0 15px; + float: none; +} + +.social-feed-box { + /*padding: 15px;*/ + border: 1px solid #e7eaec; + background: #fff; + margin-bottom: 15px; +} + +.article .social-feed-box { + margin-bottom: 0; + border-bottom: none; +} + +.article .social-feed-box:last-child { + margin-bottom: 0; + border-bottom: 1px solid #e7eaec; +} + +.article .social-feed-box p { + font-size: 13px; + line-height: 18px; +} + +.social-action { + margin: 15px; +} + +.social-avatar { + padding: 15px 15px 0 15px; +} + +.social-comment .social-comment { + margin-left: 45px; +} + +.social-avatar img { + height: 40px; + width: 40px; + margin-right: 10px; +} + +.social-avatar .media-body a { + font-size: 14px; + display: block; +} + +.social-body { + padding: 15px; +} + +.social-body img { + margin-bottom: 10px; +} + +.social-footer { + border-top: 1px solid #e7eaec; + padding: 10px 15px; + background: #f9f9f9; +} + +.social-footer .social-comment img { + width: 32px; + margin-right: 10px; +} + +.social-comment:first-child { + margin-top: 0; +} + +.social-comment { + margin-top: 15px; +} + +.social-comment textarea { + font-size: 12px; +} + +.checkbox input[type=checkbox], +.checkbox-inline input[type=checkbox], +.radio input[type=radio], +.radio-inline input[type=radio] { + margin-top: -4px; +} + + +/* Only demo */ + +@media (max-width: 1000px) { + .welcome-message { + display: none; + } +} + + +/* ECHARTS */ + +.echarts { + height: 240px; +} + +.checkbox-inline, +.radio-inline, +.checkbox-inline+.checkbox-inline, +.radio-inline+.radio-inline { + margin: 0 15px 0 0; +} + +.navbar-toggle { + background-color: #fff; +} + +.J_menuTab { + -webkit-transition: all .3s ease-out 0s; + transition: all .3s ease-out 0s; +} + +::-webkit-scrollbar-track { + background-color: #F5F5F5; +} + +::-webkit-scrollbar { + width: 6px; + background-color: #F5F5F5; +} + +::-webkit-scrollbar-thumb { + background-color: #999; +} + + +/*GO HOME*/ + +.gohome { + position: fixed; + top: 20px; + right: 20px; + z-index: 100; +} + +.gohome a { + height: 38px; + width: 38px; + display: block; + background: #2f4050; + padding: 9px 8px; + text-align: center; + color: #fff; + border-radius: 50%; + opacity: .5; +} + +.gohome a:hover { + opacity: 1; +} + +@media only screen and (-webkit-min-device-pixel-ratio : 2){ + #content-main { + -webkit-overflow-scrolling: touch; + } +} + +.navbar-header { + width: 60%; +} + +.bs-glyphicons { + margin: 0 -10px 20px; + overflow: hidden +} + +.bs-glyphicons-list { + padding-left: 0; + list-style: none +} + +.bs-glyphicons li { + float: left; + width: 25%; + height: 115px; + padding: 10px; + font-size: 10px; + line-height: 1.4; + text-align: center; + background-color: #f9f9f9; + border: 1px solid #fff +} + +.bs-glyphicons .glyphicon { + margin-top: 5px; + margin-bottom: 10px; + font-size: 24px +} + +.bs-glyphicons .glyphicon-class { + display: block; + text-align: center; + word-wrap: break-word +} + +.bs-glyphicons li:hover { + color: #fff; + background-color: #1ab394; +} + +@media (min-width: 768px) { + .bs-glyphicons { + margin-right: 0; + margin-left: 0 + } + .bs-glyphicons li { + width: 12.5%; + font-size: 12px + } +} + +.tab-menu-selected { + background-color: #293846 !important; + color: white !important; +} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/favicon.ico b/user/guns-admin/src/main/webapp/static/favicon.ico new file mode 100644 index 0000000..fe6cf7a --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/favicon.ico Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/FontAwesome.otf b/user/guns-admin/src/main/webapp/static/fonts/FontAwesome.otf new file mode 100644 index 0000000..681bdd4 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/FontAwesome.otf Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.eot b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.eot new file mode 100644 index 0000000..a30335d --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.eot Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.svg b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000..6c5bb76 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.svg @@ -0,0 +1,640 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> +<metadata></metadata> +<defs> +<font id="fontawesomeregular" horiz-adv-x="1536" > +<font-face units-per-em="1792" ascent="1536" descent="-256" /> +<missing-glyph horiz-adv-x="448" /> +<glyph unicode=" " horiz-adv-x="448" /> +<glyph unicode="	" horiz-adv-x="448" /> +<glyph unicode=" " horiz-adv-x="448" /> +<glyph unicode="¨" horiz-adv-x="1792" /> +<glyph unicode="©" horiz-adv-x="1792" /> +<glyph unicode="®" horiz-adv-x="1792" /> +<glyph unicode="´" horiz-adv-x="1792" /> +<glyph unicode="Æ" horiz-adv-x="1792" /> +<glyph unicode="Ø" horiz-adv-x="1792" /> +<glyph unicode=" " horiz-adv-x="768" /> +<glyph unicode=" " horiz-adv-x="1537" /> +<glyph unicode=" " horiz-adv-x="768" /> +<glyph unicode=" " horiz-adv-x="1537" /> +<glyph unicode=" " horiz-adv-x="512" /> +<glyph unicode=" " horiz-adv-x="384" /> +<glyph unicode=" " horiz-adv-x="256" /> +<glyph unicode=" " horiz-adv-x="256" /> +<glyph unicode=" " horiz-adv-x="192" /> +<glyph unicode=" " horiz-adv-x="307" /> +<glyph unicode=" " horiz-adv-x="85" /> +<glyph unicode=" " horiz-adv-x="307" /> +<glyph unicode=" " horiz-adv-x="384" /> +<glyph unicode="™" horiz-adv-x="1792" /> +<glyph unicode="∞" horiz-adv-x="1792" /> +<glyph unicode="≠" horiz-adv-x="1792" /> +<glyph unicode="◼" horiz-adv-x="500" d="M0 0z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1699 1350q0 -35 -43 -78l-632 -632v-768h320q26 0 45 -19t19 -45t-19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45t45 19h320v768l-632 632q-43 43 -43 78q0 23 18 36.5t38 17.5t43 4h1408q23 0 43 -4t38 -17.5t18 -36.5z" /> +<glyph unicode="" d="M1536 1312v-1120q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v537l-768 -237v-709q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89 t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v967q0 31 19 56.5t49 35.5l832 256q12 4 28 4q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -52 -38 -90t-90 -38q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5 t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 32v768q-32 -36 -69 -66q-268 -206 -426 -338q-51 -43 -83 -67t-86.5 -48.5t-102.5 -24.5h-1h-1q-48 0 -102.5 24.5t-86.5 48.5t-83 67q-158 132 -426 338q-37 30 -69 66v-768q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1664 1083v11v13.5t-0.5 13 t-3 12.5t-5.5 9t-9 7.5t-14 2.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5q0 -168 147 -284q193 -152 401 -317q6 -5 35 -29.5t46 -37.5t44.5 -31.5t50.5 -27.5t43 -9h1h1q20 0 43 9t50.5 27.5t44.5 31.5t46 37.5t35 29.5q208 165 401 317q54 43 100.5 115.5t46.5 131.5z M1792 1120v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 -128q-26 0 -44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5q224 0 351 -124t127 -344q0 -221 -229 -450l-623 -600 q-18 -18 -44 -18z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -21 -10.5 -35.5t-30.5 -14.5q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455 l502 -73q56 -9 56 -46z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1137 532l306 297l-422 62l-189 382l-189 -382l-422 -62l306 -297l-73 -421l378 199l377 -199zM1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -50 -41 -50q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500 l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455l502 -73q56 -9 56 -46z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 131q0 -120 -73 -189.5t-194 -69.5h-874q-121 0 -194 69.5t-73 189.5q0 53 3.5 103.5t14 109t26.5 108.5t43 97.5t62 81t85.5 53.5t111.5 20q9 0 42 -21.5t74.5 -48t108 -48t133.5 -21.5t133.5 21.5t108 48t74.5 48t42 21.5q61 0 111.5 -20t85.5 -53.5t62 -81 t43 -97.5t26.5 -108.5t14 -109t3.5 -103.5zM1088 1024q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M384 -64v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM384 320v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM384 704v128q0 26 -19 45t-45 19h-128 q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1408 -64v512q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-512q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM384 1088v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45 t45 -19h128q26 0 45 19t19 45zM1792 -64v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1408 704v512q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-512q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM1792 320v128 q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1792 704v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1792 1088v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19 t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1920 1248v-1344q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1344q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 512v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM768 1280v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM1664 512v-384q0 -52 -38 -90t-90 -38 h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM1664 1280v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 288v-192q0 -40 -28 -68t-68 -28h-320 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28 h320q40 0 68 -28t28 -68zM1792 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 800v-192 q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 288v-192q0 -40 -28 -68t-68 -28h-960 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h960q40 0 68 -28t28 -68zM512 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 800v-192q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v192q0 40 28 68t68 28 h960q40 0 68 -28t28 -68zM1792 1312v-192q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h960q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1671 970q0 -40 -28 -68l-724 -724l-136 -136q-28 -28 -68 -28t-68 28l-136 136l-362 362q-28 28 -28 68t28 68l136 136q28 28 68 28t68 -28l294 -295l656 657q28 28 68 28t68 -28l136 -136q28 -28 28 -68z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1298 214q0 -40 -28 -68l-136 -136q-28 -28 -68 -28t-68 28l-294 294l-294 -294q-28 -28 -68 -28t-68 28l-136 136q-28 28 -28 68t28 68l294 294l-294 294q-28 28 -28 68t28 68l136 136q28 28 68 28t68 -28l294 -294l294 294q28 28 68 28t68 -28l136 -136q28 -28 28 -68 t-28 -68l-294 -294l294 -294q28 -28 28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1024 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-224v-224q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v224h-224q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h224v224q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5v-224h224 q13 0 22.5 -9.5t9.5 -22.5zM1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -53 -37.5 -90.5t-90.5 -37.5q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5 t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1024 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-576q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h576q13 0 22.5 -9.5t9.5 -22.5zM1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5z M1664 -128q0 -53 -37.5 -90.5t-90.5 -37.5q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z " /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61t-298 61t-245 164t-164 245t-61 298q0 182 80.5 343t226.5 270q43 32 95.5 25t83.5 -50q32 -42 24.5 -94.5t-49.5 -84.5q-98 -74 -151.5 -181t-53.5 -228q0 -104 40.5 -198.5t109.5 -163.5t163.5 -109.5 t198.5 -40.5t198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5q0 121 -53.5 228t-151.5 181q-42 32 -49.5 84.5t24.5 94.5q31 43 84 50t95 -25q146 -109 226.5 -270t80.5 -343zM896 1408v-640q0 -52 -38 -90t-90 -38t-90 38t-38 90v640q0 52 38 90t90 38t90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 96v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM640 224v-320q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v320q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1024 480v-576q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23 v576q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1408 864v-960q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 1376v-1472q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v1472q0 14 9 23t23 9h192q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1024 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1536 749v-222q0 -12 -8 -23t-20 -13l-185 -28q-19 -54 -39 -91q35 -50 107 -138q10 -12 10 -25t-9 -23q-27 -37 -99 -108t-94 -71q-12 0 -26 9l-138 108q-44 -23 -91 -38 q-16 -136 -29 -186q-7 -28 -36 -28h-222q-14 0 -24.5 8.5t-11.5 21.5l-28 184q-49 16 -90 37l-141 -107q-10 -9 -25 -9q-14 0 -25 11q-126 114 -165 168q-7 10 -7 23q0 12 8 23q15 21 51 66.5t54 70.5q-27 50 -41 99l-183 27q-13 2 -21 12.5t-8 23.5v222q0 12 8 23t19 13 l186 28q14 46 39 92q-40 57 -107 138q-10 12 -10 24q0 10 9 23q26 36 98.5 107.5t94.5 71.5q13 0 26 -10l138 -107q44 23 91 38q16 136 29 186q7 28 36 28h222q14 0 24.5 -8.5t11.5 -21.5l28 -184q49 -16 90 -37l142 107q9 9 24 9q13 0 25 -10q129 -119 165 -170q7 -8 7 -22 q0 -12 -8 -23q-15 -21 -51 -66.5t-54 -70.5q26 -50 41 -98l183 -28q13 -2 21 -12.5t8 -23.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM768 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1024 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1152 76v948h-896v-948q0 -22 7 -40.5t14.5 -27t10.5 -8.5h832q3 0 10.5 8.5t14.5 27t7 40.5zM480 1152h448l-48 117q-7 9 -17 11h-317q-10 -2 -17 -11zM1408 1120v-64q0 -14 -9 -23t-23 -9h-96v-948q0 -83 -47 -143.5t-113 -60.5h-832 q-66 0 -113 58.5t-47 141.5v952h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h309l70 167q15 37 54 63t79 26h320q40 0 79 -26t54 -63l70 -167h309q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 544v-480q0 -26 -19 -45t-45 -19h-384v384h-256v-384h-384q-26 0 -45 19t-19 45v480q0 1 0.5 3t0.5 3l575 474l575 -474q1 -2 1 -6zM1631 613l-62 -74q-8 -9 -21 -11h-3q-13 0 -21 7l-692 577l-692 -577q-12 -8 -24 -7q-13 2 -21 11l-62 74q-8 10 -7 23.5t11 21.5 l719 599q32 26 76 26t76 -26l244 -204v195q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-408l219 -182q10 -8 11 -21.5t-7 -23.5z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z " /> +<glyph unicode="" d="M896 992v-448q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1111 540v4l-24 320q-1 13 -11 22.5t-23 9.5h-186q-13 0 -23 -9.5t-11 -22.5l-24 -320v-4q-1 -12 8 -20t21 -8h244q12 0 21 8t8 20zM1870 73q0 -73 -46 -73h-704q13 0 22 9.5t8 22.5l-20 256q-1 13 -11 22.5t-23 9.5h-272q-13 0 -23 -9.5t-11 -22.5l-20 -256 q-1 -13 8 -22.5t22 -9.5h-704q-46 0 -46 73q0 54 26 116l417 1044q8 19 26 33t38 14h339q-13 0 -23 -9.5t-11 -22.5l-15 -192q-1 -14 8 -23t22 -9h166q13 0 22 9t8 23l-15 192q-1 13 -11 22.5t-23 9.5h339q20 0 38 -14t26 -33l417 -1044q26 -62 26 -116z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 416v-320q0 -40 -28 -68t-68 -28h-1472q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h465l135 -136 q58 -56 136 -56t136 56l136 136h464q40 0 68 -28t28 -68zM1339 985q17 -41 -14 -70l-448 -448q-18 -19 -45 -19t-45 19l-448 448q-31 29 -14 70q17 39 59 39h256v448q0 26 19 45t45 19h256q26 0 45 -19t19 -45v-448h256q42 0 59 -39z" /> +<glyph unicode="" d="M1120 608q0 -12 -10 -24l-319 -319q-11 -9 -23 -9t-23 9l-320 320q-15 16 -7 35q8 20 30 20h192v352q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-352h192q14 0 23 -9t9 -23zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273 t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1118 660q-8 -20 -30 -20h-192v-352q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v352h-192q-14 0 -23 9t-9 23q0 12 10 24l319 319q11 9 23 9t23 -9l320 -320q15 -16 7 -35zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198 t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1023 576h316q-1 3 -2.5 8t-2.5 8l-212 496h-708l-212 -496q-1 -2 -2.5 -8t-2.5 -8h316l95 -192h320zM1536 546v-482q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v482q0 62 25 123l238 552q10 25 36.5 42t52.5 17h832q26 0 52.5 -17t36.5 -42l238 -552 q25 -61 25 -123z" /> +<glyph unicode="" d="M1184 640q0 -37 -32 -55l-544 -320q-15 -9 -32 -9q-16 0 -32 8q-32 19 -32 56v640q0 37 32 56q33 18 64 -1l544 -320q32 -18 32 -55zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1536 1280v-448q0 -26 -19 -45t-45 -19h-448q-42 0 -59 40q-17 39 14 69l138 138q-148 137 -349 137q-104 0 -198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5q119 0 225 52t179 147q7 10 23 12q14 0 25 -9 l137 -138q9 -8 9.5 -20.5t-7.5 -22.5q-109 -132 -264 -204.5t-327 -72.5q-156 0 -298 61t-245 164t-164 245t-61 298t61 298t164 245t245 164t298 61q147 0 284.5 -55.5t244.5 -156.5l130 129q29 31 70 14q39 -17 39 -59z" /> +<glyph unicode="" d="M1511 480q0 -5 -1 -7q-64 -268 -268 -434.5t-478 -166.5q-146 0 -282.5 55t-243.5 157l-129 -129q-19 -19 -45 -19t-45 19t-19 45v448q0 26 19 45t45 19h448q26 0 45 -19t19 -45t-19 -45l-137 -137q71 -66 161 -102t187 -36q134 0 250 65t186 179q11 17 53 117 q8 23 30 23h192q13 0 22.5 -9.5t9.5 -22.5zM1536 1280v-448q0 -26 -19 -45t-45 -19h-448q-26 0 -45 19t-19 45t19 45l138 138q-148 137 -349 137q-134 0 -250 -65t-186 -179q-11 -17 -53 -117q-8 -23 -30 -23h-199q-13 0 -22.5 9.5t-9.5 22.5v7q65 268 270 434.5t480 166.5 q146 0 284 -55.5t245 -156.5l130 129q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 352v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 608v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M384 864v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1536 352v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5t9.5 -22.5z M1536 608v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5t9.5 -22.5zM1536 864v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5 t9.5 -22.5zM1664 160v832q0 13 -9.5 22.5t-22.5 9.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5v-832q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1792 1248v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47 t47 -113z" /> +<glyph unicode="" horiz-adv-x="1152" d="M320 768h512v192q0 106 -75 181t-181 75t-181 -75t-75 -181v-192zM1152 672v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h32v192q0 184 132 316t316 132t316 -132t132 -316v-192h32q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M320 1280q0 -72 -64 -110v-1266q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v1266q-64 38 -64 110q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -25 -12.5 -38.5t-39.5 -27.5q-215 -116 -369 -116q-61 0 -123.5 22t-108.5 48 t-115.5 48t-142.5 22q-192 0 -464 -146q-17 -9 -33 -9q-26 0 -45 19t-19 45v742q0 32 31 55q21 14 79 43q236 120 421 120q107 0 200 -29t219 -88q38 -19 88 -19q54 0 117.5 21t110 47t88 47t54.5 21q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 650q0 -166 -60 -314l-20 -49l-185 -33q-22 -83 -90.5 -136.5t-156.5 -53.5v-32q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-32q71 0 130 -35.5t93 -95.5l68 12q29 95 29 193q0 148 -88 279t-236.5 209t-315.5 78 t-315.5 -78t-236.5 -209t-88 -279q0 -98 29 -193l68 -12q34 60 93 95.5t130 35.5v32q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v32q-88 0 -156.5 53.5t-90.5 136.5l-185 33l-20 49q-60 148 -60 314q0 151 67 291t179 242.5 t266 163.5t320 61t320 -61t266 -163.5t179 -242.5t67 -291z" /> +<glyph unicode="" horiz-adv-x="768" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1152" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142zM1408 640q0 -153 -85 -282.5t-225 -188.5q-13 -5 -25 -5q-27 0 -46 19t-19 45q0 39 39 59q56 29 76 44q74 54 115.5 135.5t41.5 173.5t-41.5 173.5 t-115.5 135.5q-20 15 -76 44q-39 20 -39 59q0 26 19 45t45 19q13 0 26 -5q140 -59 225 -188.5t85 -282.5zM1664 640q0 -230 -127 -422.5t-338 -283.5q-13 -5 -26 -5q-26 0 -45 19t-19 45q0 36 39 59q7 4 22.5 10.5t22.5 10.5q46 25 82 51q123 91 192 227t69 289t-69 289 t-192 227q-36 26 -82 51q-7 4 -22.5 10.5t-22.5 10.5q-39 23 -39 59q0 26 19 45t45 19q13 0 26 -5q211 -91 338 -283.5t127 -422.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 384v-128h-128v128h128zM384 1152v-128h-128v128h128zM1152 1152v-128h-128v128h128zM128 129h384v383h-384v-383zM128 896h384v384h-384v-384zM896 896h384v384h-384v-384zM640 640v-640h-640v640h640zM1152 128v-128h-128v128h128zM1408 128v-128h-128v128h128z M1408 640v-384h-384v128h-128v-384h-128v640h384v-128h128v128h128zM640 1408v-640h-640v640h640zM1408 1408v-640h-640v640h640z" /> +<glyph unicode="" horiz-adv-x="1792" d="M63 0h-63v1408h63v-1408zM126 1h-32v1407h32v-1407zM220 1h-31v1407h31v-1407zM377 1h-31v1407h31v-1407zM534 1h-62v1407h62v-1407zM660 1h-31v1407h31v-1407zM723 1h-31v1407h31v-1407zM786 1h-31v1407h31v-1407zM943 1h-63v1407h63v-1407zM1100 1h-63v1407h63v-1407z M1226 1h-63v1407h63v-1407zM1352 1h-63v1407h63v-1407zM1446 1h-63v1407h63v-1407zM1635 1h-94v1407h94v-1407zM1698 1h-32v1407h32v-1407zM1792 0h-63v1408h63v-1408z" /> +<glyph unicode="" d="M448 1088q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1515 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-53 0 -90 37l-715 716q-38 37 -64.5 101t-26.5 117v416q0 52 38 90t90 38h416q53 0 117 -26.5t102 -64.5 l715 -714q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1920" d="M448 1088q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1515 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-53 0 -90 37l-715 716q-38 37 -64.5 101t-26.5 117v416q0 52 38 90t90 38h416q53 0 117 -26.5t102 -64.5 l715 -714q37 -39 37 -91zM1899 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-36 0 -59 14t-53 45l470 470q37 37 37 90q0 52 -37 91l-715 714q-38 38 -102 64.5t-117 26.5h224q53 0 117 -26.5t102 -64.5l715 -714q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1639 1058q40 -57 18 -129l-275 -906q-19 -64 -76.5 -107.5t-122.5 -43.5h-923q-77 0 -148.5 53.5t-99.5 131.5q-24 67 -2 127q0 4 3 27t4 37q1 8 -3 21.5t-3 19.5q2 11 8 21t16.5 23.5t16.5 23.5q23 38 45 91.5t30 91.5q3 10 0.5 30t-0.5 28q3 11 17 28t17 23 q21 36 42 92t25 90q1 9 -2.5 32t0.5 28q4 13 22 30.5t22 22.5q19 26 42.5 84.5t27.5 96.5q1 8 -3 25.5t-2 26.5q2 8 9 18t18 23t17 21q8 12 16.5 30.5t15 35t16 36t19.5 32t26.5 23.5t36 11.5t47.5 -5.5l-1 -3q38 9 51 9h761q74 0 114 -56t18 -130l-274 -906 q-36 -119 -71.5 -153.5t-128.5 -34.5h-869q-27 0 -38 -15q-11 -16 -1 -43q24 -70 144 -70h923q29 0 56 15.5t35 41.5l300 987q7 22 5 57q38 -15 59 -43zM575 1056q-4 -13 2 -22.5t20 -9.5h608q13 0 25.5 9.5t16.5 22.5l21 64q4 13 -2 22.5t-20 9.5h-608q-13 0 -25.5 -9.5 t-16.5 -22.5zM492 800q-4 -13 2 -22.5t20 -9.5h608q13 0 25.5 9.5t16.5 22.5l21 64q4 13 -2 22.5t-20 9.5h-608q-13 0 -25.5 -9.5t-16.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1164 1408q23 0 44 -9q33 -13 52.5 -41t19.5 -62v-1289q0 -34 -19.5 -62t-52.5 -41q-19 -8 -44 -8q-48 0 -83 32l-441 424l-441 -424q-36 -33 -83 -33q-23 0 -44 9q-33 13 -52.5 41t-19.5 62v1289q0 34 19.5 62t52.5 41q21 9 44 9h1048z" /> +<glyph unicode="" horiz-adv-x="1664" d="M384 0h896v256h-896v-256zM384 640h896v384h-160q-40 0 -68 28t-28 68v160h-640v-640zM1536 576q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 576v-416q0 -13 -9.5 -22.5t-22.5 -9.5h-224v-160q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68 v160h-224q-13 0 -22.5 9.5t-9.5 22.5v416q0 79 56.5 135.5t135.5 56.5h64v544q0 40 28 68t68 28h672q40 0 88 -20t76 -48l152 -152q28 -28 48 -76t20 -88v-256h64q79 0 135.5 -56.5t56.5 -135.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M960 864q119 0 203.5 -84.5t84.5 -203.5t-84.5 -203.5t-203.5 -84.5t-203.5 84.5t-84.5 203.5t84.5 203.5t203.5 84.5zM1664 1280q106 0 181 -75t75 -181v-896q0 -106 -75 -181t-181 -75h-1408q-106 0 -181 75t-75 181v896q0 106 75 181t181 75h224l51 136 q19 49 69.5 84.5t103.5 35.5h512q53 0 103.5 -35.5t69.5 -84.5l51 -136h224zM960 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M725 977l-170 -450q33 0 136.5 -2t160.5 -2q19 0 57 2q-87 253 -184 452zM0 -128l2 79q23 7 56 12.5t57 10.5t49.5 14.5t44.5 29t31 50.5l237 616l280 724h75h53q8 -14 11 -21l205 -480q33 -78 106 -257.5t114 -274.5q15 -34 58 -144.5t72 -168.5q20 -45 35 -57 q19 -15 88 -29.5t84 -20.5q6 -38 6 -57q0 -4 -0.5 -13t-0.5 -13q-63 0 -190 8t-191 8q-76 0 -215 -7t-178 -8q0 43 4 78l131 28q1 0 12.5 2.5t15.5 3.5t14.5 4.5t15 6.5t11 8t9 11t2.5 14q0 16 -31 96.5t-72 177.5t-42 100l-450 2q-26 -58 -76.5 -195.5t-50.5 -162.5 q0 -22 14 -37.5t43.5 -24.5t48.5 -13.5t57 -8.5t41 -4q1 -19 1 -58q0 -9 -2 -27q-58 0 -174.5 10t-174.5 10q-8 0 -26.5 -4t-21.5 -4q-80 -14 -188 -14z" /> +<glyph unicode="" horiz-adv-x="1408" d="M555 15q74 -32 140 -32q376 0 376 335q0 114 -41 180q-27 44 -61.5 74t-67.5 46.5t-80.5 25t-84 10.5t-94.5 2q-73 0 -101 -10q0 -53 -0.5 -159t-0.5 -158q0 -8 -1 -67.5t-0.5 -96.5t4.5 -83.5t12 -66.5zM541 761q42 -7 109 -7q82 0 143 13t110 44.5t74.5 89.5t25.5 142 q0 70 -29 122.5t-79 82t-108 43.5t-124 14q-50 0 -130 -13q0 -50 4 -151t4 -152q0 -27 -0.5 -80t-0.5 -79q0 -46 1 -69zM0 -128l2 94q15 4 85 16t106 27q7 12 12.5 27t8.5 33.5t5.5 32.5t3 37.5t0.5 34v35.5v30q0 982 -22 1025q-4 8 -22 14.5t-44.5 11t-49.5 7t-48.5 4.5 t-30.5 3l-4 83q98 2 340 11.5t373 9.5q23 0 68.5 -0.5t67.5 -0.5q70 0 136.5 -13t128.5 -42t108 -71t74 -104.5t28 -137.5q0 -52 -16.5 -95.5t-39 -72t-64.5 -57.5t-73 -45t-84 -40q154 -35 256.5 -134t102.5 -248q0 -100 -35 -179.5t-93.5 -130.5t-138 -85.5t-163.5 -48.5 t-176 -14q-44 0 -132 3t-132 3q-106 0 -307 -11t-231 -12z" /> +<glyph unicode="" horiz-adv-x="1024" d="M0 -126l17 85q6 2 81.5 21.5t111.5 37.5q28 35 41 101q1 7 62 289t114 543.5t52 296.5v25q-24 13 -54.5 18.5t-69.5 8t-58 5.5l19 103q33 -2 120 -6.5t149.5 -7t120.5 -2.5q48 0 98.5 2.5t121 7t98.5 6.5q-5 -39 -19 -89q-30 -10 -101.5 -28.5t-108.5 -33.5 q-8 -19 -14 -42.5t-9 -40t-7.5 -45.5t-6.5 -42q-27 -148 -87.5 -419.5t-77.5 -355.5q-2 -9 -13 -58t-20 -90t-16 -83.5t-6 -57.5l1 -18q17 -4 185 -31q-3 -44 -16 -99q-11 0 -32.5 -1.5t-32.5 -1.5q-29 0 -87 10t-86 10q-138 2 -206 2q-51 0 -143 -9t-121 -11z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1744 128q33 0 42 -18.5t-11 -44.5l-126 -162q-20 -26 -49 -26t-49 26l-126 162q-20 26 -11 44.5t42 18.5h80v1024h-80q-33 0 -42 18.5t11 44.5l126 162q20 26 49 26t49 -26l126 -162q20 -26 11 -44.5t-42 -18.5h-80v-1024h80zM81 1407l54 -27q12 -5 211 -5q44 0 132 2 t132 2q36 0 107.5 -0.5t107.5 -0.5h293q6 0 21 -0.5t20.5 0t16 3t17.5 9t15 17.5l42 1q4 0 14 -0.5t14 -0.5q2 -112 2 -336q0 -80 -5 -109q-39 -14 -68 -18q-25 44 -54 128q-3 9 -11 48t-14.5 73.5t-7.5 35.5q-6 8 -12 12.5t-15.5 6t-13 2.5t-18 0.5t-16.5 -0.5 q-17 0 -66.5 0.5t-74.5 0.5t-64 -2t-71 -6q-9 -81 -8 -136q0 -94 2 -388t2 -455q0 -16 -2.5 -71.5t0 -91.5t12.5 -69q40 -21 124 -42.5t120 -37.5q5 -40 5 -50q0 -14 -3 -29l-34 -1q-76 -2 -218 8t-207 10q-50 0 -151 -9t-152 -9q-3 51 -3 52v9q17 27 61.5 43t98.5 29t78 27 q19 42 19 383q0 101 -3 303t-3 303v117q0 2 0.5 15.5t0.5 25t-1 25.5t-3 24t-5 14q-11 12 -162 12q-33 0 -93 -12t-80 -26q-19 -13 -34 -72.5t-31.5 -111t-42.5 -53.5q-42 26 -56 44v383z" /> +<glyph unicode="" d="M81 1407l54 -27q12 -5 211 -5q44 0 132 2t132 2q70 0 246.5 1t304.5 0.5t247 -4.5q33 -1 56 31l42 1q4 0 14 -0.5t14 -0.5q2 -112 2 -336q0 -80 -5 -109q-39 -14 -68 -18q-25 44 -54 128q-3 9 -11 47.5t-15 73.5t-7 36q-10 13 -27 19q-5 2 -66 2q-30 0 -93 1t-103 1 t-94 -2t-96 -7q-9 -81 -8 -136l1 -152v52q0 -55 1 -154t1.5 -180t0.5 -153q0 -16 -2.5 -71.5t0 -91.5t12.5 -69q40 -21 124 -42.5t120 -37.5q5 -40 5 -50q0 -14 -3 -29l-34 -1q-76 -2 -218 8t-207 10q-50 0 -151 -9t-152 -9q-3 51 -3 52v9q17 27 61.5 43t98.5 29t78 27 q7 16 11.5 74t6 145.5t1.5 155t-0.5 153.5t-0.5 89q0 7 -2.5 21.5t-2.5 22.5q0 7 0.5 44t1 73t0 76.5t-3 67.5t-6.5 32q-11 12 -162 12q-41 0 -163 -13.5t-138 -24.5q-19 -12 -34 -71.5t-31.5 -111.5t-42.5 -54q-42 26 -56 44v383zM1310 125q12 0 42 -19.5t57.5 -41.5 t59.5 -49t36 -30q26 -21 26 -49t-26 -49q-4 -3 -36 -30t-59.5 -49t-57.5 -41.5t-42 -19.5q-13 0 -20.5 10.5t-10 28.5t-2.5 33.5t1.5 33t1.5 19.5h-1024q0 -2 1.5 -19.5t1.5 -33t-2.5 -33.5t-10 -28.5t-20.5 -10.5q-12 0 -42 19.5t-57.5 41.5t-59.5 49t-36 30q-26 21 -26 49 t26 49q4 3 36 30t59.5 49t57.5 41.5t42 19.5q13 0 20.5 -10.5t10 -28.5t2.5 -33.5t-1.5 -33t-1.5 -19.5h1024q0 2 -1.5 19.5t-1.5 33t2.5 33.5t10 28.5t20.5 10.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1408 576v-128q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1280q26 0 45 -19t19 -45zM1664 960v-128q0 -26 -19 -45 t-45 -19h-1536q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1536q26 0 45 -19t19 -45zM1280 1344v-128q0 -26 -19 -45t-45 -19h-1152q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1408 576v-128q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h896q26 0 45 -19t19 -45zM1664 960v-128q0 -26 -19 -45t-45 -19 h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1280 1344v-128q0 -26 -19 -45t-45 -19h-640q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h640q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 576v-128q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1280q26 0 45 -19t19 -45zM1792 960v-128q0 -26 -19 -45 t-45 -19h-1536q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1536q26 0 45 -19t19 -45zM1792 1344v-128q0 -26 -19 -45t-45 -19h-1152q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 576v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 960v-128q0 -26 -19 -45 t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 1344v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM256 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5 t9.5 -22.5zM256 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1344 q13 0 22.5 -9.5t9.5 -22.5zM256 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5 t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192 q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 992v-576q0 -13 -9.5 -22.5t-22.5 -9.5q-14 0 -23 9l-288 288q-9 9 -9 23t9 23l288 288q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5 t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088 q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M352 704q0 -14 -9 -23l-288 -288q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v576q0 13 9.5 22.5t22.5 9.5q14 0 23 -9l288 -288q9 -9 9 -23zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5 t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088 q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 1184v-1088q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-403 403v-166q0 -119 -84.5 -203.5t-203.5 -84.5h-704q-119 0 -203.5 84.5t-84.5 203.5v704q0 119 84.5 203.5t203.5 84.5h704q119 0 203.5 -84.5t84.5 -203.5v-165l403 402q18 19 45 19q12 0 25 -5 q39 -17 39 -59z" /> +<glyph unicode="" horiz-adv-x="1920" d="M640 960q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1664 576v-448h-1408v192l320 320l160 -160l512 512zM1760 1280h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-1216q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5v1216 q0 13 -9.5 22.5t-22.5 9.5zM1920 1248v-1216q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" d="M363 0l91 91l-235 235l-91 -91v-107h128v-128h107zM886 928q0 22 -22 22q-10 0 -17 -7l-542 -542q-7 -7 -7 -17q0 -22 22 -22q10 0 17 7l542 542q7 7 7 17zM832 1120l416 -416l-832 -832h-416v416zM1515 1024q0 -53 -37 -90l-166 -166l-416 416l166 165q36 38 90 38 q53 0 91 -38l235 -234q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1024" d="M768 896q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1024 896q0 -109 -33 -179l-364 -774q-16 -33 -47.5 -52t-67.5 -19t-67.5 19t-46.5 52l-365 774q-33 70 -33 179q0 212 150 362t362 150t362 -150t150 -362z" /> +<glyph unicode="" d="M768 96v1088q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 384q0 36 -20 69q-1 1 -15.5 22.5t-25.5 38t-25 44t-21 50.5q-4 16 -21 16t-21 -16q-7 -23 -21 -50.5t-25 -44t-25.5 -38t-15.5 -22.5q-20 -33 -20 -69q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 512q0 -212 -150 -362t-362 -150t-362 150t-150 362 q0 145 81 275q6 9 62.5 90.5t101 151t99.5 178t83 201.5q9 30 34 47t51 17t51.5 -17t33.5 -47q28 -93 83 -201.5t99.5 -178t101 -151t62.5 -90.5q81 -127 81 -275z" /> +<glyph unicode="" horiz-adv-x="1792" d="M888 352l116 116l-152 152l-116 -116v-56h96v-96h56zM1328 1072q-16 16 -33 -1l-350 -350q-17 -17 -1 -33t33 1l350 350q17 17 1 33zM1408 478v-190q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-14 -14 -32 -8q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v126q0 13 9 22l64 64q15 15 35 7t20 -29zM1312 1216l288 -288l-672 -672h-288v288zM1756 1084l-92 -92 l-288 288l92 92q28 28 68 28t68 -28l152 -152q28 -28 28 -68t-28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 547v-259q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h255v0q13 0 22.5 -9.5t9.5 -22.5q0 -27 -26 -32q-77 -26 -133 -60q-10 -4 -16 -4h-112q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832 q66 0 113 47t47 113v214q0 19 18 29q28 13 54 37q16 16 35 8q21 -9 21 -29zM1645 1043l-384 -384q-18 -19 -45 -19q-12 0 -25 5q-39 17 -39 59v192h-160q-323 0 -438 -131q-119 -137 -74 -473q3 -23 -20 -34q-8 -2 -12 -2q-16 0 -26 13q-10 14 -21 31t-39.5 68.5t-49.5 99.5 t-38.5 114t-17.5 122q0 49 3.5 91t14 90t28 88t47 81.5t68.5 74t94.5 61.5t124.5 48.5t159.5 30.5t196.5 11h160v192q0 42 39 59q13 5 25 5q26 0 45 -19l384 -384q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 606v-318q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-10 -10 -23 -10q-3 0 -9 2q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832 q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v254q0 13 9 22l64 64q10 10 23 10q6 0 12 -3q20 -8 20 -29zM1639 1095l-814 -814q-24 -24 -57 -24t-57 24l-430 430q-24 24 -24 57t24 57l110 110q24 24 57 24t57 -24l263 -263l647 647q24 24 57 24t57 -24l110 -110 q24 -24 24 -57t-24 -57z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -26 -19 -45l-256 -256q-19 -19 -45 -19t-45 19t-19 45v128h-384v-384h128q26 0 45 -19t19 -45t-19 -45l-256 -256q-19 -19 -45 -19t-45 19l-256 256q-19 19 -19 45t19 45t45 19h128v384h-384v-128q0 -26 -19 -45t-45 -19t-45 19l-256 256q-19 19 -19 45 t19 45l256 256q19 19 45 19t45 -19t19 -45v-128h384v384h-128q-26 0 -45 19t-19 45t19 45l256 256q19 19 45 19t45 -19l256 -256q19 -19 19 -45t-19 -45t-45 -19h-128v-384h384v128q0 26 19 45t45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M979 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-678q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-678q4 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1747 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-710q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-678q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-678q4 11 13 19l710 710 q19 19 32 13t13 -32v-710q4 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1619 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-8 9 -13 19v-710q0 -26 -13 -32t-32 13l-710 710q-19 19 -19 45t19 45l710 710q19 19 32 13t13 -32v-710q5 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1384 609l-1328 -738q-23 -13 -39.5 -3t-16.5 36v1472q0 26 16.5 36t39.5 -3l1328 -738q23 -13 23 -31t-23 -31z" /> +<glyph unicode="" d="M1536 1344v-1408q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h512q26 0 45 -19t19 -45zM640 1344v-1408q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h512q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1536 1344v-1408q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v710q0 26 13 32t32 -13l710 -710q19 -19 19 -45t-19 -45l-710 -710q-19 -19 -32 -13t-13 32v710q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1792" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v710q0 26 13 32t32 -13l710 -710q8 -8 13 -19v678q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-1408q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v678q-5 -10 -13 -19l-710 -710 q-19 -19 -32 -13t-13 32v710q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1024" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v678q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-1408q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v678q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1538" d="M14 557l710 710q19 19 45 19t45 -19l710 -710q19 -19 13 -32t-32 -13h-1472q-26 0 -32 13t13 32zM1473 0h-1408q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1408q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1171 1235l-531 -531l531 -531q19 -19 19 -45t-19 -45l-166 -166q-19 -19 -45 -19t-45 19l-742 742q-19 19 -19 45t19 45l742 742q19 19 45 19t45 -19l166 -166q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1107 659l-742 -742q-19 -19 -45 -19t-45 19l-166 166q-19 19 -19 45t19 45l531 531l-531 531q-19 19 -19 45t19 45l166 166q19 19 45 19t45 -19l742 -742q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" d="M1216 576v128q0 26 -19 45t-45 19h-256v256q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-256h-256q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h256v-256q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v256h256q26 0 45 19t19 45zM1536 640q0 -209 -103 -385.5 t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1216 576v128q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5 t103 -385.5z" /> +<glyph unicode="" d="M1149 414q0 26 -19 45l-181 181l181 181q19 19 19 45q0 27 -19 46l-90 90q-19 19 -46 19q-26 0 -45 -19l-181 -181l-181 181q-19 19 -45 19q-27 0 -46 -19l-90 -90q-19 -19 -19 -46q0 -26 19 -45l181 -181l-181 -181q-19 -19 -19 -45q0 -27 19 -46l90 -90q19 -19 46 -19 q26 0 45 19l181 181l181 -181q19 -19 45 -19q27 0 46 19l90 90q19 19 19 46zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 802q0 28 -18 46l-91 90q-19 19 -45 19t-45 -19l-408 -407l-226 226q-19 19 -45 19t-45 -19l-91 -90q-18 -18 -18 -46q0 -27 18 -45l362 -362q19 -19 45 -19q27 0 46 19l543 543q18 18 18 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M896 160v192q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h192q14 0 23 9t9 23zM1152 832q0 88 -55.5 163t-138.5 116t-170 41q-243 0 -371 -213q-15 -24 8 -42l132 -100q7 -6 19 -6q16 0 25 12q53 68 86 92q34 24 86 24q48 0 85.5 -26t37.5 -59 q0 -38 -20 -61t-68 -45q-63 -28 -115.5 -86.5t-52.5 -125.5v-36q0 -14 9 -23t23 -9h192q14 0 23 9t9 23q0 19 21.5 49.5t54.5 49.5q32 18 49 28.5t46 35t44.5 48t28 60.5t12.5 81zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1024 160v160q0 14 -9 23t-23 9h-96v512q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h96v-320h-96q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h448q14 0 23 9t9 23zM896 1056v160q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23 t23 -9h192q14 0 23 9t9 23zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1197 512h-109q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h109q-32 108 -112.5 188.5t-188.5 112.5v-109q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v109q-108 -32 -188.5 -112.5t-112.5 -188.5h109q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-109 q32 -108 112.5 -188.5t188.5 -112.5v109q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-109q108 32 188.5 112.5t112.5 188.5zM1536 704v-128q0 -26 -19 -45t-45 -19h-143q-37 -161 -154.5 -278.5t-278.5 -154.5v-143q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v143 q-161 37 -278.5 154.5t-154.5 278.5h-143q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h143q37 161 154.5 278.5t278.5 154.5v143q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-143q161 -37 278.5 -154.5t154.5 -278.5h143q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1097 457l-146 -146q-10 -10 -23 -10t-23 10l-137 137l-137 -137q-10 -10 -23 -10t-23 10l-146 146q-10 10 -10 23t10 23l137 137l-137 137q-10 10 -10 23t10 23l146 146q10 10 23 10t23 -10l137 -137l137 137q10 10 23 10t23 -10l146 -146q10 -10 10 -23t-10 -23 l-137 -137l137 -137q10 -10 10 -23t-10 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5 t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1171 723l-422 -422q-19 -19 -45 -19t-45 19l-294 294q-19 19 -19 45t19 45l102 102q19 19 45 19t45 -19l147 -147l275 275q19 19 45 19t45 -19l102 -102q19 -19 19 -45t-19 -45zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198 t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1312 643q0 161 -87 295l-754 -753q137 -89 297 -89q111 0 211.5 43.5t173.5 116.5t116 174.5t43 212.5zM313 344l755 754q-135 91 -300 91q-148 0 -273 -73t-198 -199t-73 -274q0 -162 89 -299zM1536 643q0 -157 -61 -300t-163.5 -246t-245 -164t-298.5 -61t-298.5 61 t-245 164t-163.5 246t-61 300t61 299.5t163.5 245.5t245 164t298.5 61t298.5 -61t245 -164t163.5 -245.5t61 -299.5z" /> +<glyph unicode="" d="M1536 640v-128q0 -53 -32.5 -90.5t-84.5 -37.5h-704l293 -294q38 -36 38 -90t-38 -90l-75 -76q-37 -37 -90 -37q-52 0 -91 37l-651 652q-37 37 -37 90q0 52 37 91l651 650q38 38 91 38q52 0 90 -38l75 -74q38 -38 38 -91t-38 -91l-293 -293h704q52 0 84.5 -37.5 t32.5 -90.5z" /> +<glyph unicode="" d="M1472 576q0 -54 -37 -91l-651 -651q-39 -37 -91 -37q-51 0 -90 37l-75 75q-38 38 -38 91t38 91l293 293h-704q-52 0 -84.5 37.5t-32.5 90.5v128q0 53 32.5 90.5t84.5 37.5h704l-293 294q-38 36 -38 90t38 90l75 75q38 38 90 38q53 0 91 -38l651 -651q37 -35 37 -90z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1611 565q0 -51 -37 -90l-75 -75q-38 -38 -91 -38q-54 0 -90 38l-294 293v-704q0 -52 -37.5 -84.5t-90.5 -32.5h-128q-53 0 -90.5 32.5t-37.5 84.5v704l-294 -293q-36 -38 -90 -38t-90 38l-75 75q-38 38 -38 90q0 53 38 91l651 651q35 37 90 37q54 0 91 -37l651 -651 q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1611 704q0 -53 -37 -90l-651 -652q-39 -37 -91 -37q-53 0 -90 37l-651 652q-38 36 -38 90q0 53 38 91l74 75q39 37 91 37q53 0 90 -37l294 -294v704q0 52 38 90t90 38h128q52 0 90 -38t38 -90v-704l294 294q37 37 90 37q52 0 91 -37l75 -75q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 896q0 -26 -19 -45l-512 -512q-19 -19 -45 -19t-45 19t-19 45v256h-224q-98 0 -175.5 -6t-154 -21.5t-133 -42.5t-105.5 -69.5t-80 -101t-48.5 -138.5t-17.5 -181q0 -55 5 -123q0 -6 2.5 -23.5t2.5 -26.5q0 -15 -8.5 -25t-23.5 -10q-16 0 -28 17q-7 9 -13 22 t-13.5 30t-10.5 24q-127 285 -127 451q0 199 53 333q162 403 875 403h224v256q0 26 19 45t45 19t45 -19l512 -512q19 -19 19 -45z" /> +<glyph unicode="" d="M755 480q0 -13 -10 -23l-332 -332l144 -144q19 -19 19 -45t-19 -45t-45 -19h-448q-26 0 -45 19t-19 45v448q0 26 19 45t45 19t45 -19l144 -144l332 332q10 10 23 10t23 -10l114 -114q10 -10 10 -23zM1536 1344v-448q0 -26 -19 -45t-45 -19t-45 19l-144 144l-332 -332 q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l332 332l-144 144q-19 19 -19 45t19 45t45 19h448q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M768 576v-448q0 -26 -19 -45t-45 -19t-45 19l-144 144l-332 -332q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l332 332l-144 144q-19 19 -19 45t19 45t45 19h448q26 0 45 -19t19 -45zM1523 1248q0 -13 -10 -23l-332 -332l144 -144q19 -19 19 -45t-19 -45 t-45 -19h-448q-26 0 -45 19t-19 45v448q0 26 19 45t45 19t45 -19l144 -144l332 332q10 10 23 10t23 -10l114 -114q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 800v-192q0 -40 -28 -68t-68 -28h-416v-416q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v416h-416q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h416v416q0 40 28 68t68 28h192q40 0 68 -28t28 -68v-416h416q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 800v-192q0 -40 -28 -68t-68 -28h-1216q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h1216q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1482 486q46 -26 59.5 -77.5t-12.5 -97.5l-64 -110q-26 -46 -77.5 -59.5t-97.5 12.5l-266 153v-307q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v307l-266 -153q-46 -26 -97.5 -12.5t-77.5 59.5l-64 110q-26 46 -12.5 97.5t59.5 77.5l266 154l-266 154 q-46 26 -59.5 77.5t12.5 97.5l64 110q26 46 77.5 59.5t97.5 -12.5l266 -153v307q0 52 38 90t90 38h128q52 0 90 -38t38 -90v-307l266 153q46 26 97.5 12.5t77.5 -59.5l64 -110q26 -46 12.5 -97.5t-59.5 -77.5l-266 -154z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM896 161v190q0 14 -9 23.5t-22 9.5h-192q-13 0 -23 -10t-10 -23v-190q0 -13 10 -23t23 -10h192 q13 0 22 9.5t9 23.5zM894 505l18 621q0 12 -10 18q-10 8 -24 8h-220q-14 0 -24 -8q-10 -6 -10 -18l17 -621q0 -10 10 -17.5t24 -7.5h185q14 0 23.5 7.5t10.5 17.5z" /> +<glyph unicode="" d="M928 180v56v468v192h-320v-192v-468v-56q0 -25 18 -38.5t46 -13.5h192q28 0 46 13.5t18 38.5zM472 1024h195l-126 161q-26 31 -69 31q-40 0 -68 -28t-28 -68t28 -68t68 -28zM1160 1120q0 40 -28 68t-68 28q-43 0 -69 -31l-125 -161h194q40 0 68 28t28 68zM1536 864v-320 q0 -14 -9 -23t-23 -9h-96v-416q0 -40 -28 -68t-68 -28h-1088q-40 0 -68 28t-28 68v416h-96q-14 0 -23 9t-9 23v320q0 14 9 23t23 9h440q-93 0 -158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5q107 0 168 -77l128 -165l128 165q61 77 168 77q93 0 158.5 -65.5t65.5 -158.5 t-65.5 -158.5t-158.5 -65.5h440q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 832q0 26 -19 45t-45 19q-172 0 -318 -49.5t-259.5 -134t-235.5 -219.5q-19 -21 -19 -45q0 -26 19 -45t45 -19q24 0 45 19q27 24 74 71t67 66q137 124 268.5 176t313.5 52q26 0 45 19t19 45zM1792 1030q0 -95 -20 -193q-46 -224 -184.5 -383t-357.5 -268 q-214 -108 -438 -108q-148 0 -286 47q-15 5 -88 42t-96 37q-16 0 -39.5 -32t-45 -70t-52.5 -70t-60 -32q-30 0 -51 11t-31 24t-27 42q-2 4 -6 11t-5.5 10t-3 9.5t-1.5 13.5q0 35 31 73.5t68 65.5t68 56t31 48q0 4 -14 38t-16 44q-9 51 -9 104q0 115 43.5 220t119 184.5 t170.5 139t204 95.5q55 18 145 25.5t179.5 9t178.5 6t163.5 24t113.5 56.5l29.5 29.5t29.5 28t27 20t36.5 16t43.5 4.5q39 0 70.5 -46t47.5 -112t24 -124t8 -96z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 -160v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1152 896q0 -78 -24.5 -144t-64 -112.5t-87.5 -88t-96 -77.5t-87.5 -72t-64 -81.5t-24.5 -96.5q0 -96 67 -224l-4 1l1 -1 q-90 41 -160 83t-138.5 100t-113.5 122.5t-72.5 150.5t-27.5 184q0 78 24.5 144t64 112.5t87.5 88t96 77.5t87.5 72t64 81.5t24.5 96.5q0 94 -66 224l3 -1l-1 1q90 -41 160 -83t138.5 -100t113.5 -122.5t72.5 -150.5t27.5 -184z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 576q-152 236 -381 353q61 -104 61 -225q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5q0 121 61 225q-229 -117 -381 -353q133 -205 333.5 -326.5t434.5 -121.5t434.5 121.5t333.5 326.5zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5 t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1792 576q0 -34 -20 -69q-140 -230 -376.5 -368.5t-499.5 -138.5t-499.5 139t-376.5 368q-20 35 -20 69t20 69q140 229 376.5 368t499.5 139t499.5 -139t376.5 -368q20 -35 20 -69z" /> +<glyph unicode="" horiz-adv-x="1792" d="M555 201l78 141q-87 63 -136 159t-49 203q0 121 61 225q-229 -117 -381 -353q167 -258 427 -375zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1307 1151q0 -7 -1 -9 q-105 -188 -315 -566t-316 -567l-49 -89q-10 -16 -28 -16q-12 0 -134 70q-16 10 -16 28q0 12 44 87q-143 65 -263.5 173t-208.5 245q-20 31 -20 69t20 69q153 235 380 371t496 136q89 0 180 -17l54 97q10 16 28 16q5 0 18 -6t31 -15.5t33 -18.5t31.5 -18.5t19.5 -11.5 q16 -10 16 -27zM1344 704q0 -139 -79 -253.5t-209 -164.5l280 502q8 -45 8 -84zM1792 576q0 -35 -20 -69q-39 -64 -109 -145q-150 -172 -347.5 -267t-419.5 -95l74 132q212 18 392.5 137t301.5 307q-115 179 -282 294l63 112q95 -64 182.5 -153t144.5 -184q20 -34 20 -69z " /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 161v190q0 14 -9.5 23.5t-22.5 9.5h-192q-13 0 -22.5 -9.5t-9.5 -23.5v-190q0 -14 9.5 -23.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 23.5zM1022 535l18 459q0 12 -10 19q-13 11 -24 11h-220q-11 0 -24 -11q-10 -7 -10 -21l17 -457q0 -10 10 -16.5t24 -6.5h185 q14 0 23.5 6.5t10.5 16.5zM1008 1469l768 -1408q35 -63 -2 -126q-17 -29 -46.5 -46t-63.5 -17h-1536q-34 0 -63.5 17t-46.5 46q-37 63 -2 126l768 1408q17 31 47 49t65 18t65 -18t47 -49z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1376 1376q44 -52 12 -148t-108 -172l-161 -161l160 -696q5 -19 -12 -33l-128 -96q-7 -6 -19 -6q-4 0 -7 1q-15 3 -21 16l-279 508l-259 -259l53 -194q5 -17 -8 -31l-96 -96q-9 -9 -23 -9h-2q-15 2 -24 13l-189 252l-252 189q-11 7 -13 23q-1 13 9 25l96 97q9 9 23 9 q6 0 8 -1l194 -53l259 259l-508 279q-14 8 -17 24q-2 16 9 27l128 128q14 13 30 8l665 -159l160 160q76 76 172 108t148 -12z" /> +<glyph unicode="" horiz-adv-x="1664" d="M128 -128h288v288h-288v-288zM480 -128h320v288h-320v-288zM128 224h288v320h-288v-320zM480 224h320v320h-320v-320zM128 608h288v288h-288v-288zM864 -128h320v288h-320v-288zM480 608h320v288h-320v-288zM1248 -128h288v288h-288v-288zM864 224h320v320h-320v-320z M512 1088v288q0 13 -9.5 22.5t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-288q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1248 224h288v320h-288v-320zM864 608h320v288h-320v-288zM1248 608h288v288h-288v-288zM1280 1088v288q0 13 -9.5 22.5t-22.5 9.5h-64 q-13 0 -22.5 -9.5t-9.5 -22.5v-288q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47 h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M666 1055q-60 -92 -137 -273q-22 45 -37 72.5t-40.5 63.5t-51 56.5t-63 35t-81.5 14.5h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224q250 0 410 -225zM1792 256q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v192q-32 0 -85 -0.5t-81 -1t-73 1 t-71 5t-64 10.5t-63 18.5t-58 28.5t-59 40t-55 53.5t-56 69.5q59 93 136 273q22 -45 37 -72.5t40.5 -63.5t51 -56.5t63 -35t81.5 -14.5h256v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23zM1792 1152q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5 v192h-256q-48 0 -87 -15t-69 -45t-51 -61.5t-45 -77.5q-32 -62 -78 -171q-29 -66 -49.5 -111t-54 -105t-64 -100t-74 -83t-90 -68.5t-106.5 -42t-128 -16.5h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224q48 0 87 15t69 45t51 61.5t45 77.5q32 62 78 171q29 66 49.5 111 t54 105t64 100t74 83t90 68.5t106.5 42t128 16.5h256v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22q-17 -2 -30.5 9t-17.5 29v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51t27 59t26 76q-157 89 -247.5 220t-90.5 281 q0 130 71 248.5t191 204.5t286 136.5t348 50.5q244 0 450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" d="M1536 704v-128q0 -201 -98.5 -362t-274 -251.5t-395.5 -90.5t-395.5 90.5t-274 251.5t-98.5 362v128q0 26 19 45t45 19h384q26 0 45 -19t19 -45v-128q0 -52 23.5 -90t53.5 -57t71 -30t64 -13t44 -2t44 2t64 13t71 30t53.5 57t23.5 90v128q0 26 19 45t45 19h384 q26 0 45 -19t19 -45zM512 1344v-384q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h384q26 0 45 -19t19 -45zM1536 1344v-384q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h384q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1683 205l-166 -165q-19 -19 -45 -19t-45 19l-531 531l-531 -531q-19 -19 -45 -19t-45 19l-166 165q-19 19 -19 45.5t19 45.5l742 741q19 19 45 19t45 -19l742 -741q19 -19 19 -45.5t-19 -45.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1683 728l-742 -741q-19 -19 -45 -19t-45 19l-742 741q-19 19 -19 45.5t19 45.5l166 165q19 19 45 19t45 -19l531 -531l531 531q19 19 45 19t45 -19l166 -165q19 -19 19 -45.5t-19 -45.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 32q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-8 0 -13.5 2t-9 7t-5.5 8t-3 11.5t-1 11.5v13v11v160v416h-192q-26 0 -45 19t-19 45q0 24 15 41l320 384q19 22 49 22t49 -22l320 -384q15 -17 15 -41q0 -26 -19 -45t-45 -19h-192v-384h576q16 0 25 -11l160 -192q7 -11 7 -21 zM1920 448q0 -24 -15 -41l-320 -384q-20 -23 -49 -23t-49 23l-320 384q-15 17 -15 41q0 26 19 45t45 19h192v384h-576q-16 0 -25 12l-160 192q-7 9 -7 20q0 13 9.5 22.5t22.5 9.5h960q8 0 13.5 -2t9 -7t5.5 -8t3 -11.5t1 -11.5v-13v-11v-160v-416h192q26 0 45 -19t19 -45z " /> +<glyph unicode="" horiz-adv-x="1664" d="M640 0q0 -52 -38 -90t-90 -38t-90 38t-38 90t38 90t90 38t90 -38t38 -90zM1536 0q0 -52 -38 -90t-90 -38t-90 38t-38 90t38 90t90 38t90 -38t38 -90zM1664 1088v-512q0 -24 -16.5 -42.5t-40.5 -21.5l-1044 -122q13 -60 13 -70q0 -16 -24 -64h920q26 0 45 -19t19 -45 t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 11 8 31.5t16 36t21.5 40t15.5 29.5l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t19.5 -15.5t13 -24.5t8 -26t5.5 -29.5t4.5 -26h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 928v-704q0 -92 -66 -158t-158 -66h-1216q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h672q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1879 584q0 -31 -31 -66l-336 -396q-43 -51 -120.5 -86.5t-143.5 -35.5h-1088q-34 0 -60.5 13t-26.5 43q0 31 31 66l336 396q43 51 120.5 86.5t143.5 35.5h1088q34 0 60.5 -13t26.5 -43zM1536 928v-160h-832q-94 0 -197 -47.5t-164 -119.5l-337 -396l-5 -6q0 4 -0.5 12.5 t-0.5 12.5v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h544q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="768" d="M704 1216q0 -26 -19 -45t-45 -19h-128v-1024h128q26 0 45 -19t19 -45t-19 -45l-256 -256q-19 -19 -45 -19t-45 19l-256 256q-19 19 -19 45t19 45t45 19h128v1024h-128q-26 0 -45 19t-19 45t19 45l256 256q19 19 45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -26 -19 -45l-256 -256q-19 -19 -45 -19t-45 19t-19 45v128h-1024v-128q0 -26 -19 -45t-45 -19t-45 19l-256 256q-19 19 -19 45t19 45l256 256q19 19 45 19t45 -19t19 -45v-128h1024v128q0 26 19 45t45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M640 640v-512h-256v512h256zM1024 1152v-1024h-256v1024h256zM2048 0v-128h-2048v1536h128v-1408h1920zM1408 896v-768h-256v768h256zM1792 1280v-1152h-256v1152h256z" /> +<glyph unicode="" d="M1280 926q-56 -25 -121 -34q68 40 93 117q-65 -38 -134 -51q-61 66 -153 66q-87 0 -148.5 -61.5t-61.5 -148.5q0 -29 5 -48q-129 7 -242 65t-192 155q-29 -50 -29 -106q0 -114 91 -175q-47 1 -100 26v-2q0 -75 50 -133.5t123 -72.5q-29 -8 -51 -8q-13 0 -39 4 q21 -63 74.5 -104t121.5 -42q-116 -90 -261 -90q-26 0 -50 3q148 -94 322 -94q112 0 210 35.5t168 95t120.5 137t75 162t24.5 168.5q0 18 -1 27q63 45 105 109zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5 t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-188v595h199l30 232h-229v148q0 56 23.5 84t91.5 28l122 1v207q-63 9 -178 9q-136 0 -217.5 -80t-81.5 -226v-171h-200v-232h200v-595h-532q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960z" /> +<glyph unicode="" horiz-adv-x="1792" d="M928 704q0 14 -9 23t-23 9q-66 0 -113 -47t-47 -113q0 -14 9 -23t23 -9t23 9t9 23q0 40 28 68t68 28q14 0 23 9t9 23zM1152 574q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM128 0h1536v128h-1536v-128zM1280 574q0 159 -112.5 271.5 t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5zM256 1216h384v128h-384v-128zM128 1024h1536v118v138h-828l-64 -128h-644v-128zM1792 1280v-1280q0 -53 -37.5 -90.5t-90.5 -37.5h-1536q-53 0 -90.5 37.5t-37.5 90.5v1280 q0 53 37.5 90.5t90.5 37.5h1536q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M832 1024q0 80 -56 136t-136 56t-136 -56t-56 -136q0 -42 19 -83q-41 19 -83 19q-80 0 -136 -56t-56 -136t56 -136t136 -56t136 56t56 136q0 42 -19 83q41 -19 83 -19q80 0 136 56t56 136zM1683 320q0 -17 -49 -66t-66 -49q-9 0 -28.5 16t-36.5 33t-38.5 40t-24.5 26 l-96 -96l220 -220q28 -28 28 -68q0 -42 -39 -81t-81 -39q-40 0 -68 28l-671 671q-176 -131 -365 -131q-163 0 -265.5 102.5t-102.5 265.5q0 160 95 313t248 248t313 95q163 0 265.5 -102.5t102.5 -265.5q0 -189 -131 -365l355 -355l96 96q-3 3 -26 24.5t-40 38.5t-33 36.5 t-16 28.5q0 17 49 66t66 49q13 0 23 -10q6 -6 46 -44.5t82 -79.5t86.5 -86t73 -78t28.5 -41z" /> +<glyph unicode="" horiz-adv-x="1920" d="M896 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1664 128q0 52 -38 90t-90 38t-90 -38t-38 -90q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 1152q0 52 -38 90t-90 38t-90 -38t-38 -90q0 -53 37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5zM1280 731v-185q0 -10 -7 -19.5t-16 -10.5l-155 -24q-11 -35 -32 -76q34 -48 90 -115q7 -10 7 -20q0 -12 -7 -19q-23 -30 -82.5 -89.5t-78.5 -59.5q-11 0 -21 7l-115 90q-37 -19 -77 -31q-11 -108 -23 -155q-7 -24 -30 -24h-186q-11 0 -20 7.5t-10 17.5 l-23 153q-34 10 -75 31l-118 -89q-7 -7 -20 -7q-11 0 -21 8q-144 133 -144 160q0 9 7 19q10 14 41 53t47 61q-23 44 -35 82l-152 24q-10 1 -17 9.5t-7 19.5v185q0 10 7 19.5t16 10.5l155 24q11 35 32 76q-34 48 -90 115q-7 11 -7 20q0 12 7 20q22 30 82 89t79 59q11 0 21 -7 l115 -90q34 18 77 32q11 108 23 154q7 24 30 24h186q11 0 20 -7.5t10 -17.5l23 -153q34 -10 75 -31l118 89q8 7 20 7q11 0 21 -8q144 -133 144 -160q0 -9 -7 -19q-12 -16 -42 -54t-45 -60q23 -48 34 -82l152 -23q10 -2 17 -10.5t7 -19.5zM1920 198v-140q0 -16 -149 -31 q-12 -27 -30 -52q51 -113 51 -138q0 -4 -4 -7q-122 -71 -124 -71q-8 0 -46 47t-52 68q-20 -2 -30 -2t-30 2q-14 -21 -52 -68t-46 -47q-2 0 -124 71q-4 3 -4 7q0 25 51 138q-18 25 -30 52q-149 15 -149 31v140q0 16 149 31q13 29 30 52q-51 113 -51 138q0 4 4 7q4 2 35 20 t59 34t30 16q8 0 46 -46.5t52 -67.5q20 2 30 2t30 -2q51 71 92 112l6 2q4 0 124 -70q4 -3 4 -7q0 -25 -51 -138q17 -23 30 -52q149 -15 149 -31zM1920 1222v-140q0 -16 -149 -31q-12 -27 -30 -52q51 -113 51 -138q0 -4 -4 -7q-122 -71 -124 -71q-8 0 -46 47t-52 68 q-20 -2 -30 -2t-30 2q-14 -21 -52 -68t-46 -47q-2 0 -124 71q-4 3 -4 7q0 25 51 138q-18 25 -30 52q-149 15 -149 31v140q0 16 149 31q13 29 30 52q-51 113 -51 138q0 4 4 7q4 2 35 20t59 34t30 16q8 0 46 -46.5t52 -67.5q20 2 30 2t30 -2q51 71 92 112l6 2q4 0 124 -70 q4 -3 4 -7q0 -25 -51 -138q17 -23 30 -52q149 -15 149 -31z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1408 768q0 -139 -94 -257t-256.5 -186.5t-353.5 -68.5q-86 0 -176 16q-124 -88 -278 -128q-36 -9 -86 -16h-3q-11 0 -20.5 8t-11.5 21q-1 3 -1 6.5t0.5 6.5t2 6l2.5 5t3.5 5.5t4 5t4.5 5t4 4.5q5 6 23 25t26 29.5t22.5 29t25 38.5t20.5 44q-124 72 -195 177t-71 224 q0 139 94 257t256.5 186.5t353.5 68.5t353.5 -68.5t256.5 -186.5t94 -257zM1792 512q0 -120 -71 -224.5t-195 -176.5q10 -24 20.5 -44t25 -38.5t22.5 -29t26 -29.5t23 -25q1 -1 4 -4.5t4.5 -5t4 -5t3.5 -5.5l2.5 -5t2 -6t0.5 -6.5t-1 -6.5q-3 -14 -13 -22t-22 -7 q-50 7 -86 16q-154 40 -278 128q-90 -16 -176 -16q-271 0 -472 132q58 -4 88 -4q161 0 309 45t264 129q125 92 192 212t67 254q0 77 -23 152q129 -71 204 -178t75 -230z" /> +<glyph unicode="" d="M256 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 768q0 51 -39 89.5t-89 38.5h-352q0 58 48 159.5t48 160.5q0 98 -32 145t-128 47q-26 -26 -38 -85t-30.5 -125.5t-59.5 -109.5q-22 -23 -77 -91q-4 -5 -23 -30t-31.5 -41t-34.5 -42.5 t-40 -44t-38.5 -35.5t-40 -27t-35.5 -9h-32v-640h32q13 0 31.5 -3t33 -6.5t38 -11t35 -11.5t35.5 -12.5t29 -10.5q211 -73 342 -73h121q192 0 192 167q0 26 -5 56q30 16 47.5 52.5t17.5 73.5t-18 69q53 50 53 119q0 25 -10 55.5t-25 47.5q32 1 53.5 47t21.5 81zM1536 769 q0 -89 -49 -163q9 -33 9 -69q0 -77 -38 -144q3 -21 3 -43q0 -101 -60 -178q1 -139 -85 -219.5t-227 -80.5h-36h-93q-96 0 -189.5 22.5t-216.5 65.5q-116 40 -138 40h-288q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5h274q36 24 137 155q58 75 107 128 q24 25 35.5 85.5t30.5 126.5t62 108q39 37 90 37q84 0 151 -32.5t102 -101.5t35 -186q0 -93 -48 -192h176q104 0 180 -76t76 -179z" /> +<glyph unicode="" d="M256 1088q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 512q0 35 -21.5 81t-53.5 47q15 17 25 47.5t10 55.5q0 69 -53 119q18 32 18 69t-17.5 73.5t-47.5 52.5q5 30 5 56q0 85 -49 126t-136 41h-128q-131 0 -342 -73q-5 -2 -29 -10.5 t-35.5 -12.5t-35 -11.5t-38 -11t-33 -6.5t-31.5 -3h-32v-640h32q16 0 35.5 -9t40 -27t38.5 -35.5t40 -44t34.5 -42.5t31.5 -41t23 -30q55 -68 77 -91q41 -43 59.5 -109.5t30.5 -125.5t38 -85q96 0 128 47t32 145q0 59 -48 160.5t-48 159.5h352q50 0 89 38.5t39 89.5z M1536 511q0 -103 -76 -179t-180 -76h-176q48 -99 48 -192q0 -118 -35 -186q-35 -69 -102 -101.5t-151 -32.5q-51 0 -90 37q-34 33 -54 82t-25.5 90.5t-17.5 84.5t-31 64q-48 50 -107 127q-101 131 -137 155h-274q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5 h288q22 0 138 40q128 44 223 66t200 22h112q140 0 226.5 -79t85.5 -216v-5q60 -77 60 -178q0 -22 -3 -43q38 -67 38 -144q0 -36 -9 -69q49 -74 49 -163z" /> +<glyph unicode="" horiz-adv-x="896" d="M832 1504v-1339l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 940q0 81 -21.5 143t-55 98.5t-81.5 59.5t-94 31t-98 8t-112 -25.5t-110.5 -64t-86.5 -72t-60 -61.5q-18 -22 -49 -22t-49 22q-24 28 -60 61.5t-86.5 72t-110.5 64t-112 25.5t-98 -8t-94 -31t-81.5 -59.5t-55 -98.5t-21.5 -143q0 -168 187 -355l581 -560l580 559 q188 188 188 356zM1792 940q0 -221 -229 -450l-623 -600q-18 -18 -44 -18t-44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5 q224 0 351 -124t127 -344z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 96q0 -4 1 -20t0.5 -26.5t-3 -23.5t-10 -19.5t-20.5 -6.5h-320q-119 0 -203.5 84.5t-84.5 203.5v704q0 119 84.5 203.5t203.5 84.5h320q13 0 22.5 -9.5t9.5 -22.5q0 -4 1 -20t0.5 -26.5t-3 -23.5t-10 -19.5t-20.5 -6.5h-320q-66 0 -113 -47t-47 -113v-704 q0 -66 47 -113t113 -47h288h11h13t11.5 -1t11.5 -3t8 -5.5t7 -9t2 -13.5zM1568 640q0 -26 -19 -45l-544 -544q-19 -19 -45 -19t-45 19t-19 45v288h-448q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h448v288q0 26 19 45t45 19t45 -19l544 -544q19 -19 19 -45z" /> +<glyph unicode="" d="M237 122h231v694h-231v-694zM483 1030q-1 52 -36 86t-93 34t-94.5 -34t-36.5 -86q0 -51 35.5 -85.5t92.5 -34.5h1q59 0 95 34.5t36 85.5zM1068 122h231v398q0 154 -73 233t-193 79q-136 0 -209 -117h2v101h-231q3 -66 0 -694h231v388q0 38 7 56q15 35 45 59.5t74 24.5 q116 0 116 -157v-371zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1152" d="M480 672v448q0 14 -9 23t-23 9t-23 -9t-9 -23v-448q0 -14 9 -23t23 -9t23 9t9 23zM1152 320q0 -26 -19 -45t-45 -19h-429l-51 -483q-2 -12 -10.5 -20.5t-20.5 -8.5h-1q-27 0 -32 27l-76 485h-404q-26 0 -45 19t-19 45q0 123 78.5 221.5t177.5 98.5v512q-52 0 -90 38 t-38 90t38 90t90 38h640q52 0 90 -38t38 -90t-38 -90t-90 -38v-512q99 0 177.5 -98.5t78.5 -221.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1408 608v-320q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h704q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v320 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1792 1472v-512q0 -26 -19 -45t-45 -19t-45 19l-176 176l-652 -652q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l652 652l-176 176q-19 19 -19 45t19 45t45 19h512q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1184 640q0 -26 -19 -45l-544 -544q-19 -19 -45 -19t-45 19t-19 45v288h-448q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h448v288q0 26 19 45t45 19t45 -19l544 -544q19 -19 19 -45zM1536 992v-704q0 -119 -84.5 -203.5t-203.5 -84.5h-320q-13 0 -22.5 9.5t-9.5 22.5 q0 4 -1 20t-0.5 26.5t3 23.5t10 19.5t20.5 6.5h320q66 0 113 47t47 113v704q0 66 -47 113t-113 47h-288h-11h-13t-11.5 1t-11.5 3t-8 5.5t-7 9t-2 13.5q0 4 -1 20t-0.5 26.5t3 23.5t10 19.5t20.5 6.5h320q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M458 653q-74 162 -74 371h-256v-96q0 -78 94.5 -162t235.5 -113zM1536 928v96h-256q0 -209 -74 -371q141 29 235.5 113t94.5 162zM1664 1056v-128q0 -71 -41.5 -143t-112 -130t-173 -97.5t-215.5 -44.5q-42 -54 -95 -95q-38 -34 -52.5 -72.5t-14.5 -89.5q0 -54 30.5 -91 t97.5 -37q75 0 133.5 -45.5t58.5 -114.5v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v64q0 69 58.5 114.5t133.5 45.5q67 0 97.5 37t30.5 91q0 51 -14.5 89.5t-52.5 72.5q-53 41 -95 95q-113 5 -215.5 44.5t-173 97.5t-112 130t-41.5 143v128q0 40 28 68t68 28h288v96 q0 66 47 113t113 47h576q66 0 113 -47t47 -113v-96h288q40 0 68 -28t28 -68z" /> +<glyph unicode="" d="M394 184q-8 -9 -20 3q-13 11 -4 19q8 9 20 -3q12 -11 4 -19zM352 245q9 -12 0 -19q-8 -6 -17 7t0 18q9 7 17 -6zM291 305q-5 -7 -13 -2q-10 5 -7 12q3 5 13 2q10 -5 7 -12zM322 271q-6 -7 -16 3q-9 11 -2 16q6 6 16 -3q9 -11 2 -16zM451 159q-4 -12 -19 -6q-17 4 -13 15 t19 7q16 -5 13 -16zM514 154q0 -11 -16 -11q-17 -2 -17 11q0 11 16 11q17 2 17 -11zM572 164q2 -10 -14 -14t-18 8t14 15q16 2 18 -9zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-224q-16 0 -24.5 1t-19.5 5t-16 14.5t-5 27.5v239q0 97 -52 142q57 6 102.5 18t94 39 t81 66.5t53 105t20.5 150.5q0 121 -79 206q37 91 -8 204q-28 9 -81 -11t-92 -44l-38 -24q-93 26 -192 26t-192 -26q-16 11 -42.5 27t-83.5 38.5t-86 13.5q-44 -113 -7 -204q-79 -85 -79 -206q0 -85 20.5 -150t52.5 -105t80.5 -67t94 -39t102.5 -18q-40 -36 -49 -103 q-21 -10 -45 -15t-57 -5t-65.5 21.5t-55.5 62.5q-19 32 -48.5 52t-49.5 24l-20 3q-21 0 -29 -4.5t-5 -11.5t9 -14t13 -12l7 -5q22 -10 43.5 -38t31.5 -51l10 -23q13 -38 44 -61.5t67 -30t69.5 -7t55.5 3.5l23 4q0 -38 0.5 -103t0.5 -68q0 -22 -11 -33.5t-22 -13t-33 -1.5 h-224q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 288v-320q0 -40 -28 -68t-68 -28h-1472q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h427q21 -56 70.5 -92 t110.5 -36h256q61 0 110.5 36t70.5 92h427q40 0 68 -28t28 -68zM1339 936q-17 -40 -59 -40h-256v-448q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v448h-256q-42 0 -59 40q-17 39 14 69l448 448q18 19 45 19t45 -19l448 -448q31 -30 14 -69z" /> +<glyph unicode="" d="M1407 710q0 44 -7 113.5t-18 96.5q-12 30 -17 44t-9 36.5t-4 48.5q0 23 5 68.5t5 67.5q0 37 -10 55q-4 1 -13 1q-19 0 -58 -4.5t-59 -4.5q-60 0 -176 24t-175 24q-43 0 -94.5 -11.5t-85 -23.5t-89.5 -34q-137 -54 -202 -103q-96 -73 -159.5 -189.5t-88 -236t-24.5 -248.5 q0 -40 12.5 -120t12.5 -121q0 -23 -11 -66.5t-11 -65.5t12 -36.5t34 -14.5q24 0 72.5 11t73.5 11q57 0 169.5 -15.5t169.5 -15.5q181 0 284 36q129 45 235.5 152.5t166 245.5t59.5 275zM1535 712q0 -165 -70 -327.5t-196 -288t-281 -180.5q-124 -44 -326 -44 q-57 0 -170 14.5t-169 14.5q-24 0 -72.5 -14.5t-73.5 -14.5q-73 0 -123.5 55.5t-50.5 128.5q0 24 11 68t11 67q0 40 -12.5 120.5t-12.5 121.5q0 111 18 217.5t54.5 209.5t100.5 194t150 156q78 59 232 120q194 78 316 78q60 0 175.5 -24t173.5 -24q19 0 57 5t58 5 q81 0 118 -50.5t37 -134.5q0 -23 -5 -68t-5 -68q0 -10 1 -18.5t3 -17t4 -13.5t6.5 -16t6.5 -17q16 -40 25 -118.5t9 -136.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 296q0 -27 -10 -70.5t-21 -68.5q-21 -50 -122 -106q-94 -51 -186 -51q-27 0 -52.5 3.5t-57.5 12.5t-47.5 14.5t-55.5 20.5t-49 18q-98 35 -175 83q-128 79 -264.5 215.5t-215.5 264.5q-48 77 -83 175q-3 9 -18 49t-20.5 55.5t-14.5 47.5t-12.5 57.5t-3.5 52.5 q0 92 51 186q56 101 106 122q25 11 68.5 21t70.5 10q14 0 21 -3q18 -6 53 -76q11 -19 30 -54t35 -63.5t31 -53.5q3 -4 17.5 -25t21.5 -35.5t7 -28.5q0 -20 -28.5 -50t-62 -55t-62 -53t-28.5 -46q0 -9 5 -22.5t8.5 -20.5t14 -24t11.5 -19q76 -137 174 -235t235 -174 q2 -1 19 -11.5t24 -14t20.5 -8.5t22.5 -5q18 0 46 28.5t53 62t55 62t50 28.5q14 0 28.5 -7t35.5 -21.5t25 -17.5q25 -15 53.5 -31t63.5 -35t54 -30q70 -35 76 -53q3 -7 3 -21z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1120 1280h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v832q0 66 -47 113t-113 47zM1408 1120v-832q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 1280h-1024v-1242l423 406l89 85l89 -85l423 -406v1242zM1164 1408q23 0 44 -9q33 -13 52.5 -41t19.5 -62v-1289q0 -34 -19.5 -62t-52.5 -41q-19 -8 -44 -8q-48 0 -83 32l-441 424l-441 -424q-36 -33 -83 -33q-23 0 -44 9q-33 13 -52.5 41t-19.5 62v1289 q0 34 19.5 62t52.5 41q21 9 44 9h1048z" /> +<glyph unicode="" d="M1280 343q0 11 -2 16q-3 8 -38.5 29.5t-88.5 49.5l-53 29q-5 3 -19 13t-25 15t-21 5q-18 0 -47 -32.5t-57 -65.5t-44 -33q-7 0 -16.5 3.5t-15.5 6.5t-17 9.5t-14 8.5q-99 55 -170.5 126.5t-126.5 170.5q-2 3 -8.5 14t-9.5 17t-6.5 15.5t-3.5 16.5q0 13 20.5 33.5t45 38.5 t45 39.5t20.5 36.5q0 10 -5 21t-15 25t-13 19q-3 6 -15 28.5t-25 45.5t-26.5 47.5t-25 40.5t-16.5 18t-16 2q-48 0 -101 -22q-46 -21 -80 -94.5t-34 -130.5q0 -16 2.5 -34t5 -30.5t9 -33t10 -29.5t12.5 -33t11 -30q60 -164 216.5 -320.5t320.5 -216.5q6 -2 30 -11t33 -12.5 t29.5 -10t33 -9t30.5 -5t34 -2.5q57 0 130.5 34t94.5 80q22 53 22 101zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1620 1128q-67 -98 -162 -167q1 -14 1 -42q0 -130 -38 -259.5t-115.5 -248.5t-184.5 -210.5t-258 -146t-323 -54.5q-271 0 -496 145q35 -4 78 -4q225 0 401 138q-105 2 -188 64.5t-114 159.5q33 -5 61 -5q43 0 85 11q-112 23 -185.5 111.5t-73.5 205.5v4q68 -38 146 -41 q-66 44 -105 115t-39 154q0 88 44 163q121 -149 294.5 -238.5t371.5 -99.5q-8 38 -8 74q0 134 94.5 228.5t228.5 94.5q140 0 236 -102q109 21 205 78q-37 -115 -142 -178q93 10 186 50z" /> +<glyph unicode="" horiz-adv-x="1024" d="M959 1524v-264h-157q-86 0 -116 -36t-30 -108v-189h293l-39 -296h-254v-759h-306v759h-255v296h255v218q0 186 104 288.5t277 102.5q147 0 228 -12z" /> +<glyph unicode="" d="M1536 640q0 -251 -146.5 -451.5t-378.5 -277.5q-27 -5 -39.5 7t-12.5 30v211q0 97 -52 142q57 6 102.5 18t94 39t81 66.5t53 105t20.5 150.5q0 121 -79 206q37 91 -8 204q-28 9 -81 -11t-92 -44l-38 -24q-93 26 -192 26t-192 -26q-16 11 -42.5 27t-83.5 38.5t-86 13.5 q-44 -113 -7 -204q-79 -85 -79 -206q0 -85 20.5 -150t52.5 -105t80.5 -67t94 -39t102.5 -18q-40 -36 -49 -103q-21 -10 -45 -15t-57 -5t-65.5 21.5t-55.5 62.5q-19 32 -48.5 52t-49.5 24l-20 3q-21 0 -29 -4.5t-5 -11.5t9 -14t13 -12l7 -5q22 -10 43.5 -38t31.5 -51l10 -23 q13 -38 44 -61.5t67 -30t69.5 -7t55.5 3.5l23 4q0 -38 0.5 -89t0.5 -54q0 -18 -13 -30t-40 -7q-232 77 -378.5 277.5t-146.5 451.5q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 960v-256q0 -26 -19 -45t-45 -19h-64q-26 0 -45 19t-19 45v256q0 106 -75 181t-181 75t-181 -75t-75 -181v-192h96q40 0 68 -28t28 -68v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h672v192q0 185 131.5 316.5t316.5 131.5 t316.5 -131.5t131.5 -316.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1760 1408q66 0 113 -47t47 -113v-1216q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1600zM160 1280q-13 0 -22.5 -9.5t-9.5 -22.5v-224h1664v224q0 13 -9.5 22.5t-22.5 9.5h-1600zM1760 0q13 0 22.5 9.5t9.5 22.5v608h-1664v-608 q0 -13 9.5 -22.5t22.5 -9.5h1600zM256 128v128h256v-128h-256zM640 128v128h384v-128h-384z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 192q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM896 69q2 -28 -17 -48q-18 -21 -47 -21h-135q-25 0 -43 16.5t-20 41.5q-22 229 -184.5 391.5t-391.5 184.5q-25 2 -41.5 20t-16.5 43v135q0 29 21 47q17 17 43 17h5q160 -13 306 -80.5 t259 -181.5q114 -113 181.5 -259t80.5 -306zM1408 67q2 -27 -18 -47q-18 -20 -46 -20h-143q-26 0 -44.5 17.5t-19.5 42.5q-12 215 -101 408.5t-231.5 336t-336 231.5t-408.5 102q-25 1 -42.5 19.5t-17.5 43.5v143q0 28 20 46q18 18 44 18h3q262 -13 501.5 -120t425.5 -294 q187 -186 294 -425.5t120 -501.5z" /> +<glyph unicode="" d="M1040 320q0 -33 -23.5 -56.5t-56.5 -23.5t-56.5 23.5t-23.5 56.5t23.5 56.5t56.5 23.5t56.5 -23.5t23.5 -56.5zM1296 320q0 -33 -23.5 -56.5t-56.5 -23.5t-56.5 23.5t-23.5 56.5t23.5 56.5t56.5 23.5t56.5 -23.5t23.5 -56.5zM1408 160v320q0 13 -9.5 22.5t-22.5 9.5 h-1216q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h1216q13 0 22.5 9.5t9.5 22.5zM178 640h1180l-157 482q-4 13 -16 21.5t-26 8.5h-782q-14 0 -26 -8.5t-16 -21.5zM1536 480v-320q0 -66 -47 -113t-113 -47h-1216q-66 0 -113 47t-47 113v320q0 25 16 75 l197 606q17 53 63 86t101 33h782q55 0 101 -33t63 -86l197 -606q16 -50 16 -75z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 896q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5v-384q0 -52 -38 -90t-90 -38q-417 347 -812 380q-58 -19 -91 -66t-31 -100.5t40 -92.5q-20 -33 -23 -65.5t6 -58t33.5 -55t48 -50t61.5 -50.5q-29 -58 -111.5 -83t-168.5 -11.5t-132 55.5q-7 23 -29.5 87.5 t-32 94.5t-23 89t-15 101t3.5 98.5t22 110.5h-122q-66 0 -113 47t-47 113v192q0 66 47 113t113 47h480q435 0 896 384q52 0 90 -38t38 -90v-384zM1536 292v954q-394 -302 -768 -343v-270q377 -42 768 -341z" /> +<glyph unicode="" horiz-adv-x="1792" d="M912 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM246 128h1300q-266 300 -266 832q0 51 -24 105t-69 103t-121.5 80.5t-169.5 31.5t-169.5 -31.5t-121.5 -80.5t-69 -103t-24 -105q0 -532 -266 -832z M1728 128q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-181 75t-75 181h-448q-52 0 -90 38t-38 90q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q190 -28 307 -158.5 t117 -282.5q0 -139 19.5 -260t50 -206t74.5 -158.5t85 -119.5t91 -88z" /> +<glyph unicode="" d="M1376 640l138 -135q30 -28 20 -70q-12 -41 -52 -51l-188 -48l53 -186q12 -41 -19 -70q-29 -31 -70 -19l-186 53l-48 -188q-10 -40 -51 -52q-12 -2 -19 -2q-31 0 -51 22l-135 138l-135 -138q-28 -30 -70 -20q-41 11 -51 52l-48 188l-186 -53q-41 -12 -70 19q-31 29 -19 70 l53 186l-188 48q-40 10 -52 51q-10 42 20 70l138 135l-138 135q-30 28 -20 70q12 41 52 51l188 48l-53 186q-12 41 19 70q29 31 70 19l186 -53l48 188q10 41 51 51q41 12 70 -19l135 -139l135 139q29 30 70 19q41 -10 51 -51l48 -188l186 53q41 12 70 -19q31 -29 19 -70 l-53 -186l188 -48q40 -10 52 -51q10 -42 -20 -70z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 768q0 51 -39 89.5t-89 38.5h-576q0 20 15 48.5t33 55t33 68t15 84.5q0 67 -44.5 97.5t-115.5 30.5q-24 0 -90 -139q-24 -44 -37 -65q-40 -64 -112 -145q-71 -81 -101 -106 q-69 -57 -140 -57h-32v-640h32q72 0 167 -32t193.5 -64t179.5 -32q189 0 189 167q0 26 -5 56q30 16 47.5 52.5t17.5 73.5t-18 69q53 50 53 119q0 25 -10 55.5t-25 47.5h331q52 0 90 38t38 90zM1792 769q0 -105 -75.5 -181t-180.5 -76h-169q-4 -62 -37 -119q3 -21 3 -43 q0 -101 -60 -178q1 -139 -85 -219.5t-227 -80.5q-133 0 -322 69q-164 59 -223 59h-288q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5h288q10 0 21.5 4.5t23.5 14t22.5 18t24 22.5t20.5 21.5t19 21.5t14 17q65 74 100 129q13 21 33 62t37 72t40.5 63t55 49.5 t69.5 17.5q125 0 206.5 -67t81.5 -189q0 -68 -22 -128h374q104 0 180 -76t76 -179z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1376 128h32v640h-32q-35 0 -67.5 12t-62.5 37t-50 46t-49 54q-2 3 -3.5 4.5t-4 4.5t-4.5 5q-72 81 -112 145q-14 22 -38 68q-1 3 -10.5 22.5t-18.5 36t-20 35.5t-21.5 30.5t-18.5 11.5q-71 0 -115.5 -30.5t-44.5 -97.5q0 -43 15 -84.5t33 -68t33 -55t15 -48.5h-576 q-50 0 -89 -38.5t-39 -89.5q0 -52 38 -90t90 -38h331q-15 -17 -25 -47.5t-10 -55.5q0 -69 53 -119q-18 -32 -18 -69t17.5 -73.5t47.5 -52.5q-4 -24 -4 -56q0 -85 48.5 -126t135.5 -41q84 0 183 32t194 64t167 32zM1664 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45 t45 -19t45 19t19 45zM1792 768v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-288q-59 0 -223 -59q-190 -69 -317 -69q-142 0 -230 77.5t-87 217.5l1 5q-61 76 -61 178q0 22 3 43q-33 57 -37 119h-169q-105 0 -180.5 76t-75.5 181q0 103 76 179t180 76h374q-22 60 -22 128 q0 122 81.5 189t206.5 67q38 0 69.5 -17.5t55 -49.5t40.5 -63t37 -72t33 -62q35 -55 100 -129q2 -3 14 -17t19 -21.5t20.5 -21.5t24 -22.5t22.5 -18t23.5 -14t21.5 -4.5h288q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" d="M1280 -64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 700q0 189 -167 189q-26 0 -56 -5q-16 30 -52.5 47.5t-73.5 17.5t-69 -18q-50 53 -119 53q-25 0 -55.5 -10t-47.5 -25v331q0 52 -38 90t-90 38q-51 0 -89.5 -39t-38.5 -89v-576 q-20 0 -48.5 15t-55 33t-68 33t-84.5 15q-67 0 -97.5 -44.5t-30.5 -115.5q0 -24 139 -90q44 -24 65 -37q64 -40 145 -112q81 -71 106 -101q57 -69 57 -140v-32h640v32q0 72 32 167t64 193.5t32 179.5zM1536 705q0 -133 -69 -322q-59 -164 -59 -223v-288q0 -53 -37.5 -90.5 t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5v288q0 10 -4.5 21.5t-14 23.5t-18 22.5t-22.5 24t-21.5 20.5t-21.5 19t-17 14q-74 65 -129 100q-21 13 -62 33t-72 37t-63 40.5t-49.5 55t-17.5 69.5q0 125 67 206.5t189 81.5q68 0 128 -22v374q0 104 76 180t179 76 q105 0 181 -75.5t76 -180.5v-169q62 -4 119 -37q21 3 43 3q101 0 178 -60q139 1 219.5 -85t80.5 -227z" /> +<glyph unicode="" d="M1408 576q0 84 -32 183t-64 194t-32 167v32h-640v-32q0 -35 -12 -67.5t-37 -62.5t-46 -50t-54 -49q-9 -8 -14 -12q-81 -72 -145 -112q-22 -14 -68 -38q-3 -1 -22.5 -10.5t-36 -18.5t-35.5 -20t-30.5 -21.5t-11.5 -18.5q0 -71 30.5 -115.5t97.5 -44.5q43 0 84.5 15t68 33 t55 33t48.5 15v-576q0 -50 38.5 -89t89.5 -39q52 0 90 38t38 90v331q46 -35 103 -35q69 0 119 53q32 -18 69 -18t73.5 17.5t52.5 47.5q24 -4 56 -4q85 0 126 48.5t41 135.5zM1280 1344q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 580 q0 -142 -77.5 -230t-217.5 -87l-5 1q-76 -61 -178 -61q-22 0 -43 3q-54 -30 -119 -37v-169q0 -105 -76 -180.5t-181 -75.5q-103 0 -179 76t-76 180v374q-54 -22 -128 -22q-121 0 -188.5 81.5t-67.5 206.5q0 38 17.5 69.5t49.5 55t63 40.5t72 37t62 33q55 35 129 100 q3 2 17 14t21.5 19t21.5 20.5t22.5 24t18 22.5t14 23.5t4.5 21.5v288q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-288q0 -59 59 -223q69 -190 69 -317z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-502l189 189q19 19 19 45t-19 45l-91 91q-18 18 -45 18t-45 -18l-362 -362l-91 -91q-18 -18 -18 -45t18 -45l91 -91l362 -362q18 -18 45 -18t45 18l91 91q18 18 18 45t-18 45l-189 189h502q26 0 45 19t19 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1285 640q0 27 -18 45l-91 91l-362 362q-18 18 -45 18t-45 -18l-91 -91q-18 -18 -18 -45t18 -45l189 -189h-502q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h502l-189 -189q-19 -19 -19 -45t19 -45l91 -91q18 -18 45 -18t45 18l362 362l91 91q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 641q0 27 -18 45l-362 362l-91 91q-18 18 -45 18t-45 -18l-91 -91l-362 -362q-18 -18 -18 -45t18 -45l91 -91q18 -18 45 -18t45 18l189 189v-502q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v502l189 -189q19 -19 45 -19t45 19l91 91q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 639q0 27 -18 45l-91 91q-18 18 -45 18t-45 -18l-189 -189v502q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-502l-189 189q-19 19 -45 19t-45 -19l-91 -91q-18 -18 -18 -45t18 -45l362 -362l91 -91q18 -18 45 -18t45 18l91 91l362 362q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM1042 887q-2 -1 -9.5 -9.5t-13.5 -9.5q2 0 4.5 5t5 11t3.5 7q6 7 22 15q14 6 52 12q34 8 51 -11 q-2 2 9.5 13t14.5 12q3 2 15 4.5t15 7.5l2 22q-12 -1 -17.5 7t-6.5 21q0 -2 -6 -8q0 7 -4.5 8t-11.5 -1t-9 -1q-10 3 -15 7.5t-8 16.5t-4 15q-2 5 -9.5 10.5t-9.5 10.5q-1 2 -2.5 5.5t-3 6.5t-4 5.5t-5.5 2.5t-7 -5t-7.5 -10t-4.5 -5q-3 2 -6 1.5t-4.5 -1t-4.5 -3t-5 -3.5 q-3 -2 -8.5 -3t-8.5 -2q15 5 -1 11q-10 4 -16 3q9 4 7.5 12t-8.5 14h5q-1 4 -8.5 8.5t-17.5 8.5t-13 6q-8 5 -34 9.5t-33 0.5q-5 -6 -4.5 -10.5t4 -14t3.5 -12.5q1 -6 -5.5 -13t-6.5 -12q0 -7 14 -15.5t10 -21.5q-3 -8 -16 -16t-16 -12q-5 -8 -1.5 -18.5t10.5 -16.5 q2 -2 1.5 -4t-3.5 -4.5t-5.5 -4t-6.5 -3.5l-3 -2q-11 -5 -20.5 6t-13.5 26q-7 25 -16 30q-23 8 -29 -1q-5 13 -41 26q-25 9 -58 4q6 1 0 15q-7 15 -19 12q3 6 4 17.5t1 13.5q3 13 12 23q1 1 7 8.5t9.5 13.5t0.5 6q35 -4 50 11q5 5 11.5 17t10.5 17q9 6 14 5.5t14.5 -5.5 t14.5 -5q14 -1 15.5 11t-7.5 20q12 -1 3 17q-5 7 -8 9q-12 4 -27 -5q-8 -4 2 -8q-1 1 -9.5 -10.5t-16.5 -17.5t-16 5q-1 1 -5.5 13.5t-9.5 13.5q-8 0 -16 -15q3 8 -11 15t-24 8q19 12 -8 27q-7 4 -20.5 5t-19.5 -4q-5 -7 -5.5 -11.5t5 -8t10.5 -5.5t11.5 -4t8.5 -3 q14 -10 8 -14q-2 -1 -8.5 -3.5t-11.5 -4.5t-6 -4q-3 -4 0 -14t-2 -14q-5 5 -9 17.5t-7 16.5q7 -9 -25 -6l-10 1q-4 0 -16 -2t-20.5 -1t-13.5 8q-4 8 0 20q1 4 4 2q-4 3 -11 9.5t-10 8.5q-46 -15 -94 -41q6 -1 12 1q5 2 13 6.5t10 5.5q34 14 42 7l5 5q14 -16 20 -25 q-7 4 -30 1q-20 -6 -22 -12q7 -12 5 -18q-4 3 -11.5 10t-14.5 11t-15 5q-16 0 -22 -1q-146 -80 -235 -222q7 -7 12 -8q4 -1 5 -9t2.5 -11t11.5 3q9 -8 3 -19q1 1 44 -27q19 -17 21 -21q3 -11 -10 -18q-1 2 -9 9t-9 4q-3 -5 0.5 -18.5t10.5 -12.5q-7 0 -9.5 -16t-2.5 -35.5 t-1 -23.5l2 -1q-3 -12 5.5 -34.5t21.5 -19.5q-13 -3 20 -43q6 -8 8 -9q3 -2 12 -7.5t15 -10t10 -10.5q4 -5 10 -22.5t14 -23.5q-2 -6 9.5 -20t10.5 -23q-1 0 -2.5 -1t-2.5 -1q3 -7 15.5 -14t15.5 -13q1 -3 2 -10t3 -11t8 -2q2 20 -24 62q-15 25 -17 29q-3 5 -5.5 15.5 t-4.5 14.5q2 0 6 -1.5t8.5 -3.5t7.5 -4t2 -3q-3 -7 2 -17.5t12 -18.5t17 -19t12 -13q6 -6 14 -19.5t0 -13.5q9 0 20 -10t17 -20q5 -8 8 -26t5 -24q2 -7 8.5 -13.5t12.5 -9.5l16 -8t13 -7q5 -2 18.5 -10.5t21.5 -11.5q10 -4 16 -4t14.5 2.5t13.5 3.5q15 2 29 -15t21 -21 q36 -19 55 -11q-2 -1 0.5 -7.5t8 -15.5t9 -14.5t5.5 -8.5q5 -6 18 -15t18 -15q6 4 7 9q-3 -8 7 -20t18 -10q14 3 14 32q-31 -15 -49 18q0 1 -2.5 5.5t-4 8.5t-2.5 8.5t0 7.5t5 3q9 0 10 3.5t-2 12.5t-4 13q-1 8 -11 20t-12 15q-5 -9 -16 -8t-16 9q0 -1 -1.5 -5.5t-1.5 -6.5 q-13 0 -15 1q1 3 2.5 17.5t3.5 22.5q1 4 5.5 12t7.5 14.5t4 12.5t-4.5 9.5t-17.5 2.5q-19 -1 -26 -20q-1 -3 -3 -10.5t-5 -11.5t-9 -7q-7 -3 -24 -2t-24 5q-13 8 -22.5 29t-9.5 37q0 10 2.5 26.5t3 25t-5.5 24.5q3 2 9 9.5t10 10.5q2 1 4.5 1.5t4.5 0t4 1.5t3 6q-1 1 -4 3 q-3 3 -4 3q7 -3 28.5 1.5t27.5 -1.5q15 -11 22 2q0 1 -2.5 9.5t-0.5 13.5q5 -27 29 -9q3 -3 15.5 -5t17.5 -5q3 -2 7 -5.5t5.5 -4.5t5 0.5t8.5 6.5q10 -14 12 -24q11 -40 19 -44q7 -3 11 -2t4.5 9.5t0 14t-1.5 12.5l-1 8v18l-1 8q-15 3 -18.5 12t1.5 18.5t15 18.5q1 1 8 3.5 t15.5 6.5t12.5 8q21 19 15 35q7 0 11 9q-1 0 -5 3t-7.5 5t-4.5 2q9 5 2 16q5 3 7.5 11t7.5 10q9 -12 21 -2q7 8 1 16q5 7 20.5 10.5t18.5 9.5q7 -2 8 2t1 12t3 12q4 5 15 9t13 5l17 11q3 4 0 4q18 -2 31 11q10 11 -6 20q3 6 -3 9.5t-15 5.5q3 1 11.5 0.5t10.5 1.5 q15 10 -7 16q-17 5 -43 -12zM879 10q206 36 351 189q-3 3 -12.5 4.5t-12.5 3.5q-18 7 -24 8q1 7 -2.5 13t-8 9t-12.5 8t-11 7q-2 2 -7 6t-7 5.5t-7.5 4.5t-8.5 2t-10 -1l-3 -1q-3 -1 -5.5 -2.5t-5.5 -3t-4 -3t0 -2.5q-21 17 -36 22q-5 1 -11 5.5t-10.5 7t-10 1.5t-11.5 -7 q-5 -5 -6 -15t-2 -13q-7 5 0 17.5t2 18.5q-3 6 -10.5 4.5t-12 -4.5t-11.5 -8.5t-9 -6.5t-8.5 -5.5t-8.5 -7.5q-3 -4 -6 -12t-5 -11q-2 4 -11.5 6.5t-9.5 5.5q2 -10 4 -35t5 -38q7 -31 -12 -48q-27 -25 -29 -40q-4 -22 12 -26q0 -7 -8 -20.5t-7 -21.5q0 -6 2 -16z" /> +<glyph unicode="" horiz-adv-x="1664" d="M384 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1028 484l-682 -682q-37 -37 -90 -37q-52 0 -91 37l-106 108q-38 36 -38 90q0 53 38 91l681 681q39 -98 114.5 -173.5t173.5 -114.5zM1662 919q0 -39 -23 -106q-47 -134 -164.5 -217.5 t-258.5 -83.5q-185 0 -316.5 131.5t-131.5 316.5t131.5 316.5t316.5 131.5q58 0 121.5 -16.5t107.5 -46.5q16 -11 16 -28t-16 -28l-293 -169v-224l193 -107q5 3 79 48.5t135.5 81t70.5 35.5q15 0 23.5 -10t8.5 -25z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 128h640v128h-640v-128zM640 640h1024v128h-1024v-128zM1280 1152h384v128h-384v-128zM1792 320v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 832v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19 t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 1344v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1403 1241q17 -41 -14 -70l-493 -493v-742q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-256 256q-19 19 -19 45v486l-493 493q-31 29 -14 70q17 39 59 39h1280q42 0 59 -39z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1280h512v128h-512v-128zM1792 640v-480q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v480h672v-160q0 -26 19 -45t45 -19h320q26 0 45 19t19 45v160h672zM1024 640v-128h-256v128h256zM1792 1120v-384h-1792v384q0 66 47 113t113 47h352v160q0 40 28 68 t68 28h576q40 0 68 -28t28 -68v-160h352q66 0 113 -47t47 -113z" /> +<glyph unicode="" d="M1283 995l-355 -355l355 -355l144 144q29 31 70 14q39 -17 39 -59v-448q0 -26 -19 -45t-45 -19h-448q-42 0 -59 40q-17 39 14 69l144 144l-355 355l-355 -355l144 -144q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l144 -144 l355 355l-355 355l-144 -144q-19 -19 -45 -19q-12 0 -24 5q-40 17 -40 59v448q0 26 19 45t45 19h448q42 0 59 -40q17 -39 -14 -69l-144 -144l355 -355l355 355l-144 144q-31 30 -14 69q17 40 59 40h448q26 0 45 -19t19 -45v-448q0 -42 -39 -59q-13 -5 -25 -5q-26 0 -45 19z " /> +<glyph unicode="" horiz-adv-x="1920" d="M593 640q-162 -5 -265 -128h-134q-82 0 -138 40.5t-56 118.5q0 353 124 353q6 0 43.5 -21t97.5 -42.5t119 -21.5q67 0 133 23q-5 -37 -5 -66q0 -139 81 -256zM1664 3q0 -120 -73 -189.5t-194 -69.5h-874q-121 0 -194 69.5t-73 189.5q0 53 3.5 103.5t14 109t26.5 108.5 t43 97.5t62 81t85.5 53.5t111.5 20q10 0 43 -21.5t73 -48t107 -48t135 -21.5t135 21.5t107 48t73 48t43 21.5q61 0 111.5 -20t85.5 -53.5t62 -81t43 -97.5t26.5 -108.5t14 -109t3.5 -103.5zM640 1280q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75 t75 -181zM1344 896q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5zM1920 671q0 -78 -56 -118.5t-138 -40.5h-134q-103 123 -265 128q81 117 81 256q0 29 -5 66q66 -23 133 -23q59 0 119 21.5t97.5 42.5 t43.5 21q124 0 124 -353zM1792 1280q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1456 320q0 40 -28 68l-208 208q-28 28 -68 28q-42 0 -72 -32q3 -3 19 -18.5t21.5 -21.5t15 -19t13 -25.5t3.5 -27.5q0 -40 -28 -68t-68 -28q-15 0 -27.5 3.5t-25.5 13t-19 15t-21.5 21.5t-18.5 19q-33 -31 -33 -73q0 -40 28 -68l206 -207q27 -27 68 -27q40 0 68 26 l147 146q28 28 28 67zM753 1025q0 40 -28 68l-206 207q-28 28 -68 28q-39 0 -68 -27l-147 -146q-28 -28 -28 -67q0 -40 28 -68l208 -208q27 -27 68 -27q42 0 72 31q-3 3 -19 18.5t-21.5 21.5t-15 19t-13 25.5t-3.5 27.5q0 40 28 68t68 28q15 0 27.5 -3.5t25.5 -13t19 -15 t21.5 -21.5t18.5 -19q33 31 33 73zM1648 320q0 -120 -85 -203l-147 -146q-83 -83 -203 -83q-121 0 -204 85l-206 207q-83 83 -83 203q0 123 88 209l-88 88q-86 -88 -208 -88q-120 0 -204 84l-208 208q-84 84 -84 204t85 203l147 146q83 83 203 83q121 0 204 -85l206 -207 q83 -83 83 -203q0 -123 -88 -209l88 -88q86 88 208 88q120 0 204 -84l208 -208q84 -84 84 -204z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088q-185 0 -316.5 131.5t-131.5 316.5q0 132 71 241.5t187 163.5q-2 28 -2 43q0 212 150 362t362 150q158 0 286.5 -88t187.5 -230q70 62 166 62q106 0 181 -75t75 -181q0 -75 -41 -138q129 -30 213 -134.5t84 -239.5z " /> +<glyph unicode="" horiz-adv-x="1664" d="M1527 88q56 -89 21.5 -152.5t-140.5 -63.5h-1152q-106 0 -140.5 63.5t21.5 152.5l503 793v399h-64q-26 0 -45 19t-19 45t19 45t45 19h512q26 0 45 -19t19 -45t-19 -45t-45 -19h-64v-399zM748 813l-272 -429h712l-272 429l-20 31v37v399h-128v-399v-37z" /> +<glyph unicode="" horiz-adv-x="1792" d="M960 640q26 0 45 -19t19 -45t-19 -45t-45 -19t-45 19t-19 45t19 45t45 19zM1260 576l507 -398q28 -20 25 -56q-5 -35 -35 -51l-128 -64q-13 -7 -29 -7q-17 0 -31 8l-690 387l-110 -66q-8 -4 -12 -5q14 -49 10 -97q-7 -77 -56 -147.5t-132 -123.5q-132 -84 -277 -84 q-136 0 -222 78q-90 84 -79 207q7 76 56 147t131 124q132 84 278 84q83 0 151 -31q9 13 22 22l122 73l-122 73q-13 9 -22 22q-68 -31 -151 -31q-146 0 -278 84q-82 53 -131 124t-56 147q-5 59 15.5 113t63.5 93q85 79 222 79q145 0 277 -84q83 -52 132 -123t56 -148 q4 -48 -10 -97q4 -1 12 -5l110 -66l690 387q14 8 31 8q16 0 29 -7l128 -64q30 -16 35 -51q3 -36 -25 -56zM579 836q46 42 21 108t-106 117q-92 59 -192 59q-74 0 -113 -36q-46 -42 -21 -108t106 -117q92 -59 192 -59q74 0 113 36zM494 91q81 51 106 117t-21 108 q-39 36 -113 36q-100 0 -192 -59q-81 -51 -106 -117t21 -108q39 -36 113 -36q100 0 192 59zM672 704l96 -58v11q0 36 33 56l14 8l-79 47l-26 -26q-3 -3 -10 -11t-12 -12q-2 -2 -4 -3.5t-3 -2.5zM896 480l96 -32l736 576l-128 64l-768 -431v-113l-160 -96l9 -8q2 -2 7 -6 q4 -4 11 -12t11 -12l26 -26zM1600 64l128 64l-520 408l-177 -138q-2 -3 -13 -7z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1696 1152q40 0 68 -28t28 -68v-1216q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v288h-544q-40 0 -68 28t-28 68v672q0 40 20 88t48 76l408 408q28 28 76 48t88 20h416q40 0 68 -28t28 -68v-328q68 40 128 40h416zM1152 939l-299 -299h299v299zM512 1323l-299 -299 h299v299zM708 676l316 316v416h-384v-416q0 -40 -28 -68t-68 -28h-416v-640h512v256q0 40 20 88t48 76zM1664 -128v1152h-384v-416q0 -40 -28 -68t-68 -28h-416v-640h896z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1404 151q0 -117 -79 -196t-196 -79q-135 0 -235 100l-777 776q-113 115 -113 271q0 159 110 270t269 111q158 0 273 -113l605 -606q10 -10 10 -22q0 -16 -30.5 -46.5t-46.5 -30.5q-13 0 -23 10l-606 607q-79 77 -181 77q-106 0 -179 -75t-73 -181q0 -105 76 -181 l776 -777q63 -63 145 -63q64 0 106 42t42 106q0 82 -63 145l-581 581q-26 24 -60 24q-29 0 -48 -19t-19 -48q0 -32 25 -59l410 -410q10 -10 10 -22q0 -16 -31 -47t-47 -31q-12 0 -22 10l-410 410q-63 61 -63 149q0 82 57 139t139 57q88 0 149 -63l581 -581q100 -98 100 -235 z" /> +<glyph unicode="" d="M384 0h768v384h-768v-384zM1280 0h128v896q0 14 -10 38.5t-20 34.5l-281 281q-10 10 -34 20t-39 10v-416q0 -40 -28 -68t-68 -28h-576q-40 0 -68 28t-28 68v416h-128v-1280h128v416q0 40 28 68t68 28h832q40 0 68 -28t28 -68v-416zM896 928v320q0 13 -9.5 22.5t-22.5 9.5 h-192q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 22.5zM1536 896v-928q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h928q40 0 88 -20t76 -48l280 -280q28 -28 48 -76t20 -88z" /> +<glyph unicode="" d="M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1536 192v-128q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1536 704v-128q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1536 1216v-128q0 -26 -19 -45 t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 128q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM384 640q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5 t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5zM384 1152q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1792 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z M1792 1248v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M381 -84q0 -80 -54.5 -126t-135.5 -46q-106 0 -172 66l57 88q49 -45 106 -45q29 0 50.5 14.5t21.5 42.5q0 64 -105 56l-26 56q8 10 32.5 43.5t42.5 54t37 38.5v1q-16 0 -48.5 -1t-48.5 -1v-53h-106v152h333v-88l-95 -115q51 -12 81 -49t30 -88zM383 543v-159h-362 q-6 36 -6 54q0 51 23.5 93t56.5 68t66 47.5t56.5 43.5t23.5 45q0 25 -14.5 38.5t-39.5 13.5q-46 0 -81 -58l-85 59q24 51 71.5 79.5t105.5 28.5q73 0 123 -41.5t50 -112.5q0 -50 -34 -91.5t-75 -64.5t-75.5 -50.5t-35.5 -52.5h127v60h105zM1792 224v-192q0 -13 -9.5 -22.5 t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 14 9 23t23 9h1216q13 0 22.5 -9.5t9.5 -22.5zM384 1123v-99h-335v99h107q0 41 0.5 122t0.5 121v12h-2q-8 -17 -50 -54l-71 76l136 127h106v-404h108zM1792 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5 t-9.5 22.5v192q0 14 9 23t23 9h1216q13 0 22.5 -9.5t9.5 -22.5zM1792 1248v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1760 640q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1728q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h1728zM483 704q-28 35 -51 80q-48 97 -48 188q0 181 134 309q133 127 393 127q50 0 167 -19q66 -12 177 -48q10 -38 21 -118q14 -123 14 -183q0 -18 -5 -45l-12 -3l-84 6 l-14 2q-50 149 -103 205q-88 91 -210 91q-114 0 -182 -59q-67 -58 -67 -146q0 -73 66 -140t279 -129q69 -20 173 -66q58 -28 95 -52h-743zM990 448h411q7 -39 7 -92q0 -111 -41 -212q-23 -55 -71 -104q-37 -35 -109 -81q-80 -48 -153 -66q-80 -21 -203 -21q-114 0 -195 23 l-140 40q-57 16 -72 28q-8 8 -8 22v13q0 108 -2 156q-1 30 0 68l2 37v44l102 2q15 -34 30 -71t22.5 -56t12.5 -27q35 -57 80 -94q43 -36 105 -57q59 -22 132 -22q64 0 139 27q77 26 122 86q47 61 47 129q0 84 -81 157q-34 29 -137 71z" /> +<glyph unicode="" d="M48 1313q-37 2 -45 4l-3 88q13 1 40 1q60 0 112 -4q132 -7 166 -7q86 0 168 3q116 4 146 5q56 0 86 2l-1 -14l2 -64v-9q-60 -9 -124 -9q-60 0 -79 -25q-13 -14 -13 -132q0 -13 0.5 -32.5t0.5 -25.5l1 -229l14 -280q6 -124 51 -202q35 -59 96 -92q88 -47 177 -47 q104 0 191 28q56 18 99 51q48 36 65 64q36 56 53 114q21 73 21 229q0 79 -3.5 128t-11 122.5t-13.5 159.5l-4 59q-5 67 -24 88q-34 35 -77 34l-100 -2l-14 3l2 86h84l205 -10q76 -3 196 10l18 -2q6 -38 6 -51q0 -7 -4 -31q-45 -12 -84 -13q-73 -11 -79 -17q-15 -15 -15 -41 q0 -7 1.5 -27t1.5 -31q8 -19 22 -396q6 -195 -15 -304q-15 -76 -41 -122q-38 -65 -112 -123q-75 -57 -182 -89q-109 -33 -255 -33q-167 0 -284 46q-119 47 -179 122q-61 76 -83 195q-16 80 -16 237v333q0 188 -17 213q-25 36 -147 39zM1536 -96v64q0 14 -9 23t-23 9h-1472 q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h1472q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M512 160v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM512 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 160v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23 v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM512 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 160v192 q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192 q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1664 1248v-1088q0 -66 -47 -113t-113 -47h-1344q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1344q66 0 113 -47t47 -113 z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1190 955l293 293l-107 107l-293 -293zM1637 1248q0 -27 -18 -45l-1286 -1286q-18 -18 -45 -18t-45 18l-198 198q-18 18 -18 45t18 45l1286 1286q18 18 45 18t45 -18l198 -198q18 -18 18 -45zM286 1438l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98zM636 1276 l196 -60l-196 -60l-60 -196l-60 196l-196 60l196 60l60 196zM1566 798l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98zM926 1438l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 128q0 52 -38 90t-90 38t-90 -38t-38 -90t38 -90t90 -38t90 38t38 90zM256 640h384v256h-158q-13 0 -22 -9l-195 -195q-9 -9 -9 -22v-30zM1536 128q0 52 -38 90t-90 38t-90 -38t-38 -90t38 -90t90 -38t90 38t38 90zM1792 1216v-1024q0 -15 -4 -26.5t-13.5 -18.5 t-16.5 -11.5t-23.5 -6t-22.5 -2t-25.5 0t-22.5 0.5q0 -106 -75 -181t-181 -75t-181 75t-75 181h-384q0 -106 -75 -181t-181 -75t-181 75t-75 181h-64q-3 0 -22.5 -0.5t-25.5 0t-22.5 2t-23.5 6t-16.5 11.5t-13.5 18.5t-4 26.5q0 26 19 45t45 19v320q0 8 -0.5 35t0 38 t2.5 34.5t6.5 37t14 30.5t22.5 30l198 198q19 19 50.5 32t58.5 13h160v192q0 26 19 45t45 19h1024q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103q-111 0 -218 32q59 93 78 164q9 34 54 211q20 -39 73 -67.5t114 -28.5q121 0 216 68.5t147 188.5t52 270q0 114 -59.5 214t-172.5 163t-255 63q-105 0 -196 -29t-154.5 -77t-109 -110.5t-67 -129.5t-21.5 -134 q0 -104 40 -183t117 -111q30 -12 38 20q2 7 8 31t8 30q6 23 -11 43q-51 61 -51 151q0 151 104.5 259.5t273.5 108.5q151 0 235.5 -82t84.5 -213q0 -170 -68.5 -289t-175.5 -119q-61 0 -98 43.5t-23 104.5q8 35 26.5 93.5t30 103t11.5 75.5q0 50 -27 83t-77 33 q-62 0 -105 -57t-43 -142q0 -73 25 -122l-99 -418q-17 -70 -13 -177q-206 91 -333 281t-127 423q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-725q85 122 108 210q9 34 53 209q21 -39 73.5 -67t112.5 -28q181 0 295.5 147.5t114.5 373.5q0 84 -35 162.5t-96.5 139t-152.5 97t-197 36.5q-104 0 -194.5 -28.5t-153 -76.5 t-107.5 -109.5t-66.5 -128t-21.5 -132.5q0 -102 39.5 -180t116.5 -110q13 -5 23.5 0t14.5 19q10 44 15 61q6 23 -11 42q-50 62 -50 150q0 150 103.5 256.5t270.5 106.5q149 0 232.5 -81t83.5 -210q0 -168 -67.5 -286t-173.5 -118q-60 0 -97 43.5t-23 103.5q8 34 26.5 92.5 t29.5 102t11 74.5q0 49 -26.5 81.5t-75.5 32.5q-61 0 -103.5 -56.5t-42.5 -139.5q0 -72 24 -121l-98 -414q-24 -100 -7 -254h-183q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960z" /> +<glyph unicode="" d="M829 318q0 -76 -58.5 -112.5t-139.5 -36.5q-41 0 -80.5 9.5t-75.5 28.5t-58 53t-22 78q0 46 25 80t65.5 51.5t82 25t84.5 7.5q20 0 31 -2q2 -1 23 -16.5t26 -19t23 -18t24.5 -22t19 -22.5t17 -26t9 -26.5t4.5 -31.5zM755 863q0 -60 -33 -99.5t-92 -39.5q-53 0 -93 42.5 t-57.5 96.5t-17.5 106q0 61 32 104t92 43q53 0 93.5 -45t58 -101t17.5 -107zM861 1120l88 64h-265q-85 0 -161 -32t-127.5 -98t-51.5 -153q0 -93 64.5 -154.5t158.5 -61.5q22 0 43 3q-13 -29 -13 -54q0 -44 40 -94q-175 -12 -257 -63q-47 -29 -75.5 -73t-28.5 -95 q0 -43 18.5 -77.5t48.5 -56.5t69 -37t77.5 -21t76.5 -6q60 0 120.5 15.5t113.5 46t86 82.5t33 117q0 49 -20 89.5t-49 66.5t-58 47.5t-49 44t-20 44.5t15.5 42.5t37.5 39.5t44 42t37.5 59.5t15.5 82.5q0 60 -22.5 99.5t-72.5 90.5h83zM1152 672h128v64h-128v128h-64v-128 h-128v-64h128v-160h64v160zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M735 740q0 -36 32 -70.5t77.5 -68t90.5 -73.5t77 -104t32 -142q0 -90 -48 -173q-72 -122 -211 -179.5t-298 -57.5q-132 0 -246.5 41.5t-171.5 137.5q-37 60 -37 131q0 81 44.5 150t118.5 115q131 82 404 100q-32 42 -47.5 74t-15.5 73q0 36 21 85q-46 -4 -68 -4 q-148 0 -249.5 96.5t-101.5 244.5q0 82 36 159t99 131q77 66 182.5 98t217.5 32h418l-138 -88h-131q74 -63 112 -133t38 -160q0 -72 -24.5 -129.5t-59 -93t-69.5 -65t-59.5 -61.5t-24.5 -66zM589 836q38 0 78 16.5t66 43.5q53 57 53 159q0 58 -17 125t-48.5 129.5 t-84.5 103.5t-117 41q-42 0 -82.5 -19.5t-65.5 -52.5q-47 -59 -47 -160q0 -46 10 -97.5t31.5 -103t52 -92.5t75 -67t96.5 -26zM591 -37q58 0 111.5 13t99 39t73 73t27.5 109q0 25 -7 49t-14.5 42t-27 41.5t-29.5 35t-38.5 34.5t-36.5 29t-41.5 30t-36.5 26q-16 2 -48 2 q-53 0 -105 -7t-107.5 -25t-97 -46t-68.5 -74.5t-27 -105.5q0 -70 35 -123.5t91.5 -83t119 -44t127.5 -14.5zM1401 839h213v-108h-213v-219h-105v219h-212v108h212v217h105v-217z" /> +<glyph unicode="" horiz-adv-x="1920" d="M768 384h384v96h-128v448h-114l-148 -137l77 -80q42 37 55 57h2v-288h-128v-96zM1280 640q0 -70 -21 -142t-59.5 -134t-101.5 -101t-138 -39t-138 39t-101.5 101t-59.5 134t-21 142t21 142t59.5 134t101.5 101t138 39t138 -39t101.5 -101t59.5 -134t21 -142zM1792 384 v512q-106 0 -181 75t-75 181h-1152q0 -106 -75 -181t-181 -75v-512q106 0 181 -75t75 -181h1152q0 106 75 181t181 75zM1920 1216v-1152q0 -26 -19 -45t-45 -19h-1792q-26 0 -45 19t-19 45v1152q0 26 19 45t45 19h1792q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 320q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M640 1088v-896q0 -26 -19 -45t-45 -19t-45 19l-448 448q-19 19 -19 45t19 45l448 448q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M576 640q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19t-19 45v896q0 26 19 45t45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M160 0h608v1152h-640v-1120q0 -13 9.5 -22.5t22.5 -9.5zM1536 32v1120h-640v-1152h608q13 0 22.5 9.5t9.5 22.5zM1664 1248v-1216q0 -66 -47 -113t-113 -47h-1344q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1344q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 448q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45zM1024 832q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 448q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 826v-794q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v794q44 -49 101 -87q362 -246 497 -345q57 -42 92.5 -65.5t94.5 -48t110 -24.5h1h1q51 0 110 24.5t94.5 48t92.5 65.5q170 123 498 345q57 39 100 87zM1792 1120q0 -79 -49 -151t-122 -123 q-376 -261 -468 -325q-10 -7 -42.5 -30.5t-54 -38t-52 -32.5t-57.5 -27t-50 -9h-1h-1q-23 0 -50 9t-57.5 27t-52 32.5t-54 38t-42.5 30.5q-91 64 -262 182.5t-205 142.5q-62 42 -117 115.5t-55 136.5q0 78 41.5 130t118.5 52h1472q65 0 112.5 -47t47.5 -113z" /> +<glyph unicode="" d="M349 911v-991h-330v991h330zM370 1217q1 -73 -50.5 -122t-135.5 -49h-2q-82 0 -132 49t-50 122q0 74 51.5 122.5t134.5 48.5t133 -48.5t51 -122.5zM1536 488v-568h-329v530q0 105 -40.5 164.5t-126.5 59.5q-63 0 -105.5 -34.5t-63.5 -85.5q-11 -30 -11 -81v-553h-329 q2 399 2 647t-1 296l-1 48h329v-144h-2q20 32 41 56t56.5 52t87 43.5t114.5 15.5q171 0 275 -113.5t104 -332.5z" /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61q-172 0 -327 72.5t-264 204.5q-7 10 -6.5 22.5t8.5 20.5l137 138q10 9 25 9q16 -2 23 -12q73 -95 179 -147t225 -52q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5 t-163.5 109.5t-198.5 40.5q-98 0 -188 -35.5t-160 -101.5l137 -138q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l130 -129q107 101 244.5 156.5t284.5 55.5q156 0 298 -61t245 -164t164 -245t61 -298z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1771 0q0 -53 -37 -90l-107 -108q-39 -37 -91 -37q-53 0 -90 37l-363 364q-38 36 -38 90q0 53 43 96l-256 256l-126 -126q-14 -14 -34 -14t-34 14q2 -2 12.5 -12t12.5 -13t10 -11.5t10 -13.5t6 -13.5t5.5 -16.5t1.5 -18q0 -38 -28 -68q-3 -3 -16.5 -18t-19 -20.5 t-18.5 -16.5t-22 -15.5t-22 -9t-26 -4.5q-40 0 -68 28l-408 408q-28 28 -28 68q0 13 4.5 26t9 22t15.5 22t16.5 18.5t20.5 19t18 16.5q30 28 68 28q10 0 18 -1.5t16.5 -5.5t13.5 -6t13.5 -10t11.5 -10t13 -12.5t12 -12.5q-14 14 -14 34t14 34l348 348q14 14 34 14t34 -14 q-2 2 -12.5 12t-12.5 13t-10 11.5t-10 13.5t-6 13.5t-5.5 16.5t-1.5 18q0 38 28 68q3 3 16.5 18t19 20.5t18.5 16.5t22 15.5t22 9t26 4.5q40 0 68 -28l408 -408q28 -28 28 -68q0 -13 -4.5 -26t-9 -22t-15.5 -22t-16.5 -18.5t-20.5 -19t-18 -16.5q-30 -28 -68 -28 q-10 0 -18 1.5t-16.5 5.5t-13.5 6t-13.5 10t-11.5 10t-13 12.5t-12 12.5q14 -14 14 -34t-14 -34l-126 -126l256 -256q43 43 96 43q52 0 91 -37l363 -363q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM576 832q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1004 351l101 382q6 26 -7.5 48.5t-38.5 29.5 t-48 -6.5t-30 -39.5l-101 -382q-60 -5 -107 -43.5t-63 -98.5q-20 -77 20 -146t117 -89t146 20t89 117q16 60 -6 117t-72 91zM1664 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 1024q0 53 -37.5 90.5 t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1472 832q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1792 384q0 -261 -141 -483q-19 -29 -54 -29h-1402q-35 0 -54 29 q-141 221 -141 483q0 182 71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1152q-204 0 -381.5 -69.5t-282 -187.5t-104.5 -255q0 -112 71.5 -213.5t201.5 -175.5l87 -50l-27 -96q-24 -91 -70 -172q152 63 275 171l43 38l57 -6q69 -8 130 -8q204 0 381.5 69.5t282 187.5t104.5 255t-104.5 255t-282 187.5t-381.5 69.5zM1792 640 q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22h-5q-15 0 -27 10.5t-16 27.5v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51t27 59t26 76q-157 89 -247.5 220t-90.5 281q0 174 120 321.5 t326 233t450 85.5t450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M704 1152q-153 0 -286 -52t-211.5 -141t-78.5 -191q0 -82 53 -158t149 -132l97 -56l-35 -84q34 20 62 39l44 31l53 -10q78 -14 153 -14q153 0 286 52t211.5 141t78.5 191t-78.5 191t-211.5 141t-286 52zM704 1280q191 0 353.5 -68.5t256.5 -186.5t94 -257t-94 -257 t-256.5 -186.5t-353.5 -68.5q-86 0 -176 16q-124 -88 -278 -128q-36 -9 -86 -16h-3q-11 0 -20.5 8t-11.5 21q-1 3 -1 6.5t0.5 6.5t2 6l2.5 5t3.5 5.5t4 5t4.5 5t4 4.5q5 6 23 25t26 29.5t22.5 29t25 38.5t20.5 44q-124 72 -195 177t-71 224q0 139 94 257t256.5 186.5 t353.5 68.5zM1526 111q10 -24 20.5 -44t25 -38.5t22.5 -29t26 -29.5t23 -25q1 -1 4 -4.5t4.5 -5t4 -5t3.5 -5.5l2.5 -5t2 -6t0.5 -6.5t-1 -6.5q-3 -14 -13 -22t-22 -7q-50 7 -86 16q-154 40 -278 128q-90 -16 -176 -16q-271 0 -472 132q58 -4 88 -4q161 0 309 45t264 129 q125 92 192 212t67 254q0 77 -23 152q129 -71 204 -178t75 -230q0 -120 -71 -224.5t-195 -176.5z" /> +<glyph unicode="" horiz-adv-x="896" d="M885 970q18 -20 7 -44l-540 -1157q-13 -25 -42 -25q-4 0 -14 2q-17 5 -25.5 19t-4.5 30l197 808l-406 -101q-4 -1 -12 -1q-18 0 -31 11q-18 15 -13 39l201 825q4 14 16 23t28 9h328q19 0 32 -12.5t13 -29.5q0 -8 -5 -18l-171 -463l396 98q8 2 12 2q19 0 34 -15z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 288v-320q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192h-512v-192h96q40 0 68 -28t28 -68v-320q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192h-512v-192h96q40 0 68 -28t28 -68v-320 q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192q0 52 38 90t90 38h512v192h-96q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h320q40 0 68 -28t28 -68v-320q0 -40 -28 -68t-68 -28h-96v-192h512q52 0 90 -38t38 -90v-192h96q40 0 68 -28t28 -68 z" /> +<glyph unicode="" horiz-adv-x="1664" d="M896 708v-580q0 -104 -76 -180t-180 -76t-180 76t-76 180q0 26 19 45t45 19t45 -19t19 -45q0 -50 39 -89t89 -39t89 39t39 89v580q33 11 64 11t64 -11zM1664 681q0 -13 -9.5 -22.5t-22.5 -9.5q-11 0 -23 10q-49 46 -93 69t-102 23q-68 0 -128 -37t-103 -97 q-7 -10 -17.5 -28t-14.5 -24q-11 -17 -28 -17q-18 0 -29 17q-4 6 -14.5 24t-17.5 28q-43 60 -102.5 97t-127.5 37t-127.5 -37t-102.5 -97q-7 -10 -17.5 -28t-14.5 -24q-11 -17 -29 -17q-17 0 -28 17q-4 6 -14.5 24t-17.5 28q-43 60 -103 97t-128 37q-58 0 -102 -23t-93 -69 q-12 -10 -23 -10q-13 0 -22.5 9.5t-9.5 22.5q0 5 1 7q45 183 172.5 319.5t298 204.5t360.5 68q140 0 274.5 -40t246.5 -113.5t194.5 -187t115.5 -251.5q1 -2 1 -7zM896 1408v-98q-42 2 -64 2t-64 -2v98q0 26 19 45t45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M768 -128h896v640h-416q-40 0 -68 28t-28 68v416h-384v-1152zM1024 1312v64q0 13 -9.5 22.5t-22.5 9.5h-704q-13 0 -22.5 -9.5t-9.5 -22.5v-64q0 -13 9.5 -22.5t22.5 -9.5h704q13 0 22.5 9.5t9.5 22.5zM1280 640h299l-299 299v-299zM1792 512v-672q0 -40 -28 -68t-68 -28 h-960q-40 0 -68 28t-28 68v160h-544q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1088q40 0 68 -28t28 -68v-328q21 -13 36 -28l408 -408q28 -28 48 -76t20 -88z" /> +<glyph unicode="" horiz-adv-x="1024" d="M736 960q0 -13 -9.5 -22.5t-22.5 -9.5t-22.5 9.5t-9.5 22.5q0 46 -54 71t-106 25q-13 0 -22.5 9.5t-9.5 22.5t9.5 22.5t22.5 9.5q50 0 99.5 -16t87 -54t37.5 -90zM896 960q0 72 -34.5 134t-90 101.5t-123 62t-136.5 22.5t-136.5 -22.5t-123 -62t-90 -101.5t-34.5 -134 q0 -101 68 -180q10 -11 30.5 -33t30.5 -33q128 -153 141 -298h228q13 145 141 298q10 11 30.5 33t30.5 33q68 79 68 180zM1024 960q0 -155 -103 -268q-45 -49 -74.5 -87t-59.5 -95.5t-34 -107.5q47 -28 47 -82q0 -37 -25 -64q25 -27 25 -64q0 -52 -45 -81q13 -23 13 -47 q0 -46 -31.5 -71t-77.5 -25q-20 -44 -60 -70t-87 -26t-87 26t-60 70q-46 0 -77.5 25t-31.5 71q0 24 13 47q-45 29 -45 81q0 37 25 64q-25 27 -25 64q0 54 47 82q-4 50 -34 107.5t-59.5 95.5t-74.5 87q-103 113 -103 268q0 99 44.5 184.5t117 142t164 89t186.5 32.5 t186.5 -32.5t164 -89t117 -142t44.5 -184.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 352v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5q-12 0 -24 10l-319 320q-9 9 -9 22q0 14 9 23l320 320q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5v-192h1376q13 0 22.5 -9.5t9.5 -22.5zM1792 896q0 -14 -9 -23l-320 -320q-9 -9 -23 -9 q-13 0 -22.5 9.5t-9.5 22.5v192h-1376q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1376v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 608q0 14 -9 23t-23 9h-224v352q0 13 -9.5 22.5t-22.5 9.5h-192q-13 0 -22.5 -9.5t-9.5 -22.5v-352h-224q-13 0 -22.5 -9.5t-9.5 -22.5q0 -14 9 -23l352 -352q9 -9 23 -9t23 9l351 351q10 12 10 24zM1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088 q-185 0 -316.5 131.5t-131.5 316.5q0 130 70 240t188 165q-2 30 -2 43q0 212 150 362t362 150q156 0 285.5 -87t188.5 -231q71 62 166 62q106 0 181 -75t75 -181q0 -76 -41 -138q130 -31 213.5 -135.5t83.5 -238.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 672q0 14 -9 23l-352 352q-9 9 -23 9t-23 -9l-351 -351q-10 -12 -10 -24q0 -14 9 -23t23 -9h224v-352q0 -13 9.5 -22.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 22.5v352h224q13 0 22.5 9.5t9.5 22.5zM1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088 q-185 0 -316.5 131.5t-131.5 316.5q0 130 70 240t188 165q-2 30 -2 43q0 212 150 362t362 150q156 0 285.5 -87t188.5 -231q71 62 166 62q106 0 181 -75t75 -181q0 -76 -41 -138q130 -31 213.5 -135.5t83.5 -238.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 192q0 -26 -19 -45t-45 -19t-45 19t-19 45t19 45t45 19t45 -19t19 -45zM1408 131q0 -121 -73 -190t-194 -69h-874q-121 0 -194 69t-73 190q0 68 5.5 131t24 138t47.5 132.5t81 103t120 60.5q-22 -52 -22 -120v-203q-58 -20 -93 -70t-35 -111q0 -80 56 -136t136 -56 t136 56t56 136q0 61 -35.5 111t-92.5 70v203q0 62 25 93q132 -104 295 -104t295 104q25 -31 25 -93v-64q-106 0 -181 -75t-75 -181v-89q-32 -29 -32 -71q0 -40 28 -68t68 -28t68 28t28 68q0 42 -32 71v89q0 52 38 90t90 38t90 -38t38 -90v-89q-32 -29 -32 -71q0 -40 28 -68 t68 -28t68 28t28 68q0 42 -32 71v89q0 68 -34.5 127.5t-93.5 93.5q0 10 0.5 42.5t0 48t-2.5 41.5t-7 47t-13 40q68 -15 120 -60.5t81 -103t47.5 -132.5t24 -138t5.5 -131zM1088 1024q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5 t271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1280 832q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 832q0 -62 -35.5 -111t-92.5 -70v-395q0 -159 -131.5 -271.5t-316.5 -112.5t-316.5 112.5t-131.5 271.5v132q-164 20 -274 128t-110 252v512q0 26 19 45t45 19q6 0 16 -2q17 30 47 48 t65 18q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5q-33 0 -64 18v-402q0 -106 94 -181t226 -75t226 75t94 181v402q-31 -18 -64 -18q-53 0 -90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5q35 0 65 -18t47 -48q10 2 16 2q26 0 45 -19t19 -45v-512q0 -144 -110 -252 t-274 -128v-132q0 -106 94 -181t226 -75t226 75t94 181v395q-57 21 -92.5 70t-35.5 111q0 80 56 136t136 56t136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1152h512v128h-512v-128zM288 1152v-1280h-64q-92 0 -158 66t-66 158v832q0 92 66 158t158 66h64zM1408 1152v-1280h-1024v1280h128v160q0 40 28 68t68 28h576q40 0 68 -28t28 -68v-160h128zM1792 928v-832q0 -92 -66 -158t-158 -66h-64v1280h64q92 0 158 -66 t66 -158z" /> +<glyph unicode="" horiz-adv-x="1792" d="M912 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM1728 128q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-181 75t-75 181h-448q-52 0 -90 38t-38 90q50 42 91 88t85 119.5t74.5 158.5 t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q190 -28 307 -158.5t117 -282.5q0 -139 19.5 -260t50 -206t74.5 -158.5t85 -119.5t91 -88z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1664 896q0 80 -56 136t-136 56h-64v-384h64q80 0 136 56t56 136zM0 128h1792q0 -106 -75 -181t-181 -75h-1280q-106 0 -181 75t-75 181zM1856 896q0 -159 -112.5 -271.5t-271.5 -112.5h-64v-32q0 -92 -66 -158t-158 -66h-704q-92 0 -158 66t-66 158v736q0 26 19 45 t45 19h1152q159 0 271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M640 1472v-640q0 -61 -35.5 -111t-92.5 -70v-779q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v779q-57 20 -92.5 70t-35.5 111v640q0 26 19 45t45 19t45 -19t19 -45v-416q0 -26 19 -45t45 -19t45 19t19 45v416q0 26 19 45t45 19t45 -19t19 -45v-416q0 -26 19 -45 t45 -19t45 19t19 45v416q0 26 19 45t45 19t45 -19t19 -45zM1408 1472v-1600q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v512h-224q-13 0 -22.5 9.5t-9.5 22.5v800q0 132 94 226t226 94h256q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M384 736q0 14 9 23t23 9h704q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-14 0 -23 9t-9 23v64zM1120 512q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h704zM1120 256q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704 q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h704z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 -128h384v1536h-1152v-1536h384v224q0 13 9.5 22.5t22.5 9.5h320q13 0 22.5 -9.5t9.5 -22.5v-224zM1408 1472v-1664q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h1280q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 -128h384v1152h-256v-32q0 -40 -28 -68t-68 -28h-448q-40 0 -68 28t-28 68v32h-256v-1152h384v224q0 13 9.5 22.5t22.5 9.5h320q13 0 22.5 -9.5t9.5 -22.5v-224zM896 1056v320q0 13 -9.5 22.5t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-96h-128v96q0 13 -9.5 22.5 t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5v96h128v-96q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1408 1088v-1280q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1280q0 26 19 45t45 19h320 v288q0 40 28 68t68 28h448q40 0 68 -28t28 -68v-288h320q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1920" d="M640 128q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM256 640h384v256h-158q-14 -2 -22 -9l-195 -195q-7 -12 -9 -22v-30zM1536 128q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5zM1664 800v192q0 14 -9 23t-23 9h-224v224q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-224h-224q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h224v-224q0 -14 9 -23t23 -9h192q14 0 23 9t9 23v224h224q14 0 23 9t9 23zM1920 1344v-1152 q0 -26 -19 -45t-45 -19h-192q0 -106 -75 -181t-181 -75t-181 75t-75 181h-384q0 -106 -75 -181t-181 -75t-181 75t-75 181h-128q-26 0 -45 19t-19 45t19 45t45 19v416q0 26 13 58t32 51l198 198q19 19 51 32t58 13h160v320q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 416v192q0 14 -9 23t-23 9h-224v224q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-224h-224q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h224v-224q0 -14 9 -23t23 -9h192q14 0 23 9t9 23v224h224q14 0 23 9t9 23zM640 1152h512v128h-512v-128zM256 1152v-1280h-32 q-92 0 -158 66t-66 158v832q0 92 66 158t158 66h32zM1440 1152v-1280h-1088v1280h160v160q0 40 28 68t68 28h576q40 0 68 -28t28 -68v-160h160zM1792 928v-832q0 -92 -66 -158t-158 -66h-32v1280h32q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1920 576q-1 -32 -288 -96l-352 -32l-224 -64h-64l-293 -352h69q26 0 45 -4.5t19 -11.5t-19 -11.5t-45 -4.5h-96h-160h-64v32h64v416h-160l-192 -224h-96l-32 32v192h32v32h128v8l-192 24v128l192 24v8h-128v32h-32v192l32 32h96l192 -224h160v416h-64v32h64h160h96 q26 0 45 -4.5t19 -11.5t-19 -11.5t-45 -4.5h-69l293 -352h64l224 -64l352 -32q261 -58 287 -93z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 640v384h-256v-256q0 -53 37.5 -90.5t90.5 -37.5h128zM1664 192v-192h-1152v192l128 192h-128q-159 0 -271.5 112.5t-112.5 271.5v320l-64 64l32 128h480l32 128h960l32 -192l-64 -32v-800z" /> +<glyph unicode="" d="M1280 192v896q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-320h-512v320q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-896q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v320h512v-320q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-320v320q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-320h-320q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h320v-320q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v320h320q26 0 45 19t19 45zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M627 160q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23zM1011 160q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23 t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M595 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23zM979 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23 l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 224q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23zM1075 608q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393 q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 672q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23zM1075 1056q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23 t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="640" d="M627 992q0 -13 -10 -23l-393 -393l393 -393q10 -10 10 -23t-10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="640" d="M595 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 352q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 800q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1792 544v832q0 13 -9.5 22.5t-22.5 9.5h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-832q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5zM1920 1376v-1088q0 -66 -47 -113t-113 -47h-544q0 -37 16 -77.5t32 -71t16 -43.5q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19 t-19 45q0 14 16 44t32 70t16 78h-544q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1920" d="M416 256q-66 0 -113 47t-47 113v704q0 66 47 113t113 47h1088q66 0 113 -47t47 -113v-704q0 -66 -47 -113t-113 -47h-1088zM384 1120v-704q0 -13 9.5 -22.5t22.5 -9.5h1088q13 0 22.5 9.5t9.5 22.5v704q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5z M1760 192h160v-96q0 -40 -47 -68t-113 -28h-1600q-66 0 -113 28t-47 68v96h160h1600zM1040 96q16 0 16 16t-16 16h-160q-16 0 -16 -16t16 -16h160z" /> +<glyph unicode="" horiz-adv-x="1152" d="M640 128q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1024 288v960q0 13 -9.5 22.5t-22.5 9.5h-832q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h832q13 0 22.5 9.5t9.5 22.5zM1152 1248v-1088q0 -66 -47 -113t-113 -47h-832 q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h832q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="768" d="M464 128q0 33 -23.5 56.5t-56.5 23.5t-56.5 -23.5t-23.5 -56.5t23.5 -56.5t56.5 -23.5t56.5 23.5t23.5 56.5zM672 288v704q0 13 -9.5 22.5t-22.5 9.5h-512q-13 0 -22.5 -9.5t-9.5 -22.5v-704q0 -13 9.5 -22.5t22.5 -9.5h512q13 0 22.5 9.5t9.5 22.5zM480 1136 q0 16 -16 16h-160q-16 0 -16 -16t16 -16h160q16 0 16 16zM768 1152v-1024q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v1024q0 52 38 90t90 38h512q52 0 90 -38t38 -90z" /> +<glyph unicode="" d="M768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103 t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 576v-384q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v704q0 104 40.5 198.5t109.5 163.5t163.5 109.5t198.5 40.5h64q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-64q-106 0 -181 -75t-75 -181v-32q0 -40 28 -68t68 -28h224q80 0 136 -56t56 -136z M1664 576v-384q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v704q0 104 40.5 198.5t109.5 163.5t163.5 109.5t198.5 40.5h64q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-64q-106 0 -181 -75t-75 -181v-32q0 -40 28 -68t68 -28h224q80 0 136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 1216v-704q0 -104 -40.5 -198.5t-109.5 -163.5t-163.5 -109.5t-198.5 -40.5h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64q106 0 181 75t75 181v32q0 40 -28 68t-68 28h-224q-80 0 -136 56t-56 136v384q0 80 56 136t136 56h384q80 0 136 -56t56 -136zM1664 1216 v-704q0 -104 -40.5 -198.5t-109.5 -163.5t-163.5 -109.5t-198.5 -40.5h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64q106 0 181 75t75 181v32q0 40 -28 68t-68 28h-224q-80 0 -136 56t-56 136v384q0 80 56 136t136 56h384q80 0 136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1792" d="M526 142q0 -53 -37.5 -90.5t-90.5 -37.5q-52 0 -90 38t-38 90q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1024 -64q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM320 640q0 -53 -37.5 -90.5t-90.5 -37.5 t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1522 142q0 -52 -38 -90t-90 -38q-53 0 -90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM558 1138q0 -66 -47 -113t-113 -47t-113 47t-47 113t47 113t113 47t113 -47t47 -113z M1728 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1088 1344q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1618 1138q0 -93 -66 -158.5t-158 -65.5q-93 0 -158.5 65.5t-65.5 158.5 q0 92 65.5 158t158.5 66q92 0 158 -66t66 -158z" /> +<glyph unicode="" d="M1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 416q0 -166 -127 -451q-3 -7 -10.5 -24t-13.5 -30t-13 -22q-12 -17 -28 -17q-15 0 -23.5 10t-8.5 25q0 9 2.5 26.5t2.5 23.5q5 68 5 123q0 101 -17.5 181t-48.5 138.5t-80 101t-105.5 69.5t-133 42.5t-154 21.5t-175.5 6h-224v-256q0 -26 -19 -45t-45 -19t-45 19 l-512 512q-19 19 -19 45t19 45l512 512q19 19 45 19t45 -19t19 -45v-256h224q713 0 875 -403q53 -134 53 -333z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 320q0 -40 -12.5 -82t-43 -76t-72.5 -34t-72.5 34t-43 76t-12.5 82t12.5 82t43 76t72.5 34t72.5 -34t43 -76t12.5 -82zM1280 320q0 -40 -12.5 -82t-43 -76t-72.5 -34t-72.5 34t-43 76t-12.5 82t12.5 82t43 76t72.5 34t72.5 -34t43 -76t12.5 -82zM1440 320 q0 120 -69 204t-187 84q-41 0 -195 -21q-71 -11 -157 -11t-157 11q-152 21 -195 21q-118 0 -187 -84t-69 -204q0 -88 32 -153.5t81 -103t122 -60t140 -29.5t149 -7h168q82 0 149 7t140 29.5t122 60t81 103t32 153.5zM1664 496q0 -207 -61 -331q-38 -77 -105.5 -133t-141 -86 t-170 -47.5t-171.5 -22t-167 -4.5q-78 0 -142 3t-147.5 12.5t-152.5 30t-137 51.5t-121 81t-86 115q-62 123 -62 331q0 237 136 396q-27 82 -27 170q0 116 51 218q108 0 190 -39.5t189 -123.5q147 35 309 35q148 0 280 -32q105 82 187 121t189 39q51 -102 51 -218 q0 -87 -27 -168q136 -160 136 -398z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1536 224v704q0 40 -28 68t-68 28h-704q-40 0 -68 28t-28 68v64q0 40 -28 68t-68 28h-320q-40 0 -68 -28t-28 -68v-960q0 -40 28 -68t68 -28h1216q40 0 68 28t28 68zM1664 928v-704q0 -92 -66 -158t-158 -66h-1216q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320 q92 0 158 -66t66 -158v-32h672q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1781 605q0 35 -53 35h-1088q-40 0 -85.5 -21.5t-71.5 -52.5l-294 -363q-18 -24 -18 -40q0 -35 53 -35h1088q40 0 86 22t71 53l294 363q18 22 18 39zM640 768h768v160q0 40 -28 68t-68 28h-576q-40 0 -68 28t-28 68v64q0 40 -28 68t-68 28h-320q-40 0 -68 -28t-28 -68 v-853l256 315q44 53 116 87.5t140 34.5zM1909 605q0 -62 -46 -120l-295 -363q-43 -53 -116 -87.5t-140 -34.5h-1088q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h544q92 0 158 -66t66 -158v-160h192q54 0 99 -24.5t67 -70.5q15 -32 15 -68z " /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" d="M1134 461q-37 -121 -138 -195t-228 -74t-228 74t-138 195q-8 25 4 48.5t38 31.5q25 8 48.5 -4t31.5 -38q25 -80 92.5 -129.5t151.5 -49.5t151.5 49.5t92.5 129.5q8 26 32 38t49 4t37 -31.5t4 -48.5zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5 t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1134 307q8 -25 -4 -48.5t-37 -31.5t-49 4t-32 38q-25 80 -92.5 129.5t-151.5 49.5t-151.5 -49.5t-92.5 -129.5q-8 -26 -31.5 -38t-48.5 -4q-26 8 -38 31.5t-4 48.5q37 121 138 195t228 74t228 -74t138 -195zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204 t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1152 448q0 -26 -19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h640q26 0 45 -19t19 -45zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M832 448v128q0 14 -9 23t-23 9h-192v192q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-192h-192q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h192v-192q0 -14 9 -23t23 -9h128q14 0 23 9t9 23v192h192q14 0 23 9t9 23zM1408 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1920 512q0 -212 -150 -362t-362 -150q-192 0 -338 128h-220q-146 -128 -338 -128q-212 0 -362 150 t-150 362t150 362t362 150h896q212 0 362 -150t150 -362z" /> +<glyph unicode="" horiz-adv-x="1920" d="M384 368v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM512 624v-96q0 -16 -16 -16h-224q-16 0 -16 16v96q0 16 16 16h224q16 0 16 -16zM384 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1408 368v-96q0 -16 -16 -16 h-864q-16 0 -16 16v96q0 16 16 16h864q16 0 16 -16zM768 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM640 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1024 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16 h96q16 0 16 -16zM896 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1280 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1664 368v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1152 880v-96 q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1408 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1664 880v-352q0 -16 -16 -16h-224q-16 0 -16 16v96q0 16 16 16h112v240q0 16 16 16h96q16 0 16 -16zM1792 128v896h-1664v-896 h1664zM1920 1024v-896q0 -53 -37.5 -90.5t-90.5 -37.5h-1664q-53 0 -90.5 37.5t-37.5 90.5v896q0 53 37.5 90.5t90.5 37.5h1664q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 491v616q-169 -91 -306 -91q-82 0 -145 32q-100 49 -184 76.5t-178 27.5q-173 0 -403 -127v-599q245 113 433 113q55 0 103.5 -7.5t98 -26t77 -31t82.5 -39.5l28 -14q44 -22 101 -22q120 0 293 92zM320 1280q0 -35 -17.5 -64t-46.5 -46v-1266q0 -14 -9 -23t-23 -9 h-64q-14 0 -23 9t-9 23v1266q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -39 -35 -57q-10 -5 -17 -9q-218 -116 -369 -116q-88 0 -158 35l-28 14q-64 33 -99 48t-91 29t-114 14q-102 0 -235.5 -44t-228.5 -102 q-15 -9 -33 -9q-16 0 -32 8q-32 19 -32 56v742q0 35 31 55q35 21 78.5 42.5t114 52t152.5 49.5t155 19q112 0 209 -31t209 -86q38 -19 89 -19q122 0 310 112q22 12 31 17q31 16 62 -2q31 -20 31 -55z" /> +<glyph unicode="" horiz-adv-x="1792" d="M832 536v192q-181 -16 -384 -117v-185q205 96 384 110zM832 954v197q-172 -8 -384 -126v-189q215 111 384 118zM1664 491v184q-235 -116 -384 -71v224q-20 6 -39 15q-5 3 -33 17t-34.5 17t-31.5 15t-34.5 15.5t-32.5 13t-36 12.5t-35 8.5t-39.5 7.5t-39.5 4t-44 2 q-23 0 -49 -3v-222h19q102 0 192.5 -29t197.5 -82q19 -9 39 -15v-188q42 -17 91 -17q120 0 293 92zM1664 918v189q-169 -91 -306 -91q-45 0 -78 8v-196q148 -42 384 90zM320 1280q0 -35 -17.5 -64t-46.5 -46v-1266q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v1266 q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -39 -35 -57q-10 -5 -17 -9q-218 -116 -369 -116q-88 0 -158 35l-28 14q-64 33 -99 48t-91 29t-114 14q-102 0 -235.5 -44t-228.5 -102q-15 -9 -33 -9q-16 0 -32 8 q-32 19 -32 56v742q0 35 31 55q35 21 78.5 42.5t114 52t152.5 49.5t155 19q112 0 209 -31t209 -86q38 -19 89 -19q122 0 310 112q22 12 31 17q31 16 62 -2q31 -20 31 -55z" /> +<glyph unicode="" horiz-adv-x="1664" d="M585 553l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23t-10 -23zM1664 96v-64q0 -14 -9 -23t-23 -9h-960q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h960q14 0 23 -9 t9 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M617 137l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23t-10 -23zM1208 1204l-373 -1291q-4 -13 -15.5 -19.5t-23.5 -2.5l-62 17q-13 4 -19.5 15.5t-2.5 24.5 l373 1291q4 13 15.5 19.5t23.5 2.5l62 -17q13 -4 19.5 -15.5t2.5 -24.5zM1865 553l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23t-10 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 454v-70q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-512 512q-19 19 -19 45t19 45l512 512q29 31 70 14q39 -17 39 -59v-69l-397 -398q-19 -19 -19 -45t19 -45zM1792 416q0 -58 -17 -133.5t-38.5 -138t-48 -125t-40.5 -90.5l-20 -40q-8 -17 -28 -17q-6 0 -9 1 q-25 8 -23 34q43 400 -106 565q-64 71 -170.5 110.5t-267.5 52.5v-251q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-512 512q-19 19 -19 45t19 45l512 512q29 31 70 14q39 -17 39 -59v-262q411 -28 599 -221q169 -173 169 -509z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1186 579l257 250l-356 52l-66 10l-30 60l-159 322v-963l59 -31l318 -168l-60 355l-12 66zM1638 841l-363 -354l86 -500q5 -33 -6 -51.5t-34 -18.5q-17 0 -40 12l-449 236l-449 -236q-23 -12 -40 -12q-23 0 -34 18.5t-6 51.5l86 500l-364 354q-32 32 -23 59.5t54 34.5 l502 73l225 455q20 41 49 41q28 0 49 -41l225 -455l502 -73q45 -7 54 -34.5t-24 -59.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1401 1187l-640 -1280q-17 -35 -57 -35q-5 0 -15 2q-22 5 -35.5 22.5t-13.5 39.5v576h-576q-22 0 -39.5 13.5t-22.5 35.5t4 42t29 30l1280 640q13 7 29 7q27 0 45 -19q15 -14 18.5 -34.5t-6.5 -39.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M557 256h595v595zM512 301l595 595h-595v-595zM1664 224v-192q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v224h-864q-14 0 -23 9t-9 23v864h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224v224q0 14 9 23t23 9h192q14 0 23 -9t9 -23 v-224h851l246 247q10 9 23 9t23 -9q9 -10 9 -23t-9 -23l-247 -246v-851h224q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M288 64q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM288 1216q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM928 1088q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1024 1088q0 -52 -26 -96.5t-70 -69.5 q-2 -287 -226 -414q-68 -38 -203 -81q-128 -40 -169.5 -71t-41.5 -100v-26q44 -25 70 -69.5t26 -96.5q0 -80 -56 -136t-136 -56t-136 56t-56 136q0 52 26 96.5t70 69.5v820q-44 25 -70 69.5t-26 96.5q0 80 56 136t136 56t136 -56t56 -136q0 -52 -26 -96.5t-70 -69.5v-497 q54 26 154 57q55 17 87.5 29.5t70.5 31t59 39.5t40.5 51t28 69.5t8.5 91.5q-44 25 -70 69.5t-26 96.5q0 80 56 136t136 56t136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1664" d="M439 265l-256 -256q-10 -9 -23 -9q-12 0 -23 9q-9 10 -9 23t9 23l256 256q10 9 23 9t23 -9q9 -10 9 -23t-9 -23zM608 224v-320q0 -14 -9 -23t-23 -9t-23 9t-9 23v320q0 14 9 23t23 9t23 -9t9 -23zM384 448q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9t-9 23t9 23t23 9h320 q14 0 23 -9t9 -23zM1648 320q0 -120 -85 -203l-147 -146q-83 -83 -203 -83q-121 0 -204 85l-334 335q-21 21 -42 56l239 18l273 -274q27 -27 68 -27.5t68 26.5l147 146q28 28 28 67q0 40 -28 68l-274 275l18 239q35 -21 56 -42l336 -336q84 -86 84 -204zM1031 1044l-239 -18 l-273 274q-28 28 -68 28q-39 0 -68 -27l-147 -146q-28 -28 -28 -67q0 -40 28 -68l274 -274l-18 -240q-35 21 -56 42l-336 336q-84 86 -84 204q0 120 85 203l147 146q83 83 203 83q121 0 204 -85l334 -335q21 -21 42 -56zM1664 960q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9 t-9 23t9 23t23 9h320q14 0 23 -9t9 -23zM1120 1504v-320q0 -14 -9 -23t-23 -9t-23 9t-9 23v320q0 14 9 23t23 9t23 -9t9 -23zM1527 1353l-256 -256q-11 -9 -23 -9t-23 9q-9 10 -9 23t9 23l256 256q10 9 23 9t23 -9q9 -10 9 -23t-9 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M704 280v-240q0 -16 -12 -28t-28 -12h-240q-16 0 -28 12t-12 28v240q0 16 12 28t28 12h240q16 0 28 -12t12 -28zM1020 880q0 -54 -15.5 -101t-35 -76.5t-55 -59.5t-57.5 -43.5t-61 -35.5q-41 -23 -68.5 -65t-27.5 -67q0 -17 -12 -32.5t-28 -15.5h-240q-15 0 -25.5 18.5 t-10.5 37.5v45q0 83 65 156.5t143 108.5q59 27 84 56t25 76q0 42 -46.5 74t-107.5 32q-65 0 -108 -29q-35 -25 -107 -115q-13 -16 -31 -16q-12 0 -25 8l-164 125q-13 10 -15.5 25t5.5 28q160 266 464 266q80 0 161 -31t146 -83t106 -127.5t41 -158.5z" /> +<glyph unicode="" horiz-adv-x="640" d="M640 192v-128q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64v384h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h384q26 0 45 -19t19 -45v-576h64q26 0 45 -19t19 -45zM512 1344v-192q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v192 q0 26 19 45t45 19h256q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M512 288v-224q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v224q0 26 19 45t45 19h256q26 0 45 -19t19 -45zM542 1344l-28 -768q-1 -26 -20.5 -45t-45.5 -19h-256q-26 0 -45.5 19t-20.5 45l-28 768q-1 26 17.5 45t44.5 19h320q26 0 44.5 -19t17.5 -45z" /> +<glyph unicode="" d="M897 167v-167h-248l-159 252l-24 42q-8 9 -11 21h-3l-9 -21q-10 -20 -25 -44l-155 -250h-258v167h128l197 291l-185 272h-137v168h276l139 -228q2 -4 23 -42q8 -9 11 -21h3q3 9 11 21l25 42l140 228h257v-168h-125l-184 -267l204 -296h109zM1534 846v-206h-514l-3 27 q-4 28 -4 46q0 64 26 117t65 86.5t84 65t84 54.5t65 54t26 64q0 38 -29.5 62.5t-70.5 24.5q-51 0 -97 -39q-14 -11 -36 -38l-105 92q26 37 63 66q83 65 188 65q110 0 178 -59.5t68 -158.5q0 -56 -24.5 -103t-62 -76.5t-81.5 -58.5t-82 -50.5t-65.5 -51.5t-30.5 -63h232v80 h126z" /> +<glyph unicode="" d="M897 167v-167h-248l-159 252l-24 42q-8 9 -11 21h-3l-9 -21q-10 -20 -25 -44l-155 -250h-258v167h128l197 291l-185 272h-137v168h276l139 -228q2 -4 23 -42q8 -9 11 -21h3q3 9 11 21l25 42l140 228h257v-168h-125l-184 -267l204 -296h109zM1536 -50v-206h-514l-4 27 q-3 45 -3 46q0 64 26 117t65 86.5t84 65t84 54.5t65 54t26 64q0 38 -29.5 62.5t-70.5 24.5q-51 0 -97 -39q-14 -11 -36 -38l-105 92q26 37 63 66q80 65 188 65q110 0 178 -59.5t68 -158.5q0 -66 -34.5 -118.5t-84 -86t-99.5 -62.5t-87 -63t-41 -73h232v80h126z" /> +<glyph unicode="" horiz-adv-x="1920" d="M896 128l336 384h-768l-336 -384h768zM1909 1205q15 -34 9.5 -71.5t-30.5 -65.5l-896 -1024q-38 -44 -96 -44h-768q-38 0 -69.5 20.5t-47.5 54.5q-15 34 -9.5 71.5t30.5 65.5l896 1024q38 44 96 44h768q38 0 69.5 -20.5t47.5 -54.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 438q0 -81 -44.5 -135t-123.5 -54q-41 0 -77.5 17.5t-59 38t-56.5 38t-71 17.5q-110 0 -110 -124q0 -39 16 -115t15 -115v-5q-22 0 -33 -1q-34 -3 -97.5 -11.5t-115.5 -13.5t-98 -5q-61 0 -103 26.5t-42 83.5q0 37 17.5 71t38 56.5t38 59t17.5 77.5q0 79 -54 123.5 t-135 44.5q-84 0 -143 -45.5t-59 -127.5q0 -43 15 -83t33.5 -64.5t33.5 -53t15 -50.5q0 -45 -46 -89q-37 -35 -117 -35q-95 0 -245 24q-9 2 -27.5 4t-27.5 4l-13 2q-1 0 -3 1q-2 0 -2 1v1024q2 -1 17.5 -3.5t34 -5t21.5 -3.5q150 -24 245 -24q80 0 117 35q46 44 46 89 q0 22 -15 50.5t-33.5 53t-33.5 64.5t-15 83q0 82 59 127.5t144 45.5q80 0 134 -44.5t54 -123.5q0 -41 -17.5 -77.5t-38 -59t-38 -56.5t-17.5 -71q0 -57 42 -83.5t103 -26.5q64 0 180 15t163 17v-2q-1 -2 -3.5 -17.5t-5 -34t-3.5 -21.5q-24 -150 -24 -245q0 -80 35 -117 q44 -46 89 -46q22 0 50.5 15t53 33.5t64.5 33.5t83 15q82 0 127.5 -59t45.5 -143z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1152 832v-128q0 -221 -147.5 -384.5t-364.5 -187.5v-132h256q26 0 45 -19t19 -45t-19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h256v132q-217 24 -364.5 187.5t-147.5 384.5v128q0 26 19 45t45 19t45 -19t19 -45v-128q0 -185 131.5 -316.5t316.5 -131.5 t316.5 131.5t131.5 316.5v128q0 26 19 45t45 19t45 -19t19 -45zM896 1216v-512q0 -132 -94 -226t-226 -94t-226 94t-94 226v512q0 132 94 226t226 94t226 -94t94 -226z" /> +<glyph unicode="" horiz-adv-x="1408" d="M271 591l-101 -101q-42 103 -42 214v128q0 26 19 45t45 19t45 -19t19 -45v-128q0 -53 15 -113zM1385 1193l-361 -361v-128q0 -132 -94 -226t-226 -94q-55 0 -109 19l-96 -96q97 -51 205 -51q185 0 316.5 131.5t131.5 316.5v128q0 26 19 45t45 19t45 -19t19 -45v-128 q0 -221 -147.5 -384.5t-364.5 -187.5v-132h256q26 0 45 -19t19 -45t-19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h256v132q-125 13 -235 81l-254 -254q-10 -10 -23 -10t-23 10l-82 82q-10 10 -10 23t10 23l1234 1234q10 10 23 10t23 -10l82 -82q10 -10 10 -23 t-10 -23zM1005 1325l-621 -621v512q0 132 94 226t226 94q102 0 184.5 -59t116.5 -152z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1088 576v640h-448v-1137q119 63 213 137q235 184 235 360zM1280 1344v-768q0 -86 -33.5 -170.5t-83 -150t-118 -127.5t-126.5 -103t-121 -77.5t-89.5 -49.5t-42.5 -20q-12 -6 -26 -6t-26 6q-16 7 -42.5 20t-89.5 49.5t-121 77.5t-126.5 103t-118 127.5t-83 150 t-33.5 170.5v768q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280 q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 1344q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 1376v-320q0 -16 -12 -25q-8 -7 -20 -7q-4 0 -7 1l-448 96q-11 2 -18 11t-7 20h-256v-102q111 -23 183.5 -111t72.5 -203v-800q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v800 q0 106 62.5 190.5t161.5 114.5v111h-32q-59 0 -115 -23.5t-91.5 -53t-66 -66.5t-40.5 -53.5t-14 -24.5q-17 -35 -57 -35q-16 0 -29 7q-23 12 -31.5 37t3.5 49q5 10 14.5 26t37.5 53.5t60.5 70t85 67t108.5 52.5q-25 42 -25 86q0 66 47 113t113 47t113 -47t47 -113 q0 -33 -14 -64h302q0 11 7 20t18 11l448 96q3 1 7 1q12 0 20 -7q12 -9 12 -25z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1440 1088q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1664 1376q0 -249 -75.5 -430.5t-253.5 -360.5q-81 -80 -195 -176l-20 -379q-2 -16 -16 -26l-384 -224q-7 -4 -16 -4q-12 0 -23 9l-64 64q-13 14 -8 32l85 276l-281 281l-276 -85q-3 -1 -9 -1 q-14 0 -23 9l-64 64q-17 19 -5 39l224 384q10 14 26 16l379 20q96 114 176 195q188 187 358 258t431 71q14 0 24 -9.5t10 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1745 763l-164 -763h-334l178 832q13 56 -15 88q-27 33 -83 33h-169l-204 -953h-334l204 953h-286l-204 -953h-334l204 953l-153 327h1276q101 0 189.5 -40.5t147.5 -113.5q60 -73 81 -168.5t0 -194.5z" /> +<glyph unicode="" d="M909 141l102 102q19 19 19 45t-19 45l-307 307l307 307q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-454 -454q-19 -19 -19 -45t19 -45l454 -454q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M717 141l454 454q19 19 19 45t-19 45l-454 454q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l307 -307l-307 -307q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1165 397l102 102q19 19 19 45t-19 45l-454 454q-19 19 -45 19t-45 -19l-454 -454q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19l307 307l307 -307q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M813 237l454 454q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-307 -307l-307 307q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l454 -454q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1130 939l16 175h-884l47 -534h612l-22 -228l-197 -53l-196 53l-13 140h-175l22 -278l362 -100h4v1l359 99l50 544h-644l-15 181h674zM0 1408h1408l-128 -1438l-578 -162l-574 162z" /> +<glyph unicode="" horiz-adv-x="1792" d="M275 1408h1505l-266 -1333l-804 -267l-698 267l71 356h297l-29 -147l422 -161l486 161l68 339h-1208l58 297h1209l38 191h-1208z" /> +<glyph unicode="" horiz-adv-x="1792" d="M960 1280q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1792 352v-352q0 -22 -20 -30q-8 -2 -12 -2q-13 0 -23 9l-93 93q-119 -143 -318.5 -226.5t-429.5 -83.5t-429.5 83.5t-318.5 226.5l-93 -93q-9 -9 -23 -9q-4 0 -12 2q-20 8 -20 30v352 q0 14 9 23t23 9h352q22 0 30 -20q8 -19 -7 -35l-100 -100q67 -91 189.5 -153.5t271.5 -82.5v647h-192q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h192v163q-58 34 -93 92.5t-35 128.5q0 106 75 181t181 75t181 -75t75 -181q0 -70 -35 -128.5t-93 -92.5v-163h192q26 0 45 -19 t19 -45v-128q0 -26 -19 -45t-45 -19h-192v-647q149 20 271.5 82.5t189.5 153.5l-100 100q-15 16 -7 35q8 20 30 20h352q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1056 768q40 0 68 -28t28 -68v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h32v320q0 185 131.5 316.5t316.5 131.5t316.5 -131.5t131.5 -316.5q0 -26 -19 -45t-45 -19h-64q-26 0 -45 19t-19 45q0 106 -75 181t-181 75t-181 -75t-75 -181 v-320h736z" /> +<glyph unicode="" d="M1024 640q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM1152 640q0 159 -112.5 271.5t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5zM1280 640q0 -212 -150 -362t-362 -150t-362 150 t-150 362t150 362t362 150t362 -150t150 -362zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM896 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM1408 800v-192q0 -40 -28 -68t-68 -28h-192 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="384" d="M384 288v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM384 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM384 1312v-192q0 -40 -28 -68t-68 -28h-192 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68z" /> +<glyph unicode="" d="M512 256q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM863 162q-13 232 -177 396t-396 177q-14 1 -24 -9t-10 -23v-128q0 -13 8.5 -22t21.5 -10q154 -11 264 -121t121 -264q1 -13 10 -21.5t22 -8.5h128q13 0 23 10 t9 24zM1247 161q-5 154 -56 297.5t-139.5 260t-205 205t-260 139.5t-297.5 56q-14 1 -23 -9q-10 -10 -10 -23v-128q0 -13 9 -22t22 -10q204 -7 378 -111.5t278.5 -278.5t111.5 -378q1 -13 10 -22t22 -9h128q13 0 23 10q11 9 9 23zM1536 1120v-960q0 -119 -84.5 -203.5 t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM1152 585q32 18 32 55t-32 55l-544 320q-31 19 -64 1q-32 -19 -32 -56v-640q0 -37 32 -56 q16 -8 32 -8q17 0 32 9z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 1084l316 -316l-572 -572l-316 316zM813 105l618 618q19 19 19 45t-19 45l-362 362q-18 18 -45 18t-45 -18l-618 -618q-19 -19 -19 -45t19 -45l362 -362q18 -18 45 -18t45 18zM1702 742l-907 -908q-37 -37 -90.5 -37t-90.5 37l-126 126q56 56 56 136t-56 136 t-136 56t-136 -56l-125 126q-37 37 -37 90.5t37 90.5l907 906q37 37 90.5 37t90.5 -37l125 -125q-56 -56 -56 -136t56 -136t136 -56t136 56l126 -125q37 -37 37 -90.5t-37 -90.5z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-896q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h896q26 0 45 19t19 45zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1152 736v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h832q14 0 23 -9t9 -23zM1280 288v832q0 66 -47 113t-113 47h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113zM1408 1120v-832q0 -119 -84.5 -203.5 t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1018 933q-18 -37 -58 -37h-192v-864q0 -14 -9 -23t-23 -9h-704q-21 0 -29 18q-8 20 4 35l160 192q9 11 25 11h320v640h-192q-40 0 -58 37q-17 37 9 68l320 384q18 22 49 22t49 -22l320 -384q27 -32 9 -68z" /> +<glyph unicode="" horiz-adv-x="1024" d="M32 1280h704q13 0 22.5 -9.5t9.5 -23.5v-863h192q40 0 58 -37t-9 -69l-320 -384q-18 -22 -49 -22t-49 22l-320 384q-26 31 -9 69q18 37 58 37h192v640h-320q-14 0 -25 11l-160 192q-13 14 -4 34q9 19 29 19z" /> +<glyph unicode="" d="M685 237l614 614q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-467 -467l-211 211q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l358 -358q19 -19 45 -19t45 19zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5 t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M404 428l152 -152l-52 -52h-56v96h-96v56zM818 818q14 -13 -3 -30l-291 -291q-17 -17 -30 -3q-14 13 3 30l291 291q17 17 30 3zM544 128l544 544l-288 288l-544 -544v-288h288zM1152 736l92 92q28 28 28 68t-28 68l-152 152q-28 28 -68 28t-68 -28l-92 -92zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1280 608v480q0 26 -19 45t-45 19h-480q-42 0 -59 -39q-17 -41 14 -70l144 -144l-534 -534q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19l534 534l144 -144q18 -19 45 -19q12 0 25 5q39 17 39 59zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960 q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1005 435l352 352q19 19 19 45t-19 45l-352 352q-30 31 -69 14q-40 -17 -40 -59v-160q-119 0 -216 -19.5t-162.5 -51t-114 -79t-76.5 -95.5t-44.5 -109t-21.5 -111.5t-5 -110.5q0 -181 167 -404q10 -12 25 -12q7 0 13 3q22 9 19 33q-44 354 62 473q46 52 130 75.5 t224 23.5v-160q0 -42 40 -59q12 -5 24 -5q26 0 45 19zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M640 448l256 128l-256 128v-256zM1024 1039v-542l-512 -256v542zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1145 861q18 -35 -5 -66l-320 -448q-19 -27 -52 -27t-52 27l-320 448q-23 31 -5 66q17 35 57 35h640q40 0 57 -35zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1145 419q-17 -35 -57 -35h-640q-40 0 -57 35q-18 35 5 66l320 448q19 27 52 27t52 -27l320 -448q23 -31 5 -66zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1088 640q0 -33 -27 -52l-448 -320q-31 -23 -66 -5q-35 17 -35 57v640q0 40 35 57q35 18 66 -5l448 -320q27 -19 27 -52zM1280 160v960q0 14 -9 23t-23 9h-960q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h960q14 0 23 9t9 23zM1536 1120v-960q0 -119 -84.5 -203.5 t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M976 229l35 -159q3 -12 -3 -22.5t-17 -14.5l-5 -1q-4 -2 -10.5 -3.5t-16 -4.5t-21.5 -5.5t-25.5 -5t-30 -5t-33.5 -4.5t-36.5 -3t-38.5 -1q-234 0 -409 130.5t-238 351.5h-95q-13 0 -22.5 9.5t-9.5 22.5v113q0 13 9.5 22.5t22.5 9.5h66q-2 57 1 105h-67q-14 0 -23 9 t-9 23v114q0 14 9 23t23 9h98q67 210 243.5 338t400.5 128q102 0 194 -23q11 -3 20 -15q6 -11 3 -24l-43 -159q-3 -13 -14 -19.5t-24 -2.5l-4 1q-4 1 -11.5 2.5l-17.5 3.5t-22.5 3.5t-26 3t-29 2.5t-29.5 1q-126 0 -226 -64t-150 -176h468q16 0 25 -12q10 -12 7 -26 l-24 -114q-5 -26 -32 -26h-488q-3 -37 0 -105h459q15 0 25 -12q9 -12 6 -27l-24 -112q-2 -11 -11 -18.5t-20 -7.5h-387q48 -117 149.5 -185.5t228.5 -68.5q18 0 36 1.5t33.5 3.5t29.5 4.5t24.5 5t18.5 4.5l12 3l5 2q13 5 26 -2q12 -7 15 -21z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1020 399v-367q0 -14 -9 -23t-23 -9h-956q-14 0 -23 9t-9 23v150q0 13 9.5 22.5t22.5 9.5h97v383h-95q-14 0 -23 9.5t-9 22.5v131q0 14 9 23t23 9h95v223q0 171 123.5 282t314.5 111q185 0 335 -125q9 -8 10 -20.5t-7 -22.5l-103 -127q-9 -11 -22 -12q-13 -2 -23 7 q-5 5 -26 19t-69 32t-93 18q-85 0 -137 -47t-52 -123v-215h305q13 0 22.5 -9t9.5 -23v-131q0 -13 -9.5 -22.5t-22.5 -9.5h-305v-379h414v181q0 13 9 22.5t23 9.5h162q14 0 23 -9.5t9 -22.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M978 351q0 -153 -99.5 -263.5t-258.5 -136.5v-175q0 -14 -9 -23t-23 -9h-135q-13 0 -22.5 9.5t-9.5 22.5v175q-66 9 -127.5 31t-101.5 44.5t-74 48t-46.5 37.5t-17.5 18q-17 21 -2 41l103 135q7 10 23 12q15 2 24 -9l2 -2q113 -99 243 -125q37 -8 74 -8q81 0 142.5 43 t61.5 122q0 28 -15 53t-33.5 42t-58.5 37.5t-66 32t-80 32.5q-39 16 -61.5 25t-61.5 26.5t-62.5 31t-56.5 35.5t-53.5 42.5t-43.5 49t-35.5 58t-21 66.5t-8.5 78q0 138 98 242t255 134v180q0 13 9.5 22.5t22.5 9.5h135q14 0 23 -9t9 -23v-176q57 -6 110.5 -23t87 -33.5 t63.5 -37.5t39 -29t15 -14q17 -18 5 -38l-81 -146q-8 -15 -23 -16q-14 -3 -27 7q-3 3 -14.5 12t-39 26.5t-58.5 32t-74.5 26t-85.5 11.5q-95 0 -155 -43t-60 -111q0 -26 8.5 -48t29.5 -41.5t39.5 -33t56 -31t60.5 -27t70 -27.5q53 -20 81 -31.5t76 -35t75.5 -42.5t62 -50 t53 -63.5t31.5 -76.5t13 -94z" /> +<glyph unicode="" horiz-adv-x="898" d="M898 1066v-102q0 -14 -9 -23t-23 -9h-168q-23 -144 -129 -234t-276 -110q167 -178 459 -536q14 -16 4 -34q-8 -18 -29 -18h-195q-16 0 -25 12q-306 367 -498 571q-9 9 -9 22v127q0 13 9.5 22.5t22.5 9.5h112q132 0 212.5 43t102.5 125h-427q-14 0 -23 9t-9 23v102 q0 14 9 23t23 9h413q-57 113 -268 113h-145q-13 0 -22.5 9.5t-9.5 22.5v133q0 14 9 23t23 9h832q14 0 23 -9t9 -23v-102q0 -14 -9 -23t-23 -9h-233q47 -61 64 -144h171q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1027" d="M603 0h-172q-13 0 -22.5 9t-9.5 23v330h-288q-13 0 -22.5 9t-9.5 23v103q0 13 9.5 22.5t22.5 9.5h288v85h-288q-13 0 -22.5 9t-9.5 23v104q0 13 9.5 22.5t22.5 9.5h214l-321 578q-8 16 0 32q10 16 28 16h194q19 0 29 -18l215 -425q19 -38 56 -125q10 24 30.5 68t27.5 61 l191 420q8 19 29 19h191q17 0 27 -16q9 -14 1 -31l-313 -579h215q13 0 22.5 -9.5t9.5 -22.5v-104q0 -14 -9.5 -23t-22.5 -9h-290v-85h290q13 0 22.5 -9.5t9.5 -22.5v-103q0 -14 -9.5 -23t-22.5 -9h-290v-330q0 -13 -9.5 -22.5t-22.5 -9.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1043 971q0 100 -65 162t-171 62h-320v-448h320q106 0 171 62t65 162zM1280 971q0 -193 -126.5 -315t-326.5 -122h-340v-118h505q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9h-505v-192q0 -14 -9.5 -23t-22.5 -9h-167q-14 0 -23 9t-9 23v192h-224q-14 0 -23 9t-9 23v128 q0 14 9 23t23 9h224v118h-224q-14 0 -23 9t-9 23v149q0 13 9 22.5t23 9.5h224v629q0 14 9 23t23 9h539q200 0 326.5 -122t126.5 -315z" /> +<glyph unicode="" horiz-adv-x="1792" d="M514 341l81 299h-159l75 -300q1 -1 1 -3t1 -3q0 1 0.5 3.5t0.5 3.5zM630 768l35 128h-292l32 -128h225zM822 768h139l-35 128h-70zM1271 340l78 300h-162l81 -299q0 -1 0.5 -3.5t1.5 -3.5q0 1 0.5 3t0.5 3zM1382 768l33 128h-297l34 -128h230zM1792 736v-64q0 -14 -9 -23 t-23 -9h-213l-164 -616q-7 -24 -31 -24h-159q-24 0 -31 24l-166 616h-209l-167 -616q-7 -24 -31 -24h-159q-11 0 -19.5 7t-10.5 17l-160 616h-208q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h175l-33 128h-142q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h109l-89 344q-5 15 5 28 q10 12 26 12h137q26 0 31 -24l90 -360h359l97 360q7 24 31 24h126q24 0 31 -24l98 -360h365l93 360q5 24 31 24h137q16 0 26 -12q10 -13 5 -28l-91 -344h111q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-145l-34 -128h179q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1167 896q18 -182 -131 -258q117 -28 175 -103t45 -214q-7 -71 -32.5 -125t-64.5 -89t-97 -58.5t-121.5 -34.5t-145.5 -15v-255h-154v251q-80 0 -122 1v-252h-154v255q-18 0 -54 0.5t-55 0.5h-200l31 183h111q50 0 58 51v402h16q-6 1 -16 1v287q-13 68 -89 68h-111v164 l212 -1q64 0 97 1v252h154v-247q82 2 122 2v245h154v-252q79 -7 140 -22.5t113 -45t82.5 -78t36.5 -114.5zM952 351q0 36 -15 64t-37 46t-57.5 30.5t-65.5 18.5t-74 9t-69 3t-64.5 -1t-47.5 -1v-338q8 0 37 -0.5t48 -0.5t53 1.5t58.5 4t57 8.5t55.5 14t47.5 21t39.5 30 t24.5 40t9.5 51zM881 827q0 33 -12.5 58.5t-30.5 42t-48 28t-55 16.5t-61.5 8t-58 2.5t-54 -1t-39.5 -0.5v-307q5 0 34.5 -0.5t46.5 0t50 2t55 5.5t51.5 11t48.5 18.5t37 27t27 38.5t9 51z" /> +<glyph unicode="" d="M1024 1024v472q22 -14 36 -28l408 -408q14 -14 28 -36h-472zM896 992q0 -40 28 -68t68 -28h544v-1056q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h800v-544z" /> +<glyph unicode="" d="M1468 1060q14 -14 28 -36h-472v472q22 -14 36 -28zM992 896h544v-1056q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h800v-544q0 -40 28 -68t68 -28zM1152 160v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704 q14 0 23 9t9 23zM1152 416v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704q14 0 23 9t9 23zM1152 672v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1191 1128h177l-72 218l-12 47q-2 16 -2 20h-4l-3 -20q0 -1 -3.5 -18t-7.5 -29zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1572 -23 v-233h-584v90l369 529q12 18 21 27l11 9v3q-2 0 -6.5 -0.5t-7.5 -0.5q-12 -3 -30 -3h-232v-115h-120v229h567v-89l-369 -530q-6 -8 -21 -26l-11 -11v-2l14 2q9 2 30 2h248v119h121zM1661 874v-106h-288v106h75l-47 144h-243l-47 -144h75v-106h-287v106h70l230 662h162 l230 -662h70z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1191 104h177l-72 218l-12 47q-2 16 -2 20h-4l-3 -20q0 -1 -3.5 -18t-7.5 -29zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1661 -150 v-106h-288v106h75l-47 144h-243l-47 -144h75v-106h-287v106h70l230 662h162l230 -662h70zM1572 1001v-233h-584v90l369 529q12 18 21 27l11 9v3q-2 0 -6.5 -0.5t-7.5 -0.5q-12 -3 -30 -3h-232v-115h-120v229h567v-89l-369 -530q-6 -8 -21 -26l-11 -10v-3l14 3q9 1 30 1h248 v119h121z" /> +<glyph unicode="" horiz-adv-x="1792" d="M736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1792 -32v-192q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h832 q14 0 23 -9t9 -23zM1600 480v-192q0 -14 -9 -23t-23 -9h-640q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h640q14 0 23 -9t9 -23zM1408 992v-192q0 -14 -9 -23t-23 -9h-448q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h448q14 0 23 -9t9 -23zM1216 1504v-192q0 -14 -9 -23t-23 -9h-256 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h256q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1216 -32v-192q0 -14 -9 -23t-23 -9h-256q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h256q14 0 23 -9t9 -23zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192 q14 0 23 -9t9 -23zM1408 480v-192q0 -14 -9 -23t-23 -9h-448q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h448q14 0 23 -9t9 -23zM1600 992v-192q0 -14 -9 -23t-23 -9h-640q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h640q14 0 23 -9t9 -23zM1792 1504v-192q0 -14 -9 -23t-23 -9h-832 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h832q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1346 223q0 63 -44 116t-103 53q-52 0 -83 -37t-31 -94t36.5 -95t104.5 -38q50 0 85 27t35 68zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23 zM1486 165q0 -62 -13 -121.5t-41 -114t-68 -95.5t-98.5 -65.5t-127.5 -24.5q-62 0 -108 16q-24 8 -42 15l39 113q15 -7 31 -11q37 -13 75 -13q84 0 134.5 58.5t66.5 145.5h-2q-21 -23 -61.5 -37t-84.5 -14q-106 0 -173 71.5t-67 172.5q0 105 72 178t181 73q123 0 205 -94.5 t82 -252.5zM1456 882v-114h-469v114h167v432q0 7 0.5 19t0.5 17v16h-2l-7 -12q-8 -13 -26 -31l-62 -58l-82 86l192 185h123v-654h165z" /> +<glyph unicode="" d="M1346 1247q0 63 -44 116t-103 53q-52 0 -83 -37t-31 -94t36.5 -95t104.5 -38q50 0 85 27t35 68zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9 t9 -23zM1456 -142v-114h-469v114h167v432q0 7 0.5 19t0.5 17v16h-2l-7 -12q-8 -13 -26 -31l-62 -58l-82 86l192 185h123v-654h165zM1486 1189q0 -62 -13 -121.5t-41 -114t-68 -95.5t-98.5 -65.5t-127.5 -24.5q-62 0 -108 16q-24 8 -42 15l39 113q15 -7 31 -11q37 -13 75 -13 q84 0 134.5 58.5t66.5 145.5h-2q-21 -23 -61.5 -37t-84.5 -14q-106 0 -173 71.5t-67 172.5q0 105 72 178t181 73q123 0 205 -94.5t82 -252.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M256 192q0 26 -19 45t-45 19q-27 0 -45.5 -19t-18.5 -45q0 -27 18.5 -45.5t45.5 -18.5q26 0 45 18.5t19 45.5zM416 704v-640q0 -26 -19 -45t-45 -19h-288q-26 0 -45 19t-19 45v640q0 26 19 45t45 19h288q26 0 45 -19t19 -45zM1600 704q0 -86 -55 -149q15 -44 15 -76 q3 -76 -43 -137q17 -56 0 -117q-15 -57 -54 -94q9 -112 -49 -181q-64 -76 -197 -78h-36h-76h-17q-66 0 -144 15.5t-121.5 29t-120.5 39.5q-123 43 -158 44q-26 1 -45 19.5t-19 44.5v641q0 25 18 43.5t43 20.5q24 2 76 59t101 121q68 87 101 120q18 18 31 48t17.5 48.5 t13.5 60.5q7 39 12.5 61t19.5 52t34 50q19 19 45 19q46 0 82.5 -10.5t60 -26t40 -40.5t24 -45t12 -50t5 -45t0.5 -39q0 -38 -9.5 -76t-19 -60t-27.5 -56q-3 -6 -10 -18t-11 -22t-8 -24h277q78 0 135 -57t57 -135z" /> +<glyph unicode="" horiz-adv-x="1664" d="M256 960q0 -26 -19 -45t-45 -19q-27 0 -45.5 19t-18.5 45q0 27 18.5 45.5t45.5 18.5q26 0 45 -18.5t19 -45.5zM416 448v640q0 26 -19 45t-45 19h-288q-26 0 -45 -19t-19 -45v-640q0 -26 19 -45t45 -19h288q26 0 45 19t19 45zM1545 597q55 -61 55 -149q-1 -78 -57.5 -135 t-134.5 -57h-277q4 -14 8 -24t11 -22t10 -18q18 -37 27 -57t19 -58.5t10 -76.5q0 -24 -0.5 -39t-5 -45t-12 -50t-24 -45t-40 -40.5t-60 -26t-82.5 -10.5q-26 0 -45 19q-20 20 -34 50t-19.5 52t-12.5 61q-9 42 -13.5 60.5t-17.5 48.5t-31 48q-33 33 -101 120q-49 64 -101 121 t-76 59q-25 2 -43 20.5t-18 43.5v641q0 26 19 44.5t45 19.5q35 1 158 44q77 26 120.5 39.5t121.5 29t144 15.5h17h76h36q133 -2 197 -78q58 -69 49 -181q39 -37 54 -94q17 -61 0 -117q46 -61 43 -137q0 -32 -15 -76z" /> +<glyph unicode="" d="M919 233v157q0 50 -29 50q-17 0 -33 -16v-224q16 -16 33 -16q29 0 29 49zM1103 355h66v34q0 51 -33 51t-33 -51v-34zM532 621v-70h-80v-423h-74v423h-78v70h232zM733 495v-367h-67v40q-39 -45 -76 -45q-33 0 -42 28q-6 16 -6 54v290h66v-270q0 -24 1 -26q1 -15 15 -15 q20 0 42 31v280h67zM985 384v-146q0 -52 -7 -73q-12 -42 -53 -42q-35 0 -68 41v-36h-67v493h67v-161q32 40 68 40q41 0 53 -42q7 -21 7 -74zM1236 255v-9q0 -29 -2 -43q-3 -22 -15 -40q-27 -40 -80 -40q-52 0 -81 38q-21 27 -21 86v129q0 59 20 86q29 38 80 38t78 -38 q21 -28 21 -86v-76h-133v-65q0 -51 34 -51q24 0 30 26q0 1 0.5 7t0.5 16.5v21.5h68zM785 1079v-156q0 -51 -32 -51t-32 51v156q0 52 32 52t32 -52zM1318 366q0 177 -19 260q-10 44 -43 73.5t-76 34.5q-136 15 -412 15q-275 0 -411 -15q-44 -5 -76.5 -34.5t-42.5 -73.5 q-20 -87 -20 -260q0 -176 20 -260q10 -43 42.5 -73t75.5 -35q137 -15 412 -15t412 15q43 5 75.5 35t42.5 73q20 84 20 260zM563 1017l90 296h-75l-51 -195l-53 195h-78l24 -69t23 -69q35 -103 46 -158v-201h74v201zM852 936v130q0 58 -21 87q-29 38 -78 38q-51 0 -78 -38 q-21 -29 -21 -87v-130q0 -58 21 -87q27 -38 78 -38q49 0 78 38q21 27 21 87zM1033 816h67v370h-67v-283q-22 -31 -42 -31q-15 0 -16 16q-1 2 -1 26v272h-67v-293q0 -37 6 -55q11 -27 43 -27q36 0 77 45v-40zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960 q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M971 292v-211q0 -67 -39 -67q-23 0 -45 22v301q22 22 45 22q39 0 39 -67zM1309 291v-46h-90v46q0 68 45 68t45 -68zM343 509h107v94h-312v-94h105v-569h100v569zM631 -60h89v494h-89v-378q-30 -42 -57 -42q-18 0 -21 21q-1 3 -1 35v364h-89v-391q0 -49 8 -73 q12 -37 58 -37q48 0 102 61v-54zM1060 88v197q0 73 -9 99q-17 56 -71 56q-50 0 -93 -54v217h-89v-663h89v48q45 -55 93 -55q54 0 71 55q9 27 9 100zM1398 98v13h-91q0 -51 -2 -61q-7 -36 -40 -36q-46 0 -46 69v87h179v103q0 79 -27 116q-39 51 -106 51q-68 0 -107 -51 q-28 -37 -28 -116v-173q0 -79 29 -116q39 -51 108 -51q72 0 108 53q18 27 21 54q2 9 2 58zM790 1011v210q0 69 -43 69t-43 -69v-210q0 -70 43 -70t43 70zM1509 260q0 -234 -26 -350q-14 -59 -58 -99t-102 -46q-184 -21 -555 -21t-555 21q-58 6 -102.5 46t-57.5 99 q-26 112 -26 350q0 234 26 350q14 59 58 99t103 47q183 20 554 20t555 -20q58 -7 102.5 -47t57.5 -99q26 -112 26 -350zM511 1536h102l-121 -399v-271h-100v271q-14 74 -61 212q-37 103 -65 187h106l71 -263zM881 1203v-175q0 -81 -28 -118q-37 -51 -106 -51q-67 0 -105 51 q-28 38 -28 118v175q0 80 28 117q38 51 105 51q69 0 106 -51q28 -37 28 -117zM1216 1365v-499h-91v55q-53 -62 -103 -62q-46 0 -59 37q-8 24 -8 75v394h91v-367q0 -33 1 -35q3 -22 21 -22q27 0 57 43v381h91z" /> +<glyph unicode="" horiz-adv-x="1408" d="M597 869q-10 -18 -257 -456q-27 -46 -65 -46h-239q-21 0 -31 17t0 36l253 448q1 0 0 1l-161 279q-12 22 -1 37q9 15 32 15h239q40 0 66 -45zM1403 1511q11 -16 0 -37l-528 -934v-1l336 -615q11 -20 1 -37q-10 -15 -32 -15h-239q-42 0 -66 45l-339 622q18 32 531 942 q25 45 64 45h241q22 0 31 -15z" /> +<glyph unicode="" d="M685 771q0 1 -126 222q-21 34 -52 34h-184q-18 0 -26 -11q-7 -12 1 -29l125 -216v-1l-196 -346q-9 -14 0 -28q8 -13 24 -13h185q31 0 50 36zM1309 1268q-7 12 -24 12h-187q-30 0 -49 -35l-411 -729q1 -2 262 -481q20 -35 52 -35h184q18 0 25 12q8 13 -1 28l-260 476v1 l409 723q8 16 0 28zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 640q0 37 -30 54l-512 320q-31 20 -65 2q-33 -18 -33 -56v-640q0 -38 33 -56q16 -8 31 -8q20 0 34 10l512 320q30 17 30 54zM1792 640q0 -96 -1 -150t-8.5 -136.5t-22.5 -147.5q-16 -73 -69 -123t-124 -58q-222 -25 -671 -25t-671 25q-71 8 -124.5 58t-69.5 123 q-14 65 -21.5 147.5t-8.5 136.5t-1 150t1 150t8.5 136.5t22.5 147.5q16 73 69 123t124 58q222 25 671 25t671 -25q71 -8 124.5 -58t69.5 -123q14 -65 21.5 -147.5t8.5 -136.5t1 -150z" /> +<glyph unicode="" horiz-adv-x="1792" d="M402 829l494 -305l-342 -285l-490 319zM1388 274v-108l-490 -293v-1l-1 1l-1 -1v1l-489 293v108l147 -96l342 284v2l1 -1l1 1v-2l343 -284zM554 1418l342 -285l-494 -304l-338 270zM1390 829l338 -271l-489 -319l-343 285zM1239 1418l489 -319l-338 -270l-494 304z" /> +<glyph unicode="" horiz-adv-x="1408" d="M928 135v-151l-707 -1v151zM1169 481v-701l-1 -35v-1h-1132l-35 1h-1v736h121v-618h928v618h120zM241 393l704 -65l-13 -150l-705 65zM309 709l683 -183l-39 -146l-683 183zM472 1058l609 -360l-77 -130l-609 360zM832 1389l398 -585l-124 -85l-399 584zM1285 1536 l121 -697l-149 -26l-121 697z" /> +<glyph unicode="" d="M1362 110v648h-135q20 -63 20 -131q0 -126 -64 -232.5t-174 -168.5t-240 -62q-197 0 -337 135.5t-140 327.5q0 68 20 131h-141v-648q0 -26 17.5 -43.5t43.5 -17.5h1069q25 0 43 17.5t18 43.5zM1078 643q0 124 -90.5 211.5t-218.5 87.5q-127 0 -217.5 -87.5t-90.5 -211.5 t90.5 -211.5t217.5 -87.5q128 0 218.5 87.5t90.5 211.5zM1362 1003v165q0 28 -20 48.5t-49 20.5h-174q-29 0 -49 -20.5t-20 -48.5v-165q0 -29 20 -49t49 -20h174q29 0 49 20t20 49zM1536 1211v-1142q0 -81 -58 -139t-139 -58h-1142q-81 0 -139 58t-58 139v1142q0 81 58 139 t139 58h1142q81 0 139 -58t58 -139z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM698 640q0 88 -62 150t-150 62t-150 -62t-62 -150t62 -150t150 -62t150 62t62 150zM1262 640q0 88 -62 150 t-150 62t-150 -62t-62 -150t62 -150t150 -62t150 62t62 150z" /> +<glyph unicode="" d="M768 914l201 -306h-402zM1133 384h94l-459 691l-459 -691h94l104 160h522zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M815 677q8 -63 -50.5 -101t-111.5 -6q-39 17 -53.5 58t-0.5 82t52 58q36 18 72.5 12t64 -35.5t27.5 -67.5zM926 698q-14 107 -113 164t-197 13q-63 -28 -100.5 -88.5t-34.5 -129.5q4 -91 77.5 -155t165.5 -56q91 8 152 84t50 168zM1165 1240q-20 27 -56 44.5t-58 22 t-71 12.5q-291 47 -566 -2q-43 -7 -66 -12t-55 -22t-50 -43q30 -28 76 -45.5t73.5 -22t87.5 -11.5q228 -29 448 -1q63 8 89.5 12t72.5 21.5t75 46.5zM1222 205q-8 -26 -15.5 -76.5t-14 -84t-28.5 -70t-58 -56.5q-86 -48 -189.5 -71.5t-202 -22t-201.5 18.5q-46 8 -81.5 18 t-76.5 27t-73 43.5t-52 61.5q-25 96 -57 292l6 16l18 9q223 -148 506.5 -148t507.5 148q21 -6 24 -23t-5 -45t-8 -37zM1403 1166q-26 -167 -111 -655q-5 -30 -27 -56t-43.5 -40t-54.5 -31q-252 -126 -610 -88q-248 27 -394 139q-15 12 -25.5 26.5t-17 35t-9 34t-6 39.5 t-5.5 35q-9 50 -26.5 150t-28 161.5t-23.5 147.5t-22 158q3 26 17.5 48.5t31.5 37.5t45 30t46 22.5t48 18.5q125 46 313 64q379 37 676 -50q155 -46 215 -122q16 -20 16.5 -51t-5.5 -54z" /> +<glyph unicode="" d="M848 666q0 43 -41 66t-77 1q-43 -20 -42.5 -72.5t43.5 -70.5q39 -23 81 4t36 72zM928 682q8 -66 -36 -121t-110 -61t-119 40t-56 113q-2 49 25.5 93t72.5 64q70 31 141.5 -10t81.5 -118zM1100 1073q-20 -21 -53.5 -34t-53 -16t-63.5 -8q-155 -20 -324 0q-44 6 -63 9.5 t-52.5 16t-54.5 32.5q13 19 36 31t40 15.5t47 8.5q198 35 408 1q33 -5 51 -8.5t43 -16t39 -31.5zM1142 327q0 7 5.5 26.5t3 32t-17.5 16.5q-161 -106 -365 -106t-366 106l-12 -6l-5 -12q26 -154 41 -210q47 -81 204 -108q249 -46 428 53q34 19 49 51.5t22.5 85.5t12.5 71z M1272 1020q9 53 -8 75q-43 55 -155 88q-216 63 -487 36q-132 -12 -226 -46q-38 -15 -59.5 -25t-47 -34t-29.5 -54q8 -68 19 -138t29 -171t24 -137q1 -5 5 -31t7 -36t12 -27t22 -28q105 -80 284 -100q259 -28 440 63q24 13 39.5 23t31 29t19.5 40q48 267 80 473zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M944 207l80 -237q-23 -35 -111 -66t-177 -32q-104 -2 -190.5 26t-142.5 74t-95 106t-55.5 120t-16.5 118v544h-168v215q72 26 129 69.5t91 90t58 102t34 99t15 88.5q1 5 4.5 8.5t7.5 3.5h244v-424h333v-252h-334v-518q0 -30 6.5 -56t22.5 -52.5t49.5 -41.5t81.5 -14 q78 2 134 29z" /> +<glyph unicode="" d="M1136 75l-62 183q-44 -22 -103 -22q-36 -1 -62 10.5t-38.5 31.5t-17.5 40.5t-5 43.5v398h257v194h-256v326h-188q-8 0 -9 -10q-5 -44 -17.5 -87t-39 -95t-77 -95t-118.5 -68v-165h130v-418q0 -57 21.5 -115t65 -111t121 -85.5t176.5 -30.5q69 1 136.5 25t85.5 50z M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="768" d="M765 237q8 -19 -5 -35l-350 -384q-10 -10 -23 -10q-14 0 -24 10l-355 384q-13 16 -5 35q9 19 29 19h224v1248q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1248h224q21 0 29 -19z" /> +<glyph unicode="" horiz-adv-x="768" d="M765 1043q-9 -19 -29 -19h-224v-1248q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v1248h-224q-21 0 -29 19t5 35l350 384q10 10 23 10q14 0 24 -10l355 -384q13 -16 5 -35z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 736v-192q0 -14 -9 -23t-23 -9h-1248v-224q0 -21 -19 -29t-35 5l-384 350q-10 10 -10 23q0 14 10 24l384 354q16 14 35 6q19 -9 19 -29v-224h1248q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1728 643q0 -14 -10 -24l-384 -354q-16 -14 -35 -6q-19 9 -19 29v224h-1248q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h1248v224q0 21 19 29t35 -5l384 -350q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1393 321q-39 -125 -123 -250q-129 -196 -257 -196q-49 0 -140 32q-86 32 -151 32q-61 0 -142 -33q-81 -34 -132 -34q-152 0 -301 259q-147 261 -147 503q0 228 113 374q112 144 284 144q72 0 177 -30q104 -30 138 -30q45 0 143 34q102 34 173 34q119 0 213 -65 q52 -36 104 -100q-79 -67 -114 -118q-65 -94 -65 -207q0 -124 69 -223t158 -126zM1017 1494q0 -61 -29 -136q-30 -75 -93 -138q-54 -54 -108 -72q-37 -11 -104 -17q3 149 78 257q74 107 250 148q1 -3 2.5 -11t2.5 -11q0 -4 0.5 -10t0.5 -10z" /> +<glyph unicode="" horiz-adv-x="1664" d="M682 530v-651l-682 94v557h682zM682 1273v-659h-682v565zM1664 530v-786l-907 125v661h907zM1664 1408v-794h-907v669z" /> +<glyph unicode="" horiz-adv-x="1408" d="M493 1053q16 0 27.5 11.5t11.5 27.5t-11.5 27.5t-27.5 11.5t-27 -11.5t-11 -27.5t11 -27.5t27 -11.5zM915 1053q16 0 27 11.5t11 27.5t-11 27.5t-27 11.5t-27.5 -11.5t-11.5 -27.5t11.5 -27.5t27.5 -11.5zM103 869q42 0 72 -30t30 -72v-430q0 -43 -29.5 -73t-72.5 -30 t-73 30t-30 73v430q0 42 30 72t73 30zM1163 850v-666q0 -46 -32 -78t-77 -32h-75v-227q0 -43 -30 -73t-73 -30t-73 30t-30 73v227h-138v-227q0 -43 -30 -73t-73 -30q-42 0 -72 30t-30 73l-1 227h-74q-46 0 -78 32t-32 78v666h918zM931 1255q107 -55 171 -153.5t64 -215.5 h-925q0 117 64 215.5t172 153.5l-71 131q-7 13 5 20q13 6 20 -6l72 -132q95 42 201 42t201 -42l72 132q7 12 20 6q12 -7 5 -20zM1408 767v-430q0 -43 -30 -73t-73 -30q-42 0 -72 30t-30 73v430q0 43 30 72.5t72 29.5q43 0 73 -29.5t30 -72.5z" /> +<glyph unicode="" d="M663 1125q-11 -1 -15.5 -10.5t-8.5 -9.5q-5 -1 -5 5q0 12 19 15h10zM750 1111q-4 -1 -11.5 6.5t-17.5 4.5q24 11 32 -2q3 -6 -3 -9zM399 684q-4 1 -6 -3t-4.5 -12.5t-5.5 -13.5t-10 -13q-7 -10 -1 -12q4 -1 12.5 7t12.5 18q1 3 2 7t2 6t1.5 4.5t0.5 4v3t-1 2.5t-3 2z M1254 325q0 18 -55 42q4 15 7.5 27.5t5 26t3 21.5t0.5 22.5t-1 19.5t-3.5 22t-4 20.5t-5 25t-5.5 26.5q-10 48 -47 103t-72 75q24 -20 57 -83q87 -162 54 -278q-11 -40 -50 -42q-31 -4 -38.5 18.5t-8 83.5t-11.5 107q-9 39 -19.5 69t-19.5 45.5t-15.5 24.5t-13 15t-7.5 7 q-14 62 -31 103t-29.5 56t-23.5 33t-15 40q-4 21 6 53.5t4.5 49.5t-44.5 25q-15 3 -44.5 18t-35.5 16q-8 1 -11 26t8 51t36 27q37 3 51 -30t4 -58q-11 -19 -2 -26.5t30 -0.5q13 4 13 36v37q-5 30 -13.5 50t-21 30.5t-23.5 15t-27 7.5q-107 -8 -89 -134q0 -15 -1 -15 q-9 9 -29.5 10.5t-33 -0.5t-15.5 5q1 57 -16 90t-45 34q-27 1 -41.5 -27.5t-16.5 -59.5q-1 -15 3.5 -37t13 -37.5t15.5 -13.5q10 3 16 14q4 9 -7 8q-7 0 -15.5 14.5t-9.5 33.5q-1 22 9 37t34 14q17 0 27 -21t9.5 -39t-1.5 -22q-22 -15 -31 -29q-8 -12 -27.5 -23.5 t-20.5 -12.5q-13 -14 -15.5 -27t7.5 -18q14 -8 25 -19.5t16 -19t18.5 -13t35.5 -6.5q47 -2 102 15q2 1 23 7t34.5 10.5t29.5 13t21 17.5q9 14 20 8q5 -3 6.5 -8.5t-3 -12t-16.5 -9.5q-20 -6 -56.5 -21.5t-45.5 -19.5q-44 -19 -70 -23q-25 -5 -79 2q-10 2 -9 -2t17 -19 q25 -23 67 -22q17 1 36 7t36 14t33.5 17.5t30 17t24.5 12t17.5 2.5t8.5 -11q0 -2 -1 -4.5t-4 -5t-6 -4.5t-8.5 -5t-9 -4.5t-10 -5t-9.5 -4.5q-28 -14 -67.5 -44t-66.5 -43t-49 -1q-21 11 -63 73q-22 31 -25 22q-1 -3 -1 -10q0 -25 -15 -56.5t-29.5 -55.5t-21 -58t11.5 -63 q-23 -6 -62.5 -90t-47.5 -141q-2 -18 -1.5 -69t-5.5 -59q-8 -24 -29 -3q-32 31 -36 94q-2 28 4 56q4 19 -1 18l-4 -5q-36 -65 10 -166q5 -12 25 -28t24 -20q20 -23 104 -90.5t93 -76.5q16 -15 17.5 -38t-14 -43t-45.5 -23q8 -15 29 -44.5t28 -54t7 -70.5q46 24 7 92 q-4 8 -10.5 16t-9.5 12t-2 6q3 5 13 9.5t20 -2.5q46 -52 166 -36q133 15 177 87q23 38 34 30q12 -6 10 -52q-1 -25 -23 -92q-9 -23 -6 -37.5t24 -15.5q3 19 14.5 77t13.5 90q2 21 -6.5 73.5t-7.5 97t23 70.5q15 18 51 18q1 37 34.5 53t72.5 10.5t60 -22.5zM626 1152 q3 17 -2.5 30t-11.5 15q-9 2 -9 -7q2 -5 5 -6q10 0 7 -15q-3 -20 8 -20q3 0 3 3zM1045 955q-2 8 -6.5 11.5t-13 5t-14.5 5.5q-5 3 -9.5 8t-7 8t-5.5 6.5t-4 4t-4 -1.5q-14 -16 7 -43.5t39 -31.5q9 -1 14.5 8t3.5 20zM867 1168q0 11 -5 19.5t-11 12.5t-9 3q-14 -1 -7 -7l4 -2 q14 -4 18 -31q0 -3 8 2zM921 1401q0 2 -2.5 5t-9 7t-9.5 6q-15 15 -24 15q-9 -1 -11.5 -7.5t-1 -13t-0.5 -12.5q-1 -4 -6 -10.5t-6 -9t3 -8.5q4 -3 8 0t11 9t15 9q1 1 9 1t15 2t9 7zM1486 60q20 -12 31 -24.5t12 -24t-2.5 -22.5t-15.5 -22t-23.5 -19.5t-30 -18.5 t-31.5 -16.5t-32 -15.5t-27 -13q-38 -19 -85.5 -56t-75.5 -64q-17 -16 -68 -19.5t-89 14.5q-18 9 -29.5 23.5t-16.5 25.5t-22 19.5t-47 9.5q-44 1 -130 1q-19 0 -57 -1.5t-58 -2.5q-44 -1 -79.5 -15t-53.5 -30t-43.5 -28.5t-53.5 -11.5q-29 1 -111 31t-146 43q-19 4 -51 9.5 t-50 9t-39.5 9.5t-33.5 14.5t-17 19.5q-10 23 7 66.5t18 54.5q1 16 -4 40t-10 42.5t-4.5 36.5t10.5 27q14 12 57 14t60 12q30 18 42 35t12 51q21 -73 -32 -106q-32 -20 -83 -15q-34 3 -43 -10q-13 -15 5 -57q2 -6 8 -18t8.5 -18t4.5 -17t1 -22q0 -15 -17 -49t-14 -48 q3 -17 37 -26q20 -6 84.5 -18.5t99.5 -20.5q24 -6 74 -22t82.5 -23t55.5 -4q43 6 64.5 28t23 48t-7.5 58.5t-19 52t-20 36.5q-121 190 -169 242q-68 74 -113 40q-11 -9 -15 15q-3 16 -2 38q1 29 10 52t24 47t22 42q8 21 26.5 72t29.5 78t30 61t39 54q110 143 124 195 q-12 112 -16 310q-2 90 24 151.5t106 104.5q39 21 104 21q53 1 106 -13.5t89 -41.5q57 -42 91.5 -121.5t29.5 -147.5q-5 -95 30 -214q34 -113 133 -218q55 -59 99.5 -163t59.5 -191q8 -49 5 -84.5t-12 -55.5t-20 -22q-10 -2 -23.5 -19t-27 -35.5t-40.5 -33.5t-61 -14 q-18 1 -31.5 5t-22.5 13.5t-13.5 15.5t-11.5 20.5t-9 19.5q-22 37 -41 30t-28 -49t7 -97q20 -70 1 -195q-10 -65 18 -100.5t73 -33t85 35.5q59 49 89.5 66.5t103.5 42.5q53 18 77 36.5t18.5 34.5t-25 28.5t-51.5 23.5q-33 11 -49.5 48t-15 72.5t15.5 47.5q1 -31 8 -56.5 t14.5 -40.5t20.5 -28.5t21 -19t21.5 -13t16.5 -9.5z" /> +<glyph unicode="" d="M1024 36q-42 241 -140 498h-2l-2 -1q-16 -6 -43 -16.5t-101 -49t-137 -82t-131 -114.5t-103 -148l-15 11q184 -150 418 -150q132 0 256 52zM839 643q-21 49 -53 111q-311 -93 -673 -93q-1 -7 -1 -21q0 -124 44 -236.5t124 -201.5q50 89 123.5 166.5t142.5 124.5t130.5 81 t99.5 48l37 13q4 1 13 3.5t13 4.5zM732 855q-120 213 -244 378q-138 -65 -234 -186t-128 -272q302 0 606 80zM1416 536q-210 60 -409 29q87 -239 128 -469q111 75 185 189.5t96 250.5zM611 1277q-1 0 -2 -1q1 1 2 1zM1201 1132q-185 164 -433 164q-76 0 -155 -19 q131 -170 246 -382q69 26 130 60.5t96.5 61.5t65.5 57t37.5 40.5zM1424 647q-3 232 -149 410l-1 -1q-9 -12 -19 -24.5t-43.5 -44.5t-71 -60.5t-100 -65t-131.5 -64.5q25 -53 44 -95q2 -6 6.5 -17.5t7.5 -16.5q36 5 74.5 7t73.5 2t69 -1.5t64 -4t56.5 -5.5t48 -6.5t36.5 -6 t25 -4.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1173 473q0 50 -19.5 91.5t-48.5 68.5t-73 49t-82.5 34t-87.5 23l-104 24q-30 7 -44 10.5t-35 11.5t-30 16t-16.5 21t-7.5 30q0 77 144 77q43 0 77 -12t54 -28.5t38 -33.5t40 -29t48 -12q47 0 75.5 32t28.5 77q0 55 -56 99.5t-142 67.5t-182 23q-68 0 -132 -15.5 t-119.5 -47t-89 -87t-33.5 -128.5q0 -61 19 -106.5t56 -75.5t80 -48.5t103 -32.5l146 -36q90 -22 112 -36q32 -20 32 -60q0 -39 -40 -64.5t-105 -25.5q-51 0 -91.5 16t-65 38.5t-45.5 45t-46 38.5t-54 16q-50 0 -75.5 -30t-25.5 -75q0 -92 122 -157.5t291 -65.5 q73 0 140 18.5t122.5 53.5t88.5 93.5t33 131.5zM1536 256q0 -159 -112.5 -271.5t-271.5 -112.5q-130 0 -234 80q-77 -16 -150 -16q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5q0 73 16 150q-80 104 -80 234q0 159 112.5 271.5t271.5 112.5q130 0 234 -80 q77 16 150 16q143 0 273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -73 -16 -150q80 -104 80 -234z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1000 1102l37 194q5 23 -9 40t-35 17h-712q-23 0 -38.5 -17t-15.5 -37v-1101q0 -7 6 -1l291 352q23 26 38 33.5t48 7.5h239q22 0 37 14.5t18 29.5q24 130 37 191q4 21 -11.5 40t-36.5 19h-294q-29 0 -48 19t-19 48v42q0 29 19 47.5t48 18.5h346q18 0 35 13.5t20 29.5z M1227 1324q-15 -73 -53.5 -266.5t-69.5 -350t-35 -173.5q-6 -22 -9 -32.5t-14 -32.5t-24.5 -33t-38.5 -21t-58 -10h-271q-13 0 -22 -10q-8 -9 -426 -494q-22 -25 -58.5 -28.5t-48.5 5.5q-55 22 -55 98v1410q0 55 38 102.5t120 47.5h888q95 0 127 -53t10 -159zM1227 1324 l-158 -790q4 17 35 173.5t69.5 350t53.5 266.5z" /> +<glyph unicode="" d="M704 192v1024q0 14 -9 23t-23 9h-480q-14 0 -23 -9t-9 -23v-1024q0 -14 9 -23t23 -9h480q14 0 23 9t9 23zM1376 576v640q0 14 -9 23t-23 9h-480q-14 0 -23 -9t-9 -23v-640q0 -14 9 -23t23 -9h480q14 0 23 9t9 23zM1536 1344v-1408q0 -26 -19 -45t-45 -19h-1408 q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1280 480q0 -40 -28 -68t-68 -28q-51 0 -80 43l-227 341h-45v-132l247 -411q9 -15 9 -33q0 -26 -19 -45t-45 -19h-192v-272q0 -46 -33 -79t-79 -33h-160q-46 0 -79 33t-33 79v272h-192q-26 0 -45 19t-19 45q0 18 9 33l247 411v132h-45l-227 -341q-29 -43 -80 -43 q-40 0 -68 28t-28 68q0 29 16 53l256 384q73 107 176 107h384q103 0 176 -107l256 -384q16 -24 16 -53zM864 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832v-416q0 -40 -28 -68t-68 -28t-68 28t-28 68v352h-64v-912q0 -46 -33 -79t-79 -33t-79 33t-33 79v464h-64v-464q0 -46 -33 -79t-79 -33t-79 33t-33 79v912h-64v-352q0 -40 -28 -68t-68 -28t-68 28t-28 68v416q0 80 56 136t136 56h640q80 0 136 -56t56 -136z M736 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" d="M773 234l350 473q16 22 24.5 59t-6 85t-61.5 79q-40 26 -83 25.5t-73.5 -17.5t-54.5 -45q-36 -40 -96 -40q-59 0 -95 40q-24 28 -54.5 45t-73.5 17.5t-84 -25.5q-46 -31 -60.5 -79t-6 -85t24.5 -59zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1472 640q0 117 -45.5 223.5t-123 184t-184 123t-223.5 45.5t-223.5 -45.5t-184 -123t-123 -184t-45.5 -223.5t45.5 -223.5t123 -184t184 -123t223.5 -45.5t223.5 45.5t184 123t123 184t45.5 223.5zM1748 363q-4 -15 -20 -20l-292 -96v-306q0 -16 -13 -26q-15 -10 -29 -4 l-292 94l-180 -248q-10 -13 -26 -13t-26 13l-180 248l-292 -94q-14 -6 -29 4q-13 10 -13 26v306l-292 96q-16 5 -20 20q-5 17 4 29l180 248l-180 248q-9 13 -4 29q4 15 20 20l292 96v306q0 16 13 26q15 10 29 4l292 -94l180 248q9 12 26 12t26 -12l180 -248l292 94 q14 6 29 -4q13 -10 13 -26v-306l292 -96q16 -5 20 -20q5 -16 -4 -29l-180 -248l180 -248q9 -12 4 -29z" /> +<glyph unicode="" d="M1262 233q-54 -9 -110 -9q-182 0 -337 90t-245 245t-90 337q0 192 104 357q-201 -60 -328.5 -229t-127.5 -384q0 -130 51 -248.5t136.5 -204t204 -136.5t248.5 -51q144 0 273.5 61.5t220.5 171.5zM1465 318q-94 -203 -283.5 -324.5t-413.5 -121.5q-156 0 -298 61 t-245 164t-164 245t-61 298q0 153 57.5 292.5t156 241.5t235.5 164.5t290 68.5q44 2 61 -39q18 -41 -15 -72q-86 -78 -131.5 -181.5t-45.5 -218.5q0 -148 73 -273t198 -198t273 -73q118 0 228 51q41 18 72 -13q14 -14 17.5 -34t-4.5 -38z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1088 704q0 26 -19 45t-45 19h-256q-26 0 -45 -19t-19 -45t19 -45t45 -19h256q26 0 45 19t19 45zM1664 896v-960q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v960q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1728 1344v-256q0 -26 -19 -45t-45 -19h-1536 q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1536q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1632 576q0 -26 -19 -45t-45 -19h-224q0 -171 -67 -290l208 -209q19 -19 19 -45t-19 -45q-18 -19 -45 -19t-45 19l-198 197q-5 -5 -15 -13t-42 -28.5t-65 -36.5t-82 -29t-97 -13v896h-128v-896q-51 0 -101.5 13.5t-87 33t-66 39t-43.5 32.5l-15 14l-183 -207 q-20 -21 -48 -21q-24 0 -43 16q-19 18 -20.5 44.5t15.5 46.5l202 227q-58 114 -58 274h-224q-26 0 -45 19t-19 45t19 45t45 19h224v294l-173 173q-19 19 -19 45t19 45t45 19t45 -19l173 -173h844l173 173q19 19 45 19t45 -19t19 -45t-19 -45l-173 -173v-294h224q26 0 45 -19 t19 -45zM1152 1152h-640q0 133 93.5 226.5t226.5 93.5t226.5 -93.5t93.5 -226.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1917 1016q23 -64 -150 -294q-24 -32 -65 -85q-78 -100 -90 -131q-17 -41 14 -81q17 -21 81 -82h1l1 -1l1 -1l2 -2q141 -131 191 -221q3 -5 6.5 -12.5t7 -26.5t-0.5 -34t-25 -27.5t-59 -12.5l-256 -4q-24 -5 -56 5t-52 22l-20 12q-30 21 -70 64t-68.5 77.5t-61 58 t-56.5 15.5q-3 -1 -8 -3.5t-17 -14.5t-21.5 -29.5t-17 -52t-6.5 -77.5q0 -15 -3.5 -27.5t-7.5 -18.5l-4 -5q-18 -19 -53 -22h-115q-71 -4 -146 16.5t-131.5 53t-103 66t-70.5 57.5l-25 24q-10 10 -27.5 30t-71.5 91t-106 151t-122.5 211t-130.5 272q-6 16 -6 27t3 16l4 6 q15 19 57 19l274 2q12 -2 23 -6.5t16 -8.5l5 -3q16 -11 24 -32q20 -50 46 -103.5t41 -81.5l16 -29q29 -60 56 -104t48.5 -68.5t41.5 -38.5t34 -14t27 5q2 1 5 5t12 22t13.5 47t9.5 81t0 125q-2 40 -9 73t-14 46l-6 12q-25 34 -85 43q-13 2 5 24q17 19 38 30q53 26 239 24 q82 -1 135 -13q20 -5 33.5 -13.5t20.5 -24t10.5 -32t3.5 -45.5t-1 -55t-2.5 -70.5t-1.5 -82.5q0 -11 -1 -42t-0.5 -48t3.5 -40.5t11.5 -39t22.5 -24.5q8 -2 17 -4t26 11t38 34.5t52 67t68 107.5q60 104 107 225q4 10 10 17.5t11 10.5l4 3l5 2.5t13 3t20 0.5l288 2 q39 5 64 -2.5t31 -16.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M675 252q21 34 11 69t-45 50q-34 14 -73 1t-60 -46q-22 -34 -13 -68.5t43 -50.5t74.5 -2.5t62.5 47.5zM769 373q8 13 3.5 26.5t-17.5 18.5q-14 5 -28.5 -0.5t-21.5 -18.5q-17 -31 13 -45q14 -5 29 0.5t22 18.5zM943 266q-45 -102 -158 -150t-224 -12 q-107 34 -147.5 126.5t6.5 187.5q47 93 151.5 139t210.5 19q111 -29 158.5 -119.5t2.5 -190.5zM1255 426q-9 96 -89 170t-208.5 109t-274.5 21q-223 -23 -369.5 -141.5t-132.5 -264.5q9 -96 89 -170t208.5 -109t274.5 -21q223 23 369.5 141.5t132.5 264.5zM1563 422 q0 -68 -37 -139.5t-109 -137t-168.5 -117.5t-226 -83t-270.5 -31t-275 33.5t-240.5 93t-171.5 151t-65 199.5q0 115 69.5 245t197.5 258q169 169 341.5 236t246.5 -7q65 -64 20 -209q-4 -14 -1 -20t10 -7t14.5 0.5t13.5 3.5l6 2q139 59 246 59t153 -61q45 -63 0 -178 q-2 -13 -4.5 -20t4.5 -12.5t12 -7.5t17 -6q57 -18 103 -47t80 -81.5t34 -116.5zM1489 1046q42 -47 54.5 -108.5t-6.5 -117.5q-8 -23 -29.5 -34t-44.5 -4q-23 8 -34 29.5t-4 44.5q20 63 -24 111t-107 35q-24 -5 -45 8t-25 37q-5 24 8 44.5t37 25.5q60 13 119 -5.5t101 -65.5z M1670 1209q87 -96 112.5 -222.5t-13.5 -241.5q-9 -27 -34 -40t-52 -4t-40 34t-5 52q28 82 10 172t-80 158q-62 69 -148 95.5t-173 8.5q-28 -6 -52 9.5t-30 43.5t9.5 51.5t43.5 29.5q123 26 244 -11.5t208 -134.5z" /> +<glyph unicode="" d="M1133 -34q-171 -94 -368 -94q-196 0 -367 94q138 87 235.5 211t131.5 268q35 -144 132.5 -268t235.5 -211zM638 1394v-485q0 -252 -126.5 -459.5t-330.5 -306.5q-181 215 -181 495q0 187 83.5 349.5t229.5 269.5t325 137zM1536 638q0 -280 -181 -495 q-204 99 -330.5 306.5t-126.5 459.5v485q179 -30 325 -137t229.5 -269.5t83.5 -349.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1402 433q-32 -80 -76 -138t-91 -88.5t-99 -46.5t-101.5 -14.5t-96.5 8.5t-86.5 22t-69.5 27.5t-46 22.5l-17 10q-113 -228 -289.5 -359.5t-384.5 -132.5q-19 0 -32 13t-13 32t13 31.5t32 12.5q173 1 322.5 107.5t251.5 294.5q-36 -14 -72 -23t-83 -13t-91 2.5t-93 28.5 t-92 59t-84.5 100t-74.5 146q114 47 214 57t167.5 -7.5t124.5 -56.5t88.5 -77t56.5 -82q53 131 79 291q-7 -1 -18 -2.5t-46.5 -2.5t-69.5 0.5t-81.5 10t-88.5 23t-84 42.5t-75 65t-54.5 94.5t-28.5 127.5q70 28 133.5 36.5t112.5 -1t92 -30t73.5 -50t56 -61t42 -63t27.5 -56 t16 -39.5l4 -16q12 122 12 195q-8 6 -21.5 16t-49 44.5t-63.5 71.5t-54 93t-33 112.5t12 127t70 138.5q73 -25 127.5 -61.5t84.5 -76.5t48 -85t20.5 -89t-0.5 -85.5t-13 -76.5t-19 -62t-17 -42l-7 -15q1 -5 1 -50.5t-1 -71.5q3 7 10 18.5t30.5 43t50.5 58t71 55.5t91.5 44.5 t112 14.5t132.5 -24q-2 -78 -21.5 -141.5t-50 -104.5t-69.5 -71.5t-81.5 -45.5t-84.5 -24t-80 -9.5t-67.5 1t-46.5 4.5l-17 3q-23 -147 -73 -283q6 7 18 18.5t49.5 41t77.5 52.5t99.5 42t117.5 20t129 -23.5t137 -77.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1259 283v-66q0 -85 -57.5 -144.5t-138.5 -59.5h-57l-260 -269v269h-529q-81 0 -138.5 59.5t-57.5 144.5v66h1238zM1259 609v-255h-1238v255h1238zM1259 937v-255h-1238v255h1238zM1259 1077v-67h-1238v67q0 84 57.5 143.5t138.5 59.5h846q81 0 138.5 -59.5t57.5 -143.5z " /> +<glyph unicode="" d="M1152 640q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v192h-352q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h352v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198 t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1152 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-352v-192q0 -14 -9 -23t-23 -9q-12 0 -24 10l-319 319q-9 9 -9 23t9 23l320 320q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5v-192h352q13 0 22.5 -9.5t9.5 -22.5zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198 t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1024 960v-640q0 -26 -19 -45t-45 -19q-20 0 -37 12l-448 320q-27 19 -27 52t27 52l448 320q17 12 37 12q26 0 45 -19t19 -45zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5z M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1024 640q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5 t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1023 349l102 -204q-58 -179 -210 -290t-339 -111q-156 0 -288.5 77.5t-210 210t-77.5 288.5q0 181 104.5 330t274.5 211l17 -131q-122 -54 -195 -165.5t-73 -244.5q0 -185 131.5 -316.5t316.5 -131.5q126 0 232.5 65t165 175.5t49.5 236.5zM1571 249l58 -114l-256 -128 q-13 -7 -29 -7q-40 0 -57 35l-239 477h-472q-24 0 -42.5 16.5t-21.5 40.5l-96 779q-2 16 6 42q14 51 57 82.5t97 31.5q66 0 113 -47t47 -113q0 -69 -52 -117.5t-120 -41.5l37 -289h423v-128h-407l16 -128h455q40 0 57 -35l228 -455z" /> +<glyph unicode="" d="M1292 898q10 216 -161 222q-231 8 -312 -261q44 19 82 19q85 0 74 -96q-4 -57 -74 -167t-105 -110q-43 0 -82 169q-13 54 -45 255q-30 189 -160 177q-59 -7 -164 -100l-81 -72l-81 -72l52 -67q76 52 87 52q57 0 107 -179q15 -55 45 -164.5t45 -164.5q68 -179 164 -179 q157 0 383 294q220 283 226 444zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1152 704q0 -191 -94.5 -353t-256.5 -256.5t-353 -94.5h-160q-14 0 -23 9t-9 23v611l-215 -66q-3 -1 -9 -1q-10 0 -19 6q-13 10 -13 26v128q0 23 23 31l233 71v93l-215 -66q-3 -1 -9 -1q-10 0 -19 6q-13 10 -13 26v128q0 23 23 31l233 71v250q0 14 9 23t23 9h160 q14 0 23 -9t9 -23v-181l375 116q15 5 28 -5t13 -26v-128q0 -23 -23 -31l-393 -121v-93l375 116q15 5 28 -5t13 -26v-128q0 -23 -23 -31l-393 -121v-487q188 13 318 151t130 328q0 14 9 23t23 9h160q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1152 736v-64q0 -14 -9 -23t-23 -9h-352v-352q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v352h-352q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h352v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-352h352q14 0 23 -9t9 -23zM1280 288v832q0 66 -47 113t-113 47h-832 q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113zM1408 1120v-832q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2176" d="M620 416q-110 -64 -268 -64h-128v64h-64q-13 0 -22.5 23.5t-9.5 56.5q0 24 7 49q-58 2 -96.5 10.5t-38.5 20.5t38.5 20.5t96.5 10.5q-7 25 -7 49q0 33 9.5 56.5t22.5 23.5h64v64h128q158 0 268 -64h1113q42 -7 106.5 -18t80.5 -14q89 -15 150 -40.5t83.5 -47.5t22.5 -40 t-22.5 -40t-83.5 -47.5t-150 -40.5q-16 -3 -80.5 -14t-106.5 -18h-1113zM1739 668q53 -36 53 -92t-53 -92l81 -30q68 48 68 122t-68 122zM625 400h1015q-217 -38 -456 -80q-57 0 -113 -24t-83 -48l-28 -24l-288 -288q-26 -26 -70.5 -45t-89.5 -19h-96l-93 464h29 q157 0 273 64zM352 816h-29l93 464h96q46 0 90 -19t70 -45l288 -288q4 -4 11 -10.5t30.5 -23t48.5 -29t61.5 -23t72.5 -10.5l456 -80h-1015q-116 64 -273 64z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1519 760q62 0 103.5 -40.5t41.5 -101.5q0 -97 -93 -130l-172 -59l56 -167q7 -21 7 -47q0 -59 -42 -102t-101 -43q-47 0 -85.5 27t-53.5 72l-55 165l-310 -106l55 -164q8 -24 8 -47q0 -59 -42 -102t-102 -43q-47 0 -85 27t-53 72l-55 163l-153 -53q-29 -9 -50 -9 q-61 0 -101.5 40t-40.5 101q0 47 27.5 85t71.5 53l156 53l-105 313l-156 -54q-26 -8 -48 -8q-60 0 -101 40.5t-41 100.5q0 47 27.5 85t71.5 53l157 53l-53 159q-8 24 -8 47q0 60 42 102.5t102 42.5q47 0 85 -27t53 -72l54 -160l310 105l-54 160q-8 24 -8 47q0 59 42.5 102 t101.5 43q47 0 85.5 -27.5t53.5 -71.5l53 -161l162 55q21 6 43 6q60 0 102.5 -39.5t42.5 -98.5q0 -45 -30 -81.5t-74 -51.5l-157 -54l105 -316l164 56q24 8 46 8zM725 498l310 105l-105 315l-310 -107z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM1280 352v436q-31 -35 -64 -55q-34 -22 -132.5 -85t-151.5 -99q-98 -69 -164 -69v0v0q-66 0 -164 69 q-46 32 -141.5 92.5t-142.5 92.5q-12 8 -33 27t-31 27v-436q0 -40 28 -68t68 -28h832q40 0 68 28t28 68zM1280 925q0 41 -27.5 70t-68.5 29h-832q-40 0 -68 -28t-28 -68q0 -37 30.5 -76.5t67.5 -64.5q47 -32 137.5 -89t129.5 -83q3 -2 17 -11.5t21 -14t21 -13t23.5 -13 t21.5 -9.5t22.5 -7.5t20.5 -2.5t20.5 2.5t22.5 7.5t21.5 9.5t23.5 13t21 13t21 14t17 11.5l267 174q35 23 66.5 62.5t31.5 73.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M127 640q0 163 67 313l367 -1005q-196 95 -315 281t-119 411zM1415 679q0 -19 -2.5 -38.5t-10 -49.5t-11.5 -44t-17.5 -59t-17.5 -58l-76 -256l-278 826q46 3 88 8q19 2 26 18.5t-2.5 31t-28.5 13.5l-205 -10q-75 1 -202 10q-12 1 -20.5 -5t-11.5 -15t-1.5 -18.5t9 -16.5 t19.5 -8l80 -8l120 -328l-168 -504l-280 832q46 3 88 8q19 2 26 18.5t-2.5 31t-28.5 13.5l-205 -10q-7 0 -23 0.5t-26 0.5q105 160 274.5 253.5t367.5 93.5q147 0 280.5 -53t238.5 -149h-10q-55 0 -92 -40.5t-37 -95.5q0 -12 2 -24t4 -21.5t8 -23t9 -21t12 -22.5t12.5 -21 t14.5 -24t14 -23q63 -107 63 -212zM909 573l237 -647q1 -6 5 -11q-126 -44 -255 -44q-112 0 -217 32zM1570 1009q95 -174 95 -369q0 -209 -104 -385.5t-279 -278.5l235 678q59 169 59 276q0 42 -6 79zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286 t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM896 -215q173 0 331.5 68t273 182.5t182.5 273t68 331.5t-68 331.5t-182.5 273t-273 182.5t-331.5 68t-331.5 -68t-273 -182.5t-182.5 -273t-68 -331.5t68 -331.5t182.5 -273 t273 -182.5t331.5 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1086 1536v-1536l-272 -128q-228 20 -414 102t-293 208.5t-107 272.5q0 140 100.5 263.5t275 205.5t391.5 108v-172q-217 -38 -356.5 -150t-139.5 -255q0 -152 154.5 -267t388.5 -145v1360zM1755 954l37 -390l-525 114l147 83q-119 70 -280 99v172q277 -33 481 -157z" /> +<glyph unicode="" horiz-adv-x="2048" d="M960 1536l960 -384v-128h-128q0 -26 -20.5 -45t-48.5 -19h-1526q-28 0 -48.5 19t-20.5 45h-128v128zM256 896h256v-768h128v768h256v-768h128v768h256v-768h128v768h256v-768h59q28 0 48.5 -19t20.5 -45v-64h-1664v64q0 26 20.5 45t48.5 19h59v768zM1851 -64 q28 0 48.5 -19t20.5 -45v-128h-1920v128q0 26 20.5 45t48.5 19h1782z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1774 700l18 -316q4 -69 -82 -128t-235 -93.5t-323 -34.5t-323 34.5t-235 93.5t-82 128l18 316l574 -181q22 -7 48 -7t48 7zM2304 1024q0 -23 -22 -31l-1120 -352q-4 -1 -10 -1t-10 1l-652 206q-43 -34 -71 -111.5t-34 -178.5q63 -36 63 -109q0 -69 -58 -107l58 -433 q2 -14 -8 -25q-9 -11 -24 -11h-192q-15 0 -24 11q-10 11 -8 25l58 433q-58 38 -58 107q0 73 65 111q11 207 98 330l-333 104q-22 8 -22 31t22 31l1120 352q4 1 10 1t10 -1l1120 -352q22 -8 22 -31z" /> +<glyph unicode="" d="M859 579l13 -707q-62 11 -105 11q-41 0 -105 -11l13 707q-40 69 -168.5 295.5t-216.5 374.5t-181 287q58 -15 108 -15q43 0 111 15q63 -111 133.5 -229.5t167 -276.5t138.5 -227q37 61 109.5 177.5t117.5 190t105 176t107 189.5q54 -14 107 -14q56 0 114 14v0 q-28 -39 -60 -88.5t-49.5 -78.5t-56.5 -96t-49 -84q-146 -248 -353 -610z" /> +<glyph unicode="" horiz-adv-x="1280" d="M981 197q0 25 -7 49t-14.5 42t-27 41.5t-29.5 35t-38.5 34.5t-36.5 29t-41.5 30t-36.5 26q-16 2 -49 2q-53 0 -104.5 -7t-107 -25t-97 -46t-68.5 -74.5t-27 -105.5q0 -56 23.5 -102t61 -75.5t87 -50t100 -29t101.5 -8.5q58 0 111.5 13t99 39t73 73t27.5 109zM864 1055 q0 59 -17 125.5t-48 129t-84 103.5t-117 41q-42 0 -82.5 -19.5t-66.5 -52.5q-46 -59 -46 -160q0 -46 10 -97.5t31.5 -103t52 -92.5t75 -67t96.5 -26q37 0 77.5 16.5t65.5 43.5q53 56 53 159zM752 1536h417l-137 -88h-132q75 -63 113 -133t38 -160q0 -72 -24.5 -129.5 t-59.5 -93t-69.5 -65t-59 -61.5t-24.5 -66q0 -36 32 -70.5t77 -68t90.5 -73.5t77.5 -104t32 -142q0 -91 -49 -173q-71 -122 -209.5 -179.5t-298.5 -57.5q-132 0 -246.5 41.5t-172.5 137.5q-36 59 -36 131q0 81 44.5 150t118.5 115q131 82 404 100q-32 41 -47.5 73.5 t-15.5 73.5q0 40 21 85q-46 -4 -68 -4q-148 0 -249.5 96.5t-101.5 244.5q0 82 36 159t99 131q76 66 182 98t218 32z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1095 369q16 -16 0 -31q-62 -62 -199 -62t-199 62q-16 15 0 31q6 6 15 6t15 -6q48 -49 169 -49q120 0 169 49q6 6 15 6t15 -6zM788 550q0 -37 -26 -63t-63 -26t-63.5 26t-26.5 63q0 38 26.5 64t63.5 26t63 -26.5t26 -63.5zM1183 550q0 -37 -26.5 -63t-63.5 -26t-63 26 t-26 63t26 63.5t63 26.5t63.5 -26t26.5 -64zM1434 670q0 49 -35 84t-85 35t-86 -36q-130 90 -311 96l63 283l200 -45q0 -37 26 -63t63 -26t63.5 26.5t26.5 63.5t-26.5 63.5t-63.5 26.5q-54 0 -80 -50l-221 49q-19 5 -25 -16l-69 -312q-180 -7 -309 -97q-35 37 -87 37 q-50 0 -85 -35t-35 -84q0 -35 18.5 -64t49.5 -44q-6 -27 -6 -56q0 -142 140 -243t337 -101q198 0 338 101t140 243q0 32 -7 57q30 15 48 43.5t18 63.5zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191 t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" d="M939 407q13 -13 0 -26q-53 -53 -171 -53t-171 53q-13 13 0 26q5 6 13 6t13 -6q42 -42 145 -42t145 42q5 6 13 6t13 -6zM676 563q0 -31 -23 -54t-54 -23t-54 23t-23 54q0 32 22.5 54.5t54.5 22.5t54.5 -22.5t22.5 -54.5zM1014 563q0 -31 -23 -54t-54 -23t-54 23t-23 54 q0 32 22.5 54.5t54.5 22.5t54.5 -22.5t22.5 -54.5zM1229 666q0 42 -30 72t-73 30q-42 0 -73 -31q-113 78 -267 82l54 243l171 -39q1 -32 23.5 -54t53.5 -22q32 0 54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5q-48 0 -69 -43l-189 42q-17 5 -21 -13l-60 -268q-154 -6 -265 -83 q-30 32 -74 32q-43 0 -73 -30t-30 -72q0 -30 16 -55t42 -38q-5 -25 -5 -48q0 -122 120 -208.5t289 -86.5q170 0 290 86.5t120 208.5q0 25 -6 49q25 13 40.5 37.5t15.5 54.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M866 697l90 27v62q0 79 -58 135t-138 56t-138 -55.5t-58 -134.5v-283q0 -20 -14 -33.5t-33 -13.5t-32.5 13.5t-13.5 33.5v120h-151v-122q0 -82 57.5 -139t139.5 -57q81 0 138.5 56.5t57.5 136.5v280q0 19 13.5 33t33.5 14q19 0 32.5 -14t13.5 -33v-54zM1199 502v122h-150 v-126q0 -20 -13.5 -33.5t-33.5 -13.5q-19 0 -32.5 14t-13.5 33v123l-90 -26l-60 28v-123q0 -80 58 -137t139 -57t138.5 57t57.5 139zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103 t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1062 824v118q0 42 -30 72t-72 30t-72 -30t-30 -72v-612q0 -175 -126 -299t-303 -124q-178 0 -303.5 125.5t-125.5 303.5v266h328v-262q0 -43 30 -72.5t72 -29.5t72 29.5t30 72.5v620q0 171 126.5 292t301.5 121q176 0 302 -122t126 -294v-136l-195 -58zM1592 602h328 v-266q0 -178 -125.5 -303.5t-303.5 -125.5q-177 0 -303 124.5t-126 300.5v268l131 -61l195 58v-270q0 -42 30 -71.5t72 -29.5t72 29.5t30 71.5v275z" /> +<glyph unicode="" d="M1472 160v480h-704v704h-480q-93 0 -158.5 -65.5t-65.5 -158.5v-480h704v-704h480q93 0 158.5 65.5t65.5 158.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M328 1254h204v-983h-532v697h328v286zM328 435v369h-123v-369h123zM614 968v-697h205v697h-205zM614 1254v-204h205v204h-205zM901 968h533v-942h-533v163h328v82h-328v697zM1229 435v369h-123v-369h123zM1516 968h532v-942h-532v163h327v82h-327v697zM1843 435v369h-123 v-369h123z" /> +<glyph unicode="" d="M1046 516q0 -64 -38 -109t-91 -45q-43 0 -70 15v277q28 17 70 17q53 0 91 -45.5t38 -109.5zM703 944q0 -64 -38 -109.5t-91 -45.5q-43 0 -70 15v277q28 17 70 17q53 0 91 -45t38 -109zM1265 513q0 134 -88 229t-213 95q-20 0 -39 -3q-23 -78 -78 -136q-87 -95 -211 -101 v-636l211 41v206q51 -19 117 -19q125 0 213 95t88 229zM922 940q0 134 -88.5 229t-213.5 95q-74 0 -141 -36h-186v-840l211 41v206q55 -19 116 -19q125 0 213.5 95t88.5 229zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2038" d="M1222 607q75 3 143.5 -20.5t118 -58.5t101 -94.5t84 -108t75.5 -120.5q33 -56 78.5 -109t75.5 -80.5t99 -88.5q-48 -30 -108.5 -57.5t-138.5 -59t-114 -47.5q-44 37 -74 115t-43.5 164.5t-33 180.5t-42.5 168.5t-72.5 123t-122.5 48.5l-10 -2l-6 -4q4 -5 13 -14 q6 -5 28 -23.5t25.5 -22t19 -18t18 -20.5t11.5 -21t10.5 -27.5t4.5 -31t4 -40.5l1 -33q1 -26 -2.5 -57.5t-7.5 -52t-12.5 -58.5t-11.5 -53q-35 1 -101 -9.5t-98 -10.5q-39 0 -72 10q-2 16 -2 47q0 74 3 96q2 13 31.5 41.5t57 59t26.5 51.5q-24 2 -43 -24 q-36 -53 -111.5 -99.5t-136.5 -46.5q-25 0 -75.5 63t-106.5 139.5t-84 96.5q-6 4 -27 30q-482 -112 -513 -112q-16 0 -28 11t-12 27q0 15 8.5 26.5t22.5 14.5l486 106q-8 14 -8 25t5.5 17.5t16 11.5t20 7t23 4.5t18.5 4.5q4 1 15.5 7.5t17.5 6.5q15 0 28 -16t20 -33 q163 37 172 37q17 0 29.5 -11t12.5 -28q0 -15 -8.5 -26t-23.5 -14l-182 -40l-1 -16q-1 -26 81.5 -117.5t104.5 -91.5q47 0 119 80t72 129q0 36 -23.5 53t-51 18.5t-51 11.5t-23.5 34q0 16 10 34l-68 19q43 44 43 117q0 26 -5 58q82 16 144 16q44 0 71.5 -1.5t48.5 -8.5 t31 -13.5t20.5 -24.5t15.5 -33.5t17 -47.5t24 -60l50 25q-3 -40 -23 -60t-42.5 -21t-40 -6.5t-16.5 -20.5zM1282 842q-5 5 -13.5 15.5t-12 14.5t-10.5 11.5t-10 10.5l-8 8t-8.5 7.5t-8 5t-8.5 4.5q-7 3 -14.5 5t-20.5 2.5t-22 0.5h-32.5h-37.5q-126 0 -217 -43 q16 30 36 46.5t54 29.5t65.5 36t46 36.5t50 55t43.5 50.5q12 -9 28 -31.5t32 -36.5t38 -13l12 1v-76l22 -1q247 95 371 190q28 21 50 39t42.5 37.5t33 31t29.5 34t24 31t24.5 37t23 38t27 47.5t29.5 53l7 9q-2 -53 -43 -139q-79 -165 -205 -264t-306 -142q-14 -3 -42 -7.5 t-50 -9.5t-39 -14q3 -19 24.5 -46t21.5 -34q0 -11 -26 -30zM1061 -79q39 26 131.5 47.5t146.5 21.5q9 0 22.5 -15.5t28 -42.5t26 -50t24 -51t14.5 -33q-121 -45 -244 -45q-61 0 -125 11zM822 568l48 12l109 -177l-73 -48zM1323 51q3 -15 3 -16q0 -7 -17.5 -14.5t-46 -13 t-54 -9.5t-53.5 -7.5t-32 -4.5l-7 43q21 2 60.5 8.5t72 10t60.5 3.5h14zM866 679l-96 -20l-6 17q10 1 32.5 7t34.5 6q19 0 35 -10zM1061 45h31l10 -83l-41 -12v95zM1950 1535v1v-1zM1950 1535l-1 -5l-2 -2l1 3zM1950 1535l1 1z" /> +<glyph unicode="" d="M1167 -50q-5 19 -24 5q-30 -22 -87 -39t-131 -17q-129 0 -193 49q-5 4 -13 4q-11 0 -26 -12q-7 -6 -7.5 -16t7.5 -20q34 -32 87.5 -46t102.5 -12.5t99 4.5q41 4 84.5 20.5t65 30t28.5 20.5q12 12 7 29zM1128 65q-19 47 -39 61q-23 15 -76 15q-47 0 -71 -10 q-29 -12 -78 -56q-26 -24 -12 -44q9 -8 17.5 -4.5t31.5 23.5q3 2 10.5 8.5t10.5 8.5t10 7t11.5 7t12.5 5t15 4.5t16.5 2.5t20.5 1q27 0 44.5 -7.5t23 -14.5t13.5 -22q10 -17 12.5 -20t12.5 1q23 12 14 34zM1483 346q0 22 -5 44.5t-16.5 45t-34 36.5t-52.5 14 q-33 0 -97 -41.5t-129 -83.5t-101 -42q-27 -1 -63.5 19t-76 49t-83.5 58t-100 49t-111 19q-115 -1 -197 -78.5t-84 -178.5q-2 -112 74 -164q29 -20 62.5 -28.5t103.5 -8.5q57 0 132 32.5t134 71t120 70.5t93 31q26 -1 65 -31.5t71.5 -67t68 -67.5t55.5 -32q35 -3 58.5 14 t55.5 63q28 41 42.5 101t14.5 106zM1536 506q0 -164 -62 -304.5t-166 -236t-242.5 -149.5t-290.5 -54t-293 57.5t-247.5 157t-170.5 241.5t-64 302q0 89 19.5 172.5t49 145.5t70.5 118.5t78.5 94t78.5 69.5t64.5 46.5t42.5 24.5q14 8 51 26.5t54.5 28.5t48 30t60.5 44 q36 28 58 72.5t30 125.5q129 -155 186 -193q44 -29 130 -68t129 -66q21 -13 39 -25t60.5 -46.5t76 -70.5t75 -95t69 -122t47 -148.5t19.5 -177.5z" /> +<glyph unicode="" d="M1070 463l-160 -160l-151 -152l-30 -30q-65 -64 -151.5 -87t-171.5 -2q-16 -70 -72 -115t-129 -45q-85 0 -145 60.5t-60 145.5q0 72 44.5 128t113.5 72q-22 86 1 173t88 152l12 12l151 -152l-11 -11q-37 -37 -37 -89t37 -90q37 -37 89 -37t89 37l30 30l151 152l161 160z M729 1145l12 -12l-152 -152l-12 12q-37 37 -89 37t-89 -37t-37 -89.5t37 -89.5l29 -29l152 -152l160 -160l-151 -152l-161 160l-151 152l-30 30q-68 67 -90 159.5t5 179.5q-70 15 -115 71t-45 129q0 85 60 145.5t145 60.5q76 0 133.5 -49t69.5 -123q84 20 169.5 -3.5 t149.5 -87.5zM1536 78q0 -85 -60 -145.5t-145 -60.5q-74 0 -131 47t-71 118q-86 -28 -179.5 -6t-161.5 90l-11 12l151 152l12 -12q37 -37 89 -37t89 37t37 89t-37 89l-30 30l-152 152l-160 160l152 152l160 -160l152 -152l29 -30q64 -64 87.5 -150.5t2.5 -171.5 q76 -11 126.5 -68.5t50.5 -134.5zM1534 1202q0 -77 -51 -135t-127 -69q26 -85 3 -176.5t-90 -158.5l-12 -12l-151 152l12 12q37 37 37 89t-37 89t-89 37t-89 -37l-30 -30l-152 -152l-160 -160l-152 152l161 160l152 152l29 30q67 67 159 89.5t178 -3.5q11 75 68.5 126 t135.5 51q85 0 145 -60.5t60 -145.5z" /> +<glyph unicode="" d="M654 458q-1 -3 -12.5 0.5t-31.5 11.5l-20 9q-44 20 -87 49q-7 5 -41 31.5t-38 28.5q-67 -103 -134 -181q-81 -95 -105 -110q-4 -2 -19.5 -4t-18.5 0q6 4 82 92q21 24 85.5 115t78.5 118q17 30 51 98.5t36 77.5q-8 1 -110 -33q-8 -2 -27.5 -7.5t-34.5 -9.5t-17 -5 q-2 -2 -2 -10.5t-1 -9.5q-5 -10 -31 -15q-23 -7 -47 0q-18 4 -28 21q-4 6 -5 23q6 2 24.5 5t29.5 6q58 16 105 32q100 35 102 35q10 2 43 19.5t44 21.5q9 3 21.5 8t14.5 5.5t6 -0.5q2 -12 -1 -33q0 -2 -12.5 -27t-26.5 -53.5t-17 -33.5q-25 -50 -77 -131l64 -28 q12 -6 74.5 -32t67.5 -28q4 -1 10.5 -25.5t4.5 -30.5zM449 944q3 -15 -4 -28q-12 -23 -50 -38q-30 -12 -60 -12q-26 3 -49 26q-14 15 -18 41l1 3q3 -3 19.5 -5t26.5 0t58 16q36 12 55 14q17 0 21 -17zM1147 815l63 -227l-139 42zM39 15l694 232v1032l-694 -233v-1031z M1280 332l102 -31l-181 657l-100 31l-216 -536l102 -31l45 110l211 -65zM777 1294l573 -184v380zM1088 -29l158 -13l-54 -160l-40 66q-130 -83 -276 -108q-58 -12 -91 -12h-84q-79 0 -199.5 39t-183.5 85q-8 7 -8 16q0 8 5 13.5t13 5.5q4 0 18 -7.5t30.5 -16.5t20.5 -11 q73 -37 159.5 -61.5t157.5 -24.5q95 0 167 14.5t157 50.5q15 7 30.5 15.5t34 19t28.5 16.5zM1536 1050v-1079l-774 246q-14 -6 -375 -127.5t-368 -121.5q-13 0 -18 13q0 1 -1 3v1078q3 9 4 10q5 6 20 11q106 35 149 50v384l558 -198q2 0 160.5 55t316 108.5t161.5 53.5 q20 0 20 -21v-418z" /> +<glyph unicode="" horiz-adv-x="1792" d="M288 1152q66 0 113 -47t47 -113v-1088q0 -66 -47 -113t-113 -47h-128q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h128zM1664 989q58 -34 93 -93t35 -128v-768q0 -106 -75 -181t-181 -75h-864q-66 0 -113 47t-47 113v1536q0 40 28 68t68 28h672q40 0 88 -20t76 -48 l152 -152q28 -28 48 -76t20 -88v-163zM928 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM928 256v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM928 512v128q0 14 -9 23 t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1184 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1184 256v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128 q14 0 23 9t9 23zM1184 512v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 256v128q0 14 -9 23t-23 9h-128 q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 512v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1536 896v256h-160q-40 0 -68 28t-28 68v160h-640v-512h896z" /> +<glyph unicode="" d="M1344 1536q26 0 45 -19t19 -45v-1664q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h1280zM512 1248v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 992v-64q0 -14 9 -23t23 -9h64q14 0 23 9 t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 736v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 480v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM384 160v64 q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64 q14 0 23 9t9 23zM384 928v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 -96v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9 t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM896 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 928v64 q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 160v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64 q14 0 23 9t9 23zM1152 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 928v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9 t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1188 988l-292 -292v-824q0 -46 -33 -79t-79 -33t-79 33t-33 79v384h-64v-384q0 -46 -33 -79t-79 -33t-79 33t-33 79v824l-292 292q-28 28 -28 68t28 68t68 28t68 -28l228 -228h368l228 228q28 28 68 28t68 -28t28 -68t-28 -68zM864 1152q0 -93 -65.5 -158.5 t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M780 1064q0 -60 -19 -113.5t-63 -92.5t-105 -39q-76 0 -138 57.5t-92 135.5t-30 151q0 60 19 113.5t63 92.5t105 39q77 0 138.5 -57.5t91.5 -135t30 -151.5zM438 581q0 -80 -42 -139t-119 -59q-76 0 -141.5 55.5t-100.5 133.5t-35 152q0 80 42 139.5t119 59.5 q76 0 141.5 -55.5t100.5 -134t35 -152.5zM832 608q118 0 255 -97.5t229 -237t92 -254.5q0 -46 -17 -76.5t-48.5 -45t-64.5 -20t-76 -5.5q-68 0 -187.5 45t-182.5 45q-66 0 -192.5 -44.5t-200.5 -44.5q-183 0 -183 146q0 86 56 191.5t139.5 192.5t187.5 146t193 59zM1071 819 q-61 0 -105 39t-63 92.5t-19 113.5q0 74 30 151.5t91.5 135t138.5 57.5q61 0 105 -39t63 -92.5t19 -113.5q0 -73 -30 -151t-92 -135.5t-138 -57.5zM1503 923q77 0 119 -59.5t42 -139.5q0 -74 -35 -152t-100.5 -133.5t-141.5 -55.5q-77 0 -119 59t-42 139q0 74 35 152.5 t100.5 134t141.5 55.5z" /> +<glyph unicode="" horiz-adv-x="768" d="M704 1008q0 -145 -57 -243.5t-152 -135.5l45 -821q2 -26 -16 -45t-44 -19h-192q-26 0 -44 19t-16 45l45 821q-95 37 -152 135.5t-57 243.5q0 128 42.5 249.5t117.5 200t160 78.5t160 -78.5t117.5 -200t42.5 -249.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 -93l640 349v636l-640 -233v-752zM832 772l698 254l-698 254l-698 -254zM1664 1024v-768q0 -35 -18 -65t-49 -47l-704 -384q-28 -16 -61 -16t-61 16l-704 384q-31 17 -49 47t-18 65v768q0 40 23 73t61 47l704 256q22 8 44 8t44 -8l704 -256q38 -14 61 -47t23 -73z " /> +<glyph unicode="" horiz-adv-x="2304" d="M640 -96l384 192v314l-384 -164v-342zM576 358l404 173l-404 173l-404 -173zM1664 -96l384 192v314l-384 -164v-342zM1600 358l404 173l-404 173l-404 -173zM1152 651l384 165v266l-384 -164v-267zM1088 1030l441 189l-441 189l-441 -189zM2176 512v-416q0 -36 -19 -67 t-52 -47l-448 -224q-25 -14 -57 -14t-57 14l-448 224q-5 2 -7 4q-2 -2 -7 -4l-448 -224q-25 -14 -57 -14t-57 14l-448 224q-33 16 -52 47t-19 67v416q0 38 21.5 70t56.5 48l434 186v400q0 38 21.5 70t56.5 48l448 192q23 10 50 10t50 -10l448 -192q35 -16 56.5 -48t21.5 -70 v-400l434 -186q36 -16 57 -48t21 -70z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1848 1197h-511v-124h511v124zM1596 771q-90 0 -146 -52.5t-62 -142.5h408q-18 195 -200 195zM1612 186q63 0 122 32t76 87h221q-100 -307 -427 -307q-214 0 -340.5 132t-126.5 347q0 208 130.5 345.5t336.5 137.5q138 0 240.5 -68t153 -179t50.5 -248q0 -17 -2 -47h-658 q0 -111 57.5 -171.5t166.5 -60.5zM277 236h296q205 0 205 167q0 180 -199 180h-302v-347zM277 773h281q78 0 123.5 36.5t45.5 113.5q0 144 -190 144h-260v-294zM0 1282h594q87 0 155 -14t126.5 -47.5t90 -96.5t31.5 -154q0 -181 -172 -263q114 -32 172 -115t58 -204 q0 -75 -24.5 -136.5t-66 -103.5t-98.5 -71t-121 -42t-134 -13h-611v1260z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM499 1041h-371v-787h382q117 0 197 57.5t80 170.5q0 158 -143 200q107 52 107 164q0 57 -19.5 96.5 t-56.5 60.5t-79 29.5t-97 8.5zM477 723h-176v184h163q119 0 119 -90q0 -94 -106 -94zM486 388h-185v217h189q124 0 124 -113q0 -104 -128 -104zM1136 356q-68 0 -104 38t-36 107h411q1 10 1 30q0 132 -74.5 220.5t-203.5 88.5q-128 0 -210 -86t-82 -216q0 -135 79 -217 t213 -82q205 0 267 191h-138q-11 -34 -47.5 -54t-75.5 -20zM1126 722q113 0 124 -122h-254q4 56 39 89t91 33zM964 988h319v-77h-319v77z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1582 954q0 -101 -71.5 -172.5t-172.5 -71.5t-172.5 71.5t-71.5 172.5t71.5 172.5t172.5 71.5t172.5 -71.5t71.5 -172.5zM812 212q0 104 -73 177t-177 73q-27 0 -54 -6l104 -42q77 -31 109.5 -106.5t1.5 -151.5q-31 -77 -107 -109t-152 -1q-21 8 -62 24.5t-61 24.5 q32 -60 91 -96.5t130 -36.5q104 0 177 73t73 177zM1642 953q0 126 -89.5 215.5t-215.5 89.5q-127 0 -216.5 -89.5t-89.5 -215.5q0 -127 89.5 -216t216.5 -89q126 0 215.5 89t89.5 216zM1792 953q0 -189 -133.5 -322t-321.5 -133l-437 -319q-12 -129 -109 -218t-229 -89 q-121 0 -214 76t-118 192l-230 92v429l389 -157q79 48 173 48q13 0 35 -2l284 407q2 187 135.5 319t320.5 132q188 0 321.5 -133.5t133.5 -321.5z" /> +<glyph unicode="" d="M1242 889q0 80 -57 136.5t-137 56.5t-136.5 -57t-56.5 -136q0 -80 56.5 -136.5t136.5 -56.5t137 56.5t57 136.5zM632 301q0 -83 -58 -140.5t-140 -57.5q-56 0 -103 29t-72 77q52 -20 98 -40q60 -24 120 1.5t85 86.5q24 60 -1.5 120t-86.5 84l-82 33q22 5 42 5 q82 0 140 -57.5t58 -140.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v153l172 -69q20 -92 93.5 -152t168.5 -60q104 0 181 70t87 173l345 252q150 0 255.5 105.5t105.5 254.5q0 150 -105.5 255.5t-255.5 105.5 q-148 0 -253 -104.5t-107 -252.5l-225 -322q-9 1 -28 1q-75 0 -137 -37l-297 119v468q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5zM1289 887q0 -100 -71 -170.5t-171 -70.5t-170.5 70.5t-70.5 170.5t70.5 171t170.5 71q101 0 171.5 -70.5t70.5 -171.5z " /> +<glyph unicode="" horiz-adv-x="1792" d="M836 367l-15 -368l-2 -22l-420 29q-36 3 -67 31.5t-47 65.5q-11 27 -14.5 55t4 65t12 55t21.5 64t19 53q78 -12 509 -28zM449 953l180 -379l-147 92q-63 -72 -111.5 -144.5t-72.5 -125t-39.5 -94.5t-18.5 -63l-4 -21l-190 357q-17 26 -18 56t6 47l8 18q35 63 114 188 l-140 86zM1680 436l-188 -359q-12 -29 -36.5 -46.5t-43.5 -20.5l-18 -4q-71 -7 -219 -12l8 -164l-230 367l211 362l7 -173q170 -16 283 -5t170 33zM895 1360q-47 -63 -265 -435l-317 187l-19 12l225 356q20 31 60 45t80 10q24 -2 48.5 -12t42 -21t41.5 -33t36 -34.5 t36 -39.5t32 -35zM1550 1053l212 -363q18 -37 12.5 -76t-27.5 -74q-13 -20 -33 -37t-38 -28t-48.5 -22t-47 -16t-51.5 -14t-46 -12q-34 72 -265 436l313 195zM1407 1279l142 83l-220 -373l-419 20l151 86q-34 89 -75 166t-75.5 123.5t-64.5 80t-47 46.5l-17 13l405 -1 q31 3 58 -10.5t39 -28.5l11 -15q39 -61 112 -190z" /> +<glyph unicode="" horiz-adv-x="2048" d="M480 448q0 66 -47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47t113 47t47 113zM516 768h1016l-89 357q-2 8 -14 17.5t-21 9.5h-768q-9 0 -21 -9.5t-14 -17.5zM1888 448q0 66 -47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47t113 47t47 113zM2048 544v-384 q0 -14 -9 -23t-23 -9h-96v-128q0 -80 -56 -136t-136 -56t-136 56t-56 136v128h-1024v-128q0 -80 -56 -136t-136 -56t-136 56t-56 136v128h-96q-14 0 -23 9t-9 23v384q0 93 65.5 158.5t158.5 65.5h28l105 419q23 94 104 157.5t179 63.5h768q98 0 179 -63.5t104 -157.5 l105 -419h28q93 0 158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1824 640q93 0 158.5 -65.5t65.5 -158.5v-384q0 -14 -9 -23t-23 -9h-96v-64q0 -80 -56 -136t-136 -56t-136 56t-56 136v64h-1024v-64q0 -80 -56 -136t-136 -56t-136 56t-56 136v64h-96q-14 0 -23 9t-9 23v384q0 93 65.5 158.5t158.5 65.5h28l105 419q23 94 104 157.5 t179 63.5h128v224q0 14 9 23t23 9h448q14 0 23 -9t9 -23v-224h128q98 0 179 -63.5t104 -157.5l105 -419h28zM320 160q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47zM516 640h1016l-89 357q-2 8 -14 17.5t-21 9.5h-768q-9 0 -21 -9.5t-14 -17.5z M1728 160q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47z" /> +<glyph unicode="" d="M1504 64q0 -26 -19 -45t-45 -19h-462q1 -17 6 -87.5t5 -108.5q0 -25 -18 -42.5t-43 -17.5h-320q-25 0 -43 17.5t-18 42.5q0 38 5 108.5t6 87.5h-462q-26 0 -45 19t-19 45t19 45l402 403h-229q-26 0 -45 19t-19 45t19 45l402 403h-197q-26 0 -45 19t-19 45t19 45l384 384 q19 19 45 19t45 -19l384 -384q19 -19 19 -45t-19 -45t-45 -19h-197l402 -403q19 -19 19 -45t-19 -45t-45 -19h-229l402 -403q19 -19 19 -45z" /> +<glyph unicode="" d="M1127 326q0 32 -30 51q-193 115 -447 115q-133 0 -287 -34q-42 -9 -42 -52q0 -20 13.5 -34.5t35.5 -14.5q5 0 37 8q132 27 243 27q226 0 397 -103q19 -11 33 -11q19 0 33 13.5t14 34.5zM1223 541q0 40 -35 61q-237 141 -548 141q-153 0 -303 -42q-48 -13 -48 -64 q0 -25 17.5 -42.5t42.5 -17.5q7 0 37 8q122 33 251 33q279 0 488 -124q24 -13 38 -13q25 0 42.5 17.5t17.5 42.5zM1331 789q0 47 -40 70q-126 73 -293 110.5t-343 37.5q-204 0 -364 -47q-23 -7 -38.5 -25.5t-15.5 -48.5q0 -31 20.5 -52t51.5 -21q11 0 40 8q133 37 307 37 q159 0 309.5 -34t253.5 -95q21 -12 40 -12q29 0 50.5 20.5t21.5 51.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 1233l-303 -582l24 -31h279v-415h-507l-44 -30l-142 -273l-30 -30h-301v303l303 583l-24 30h-279v415h507l44 30l142 273l30 30h301v-303z" /> +<glyph unicode="" horiz-adv-x="2304" d="M784 164l16 241l-16 523q-1 10 -7.5 17t-16.5 7q-9 0 -16 -7t-7 -17l-14 -523l14 -241q1 -10 7.5 -16.5t15.5 -6.5q22 0 24 23zM1080 193l11 211l-12 586q0 16 -13 24q-8 5 -16 5t-16 -5q-13 -8 -13 -24l-1 -6l-10 -579q0 -1 11 -236v-1q0 -10 6 -17q9 -11 23 -11 q11 0 20 9q9 7 9 20zM35 533l20 -128l-20 -126q-2 -9 -9 -9t-9 9l-17 126l17 128q2 9 9 9t9 -9zM121 612l26 -207l-26 -203q-2 -9 -10 -9q-9 0 -9 10l-23 202l23 207q0 9 9 9q8 0 10 -9zM401 159zM213 650l25 -245l-25 -237q0 -11 -11 -11q-10 0 -12 11l-21 237l21 245 q2 12 12 12q11 0 11 -12zM307 657l23 -252l-23 -244q-2 -13 -14 -13q-13 0 -13 13l-21 244l21 252q0 13 13 13q12 0 14 -13zM401 639l21 -234l-21 -246q-2 -16 -16 -16q-6 0 -10.5 4.5t-4.5 11.5l-20 246l20 234q0 6 4.5 10.5t10.5 4.5q14 0 16 -15zM784 164zM495 785 l21 -380l-21 -246q0 -7 -5 -12.5t-12 -5.5q-16 0 -18 18l-18 246l18 380q2 18 18 18q7 0 12 -5.5t5 -12.5zM589 871l19 -468l-19 -244q0 -8 -5.5 -13.5t-13.5 -5.5q-18 0 -20 19l-16 244l16 468q2 19 20 19q8 0 13.5 -5.5t5.5 -13.5zM687 911l18 -506l-18 -242 q-2 -21 -22 -21q-19 0 -21 21l-16 242l16 506q0 9 6.5 15.5t14.5 6.5q9 0 15 -6.5t7 -15.5zM1079 169v0v0zM881 915l15 -510l-15 -239q0 -10 -7.5 -17.5t-17.5 -7.5t-17 7t-8 18l-14 239l14 510q0 11 7.5 18t17.5 7t17.5 -7t7.5 -18zM980 896l14 -492l-14 -236q0 -11 -8 -19 t-19 -8t-19 8t-9 19l-12 236l12 492q1 12 9 20t19 8t18.5 -8t8.5 -20zM1192 404l-14 -231v0q0 -13 -9 -22t-22 -9t-22 9t-10 22l-6 114l-6 117l12 636v3q2 15 12 24q9 7 20 7q8 0 15 -5q14 -8 16 -26zM2304 423q0 -117 -83 -199.5t-200 -82.5h-786q-13 2 -22 11t-9 22v899 q0 23 28 33q85 34 181 34q195 0 338 -131.5t160 -323.5q53 22 110 22q117 0 200 -83t83 -201z" /> +<glyph unicode="" d="M768 768q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127t443 -43zM768 0q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127 t443 -43zM768 384q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127t443 -43zM768 1536q208 0 385 -34.5t280 -93.5t103 -128v-128q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5 t-103 128v128q0 69 103 128t280 93.5t385 34.5z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M894 465q33 -26 84 -56q59 7 117 7q147 0 177 -49q16 -22 2 -52q0 -1 -1 -2l-2 -2v-1q-6 -38 -71 -38q-48 0 -115 20t-130 53q-221 -24 -392 -83q-153 -262 -242 -262q-15 0 -28 7l-24 12q-1 1 -6 5q-10 10 -6 36q9 40 56 91.5t132 96.5q14 9 23 -6q2 -2 2 -4q52 85 107 197 q68 136 104 262q-24 82 -30.5 159.5t6.5 127.5q11 40 42 40h21h1q23 0 35 -15q18 -21 9 -68q-2 -6 -4 -8q1 -3 1 -8v-30q-2 -123 -14 -192q55 -164 146 -238zM318 54q52 24 137 158q-51 -40 -87.5 -84t-49.5 -74zM716 974q-15 -42 -2 -132q1 7 7 44q0 3 7 43q1 4 4 8 q-1 1 -1 2t-0.5 1.5t-0.5 1.5q-1 22 -13 36q0 -1 -1 -2v-2zM592 313q135 54 284 81q-2 1 -13 9.5t-16 13.5q-76 67 -127 176q-27 -86 -83 -197q-30 -56 -45 -83zM1238 329q-24 24 -140 24q76 -28 124 -28q14 0 18 1q0 1 -2 3z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M233 768v-107h70l164 -661h159l128 485q7 20 10 46q2 16 2 24h4l3 -24q1 -3 3.5 -20t5.5 -26l128 -485h159l164 661h70v107h-300v-107h90l-99 -438q-5 -20 -7 -46l-2 -21h-4l-3 21q-1 5 -4 21t-5 25l-144 545h-114l-144 -545q-2 -9 -4.5 -24.5t-3.5 -21.5l-4 -21h-4l-2 21 q-2 26 -7 46l-99 438h90v107h-300z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M429 106v-106h281v106h-75l103 161q5 7 10 16.5t7.5 13.5t3.5 4h2q1 -4 5 -10q2 -4 4.5 -7.5t6 -8t6.5 -8.5l107 -161h-76v-106h291v106h-68l-192 273l195 282h67v107h-279v-107h74l-103 -159q-4 -7 -10 -16.5t-9 -13.5l-2 -3h-2q-1 4 -5 10q-6 11 -17 23l-106 159h76v107 h-290v-107h68l189 -272l-194 -283h-68z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M416 106v-106h327v106h-93v167h137q76 0 118 15q67 23 106.5 87t39.5 146q0 81 -37 141t-100 87q-48 19 -130 19h-368v-107h92v-555h-92zM769 386h-119v268h120q52 0 83 -18q56 -33 56 -115q0 -89 -62 -120q-31 -15 -78 -15z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M1280 320v-320h-1024v192l192 192l128 -128l384 384zM448 512q-80 0 -136 56t-56 136t56 136t136 56t136 -56t56 -136t-56 -136t-136 -56z" /> +<glyph unicode="" d="M640 1152v128h-128v-128h128zM768 1024v128h-128v-128h128zM640 896v128h-128v-128h128zM768 768v128h-128v-128h128zM1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400 v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-128v-128h-128v128h-512v-1536h1280zM781 593l107 -349q8 -27 8 -52q0 -83 -72.5 -137.5t-183.5 -54.5t-183.5 54.5t-72.5 137.5q0 25 8 52q21 63 120 396v128h128v-128h79 q22 0 39 -13t23 -34zM640 128q53 0 90.5 19t37.5 45t-37.5 45t-90.5 19t-90.5 -19t-37.5 -45t37.5 -45t90.5 -19z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M620 686q20 -8 20 -30v-544q0 -22 -20 -30q-8 -2 -12 -2q-12 0 -23 9l-166 167h-131q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h131l166 167q16 15 35 7zM1037 -3q31 0 50 24q129 159 129 363t-129 363q-16 21 -43 24t-47 -14q-21 -17 -23.5 -43.5t14.5 -47.5 q100 -123 100 -282t-100 -282q-17 -21 -14.5 -47.5t23.5 -42.5q18 -15 40 -15zM826 145q27 0 47 20q87 93 87 219t-87 219q-18 19 -45 20t-46 -17t-20 -44.5t18 -46.5q52 -57 52 -131t-52 -131q-19 -20 -18 -46.5t20 -44.5q20 -17 44 -17z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M768 768q52 0 90 -38t38 -90v-384q0 -52 -38 -90t-90 -38h-384q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h384zM1260 766q20 -8 20 -30v-576q0 -22 -20 -30q-8 -2 -12 -2q-14 0 -23 9l-265 266v90l265 266q9 9 23 9q4 0 12 -2z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M480 768q8 11 21 12.5t24 -6.5l51 -38q11 -8 12.5 -21t-6.5 -24l-182 -243l182 -243q8 -11 6.5 -24t-12.5 -21l-51 -38q-11 -8 -24 -6.5t-21 12.5l-226 301q-14 19 0 38zM1282 467q14 -19 0 -38l-226 -301q-8 -11 -21 -12.5t-24 6.5l-51 38q-11 8 -12.5 21t6.5 24l182 243 l-182 243q-8 11 -6.5 24t12.5 21l51 38q11 8 24 6.5t21 -12.5zM662 6q-13 2 -20.5 13t-5.5 24l138 831q2 13 13 20.5t24 5.5l63 -10q13 -2 20.5 -13t5.5 -24l-138 -831q-2 -13 -13 -20.5t-24 -5.5z" /> +<glyph unicode="" d="M1497 709v-198q-101 -23 -198 -23q-65 -136 -165.5 -271t-181.5 -215.5t-128 -106.5q-80 -45 -162 3q-28 17 -60.5 43.5t-85 83.5t-102.5 128.5t-107.5 184t-105.5 244t-91.5 314.5t-70.5 390h283q26 -218 70 -398.5t104.5 -317t121.5 -235.5t140 -195q169 169 287 406 q-142 72 -223 220t-81 333q0 192 104 314.5t284 122.5q178 0 273 -105.5t95 -297.5q0 -159 -58 -286q-7 -1 -19.5 -3t-46 -2t-63 6t-62 25.5t-50.5 51.5q31 103 31 184q0 87 -29 132t-79 45q-53 0 -85 -49.5t-32 -140.5q0 -186 105 -293.5t267 -107.5q62 0 121 14z" /> +<glyph unicode="" horiz-adv-x="1792" d="M216 367l603 -402v359l-334 223zM154 511l193 129l-193 129v-258zM973 -35l603 402l-269 180l-334 -223v-359zM896 458l272 182l-272 182l-272 -182zM485 733l334 223v359l-603 -402zM1445 640l193 -129v258zM1307 733l269 180l-603 402v-359zM1792 913v-546 q0 -41 -34 -64l-819 -546q-21 -13 -43 -13t-43 13l-819 546q-34 23 -34 64v546q0 41 34 64l819 546q21 13 43 13t43 -13l819 -546q34 -23 34 -64z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1800 764q111 -46 179.5 -145.5t68.5 -221.5q0 -164 -118 -280.5t-285 -116.5q-4 0 -11.5 0.5t-10.5 0.5h-1209h-1h-2h-5q-170 10 -288 125.5t-118 280.5q0 110 55 203t147 147q-12 39 -12 82q0 115 82 196t199 81q95 0 172 -58q75 154 222.5 248t326.5 94 q166 0 306 -80.5t221.5 -218.5t81.5 -301q0 -6 -0.5 -18t-0.5 -18zM468 498q0 -122 84 -193t208 -71q137 0 240 99q-16 20 -47.5 56.5t-43.5 50.5q-67 -65 -144 -65q-55 0 -93.5 33.5t-38.5 87.5q0 53 38.5 87t91.5 34q44 0 84.5 -21t73 -55t65 -75t69 -82t77 -75t97 -55 t121.5 -21q121 0 204.5 71.5t83.5 190.5q0 121 -84 192t-207 71q-143 0 -241 -97q14 -16 29.5 -34t34.5 -40t29 -34q66 64 142 64q52 0 92 -33t40 -84q0 -57 -37 -91.5t-94 -34.5q-43 0 -82.5 21t-72 55t-65.5 75t-69.5 82t-77.5 75t-96.5 55t-118.5 21q-122 0 -207 -70.5 t-85 -189.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM896 1408q-190 0 -361 -90l194 -194q82 28 167 28t167 -28l194 194q-171 90 -361 90zM218 279l194 194 q-28 82 -28 167t28 167l-194 194q-90 -171 -90 -361t90 -361zM896 -128q190 0 361 90l-194 194q-82 -28 -167 -28t-167 28l-194 -194q171 -90 361 -90zM896 256q159 0 271.5 112.5t112.5 271.5t-112.5 271.5t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5 t271.5 -112.5zM1380 473l194 -194q90 171 90 361t-90 361l-194 -194q28 -82 28 -167t-28 -167z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348q0 222 101 414.5t276.5 317t390.5 155.5v-260q-221 -45 -366.5 -221t-145.5 -406q0 -130 51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5 q0 230 -145.5 406t-366.5 221v260q215 -31 390.5 -155.5t276.5 -317t101 -414.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M19 662q8 217 116 406t305 318h5q0 -1 -1 -3q-8 -8 -28 -33.5t-52 -76.5t-60 -110.5t-44.5 -135.5t-14 -150.5t39 -157.5t108.5 -154q50 -50 102 -69.5t90.5 -11.5t69.5 23.5t47 32.5l16 16q39 51 53 116.5t6.5 122.5t-21 107t-26.5 80l-14 29q-10 25 -30.5 49.5t-43 41 t-43.5 29.5t-35 19l-13 6l104 115q39 -17 78 -52t59 -61l19 -27q1 48 -18.5 103.5t-40.5 87.5l-20 31l161 183l160 -181q-33 -46 -52.5 -102.5t-22.5 -90.5l-4 -33q22 37 61.5 72.5t67.5 52.5l28 17l103 -115q-44 -14 -85 -50t-60 -65l-19 -29q-31 -56 -48 -133.5t-7 -170 t57 -156.5q33 -45 77.5 -60.5t85 -5.5t76 26.5t57.5 33.5l21 16q60 53 96.5 115t48.5 121.5t10 121.5t-18 118t-37 107.5t-45.5 93t-45 72t-34.5 47.5l-13 17q-14 13 -7 13l10 -3q40 -29 62.5 -46t62 -50t64 -58t58.5 -65t55.5 -77t45.5 -88t38 -103t23.5 -117t10.5 -136 q3 -259 -108 -465t-312 -321t-456 -115q-185 0 -351 74t-283.5 198t-184 293t-60.5 353z" /> +<glyph unicode="" horiz-adv-x="1792" d="M874 -102v-66q-208 6 -385 109.5t-283 275.5l58 34q29 -49 73 -99l65 57q148 -168 368 -212l-17 -86q65 -12 121 -13zM276 428l-83 -28q22 -60 49 -112l-57 -33q-98 180 -98 385t98 385l57 -33q-30 -56 -49 -112l82 -28q-35 -100 -35 -212q0 -109 36 -212zM1528 251 l58 -34q-106 -172 -283 -275.5t-385 -109.5v66q56 1 121 13l-17 86q220 44 368 212l65 -57q44 50 73 99zM1377 805l-233 -80q14 -42 14 -85t-14 -85l232 -80q-31 -92 -98 -169l-185 162q-57 -67 -147 -85l48 -241q-52 -10 -98 -10t-98 10l48 241q-90 18 -147 85l-185 -162 q-67 77 -98 169l232 80q-14 42 -14 85t14 85l-233 80q33 93 99 169l185 -162q59 68 147 86l-48 240q44 10 98 10t98 -10l-48 -240q88 -18 147 -86l185 162q66 -76 99 -169zM874 1448v-66q-65 -2 -121 -13l17 -86q-220 -42 -368 -211l-65 56q-38 -42 -73 -98l-57 33 q106 172 282 275.5t385 109.5zM1705 640q0 -205 -98 -385l-57 33q27 52 49 112l-83 28q36 103 36 212q0 112 -35 212l82 28q-19 56 -49 112l57 33q98 -180 98 -385zM1585 1063l-57 -33q-35 56 -73 98l-65 -56q-148 169 -368 211l17 86q-56 11 -121 13v66q209 -6 385 -109.5 t282 -275.5zM1748 640q0 173 -67.5 331t-181.5 272t-272 181.5t-331 67.5t-331 -67.5t-272 -181.5t-181.5 -272t-67.5 -331t67.5 -331t181.5 -272t272 -181.5t331 -67.5t331 67.5t272 181.5t181.5 272t67.5 331zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71 t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" d="M582 228q0 -66 -93 -66q-107 0 -107 63q0 64 98 64q102 0 102 -61zM546 694q0 -85 -74 -85q-77 0 -77 84q0 90 77 90q36 0 55 -25.5t19 -63.5zM712 769v125q-78 -29 -135 -29q-50 29 -110 29q-86 0 -145 -57t-59 -143q0 -50 29.5 -102t73.5 -67v-3q-38 -17 -38 -85 q0 -53 41 -77v-3q-113 -37 -113 -139q0 -45 20 -78.5t54 -51t72 -25.5t81 -8q224 0 224 188q0 67 -48 99t-126 46q-27 5 -51.5 20.5t-24.5 39.5q0 44 49 52q77 15 122 70t45 134q0 24 -10 52q37 9 49 13zM771 350h137q-2 27 -2 82v387q0 46 2 69h-137q3 -23 3 -71v-392 q0 -50 -3 -75zM1280 366v121q-30 -21 -68 -21q-53 0 -53 82v225h52q9 0 26.5 -1t26.5 -1v117h-105q0 82 3 102h-140q4 -24 4 -55v-47h-60v-117q36 3 37 3q3 0 11 -0.5t12 -0.5v-2h-2v-217q0 -37 2.5 -64t11.5 -56.5t24.5 -48.5t43.5 -31t66 -12q64 0 108 24zM924 1072 q0 36 -24 63.5t-60 27.5t-60.5 -27t-24.5 -64q0 -36 25 -62.5t60 -26.5t59.5 27t24.5 62zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M595 22q0 100 -165 100q-158 0 -158 -104q0 -101 172 -101q151 0 151 105zM536 777q0 61 -30 102t-89 41q-124 0 -124 -145q0 -135 124 -135q119 0 119 137zM805 1101v-202q-36 -12 -79 -22q16 -43 16 -84q0 -127 -73 -216.5t-197 -112.5q-40 -8 -59.5 -27t-19.5 -58 q0 -31 22.5 -51.5t58 -32t78.5 -22t86 -25.5t78.5 -37.5t58 -64t22.5 -98.5q0 -304 -363 -304q-69 0 -130 12.5t-116 41t-87.5 82t-32.5 127.5q0 165 182 225v4q-67 41 -67 126q0 109 63 137v4q-72 24 -119.5 108.5t-47.5 165.5q0 139 95 231.5t235 92.5q96 0 178 -47 q98 0 218 47zM1123 220h-222q4 45 4 134v609q0 94 -4 128h222q-4 -33 -4 -124v-613q0 -89 4 -134zM1724 442v-196q-71 -39 -174 -39q-62 0 -107 20t-70 50t-39.5 78t-18.5 92t-4 103v351h2v4q-7 0 -19 1t-18 1q-21 0 -59 -6v190h96v76q0 54 -6 89h227q-6 -41 -6 -165h171 v-190q-15 0 -43.5 2t-42.5 2h-85v-365q0 -131 87 -131q61 0 109 33zM1148 1389q0 -58 -39 -101.5t-96 -43.5q-58 0 -98 43.5t-40 101.5q0 59 39.5 103t98.5 44q58 0 96.5 -44.5t38.5 -102.5z" /> +<glyph unicode="" d="M809 532l266 499h-112l-157 -312q-24 -48 -44 -92l-42 92l-155 312h-120l263 -493v-324h101v318zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M842 964q0 -80 -57 -136.5t-136 -56.5q-60 0 -111 35q-62 -67 -115 -146q-247 -371 -202 -859q1 -22 -12.5 -38.5t-34.5 -18.5h-5q-20 0 -35 13.5t-17 33.5q-14 126 -3.5 247.5t29.5 217t54 186t69 155.5t74 125q61 90 132 165q-16 35 -16 77q0 80 56.5 136.5t136.5 56.5 t136.5 -56.5t56.5 -136.5zM1223 953q0 -158 -78 -292t-212.5 -212t-292.5 -78q-64 0 -131 14q-21 5 -32.5 23.5t-6.5 39.5q5 20 23 31.5t39 7.5q51 -13 108 -13q97 0 186 38t153 102t102 153t38 186t-38 186t-102 153t-153 102t-186 38t-186 -38t-153 -102t-102 -153 t-38 -186q0 -114 52 -218q10 -20 3.5 -40t-25.5 -30t-39.5 -3t-30.5 26q-64 123 -64 265q0 119 46.5 227t124.5 186t186 124t226 46q158 0 292.5 -78t212.5 -212.5t78 -292.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M270 730q-8 19 -8 52q0 20 11 49t24 45q-1 22 7.5 53t22.5 43q0 139 92.5 288.5t217.5 209.5q139 66 324 66q133 0 266 -55q49 -21 90 -48t71 -56t55 -68t42 -74t32.5 -84.5t25.5 -89.5t22 -98l1 -5q55 -83 55 -150q0 -14 -9 -40t-9 -38q0 -1 1.5 -3.5t3.5 -5t2 -3.5 q77 -114 120.5 -214.5t43.5 -208.5q0 -43 -19.5 -100t-55.5 -57q-9 0 -19.5 7.5t-19 17.5t-19 26t-16 26.5t-13.5 26t-9 17.5q-1 1 -3 1l-5 -4q-59 -154 -132 -223q20 -20 61.5 -38.5t69 -41.5t35.5 -65q-2 -4 -4 -16t-7 -18q-64 -97 -302 -97q-53 0 -110.5 9t-98 20 t-104.5 30q-15 5 -23 7q-14 4 -46 4.5t-40 1.5q-41 -45 -127.5 -65t-168.5 -20q-35 0 -69 1.5t-93 9t-101 20.5t-74.5 40t-32.5 64q0 40 10 59.5t41 48.5q11 2 40.5 13t49.5 12q4 0 14 2q2 2 2 4l-2 3q-48 11 -108 105.5t-73 156.5l-5 3q-4 0 -12 -20q-18 -41 -54.5 -74.5 t-77.5 -37.5h-1q-4 0 -6 4.5t-5 5.5q-23 54 -23 100q0 275 252 466z" /> +<glyph unicode="" horiz-adv-x="2048" d="M580 1075q0 41 -25 66t-66 25q-43 0 -76 -25.5t-33 -65.5q0 -39 33 -64.5t76 -25.5q41 0 66 24.5t25 65.5zM1323 568q0 28 -25.5 50t-65.5 22q-27 0 -49.5 -22.5t-22.5 -49.5q0 -28 22.5 -50.5t49.5 -22.5q40 0 65.5 22t25.5 51zM1087 1075q0 41 -24.5 66t-65.5 25 q-43 0 -76 -25.5t-33 -65.5q0 -39 33 -64.5t76 -25.5q41 0 65.5 24.5t24.5 65.5zM1722 568q0 28 -26 50t-65 22q-27 0 -49.5 -22.5t-22.5 -49.5q0 -28 22.5 -50.5t49.5 -22.5q39 0 65 22t26 51zM1456 965q-31 4 -70 4q-169 0 -311 -77t-223.5 -208.5t-81.5 -287.5 q0 -78 23 -152q-35 -3 -68 -3q-26 0 -50 1.5t-55 6.5t-44.5 7t-54.5 10.5t-50 10.5l-253 -127l72 218q-290 203 -290 490q0 169 97.5 311t264 223.5t363.5 81.5q176 0 332.5 -66t262 -182.5t136.5 -260.5zM2048 404q0 -117 -68.5 -223.5t-185.5 -193.5l55 -181l-199 109 q-150 -37 -218 -37q-169 0 -311 70.5t-223.5 191.5t-81.5 264t81.5 264t223.5 191.5t311 70.5q161 0 303 -70.5t227.5 -192t85.5 -263.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1764 1525q33 -24 27 -64l-256 -1536q-5 -29 -32 -45q-14 -8 -31 -8q-11 0 -24 5l-453 185l-242 -295q-18 -23 -49 -23q-13 0 -22 4q-19 7 -30.5 23.5t-11.5 36.5v349l864 1059l-1069 -925l-395 162q-37 14 -40 55q-2 40 32 59l1664 960q15 9 32 9q20 0 36 -11z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1764 1525q33 -24 27 -64l-256 -1536q-5 -29 -32 -45q-14 -8 -31 -8q-11 0 -24 5l-527 215l-298 -327q-18 -21 -47 -21q-14 0 -23 4q-19 7 -30 23.5t-11 36.5v452l-472 193q-37 14 -40 55q-3 39 32 59l1664 960q35 21 68 -2zM1422 26l221 1323l-1434 -827l336 -137 l863 639l-478 -797z" /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61q-172 0 -327 72.5t-264 204.5q-7 10 -6.5 22.5t8.5 20.5l137 138q10 9 25 9q16 -2 23 -12q73 -95 179 -147t225 -52q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5 t-163.5 109.5t-198.5 40.5q-98 0 -188 -35.5t-160 -101.5l137 -138q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l130 -129q107 101 244.5 156.5t284.5 55.5q156 0 298 -61t245 -164t164 -245t61 -298zM896 928v-448q0 -14 -9 -23 t-23 -9h-320q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M768 1280q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5t-51 248.5t-136.5 204t-204 136.5t-248.5 51zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1682 -128q-44 0 -132.5 3.5t-133.5 3.5q-44 0 -132 -3.5t-132 -3.5q-24 0 -37 20.5t-13 45.5q0 31 17 46t39 17t51 7t45 15q33 21 33 140l-1 391q0 21 -1 31q-13 4 -50 4h-675q-38 0 -51 -4q-1 -10 -1 -31l-1 -371q0 -142 37 -164q16 -10 48 -13t57 -3.5t45 -15 t20 -45.5q0 -26 -12.5 -48t-36.5 -22q-47 0 -139.5 3.5t-138.5 3.5q-43 0 -128 -3.5t-127 -3.5q-23 0 -35.5 21t-12.5 45q0 30 15.5 45t36 17.5t47.5 7.5t42 15q33 23 33 143l-1 57v813q0 3 0.5 26t0 36.5t-1.5 38.5t-3.5 42t-6.5 36.5t-11 31.5t-16 18q-15 10 -45 12t-53 2 t-41 14t-18 45q0 26 12 48t36 22q46 0 138.5 -3.5t138.5 -3.5q42 0 126.5 3.5t126.5 3.5q25 0 37.5 -22t12.5 -48q0 -30 -17 -43.5t-38.5 -14.5t-49.5 -4t-43 -13q-35 -21 -35 -160l1 -320q0 -21 1 -32q13 -3 39 -3h699q25 0 38 3q1 11 1 32l1 320q0 139 -35 160 q-18 11 -58.5 12.5t-66 13t-25.5 49.5q0 26 12.5 48t37.5 22q44 0 132 -3.5t132 -3.5q43 0 129 3.5t129 3.5q25 0 37.5 -22t12.5 -48q0 -30 -17.5 -44t-40 -14.5t-51.5 -3t-44 -12.5q-35 -23 -35 -161l1 -943q0 -119 34 -140q16 -10 46 -13.5t53.5 -4.5t41.5 -15.5t18 -44.5 q0 -26 -12 -48t-36 -22z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1278 1347v-73q0 -29 -18.5 -61t-42.5 -32q-50 0 -54 -1q-26 -6 -32 -31q-3 -11 -3 -64v-1152q0 -25 -18 -43t-43 -18h-108q-25 0 -43 18t-18 43v1218h-143v-1218q0 -25 -17.5 -43t-43.5 -18h-108q-26 0 -43.5 18t-17.5 43v496q-147 12 -245 59q-126 58 -192 179 q-64 117 -64 259q0 166 88 286q88 118 209 159q111 37 417 37h479q25 0 43 -18t18 -43z" /> +<glyph unicode="" d="M352 128v-128h-352v128h352zM704 256q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM864 640v-128h-864v128h864zM224 1152v-128h-224v128h224zM1536 128v-128h-736v128h736zM576 1280q26 0 45 -19t19 -45v-256 q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM1216 768q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM1536 640v-128h-224v128h224zM1536 1152v-128h-864v128h864z" /> +<glyph unicode="" d="M1216 512q133 0 226.5 -93.5t93.5 -226.5t-93.5 -226.5t-226.5 -93.5t-226.5 93.5t-93.5 226.5q0 12 2 34l-360 180q-92 -86 -218 -86q-133 0 -226.5 93.5t-93.5 226.5t93.5 226.5t226.5 93.5q126 0 218 -86l360 180q-2 22 -2 34q0 133 93.5 226.5t226.5 93.5 t226.5 -93.5t93.5 -226.5t-93.5 -226.5t-226.5 -93.5q-126 0 -218 86l-360 -180q2 -22 2 -34t-2 -34l360 -180q92 86 218 86z" /> +<glyph unicode="" d="M1280 341q0 88 -62.5 151t-150.5 63q-84 0 -145 -58l-241 120q2 16 2 23t-2 23l241 120q61 -58 145 -58q88 0 150.5 63t62.5 151t-62.5 150.5t-150.5 62.5t-151 -62.5t-63 -150.5q0 -7 2 -23l-241 -120q-62 57 -145 57q-88 0 -150.5 -62.5t-62.5 -150.5t62.5 -150.5 t150.5 -62.5q83 0 145 57l241 -120q-2 -16 -2 -23q0 -88 63 -150.5t151 -62.5t150.5 62.5t62.5 150.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M571 947q-10 25 -34 35t-49 0q-108 -44 -191 -127t-127 -191q-10 -25 0 -49t35 -34q13 -5 24 -5q42 0 60 40q34 84 98.5 148.5t148.5 98.5q25 11 35 35t0 49zM1513 1303l46 -46l-244 -243l68 -68q19 -19 19 -45.5t-19 -45.5l-64 -64q89 -161 89 -343q0 -143 -55.5 -273.5 t-150 -225t-225 -150t-273.5 -55.5t-273.5 55.5t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5q182 0 343 -89l64 64q19 19 45.5 19t45.5 -19l68 -68zM1521 1359q-10 -10 -22 -10q-13 0 -23 10l-91 90q-9 10 -9 23t9 23q10 9 23 9t23 -9l90 -91 q10 -9 10 -22.5t-10 -22.5zM1751 1129q-11 -9 -23 -9t-23 9l-90 91q-10 9 -10 22.5t10 22.5q9 10 22.5 10t22.5 -10l91 -90q9 -10 9 -23t-9 -23zM1792 1312q0 -14 -9 -23t-23 -9h-96q-14 0 -23 9t-9 23t9 23t23 9h96q14 0 23 -9t9 -23zM1600 1504v-96q0 -14 -9 -23t-23 -9 t-23 9t-9 23v96q0 14 9 23t23 9t23 -9t9 -23zM1751 1449l-91 -90q-10 -10 -22 -10q-13 0 -23 10q-10 9 -10 22.5t10 22.5l90 91q10 9 23 9t23 -9q9 -10 9 -23t-9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M609 720l287 208l287 -208l-109 -336h-355zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM1515 186q149 203 149 454v3l-102 -89l-240 224l63 323 l134 -12q-150 206 -389 282l53 -124l-287 -159l-287 159l53 124q-239 -76 -389 -282l135 12l62 -323l-240 -224l-102 89v-3q0 -251 149 -454l30 132l326 -40l139 -298l-116 -69q117 -39 240 -39t240 39l-116 69l139 298l326 40z" /> +<glyph unicode="" horiz-adv-x="1792" d="M448 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM256 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM832 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23 v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM640 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM66 768q-28 0 -47 19t-19 46v129h514v-129q0 -27 -19 -46t-46 -19h-383zM1216 224v-192q0 -14 -9 -23t-23 -9h-192 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1024 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1600 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23 zM1408 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 1016v-13h-514v10q0 104 -382 102q-382 -1 -382 -102v-10h-514v13q0 17 8.5 43t34 64t65.5 75.5t110.5 76t160 67.5t224 47.5t293.5 18.5t293 -18.5t224 -47.5 t160.5 -67.5t110.5 -76t65.5 -75.5t34 -64t8.5 -43zM1792 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 962v-129q0 -27 -19 -46t-46 -19h-384q-27 0 -46 19t-19 46v129h514z" /> +<glyph unicode="" horiz-adv-x="1792" d="M704 1216v-768q0 -26 -19 -45t-45 -19v-576q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v512l249 873q7 23 31 23h424zM1024 1216v-704h-256v704h256zM1792 320v-512q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v576q-26 0 -45 19t-19 45v768h424q24 0 31 -23z M736 1504v-224h-352v224q0 14 9 23t23 9h288q14 0 23 -9t9 -23zM1408 1504v-224h-352v224q0 14 9 23t23 9h288q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1755 1083q37 -37 37 -90t-37 -91l-401 -400l150 -150l-160 -160q-163 -163 -389.5 -186.5t-411.5 100.5l-362 -362h-181v181l362 362q-124 185 -100.5 411.5t186.5 389.5l160 160l150 -150l400 401q38 37 91 37t90 -37t37 -90.5t-37 -90.5l-400 -401l234 -234l401 400 q38 37 91 37t90 -37z" /> +<glyph unicode="" horiz-adv-x="1792" d="M873 796q0 -83 -63.5 -142.5t-152.5 -59.5t-152.5 59.5t-63.5 142.5q0 84 63.5 143t152.5 59t152.5 -59t63.5 -143zM1375 796q0 -83 -63 -142.5t-153 -59.5q-89 0 -152.5 59.5t-63.5 142.5q0 84 63.5 143t152.5 59q90 0 153 -59t63 -143zM1600 616v667q0 87 -32 123.5 t-111 36.5h-1112q-83 0 -112.5 -34t-29.5 -126v-673q43 -23 88.5 -40t81 -28t81 -18.5t71 -11t70 -4t58.5 -0.5t56.5 2t44.5 2q68 1 95 -27q6 -6 10 -9q26 -25 61 -51q7 91 118 87q5 0 36.5 -1.5t43 -2t45.5 -1t53 1t54.5 4.5t61 8.5t62 13.5t67 19.5t67.5 27t72 34.5z M1763 621q-121 -149 -372 -252q84 -285 -23 -465q-66 -113 -183 -148q-104 -32 -182 15q-86 51 -82 164l-1 326v1q-8 2 -24.5 6t-23.5 5l-1 -338q4 -114 -83 -164q-79 -47 -183 -15q-117 36 -182 150q-105 180 -22 463q-251 103 -372 252q-25 37 -4 63t60 -1q3 -2 11 -7 t11 -8v694q0 72 47 123t114 51h1257q67 0 114 -51t47 -123v-694l21 15q39 27 60 1t-4 -63z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1102v-434h-145v434h145zM1294 1102v-434h-145v434h145zM1294 342l253 254v795h-1194v-1049h326v-217l217 217h398zM1692 1536v-1013l-434 -434h-326l-217 -217h-217v217h-398v1158l109 289h1483z" /> +<glyph unicode="" d="M773 217v-127q-1 -292 -6 -305q-12 -32 -51 -40q-54 -9 -181.5 38t-162.5 89q-13 15 -17 36q-1 12 4 26q4 10 34 47t181 216q1 0 60 70q15 19 39.5 24.5t49.5 -3.5q24 -10 37.5 -29t12.5 -42zM624 468q-3 -55 -52 -70l-120 -39q-275 -88 -292 -88q-35 2 -54 36 q-12 25 -17 75q-8 76 1 166.5t30 124.5t56 32q13 0 202 -77q70 -29 115 -47l84 -34q23 -9 35.5 -30.5t11.5 -48.5zM1450 171q-7 -54 -91.5 -161t-135.5 -127q-37 -14 -63 7q-14 10 -184 287l-47 77q-14 21 -11.5 46t19.5 46q35 43 83 26q1 -1 119 -40q203 -66 242 -79.5 t47 -20.5q28 -22 22 -61zM778 803q5 -102 -54 -122q-58 -17 -114 71l-378 598q-8 35 19 62q41 43 207.5 89.5t224.5 31.5q40 -10 49 -45q3 -18 22 -305.5t24 -379.5zM1440 695q3 -39 -26 -59q-15 -10 -329 -86q-67 -15 -91 -23l1 2q-23 -6 -46 4t-37 32q-30 47 0 87 q1 1 75 102q125 171 150 204t34 39q28 19 65 2q48 -23 123 -133.5t81 -167.5v-3z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1024 1024h-384v-384h384v384zM1152 384v-128h-640v128h640zM1152 1152v-640h-640v640h640zM1792 384v-128h-512v128h512zM1792 640v-128h-512v128h512zM1792 896v-128h-512v128h512zM1792 1152v-128h-512v128h512zM256 192v960h-128v-960q0 -26 19 -45t45 -19t45 19 t19 45zM1920 192v1088h-1536v-1088q0 -33 -11 -64h1483q26 0 45 19t19 45zM2048 1408v-1216q0 -80 -56 -136t-136 -56h-1664q-80 0 -136 56t-56 136v1088h256v128h1792z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1024 13q-20 0 -93 73.5t-73 93.5q0 32 62.5 54t103.5 22t103.5 -22t62.5 -54q0 -20 -73 -93.5t-93 -73.5zM1294 284q-2 0 -40 25t-101.5 50t-128.5 25t-128.5 -25t-101 -50t-40.5 -25q-18 0 -93.5 75t-75.5 93q0 13 10 23q78 77 196 121t233 44t233 -44t196 -121 q10 -10 10 -23q0 -18 -75.5 -93t-93.5 -75zM1567 556q-11 0 -23 8q-136 105 -252 154.5t-268 49.5q-85 0 -170.5 -22t-149 -53t-113.5 -62t-79 -53t-31 -22q-17 0 -92 75t-75 93q0 12 10 22q132 132 320 205t380 73t380 -73t320 -205q10 -10 10 -22q0 -18 -75 -93t-92 -75z M1838 827q-11 0 -22 9q-179 157 -371.5 236.5t-420.5 79.5t-420.5 -79.5t-371.5 -236.5q-11 -9 -22 -9q-17 0 -92.5 75t-75.5 93q0 13 10 23q187 186 445 288t527 102t527 -102t445 -288q10 -10 10 -23q0 -18 -75.5 -93t-92.5 -75z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM384 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1152 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5 t37.5 90.5zM384 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1152 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 768q0 53 -37.5 90.5t-90.5 37.5 t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1536 0v384q0 52 -38 90t-90 38t-90 -38t-38 -90v-384q0 -52 38 -90t90 -38t90 38t38 90zM1152 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5z M1536 1088v256q0 26 -19 45t-45 19h-1280q-26 0 -45 -19t-19 -45v-256q0 -26 19 -45t45 -19h1280q26 0 45 19t19 45zM1536 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 1408v-1536q0 -52 -38 -90t-90 -38 h-1408q-52 0 -90 38t-38 90v1536q0 52 38 90t90 38h1408q52 0 90 -38t38 -90z" /> +<glyph unicode="" d="M1519 890q18 -84 -4 -204q-87 -444 -565 -444h-44q-25 0 -44 -16.5t-24 -42.5l-4 -19l-55 -346l-2 -15q-5 -26 -24.5 -42.5t-44.5 -16.5h-251q-21 0 -33 15t-9 36q9 56 26.5 168t26.5 168t27 167.5t27 167.5q5 37 43 37h131q133 -2 236 21q175 39 287 144q102 95 155 246 q24 70 35 133q1 6 2.5 7.5t3.5 1t6 -3.5q79 -59 98 -162zM1347 1172q0 -107 -46 -236q-80 -233 -302 -315q-113 -40 -252 -42q0 -1 -90 -1l-90 1q-100 0 -118 -96q-2 -8 -85 -530q-1 -10 -12 -10h-295q-22 0 -36.5 16.5t-11.5 38.5l232 1471q5 29 27.5 48t51.5 19h598 q34 0 97.5 -13t111.5 -32q107 -41 163.5 -123t56.5 -196z" /> +<glyph unicode="" horiz-adv-x="1792" d="M602 949q19 -61 31 -123.5t17 -141.5t-14 -159t-62 -145q-21 81 -67 157t-95.5 127t-99 90.5t-78.5 57.5t-33 19q-62 34 -81.5 100t14.5 128t101 81.5t129 -14.5q138 -83 238 -177zM927 1236q11 -25 20.5 -46t36.5 -100.5t42.5 -150.5t25.5 -179.5t0 -205.5t-47.5 -209.5 t-105.5 -208.5q-51 -72 -138 -72q-54 0 -98 31q-57 40 -69 109t28 127q60 85 81 195t13 199.5t-32 180.5t-39 128t-22 52q-31 63 -8.5 129.5t85.5 97.5q34 17 75 17q47 0 88.5 -25t63.5 -69zM1248 567q-17 -160 -72 -311q-17 131 -63 246q25 174 -5 361q-27 178 -94 342 q114 -90 212 -211q9 -37 15 -80q26 -179 7 -347zM1520 1440q9 -17 23.5 -49.5t43.5 -117.5t50.5 -178t34 -227.5t5 -269t-47 -300t-112.5 -323.5q-22 -48 -66 -75.5t-95 -27.5q-39 0 -74 16q-67 31 -92.5 100t4.5 136q58 126 90 257.5t37.5 239.5t-3.5 213.5t-26.5 180.5 t-38.5 138.5t-32.5 90t-15.5 32.5q-34 65 -11.5 135.5t87.5 104.5q37 20 81 20q49 0 91.5 -25.5t66.5 -70.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1975 546h-138q14 37 66 179l3 9q4 10 10 26t9 26l12 -55zM531 611l-58 295q-11 54 -75 54h-268l-2 -13q311 -79 403 -336zM710 960l-162 -438l-17 89q-26 70 -85 129.5t-131 88.5l135 -510h175l261 641h-176zM849 318h166l104 642h-166zM1617 944q-69 27 -149 27 q-123 0 -201 -59t-79 -153q-1 -102 145 -174q48 -23 67 -41t19 -39q0 -30 -30 -46t-69 -16q-86 0 -156 33l-22 11l-23 -144q74 -34 185 -34q130 -1 208.5 59t80.5 160q0 106 -140 174q-49 25 -71 42t-22 38q0 22 24.5 38.5t70.5 16.5q70 1 124 -24l15 -8zM2042 960h-128 q-65 0 -87 -54l-246 -588h174l35 96h212q5 -22 20 -96h154zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M671 603h-13q-47 0 -47 -32q0 -22 20 -22q17 0 28 15t12 39zM1066 639h62v3q1 4 0.5 6.5t-1 7t-2 8t-4.5 6.5t-7.5 5t-11.5 2q-28 0 -36 -38zM1606 603h-12q-48 0 -48 -32q0 -22 20 -22q17 0 28 15t12 39zM1925 629q0 41 -30 41q-19 0 -31 -20t-12 -51q0 -42 28 -42 q20 0 32.5 20t12.5 52zM480 770h87l-44 -262h-56l32 201l-71 -201h-39l-4 200l-34 -200h-53l44 262h81l2 -163zM733 663q0 -6 -4 -42q-16 -101 -17 -113h-47l1 22q-20 -26 -58 -26q-23 0 -37.5 16t-14.5 42q0 39 26 60.5t73 21.5q14 0 23 -1q0 3 0.5 5.5t1 4.5t0.5 3 q0 20 -36 20q-29 0 -59 -10q0 4 7 48q38 11 67 11q74 0 74 -62zM889 721l-8 -49q-22 3 -41 3q-27 0 -27 -17q0 -8 4.5 -12t21.5 -11q40 -19 40 -60q0 -72 -87 -71q-34 0 -58 6q0 2 7 49q29 -8 51 -8q32 0 32 19q0 7 -4.5 11.5t-21.5 12.5q-43 20 -43 59q0 72 84 72 q30 0 50 -4zM977 721h28l-7 -52h-29q-2 -17 -6.5 -40.5t-7 -38.5t-2.5 -18q0 -16 19 -16q8 0 16 2l-8 -47q-21 -7 -40 -7q-43 0 -45 47q0 12 8 56q3 20 25 146h55zM1180 648q0 -23 -7 -52h-111q-3 -22 10 -33t38 -11q30 0 58 14l-9 -54q-30 -8 -57 -8q-95 0 -95 95 q0 55 27.5 90.5t69.5 35.5q35 0 55.5 -21t20.5 -56zM1319 722q-13 -23 -22 -62q-22 2 -31 -24t-25 -128h-56l3 14q22 130 29 199h51l-3 -33q14 21 25.5 29.5t28.5 4.5zM1506 763l-9 -57q-28 14 -50 14q-31 0 -51 -27.5t-20 -70.5q0 -30 13.5 -47t38.5 -17q21 0 48 13 l-10 -59q-28 -8 -50 -8q-45 0 -71.5 30.5t-26.5 82.5q0 70 35.5 114.5t91.5 44.5q26 0 61 -13zM1668 663q0 -18 -4 -42q-13 -79 -17 -113h-46l1 22q-20 -26 -59 -26q-23 0 -37 16t-14 42q0 39 25.5 60.5t72.5 21.5q15 0 23 -1q2 7 2 13q0 20 -36 20q-29 0 -59 -10q0 4 8 48 q38 11 67 11q73 0 73 -62zM1809 722q-14 -24 -21 -62q-23 2 -31.5 -23t-25.5 -129h-56l3 14q19 104 29 199h52q0 -11 -4 -33q15 21 26.5 29.5t27.5 4.5zM1950 770h56l-43 -262h-53l3 19q-23 -23 -52 -23q-31 0 -49.5 24t-18.5 64q0 53 27.5 92t64.5 39q31 0 53 -29z M2061 640q0 148 -72.5 273t-198 198t-273.5 73q-181 0 -328 -110q127 -116 171 -284h-50q-44 150 -158 253q-114 -103 -158 -253h-50q44 168 171 284q-147 110 -328 110q-148 0 -273.5 -73t-198 -198t-72.5 -273t72.5 -273t198 -198t273.5 -73q181 0 328 110 q-120 111 -165 264h50q46 -138 152 -233q106 95 152 233h50q-45 -153 -165 -264q147 -110 328 -110q148 0 273.5 73t198 198t72.5 273zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M313 759q0 -51 -36 -84q-29 -26 -89 -26h-17v220h17q61 0 89 -27q36 -31 36 -83zM2089 824q0 -52 -64 -52h-19v101h20q63 0 63 -49zM380 759q0 74 -50 120.5t-129 46.5h-95v-333h95q74 0 119 38q60 51 60 128zM410 593h65v333h-65v-333zM730 694q0 40 -20.5 62t-75.5 42 q-29 10 -39.5 19t-10.5 23q0 16 13.5 26.5t34.5 10.5q29 0 53 -27l34 44q-41 37 -98 37q-44 0 -74 -27.5t-30 -67.5q0 -35 18 -55.5t64 -36.5q37 -13 45 -19q19 -12 19 -34q0 -20 -14 -33.5t-36 -13.5q-48 0 -71 44l-42 -40q44 -64 115 -64q51 0 83 30.5t32 79.5zM1008 604 v77q-37 -37 -78 -37q-49 0 -80.5 32.5t-31.5 82.5q0 48 31.5 81.5t77.5 33.5q43 0 81 -38v77q-40 20 -80 20q-74 0 -125.5 -50.5t-51.5 -123.5t51 -123.5t125 -50.5q42 0 81 19zM2240 0v527q-65 -40 -144.5 -84t-237.5 -117t-329.5 -137.5t-417.5 -134.5t-504 -118h1569 q26 0 45 19t19 45zM1389 757q0 75 -53 128t-128 53t-128 -53t-53 -128t53 -128t128 -53t128 53t53 128zM1541 584l144 342h-71l-90 -224l-89 224h-71l142 -342h35zM1714 593h184v56h-119v90h115v56h-115v74h119v57h-184v-333zM2105 593h80l-105 140q76 16 76 94q0 47 -31 73 t-87 26h-97v-333h65v133h9zM2304 1274v-1268q0 -56 -38.5 -95t-93.5 -39h-2040q-55 0 -93.5 39t-38.5 95v1268q0 56 38.5 95t93.5 39h2040q55 0 93.5 -39t38.5 -95z" /> +<glyph unicode="" horiz-adv-x="2304" d="M119 854h89l-45 108zM740 328l74 79l-70 79h-163v-49h142v-55h-142v-54h159zM898 406l99 -110v217zM1186 453q0 33 -40 33h-84v-69h83q41 0 41 36zM1475 457q0 29 -42 29h-82v-61h81q43 0 43 32zM1197 923q0 29 -42 29h-82v-60h81q43 0 43 31zM1656 854h89l-44 108z M699 1009v-271h-66v212l-94 -212h-57l-94 212v-212h-132l-25 60h-135l-25 -60h-70l116 271h96l110 -257v257h106l85 -184l77 184h108zM1255 453q0 -20 -5.5 -35t-14 -25t-22.5 -16.5t-26 -10t-31.5 -4.5t-31.5 -1t-32.5 0.5t-29.5 0.5v-91h-126l-80 90l-83 -90h-256v271h260 l80 -89l82 89h207q109 0 109 -89zM964 794v-56h-217v271h217v-57h-152v-49h148v-55h-148v-54h152zM2304 235v-229q0 -55 -38.5 -94.5t-93.5 -39.5h-2040q-55 0 -93.5 39.5t-38.5 94.5v678h111l25 61h55l25 -61h218v46l19 -46h113l20 47v-47h541v99l10 1q10 0 10 -14v-86h279 v23q23 -12 55 -18t52.5 -6.5t63 0.5t51.5 1l25 61h56l25 -61h227v58l34 -58h182v378h-180v-44l-25 44h-185v-44l-23 44h-249q-69 0 -109 -22v22h-172v-22q-24 22 -73 22h-628l-43 -97l-43 97h-198v-44l-22 44h-169l-78 -179v391q0 55 38.5 94.5t93.5 39.5h2040 q55 0 93.5 -39.5t38.5 -94.5v-678h-120q-51 0 -81 -22v22h-177q-55 0 -78 -22v22h-316v-22q-31 22 -87 22h-209v-22q-23 22 -91 22h-234l-54 -58l-50 58h-349v-378h343l55 59l52 -59h211v89h21q59 0 90 13v-102h174v99h8q8 0 10 -2t2 -10v-87h529q57 0 88 24v-24h168 q60 0 95 17zM1546 469q0 -23 -12 -43t-34 -29q25 -9 34 -26t9 -46v-54h-65v45q0 33 -12 43.5t-46 10.5h-69v-99h-65v271h154q48 0 77 -15t29 -58zM1269 936q0 -24 -12.5 -44t-33.5 -29q26 -9 34.5 -25.5t8.5 -46.5v-53h-65q0 9 0.5 26.5t0 25t-3 18.5t-8.5 16t-17.5 8.5 t-29.5 3.5h-70v-98h-64v271l153 -1q49 0 78 -14.5t29 -57.5zM1798 327v-56h-216v271h216v-56h-151v-49h148v-55h-148v-54zM1372 1009v-271h-66v271h66zM2065 357q0 -86 -102 -86h-126v58h126q34 0 34 25q0 16 -17 21t-41.5 5t-49.5 3.5t-42 22.5t-17 55q0 39 26 60t66 21 h130v-57h-119q-36 0 -36 -25q0 -16 17.5 -20.5t42 -4t49 -2.5t42 -21.5t17.5 -54.5zM2304 407v-101q-24 -35 -88 -35h-125v58h125q33 0 33 25q0 13 -12.5 19t-31 5.5t-40 2t-40 8t-31 24t-12.5 48.5q0 39 26.5 60t66.5 21h129v-57h-118q-36 0 -36 -25q0 -20 29 -22t68.5 -5 t56.5 -26zM2139 1008v-270h-92l-122 203v-203h-132l-26 60h-134l-25 -60h-75q-129 0 -129 133q0 138 133 138h63v-59q-7 0 -28 1t-28.5 0.5t-23 -2t-21.5 -6.5t-14.5 -13.5t-11.5 -23t-3 -33.5q0 -38 13.5 -58t49.5 -20h29l92 213h97l109 -256v256h99l114 -188v188h66z" /> +<glyph unicode="" horiz-adv-x="2304" d="M745 630q0 -37 -25.5 -61.5t-62.5 -24.5q-29 0 -46.5 16t-17.5 44q0 37 25 62.5t62 25.5q28 0 46.5 -16.5t18.5 -45.5zM1530 779q0 -42 -22 -57t-66 -15l-32 -1l17 107q2 11 13 11h18q22 0 35 -2t25 -12.5t12 -30.5zM1881 630q0 -36 -25.5 -61t-61.5 -25q-29 0 -47 16 t-18 44q0 37 25 62.5t62 25.5q28 0 46.5 -16.5t18.5 -45.5zM513 801q0 59 -38.5 85.5t-100.5 26.5h-160q-19 0 -21 -19l-65 -408q-1 -6 3 -11t10 -5h76q20 0 22 19l18 110q1 8 7 13t15 6.5t17 1.5t19 -1t14 -1q86 0 135 48.5t49 134.5zM822 489l41 261q1 6 -3 11t-10 5h-76 q-14 0 -17 -33q-27 40 -95 40q-72 0 -122.5 -54t-50.5 -127q0 -59 34.5 -94t92.5 -35q28 0 58 12t48 32q-4 -12 -4 -21q0 -16 13 -16h69q19 0 22 19zM1269 752q0 5 -4 9.5t-9 4.5h-77q-11 0 -18 -10l-106 -156l-44 150q-5 16 -22 16h-75q-5 0 -9 -4.5t-4 -9.5q0 -2 19.5 -59 t42 -123t23.5 -70q-82 -112 -82 -120q0 -13 13 -13h77q11 0 18 10l255 368q2 2 2 7zM1649 801q0 59 -38.5 85.5t-100.5 26.5h-159q-20 0 -22 -19l-65 -408q-1 -6 3 -11t10 -5h82q12 0 16 13l18 116q1 8 7 13t15 6.5t17 1.5t19 -1t14 -1q86 0 135 48.5t49 134.5zM1958 489 l41 261q1 6 -3 11t-10 5h-76q-14 0 -17 -33q-26 40 -95 40q-72 0 -122.5 -54t-50.5 -127q0 -59 34.5 -94t92.5 -35q29 0 59 12t47 32q0 -1 -2 -9t-2 -12q0 -16 13 -16h69q19 0 22 19zM2176 898v1q0 14 -13 14h-74q-11 0 -13 -11l-65 -416l-1 -2q0 -5 4 -9.5t10 -4.5h66 q19 0 21 19zM392 764q-5 -35 -26 -46t-60 -11l-33 -1l17 107q2 11 13 11h19q40 0 58 -11.5t12 -48.5zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1597 633q0 -69 -21 -106q-19 -35 -52 -35q-23 0 -41 9v224q29 30 57 30q57 0 57 -122zM2035 669h-110q6 98 56 98q51 0 54 -98zM476 534q0 59 -33 91.5t-101 57.5q-36 13 -52 24t-16 25q0 26 38 26q58 0 124 -33l18 112q-67 32 -149 32q-77 0 -123 -38q-48 -39 -48 -109 q0 -58 32.5 -90.5t99.5 -56.5q39 -14 54.5 -25.5t15.5 -27.5q0 -31 -48 -31q-29 0 -70 12.5t-72 30.5l-18 -113q72 -41 168 -41q81 0 129 37q51 41 51 117zM771 749l19 111h-96v135l-129 -21l-18 -114l-46 -8l-17 -103h62v-219q0 -84 44 -120q38 -30 111 -30q32 0 79 11v118 q-32 -7 -44 -7q-42 0 -42 50v197h77zM1087 724v139q-15 3 -28 3q-32 0 -55.5 -16t-33.5 -46l-10 56h-131v-471h150v306q26 31 82 31q16 0 26 -2zM1124 389h150v471h-150v-471zM1746 638q0 122 -45 179q-40 52 -111 52q-64 0 -117 -56l-8 47h-132v-645l150 25v151 q36 -11 68 -11q83 0 134 56q61 65 61 202zM1278 986q0 33 -23 56t-56 23t-56 -23t-23 -56t23 -56.5t56 -23.5t56 23.5t23 56.5zM2176 629q0 113 -48 176q-50 64 -144 64q-96 0 -151.5 -66t-55.5 -180q0 -128 63 -188q55 -55 161 -55q101 0 160 40l-16 103q-57 -31 -128 -31 q-43 0 -63 19q-23 19 -28 66h248q2 14 2 52zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1558 684q61 -356 298 -556q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-180.5 74.5t-75.5 180.5zM1024 -176q16 0 16 16t-16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5zM2026 1424q8 -10 7.5 -23.5t-10.5 -22.5 l-1872 -1622q-10 -8 -23.5 -7t-21.5 11l-84 96q-8 10 -7.5 23.5t10.5 21.5l186 161q-19 32 -19 66q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q124 -18 219 -82.5t148 -157.5 l418 363q10 8 23.5 7t21.5 -11z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1040 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM503 315l877 760q-42 88 -132.5 146.5t-223.5 58.5q-93 0 -169.5 -31.5t-121.5 -80.5t-69 -103t-24 -105q0 -384 -137 -645zM1856 128 q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-180.5 74.5t-75.5 180.5l149 129h757q-166 187 -227 459l111 97q61 -356 298 -556zM1942 1520l84 -96q8 -10 7.5 -23.5t-10.5 -22.5l-1872 -1622q-10 -8 -23.5 -7t-21.5 11l-84 96q-8 10 -7.5 23.5t10.5 21.5l186 161 q-19 32 -19 66q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q124 -18 219 -82.5t148 -157.5l418 363q10 8 23.5 7t21.5 -11z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM768 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1024 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704 q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM480 1152h448l-48 117q-7 9 -17 11h-317q-10 -2 -17 -11zM1408 1120v-64q0 -14 -9 -23t-23 -9h-96v-948q0 -83 -47 -143.5t-113 -60.5h-832q-66 0 -113 58.5t-47 141.5v952h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h309l70 167 q15 37 54 63t79 26h320q40 0 79 -26t54 -63l70 -167h309q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1150 462v-109q0 -50 -36.5 -89t-94 -60.5t-118 -32.5t-117.5 -11q-205 0 -342.5 139t-137.5 346q0 203 136 339t339 136q34 0 75.5 -4.5t93 -18t92.5 -34t69 -56.5t28 -81v-109q0 -16 -16 -16h-118q-16 0 -16 16v70q0 43 -65.5 67.5t-137.5 24.5q-140 0 -228.5 -91.5 t-88.5 -237.5q0 -151 91.5 -249.5t233.5 -98.5q68 0 138 24t70 66v70q0 7 4.5 11.5t10.5 4.5h119q6 0 11 -4.5t5 -11.5zM768 1280q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5 t-51 248.5t-136.5 204t-204 136.5t-248.5 51zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M972 761q0 108 -53.5 169t-147.5 61q-63 0 -124 -30.5t-110 -84.5t-79.5 -137t-30.5 -180q0 -112 53.5 -173t150.5 -61q96 0 176 66.5t122.5 166t42.5 203.5zM1536 640q0 -111 -37 -197t-98.5 -135t-131.5 -74.5t-145 -27.5q-6 0 -15.5 -0.5t-16.5 -0.5q-95 0 -142 53 q-28 33 -33 83q-52 -66 -131.5 -110t-173.5 -44q-161 0 -249.5 95.5t-88.5 269.5q0 157 66 290t179 210.5t246 77.5q87 0 155 -35.5t106 -99.5l2 19l11 56q1 6 5.5 12t9.5 6h118q5 0 13 -11q5 -5 3 -16l-120 -614q-5 -24 -5 -48q0 -39 12.5 -52t44.5 -13q28 1 57 5.5t73 24 t77 50t57 89.5t24 137q0 292 -174 466t-466 174q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51q228 0 405 144q11 9 24 8t21 -12l41 -49q8 -12 7 -24q-2 -13 -12 -22q-102 -83 -227.5 -128t-258.5 -45q-156 0 -298 61 t-245 164t-164 245t-61 298t61 298t164 245t245 164t298 61q344 0 556 -212t212 -556z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1698 1442q94 -94 94 -226.5t-94 -225.5l-225 -223l104 -104q10 -10 10 -23t-10 -23l-210 -210q-10 -10 -23 -10t-23 10l-105 105l-603 -603q-37 -37 -90 -37h-203l-256 -128l-64 64l128 256v203q0 53 37 90l603 603l-105 105q-10 10 -10 23t10 23l210 210q10 10 23 10 t23 -10l104 -104l223 225q93 94 225.5 94t226.5 -94zM512 64l576 576l-192 192l-576 -576v-192h192z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1615 1536q70 0 122.5 -46.5t52.5 -116.5q0 -63 -45 -151q-332 -629 -465 -752q-97 -91 -218 -91q-126 0 -216.5 92.5t-90.5 219.5q0 128 92 212l638 579q59 54 130 54zM706 502q39 -76 106.5 -130t150.5 -76l1 -71q4 -213 -129.5 -347t-348.5 -134q-123 0 -218 46.5 t-152.5 127.5t-86.5 183t-29 220q7 -5 41 -30t62 -44.5t59 -36.5t46 -17q41 0 55 37q25 66 57.5 112.5t69.5 76t88 47.5t103 25.5t125 10.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 128v-384h-1792v384q45 0 85 14t59 27.5t47 37.5q30 27 51.5 38t56.5 11t55.5 -11t52.5 -38q29 -25 47 -38t58 -27t86 -14q45 0 85 14.5t58 27t48 37.5q21 19 32.5 27t31 15t43.5 7q35 0 56.5 -11t51.5 -38q28 -24 47 -37.5t59 -27.5t85 -14t85 14t59 27.5t47 37.5 q30 27 51.5 38t56.5 11q34 0 55.5 -11t51.5 -38q28 -24 47 -37.5t59 -27.5t85 -14zM1792 448v-192q-35 0 -55.5 11t-52.5 38q-29 25 -47 38t-58 27t-85 14q-46 0 -86 -14t-58 -27t-47 -38q-22 -19 -33 -27t-31 -15t-44 -7q-35 0 -56.5 11t-51.5 38q-29 25 -47 38t-58 27 t-86 14q-45 0 -85 -14.5t-58 -27t-48 -37.5q-21 -19 -32.5 -27t-31 -15t-43.5 -7q-35 0 -56.5 11t-51.5 38q-28 24 -47 37.5t-59 27.5t-85 14q-46 0 -86 -14t-58 -27t-47 -38q-30 -27 -51.5 -38t-56.5 -11v192q0 80 56 136t136 56h64v448h256v-448h256v448h256v-448h256v448 h256v-448h64q80 0 136 -56t56 -136zM512 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150zM1024 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51 t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150zM1536 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 0v-128h-2048v1536h128v-1408h1920zM1664 1024l256 -896h-1664v576l448 576l576 -576z" /> +<glyph unicode="" horiz-adv-x="1792" d="M768 646l546 -546q-106 -108 -247.5 -168t-298.5 -60q-209 0 -385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103v-762zM955 640h773q0 -157 -60 -298.5t-168 -247.5zM1664 768h-768v768q209 0 385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 0v-128h-2048v1536h128v-1408h1920zM1920 1248v-435q0 -21 -19.5 -29.5t-35.5 7.5l-121 121l-633 -633q-10 -10 -23 -10t-23 10l-233 233l-416 -416l-192 192l585 585q10 10 23 10t23 -10l233 -233l464 464l-121 121q-16 16 -7.5 35.5t29.5 19.5h435q14 0 23 -9 t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1292 832q0 -6 10 -41q10 -29 25 -49.5t41 -34t44 -20t55 -16.5q325 -91 325 -332q0 -146 -105.5 -242.5t-254.5 -96.5q-59 0 -111.5 18.5t-91.5 45.5t-77 74.5t-63 87.5t-53.5 103.5t-43.5 103t-39.5 106.5t-35.5 95q-32 81 -61.5 133.5t-73.5 96.5t-104 64t-142 20 q-96 0 -183 -55.5t-138 -144.5t-51 -185q0 -160 106.5 -279.5t263.5 -119.5q177 0 258 95q56 63 83 116l84 -152q-15 -34 -44 -70l1 -1q-131 -152 -388 -152q-147 0 -269.5 79t-190.5 207.5t-68 274.5q0 105 43.5 206t116 176.5t172 121.5t204.5 46q87 0 159 -19t123.5 -50 t95 -80t72.5 -99t58.5 -117t50.5 -124.5t50 -130.5t55 -127q96 -200 233 -200q81 0 138.5 48.5t57.5 128.5q0 42 -19 72t-50.5 46t-72.5 31.5t-84.5 27t-87.5 34t-81 52t-65 82t-39 122.5q-3 16 -3 33q0 110 87.5 192t198.5 78q78 -3 120.5 -14.5t90.5 -53.5h-1 q12 -11 23 -24.5t26 -36t19 -27.5l-129 -99q-26 49 -54 70v1q-23 21 -97 21q-49 0 -84 -33t-35 -83z" /> +<glyph unicode="" d="M1432 484q0 173 -234 239q-35 10 -53 16.5t-38 25t-29 46.5q0 2 -2 8.5t-3 12t-1 7.5q0 36 24.5 59.5t60.5 23.5q54 0 71 -15h-1q20 -15 39 -51l93 71q-39 54 -49 64q-33 29 -67.5 39t-85.5 10q-80 0 -142 -57.5t-62 -137.5q0 -7 2 -23q16 -96 64.5 -140t148.5 -73 q29 -8 49 -15.5t45 -21.5t38.5 -34.5t13.5 -46.5v-5q1 -58 -40.5 -93t-100.5 -35q-97 0 -167 144q-23 47 -51.5 121.5t-48 125.5t-54 110.5t-74 95.5t-103.5 60.5t-147 24.5q-101 0 -192 -56t-144 -148t-50 -192v-1q4 -108 50.5 -199t133.5 -147.5t196 -56.5q186 0 279 110 q20 27 31 51l-60 109q-42 -80 -99 -116t-146 -36q-115 0 -191 87t-76 204q0 105 82 189t186 84q112 0 170 -53.5t104 -172.5q8 -21 25.5 -68.5t28.5 -76.5t31.5 -74.5t38.5 -74t45.5 -62.5t55.5 -53.5t66 -33t80 -13.5q107 0 183 69.5t76 174.5zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1152 640q0 104 -40.5 198.5t-109.5 163.5t-163.5 109.5t-198.5 40.5t-198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5t198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5zM1920 640q0 104 -40.5 198.5 t-109.5 163.5t-163.5 109.5t-198.5 40.5h-386q119 -90 188.5 -224t69.5 -288t-69.5 -288t-188.5 -224h386q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5zM2048 640q0 -130 -51 -248.5t-136.5 -204t-204 -136.5t-248.5 -51h-768q-130 0 -248.5 51t-204 136.5 t-136.5 204t-51 248.5t51 248.5t136.5 204t204 136.5t248.5 51h768q130 0 248.5 -51t204 -136.5t136.5 -204t51 -248.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M0 640q0 130 51 248.5t136.5 204t204 136.5t248.5 51h768q130 0 248.5 -51t204 -136.5t136.5 -204t51 -248.5t-51 -248.5t-136.5 -204t-204 -136.5t-248.5 -51h-768q-130 0 -248.5 51t-204 136.5t-136.5 204t-51 248.5zM1408 128q104 0 198.5 40.5t163.5 109.5 t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5t-163.5 109.5t-198.5 40.5t-198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M762 384h-314q-40 0 -57.5 35t6.5 67l188 251q-65 31 -137 31q-132 0 -226 -94t-94 -226t94 -226t226 -94q115 0 203 72.5t111 183.5zM576 512h186q-18 85 -75 148zM1056 512l288 384h-480l-99 -132q105 -103 126 -252h165zM2176 448q0 132 -94 226t-226 94 q-60 0 -121 -24l174 -260q15 -23 10 -49t-27 -40q-15 -11 -36 -11q-35 0 -53 29l-174 260q-93 -95 -93 -225q0 -132 94 -226t226 -94t226 94t94 226zM2304 448q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5q0 97 39.5 183.5t109.5 149.5l-65 98l-353 -469 q-18 -26 -51 -26h-197q-23 -164 -149 -274t-294 -110q-185 0 -316.5 131.5t-131.5 316.5t131.5 316.5t316.5 131.5q114 0 215 -55l137 183h-224q-26 0 -45 19t-19 45t19 45t45 19h384v-128h435l-85 128h-222q-26 0 -45 19t-19 45t19 45t45 19h256q33 0 53 -28l267 -400 q91 44 192 44q185 0 316.5 -131.5t131.5 -316.5z" /> +<glyph unicode="" d="M384 320q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1408 320q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1362 716l-72 384q-5 23 -22.5 37.5t-40.5 14.5 h-918q-23 0 -40.5 -14.5t-22.5 -37.5l-72 -384q-5 -30 14 -53t49 -23h1062q30 0 49 23t14 53zM1136 1328q0 20 -14 34t-34 14h-640q-20 0 -34 -14t-14 -34t14 -34t34 -14h640q20 0 34 14t14 34zM1536 603v-603h-128v-128q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5v128h-768v-128q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5v128h-128v603q0 112 25 223l103 454q9 78 97.5 137t230 89t312.5 30t312.5 -30t230 -89t97.5 -137l105 -454q23 -102 23 -223z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1463 704q0 -35 -25 -60.5t-61 -25.5h-702q-36 0 -61 25.5t-25 60.5t25 60.5t61 25.5h702q36 0 61 -25.5t25 -60.5zM1677 704q0 86 -23 170h-982q-36 0 -61 25t-25 60q0 36 25 61t61 25h908q-88 143 -235 227t-320 84q-177 0 -327.5 -87.5t-238 -237.5t-87.5 -327 q0 -86 23 -170h982q36 0 61 -25t25 -60q0 -36 -25 -61t-61 -25h-908q88 -143 235.5 -227t320.5 -84q132 0 253 51.5t208 139t139 208t52 253.5zM2048 959q0 -35 -25 -60t-61 -25h-131q17 -85 17 -170q0 -167 -65.5 -319.5t-175.5 -263t-262.5 -176t-319.5 -65.5 q-246 0 -448.5 133t-301.5 350h-189q-36 0 -61 25t-25 61q0 35 25 60t61 25h132q-17 85 -17 170q0 167 65.5 319.5t175.5 263t262.5 176t320.5 65.5q245 0 447.5 -133t301.5 -350h188q36 0 61 -25t25 -61z" /> +<glyph unicode="" horiz-adv-x="1280" d="M953 1158l-114 -328l117 -21q165 451 165 518q0 56 -38 56q-57 0 -130 -225zM654 471l33 -88q37 42 71 67l-33 5.5t-38.5 7t-32.5 8.5zM362 1367q0 -98 159 -521q18 10 49 10q15 0 75 -5l-121 351q-75 220 -123 220q-19 0 -29 -17.5t-10 -37.5zM283 608q0 -36 51.5 -119 t117.5 -153t100 -70q14 0 25.5 13t11.5 27q0 24 -32 102q-13 32 -32 72t-47.5 89t-61.5 81t-62 32q-20 0 -45.5 -27t-25.5 -47zM125 273q0 -41 25 -104q59 -145 183.5 -227t281.5 -82q227 0 382 170q152 169 152 427q0 43 -1 67t-11.5 62t-30.5 56q-56 49 -211.5 75.5 t-270.5 26.5q-37 0 -49 -11q-12 -5 -12 -35q0 -34 21.5 -60t55.5 -40t77.5 -23.5t87.5 -11.5t85 -4t70 0h23q24 0 40 -19q15 -19 19 -55q-28 -28 -96 -54q-61 -22 -93 -46q-64 -46 -108.5 -114t-44.5 -137q0 -31 18.5 -88.5t18.5 -87.5l-3 -12q-4 -12 -4 -14 q-137 10 -146 216q-8 -2 -41 -2q2 -7 2 -21q0 -53 -40.5 -89.5t-94.5 -36.5q-82 0 -166.5 78t-84.5 159q0 34 33 67q52 -64 60 -76q77 -104 133 -104q12 0 26.5 8.5t14.5 20.5q0 34 -87.5 145t-116.5 111q-43 0 -70 -44.5t-27 -90.5zM11 264q0 101 42.5 163t136.5 88 q-28 74 -28 104q0 62 61 123t122 61q29 0 70 -15q-163 462 -163 567q0 80 41 130.5t119 50.5q131 0 325 -581q6 -17 8 -23q6 16 29 79.5t43.5 118.5t54 127.5t64.5 123t70.5 86.5t76.5 36q71 0 112 -49t41 -122q0 -108 -159 -550q61 -15 100.5 -46t58.5 -78t26 -93.5 t7 -110.5q0 -150 -47 -280t-132 -225t-211 -150t-278 -55q-111 0 -223 42q-149 57 -258 191.5t-109 286.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M785 528h207q-14 -158 -98.5 -248.5t-214.5 -90.5q-162 0 -254.5 116t-92.5 316q0 194 93 311.5t233 117.5q148 0 232 -87t97 -247h-203q-5 64 -35.5 99t-81.5 35q-57 0 -88.5 -60.5t-31.5 -177.5q0 -48 5 -84t18 -69.5t40 -51.5t66 -18q95 0 109 139zM1497 528h206 q-14 -158 -98 -248.5t-214 -90.5q-162 0 -254.5 116t-92.5 316q0 194 93 311.5t233 117.5q148 0 232 -87t97 -247h-204q-4 64 -35 99t-81 35q-57 0 -88.5 -60.5t-31.5 -177.5q0 -48 5 -84t18 -69.5t39.5 -51.5t65.5 -18q49 0 76.5 38t33.5 101zM1856 647q0 207 -15.5 307 t-60.5 161q-6 8 -13.5 14t-21.5 15t-16 11q-86 63 -697 63q-625 0 -710 -63q-5 -4 -17.5 -11.5t-21 -14t-14.5 -14.5q-45 -60 -60 -159.5t-15 -308.5q0 -208 15 -307.5t60 -160.5q6 -8 15 -15t20.5 -14t17.5 -12q44 -33 239.5 -49t470.5 -16q610 0 697 65q5 4 17 11t20.5 14 t13.5 16q46 60 61 159t15 309zM2048 1408v-1536h-2048v1536h2048z" /> +<glyph unicode="" d="M992 912v-496q0 -14 -9 -23t-23 -9h-160q-14 0 -23 9t-9 23v496q0 112 -80 192t-192 80h-272v-1152q0 -14 -9 -23t-23 -9h-160q-14 0 -23 9t-9 23v1344q0 14 9 23t23 9h464q135 0 249 -66.5t180.5 -180.5t66.5 -249zM1376 1376v-880q0 -135 -66.5 -249t-180.5 -180.5 t-249 -66.5h-464q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h160q14 0 23 -9t9 -23v-768h272q112 0 192 80t80 192v880q0 14 9 23t23 9h160q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1311 694v-114q0 -24 -13.5 -38t-37.5 -14h-202q-24 0 -38 14t-14 38v114q0 24 14 38t38 14h202q24 0 37.5 -14t13.5 -38zM821 464v250q0 53 -32.5 85.5t-85.5 32.5h-133q-68 0 -96 -52q-28 52 -96 52h-130q-53 0 -85.5 -32.5t-32.5 -85.5v-250q0 -22 21 -22h55 q22 0 22 22v230q0 24 13.5 38t38.5 14h94q24 0 38 -14t14 -38v-230q0 -22 21 -22h54q22 0 22 22v230q0 24 14 38t38 14h97q24 0 37.5 -14t13.5 -38v-230q0 -22 22 -22h55q21 0 21 22zM1410 560v154q0 53 -33 85.5t-86 32.5h-264q-53 0 -86 -32.5t-33 -85.5v-410 q0 -21 22 -21h55q21 0 21 21v180q31 -42 94 -42h191q53 0 86 32.5t33 85.5zM1536 1176v-1072q0 -96 -68 -164t-164 -68h-1072q-96 0 -164 68t-68 164v1072q0 96 68 164t164 68h1072q96 0 164 -68t68 -164z" /> +<glyph unicode="" d="M915 450h-294l147 551zM1001 128h311l-324 1024h-440l-324 -1024h311l383 314zM1536 1120v-960q0 -118 -85 -203t-203 -85h-960q-118 0 -203 85t-85 203v960q0 118 85 203t203 85h960q118 0 203 -85t85 -203z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 641q0 -21 -13 -36.5t-33 -19.5l-205 -356q3 -9 3 -18q0 -20 -12.5 -35.5t-32.5 -19.5l-193 -337q3 -8 3 -16q0 -23 -16.5 -40t-40.5 -17q-25 0 -41 18h-400q-17 -20 -43 -20t-43 20h-399q-17 -20 -43 -20q-23 0 -40 16.5t-17 40.5q0 8 4 20l-193 335 q-20 4 -32.5 19.5t-12.5 35.5q0 9 3 18l-206 356q-20 5 -32.5 20.5t-12.5 35.5q0 21 13.5 36.5t33.5 19.5l199 344q0 1 -0.5 3t-0.5 3q0 36 34 51l209 363q-4 10 -4 18q0 24 17 40.5t40 16.5q26 0 44 -21h396q16 21 43 21t43 -21h398q18 21 44 21q23 0 40 -16.5t17 -40.5 q0 -6 -4 -18l207 -358q23 -1 39 -17.5t16 -38.5q0 -13 -7 -27l187 -324q19 -4 31.5 -19.5t12.5 -35.5zM1063 -158h389l-342 354h-143l-342 -354h360q18 16 39 16t39 -16zM112 654q1 -4 1 -13q0 -10 -2 -15l208 -360q2 0 4.5 -1t5.5 -2.5l5 -2.5l188 199v347l-187 194 q-13 -8 -29 -10zM986 1438h-388l190 -200l554 200h-280q-16 -16 -38 -16t-38 16zM1689 226q1 6 5 11l-64 68l-17 -79h76zM1583 226l22 105l-252 266l-296 -307l63 -64h463zM1495 -142l16 28l65 310h-427l333 -343q8 4 13 5zM578 -158h5l342 354h-373v-335l4 -6q14 -5 22 -13 zM552 226h402l64 66l-309 321l-157 -166v-221zM359 226h163v189l-168 -177q4 -8 5 -12zM358 1051q0 -1 0.5 -2t0.5 -2q0 -16 -8 -29l171 -177v269zM552 1121v-311l153 -157l297 314l-223 236zM556 1425l-4 -8v-264l205 74l-191 201q-6 -2 -10 -3zM1447 1438h-16l-621 -224 l213 -225zM1023 946l-297 -315l311 -319l296 307zM688 634l-136 141v-284zM1038 270l-42 -44h85zM1374 618l238 -251l132 624l-3 5l-1 1zM1718 1018q-8 13 -8 29v2l-216 376q-5 1 -13 5l-437 -463l310 -327zM522 1142v223l-163 -282zM522 196h-163l163 -283v283zM1607 196 l-48 -227l130 227h-82zM1729 266l207 361q-2 10 -2 14q0 1 3 16l-171 296l-129 -612l77 -82q5 3 15 7z" /> +<glyph unicode="" d="M0 856q0 131 91.5 226.5t222.5 95.5h742l352 358v-1470q0 -132 -91.5 -227t-222.5 -95h-780q-131 0 -222.5 95t-91.5 227v790zM1232 102l-176 180v425q0 46 -32 79t-78 33h-484q-46 0 -78 -33t-32 -79v-492q0 -46 32.5 -79.5t77.5 -33.5h770z" /> +<glyph unicode="" d="M934 1386q-317 -121 -556 -362.5t-358 -560.5q-20 89 -20 176q0 208 102.5 384.5t278.5 279t384 102.5q82 0 169 -19zM1203 1267q93 -65 164 -155q-389 -113 -674.5 -400.5t-396.5 -676.5q-93 72 -155 162q112 386 395 671t667 399zM470 -67q115 356 379.5 622t619.5 384 q40 -92 54 -195q-292 -120 -516 -345t-343 -518q-103 14 -194 52zM1536 -125q-193 50 -367 115q-135 -84 -290 -107q109 205 274 370.5t369 275.5q-21 -152 -101 -284q65 -175 115 -370z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1893 1144l155 -1272q-131 0 -257 57q-200 91 -393 91q-226 0 -374 -148q-148 148 -374 148q-193 0 -393 -91q-128 -57 -252 -57h-5l155 1272q224 127 482 127q233 0 387 -106q154 106 387 106q258 0 482 -127zM1398 157q129 0 232 -28.5t260 -93.5l-124 1021 q-171 78 -368 78q-224 0 -374 -141q-150 141 -374 141q-197 0 -368 -78l-124 -1021q105 43 165.5 65t148.5 39.5t178 17.5q202 0 374 -108q172 108 374 108zM1438 191l-55 907q-211 -4 -359 -155q-152 155 -374 155q-176 0 -336 -66l-114 -941q124 51 228.5 76t221.5 25 q209 0 374 -102q172 107 374 102z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1500 165v733q0 21 -15 36t-35 15h-93q-20 0 -35 -15t-15 -36v-733q0 -20 15 -35t35 -15h93q20 0 35 15t15 35zM1216 165v531q0 20 -15 35t-35 15h-101q-20 0 -35 -15t-15 -35v-531q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM924 165v429q0 20 -15 35t-35 15h-101 q-20 0 -35 -15t-15 -35v-429q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM632 165v362q0 20 -15 35t-35 15h-101q-20 0 -35 -15t-15 -35v-362q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM2048 311q0 -166 -118 -284t-284 -118h-1244q-166 0 -284 118t-118 284 q0 116 63 214.5t168 148.5q-10 34 -10 73q0 113 80.5 193.5t193.5 80.5q102 0 180 -67q45 183 194 300t338 117q149 0 275 -73.5t199.5 -199.5t73.5 -275q0 -66 -14 -122q135 -33 221 -142.5t86 -247.5z" /> +<glyph unicode="" d="M0 1536h1536v-1392l-776 -338l-760 338v1392zM1436 209v926h-1336v-926l661 -294zM1436 1235v201h-1336v-201h1336zM181 937v-115h-37v115h37zM181 789v-115h-37v115h37zM181 641v-115h-37v115h37zM181 493v-115h-37v115h37zM181 345v-115h-37v115h37zM207 202l15 34 l105 -47l-15 -33zM343 142l15 34l105 -46l-15 -34zM478 82l15 34l105 -46l-15 -34zM614 23l15 33l104 -46l-15 -34zM797 10l105 46l15 -33l-105 -47zM932 70l105 46l15 -34l-105 -46zM1068 130l105 46l15 -34l-105 -46zM1203 189l105 47l15 -34l-105 -46zM259 1389v-36h-114 v36h114zM421 1389v-36h-115v36h115zM583 1389v-36h-115v36h115zM744 1389v-36h-114v36h114zM906 1389v-36h-114v36h114zM1068 1389v-36h-115v36h115zM1230 1389v-36h-115v36h115zM1391 1389v-36h-114v36h114zM181 1049v-79h-37v115h115v-36h-78zM421 1085v-36h-115v36h115z M583 1085v-36h-115v36h115zM744 1085v-36h-114v36h114zM906 1085v-36h-114v36h114zM1068 1085v-36h-115v36h115zM1230 1085v-36h-115v36h115zM1355 970v79h-78v36h115v-115h-37zM1355 822v115h37v-115h-37zM1355 674v115h37v-115h-37zM1355 526v115h37v-115h-37zM1355 378 v115h37v-115h-37zM1355 230v115h37v-115h-37zM760 265q-129 0 -221 91.5t-92 221.5q0 129 92 221t221 92q130 0 221.5 -92t91.5 -221q0 -130 -91.5 -221.5t-221.5 -91.5zM595 646q0 -36 19.5 -56.5t49.5 -25t64 -7t64 -2t49.5 -9t19.5 -30.5q0 -49 -112 -49q-97 0 -123 51 h-3l-31 -63q67 -42 162 -42q29 0 56.5 5t55.5 16t45.5 33t17.5 53q0 46 -27.5 69.5t-67.5 27t-79.5 3t-67 5t-27.5 25.5q0 21 20.5 33t40.5 15t41 3q34 0 70.5 -11t51.5 -34h3l30 58q-3 1 -21 8.5t-22.5 9t-19.5 7t-22 7t-20 4.5t-24 4t-23 1q-29 0 -56.5 -5t-54 -16.5 t-43 -34t-16.5 -53.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M863 504q0 112 -79.5 191.5t-191.5 79.5t-191 -79.5t-79 -191.5t79 -191t191 -79t191.5 79t79.5 191zM1726 505q0 112 -79 191t-191 79t-191.5 -79t-79.5 -191q0 -113 79.5 -192t191.5 -79t191 79.5t79 191.5zM2048 1314v-1348q0 -44 -31.5 -75.5t-76.5 -31.5h-1832 q-45 0 -76.5 31.5t-31.5 75.5v1348q0 44 31.5 75.5t76.5 31.5h431q44 0 76 -31.5t32 -75.5v-161h754v161q0 44 32 75.5t76 31.5h431q45 0 76.5 -31.5t31.5 -75.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1430 953zM1690 749q148 0 253 -98.5t105 -244.5q0 -157 -109 -261.5t-267 -104.5q-85 0 -162 27.5t-138 73.5t-118 106t-109 126.5t-103.5 132.5t-108.5 126t-117 106t-136 73.5t-159 27.5q-154 0 -251.5 -91.5t-97.5 -244.5q0 -157 104 -250t263 -93q100 0 208 37.5 t193 98.5q5 4 21 18.5t30 24t22 9.5q14 0 24.5 -10.5t10.5 -24.5q0 -24 -60 -77q-101 -88 -234.5 -142t-260.5 -54q-133 0 -245.5 58t-180 165t-67.5 241q0 205 141.5 341t347.5 136q120 0 226.5 -43.5t185.5 -113t151.5 -153t139 -167.5t133.5 -153.5t149.5 -113 t172.5 -43.5q102 0 168.5 61.5t66.5 162.5q0 95 -64.5 159t-159.5 64q-30 0 -81.5 -18.5t-68.5 -18.5q-20 0 -35.5 15t-15.5 35q0 18 8.5 57t8.5 59q0 159 -107.5 263t-266.5 104q-58 0 -111.5 -18.5t-84 -40.5t-55.5 -40.5t-33 -18.5q-15 0 -25.5 10.5t-10.5 25.5 q0 19 25 46q59 67 147 103.5t182 36.5q191 0 318 -125.5t127 -315.5q0 -37 -4 -66q57 15 115 15z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1216 832q0 26 -19 45t-45 19h-128v128q0 26 -19 45t-45 19t-45 -19t-19 -45v-128h-128q-26 0 -45 -19t-19 -45t19 -45t45 -19h128v-128q0 -26 19 -45t45 -19t45 19t19 45v128h128q26 0 45 19t19 45zM640 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1536 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1664 1088v-512q0 -24 -16 -42.5t-41 -21.5l-1044 -122q1 -7 4.5 -21.5t6 -26.5t2.5 -22q0 -16 -24 -64h920 q26 0 45 -19t19 -45t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 14 11 39.5t29.5 59.5t20.5 38l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t20 -15.5t13 -24.5t7.5 -26.5t5.5 -29.5t4.5 -25.5h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 832q0 26 -19 45t-45 19t-45 -19l-147 -146v293q0 26 -19 45t-45 19t-45 -19t-19 -45v-293l-147 146q-19 19 -45 19t-45 -19t-19 -45t19 -45l256 -256q19 -19 45 -19t45 19l256 256q19 19 19 45zM640 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1536 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1664 1088v-512q0 -24 -16 -42.5t-41 -21.5l-1044 -122q1 -7 4.5 -21.5t6 -26.5t2.5 -22q0 -16 -24 -64h920 q26 0 45 -19t19 -45t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 14 11 39.5t29.5 59.5t20.5 38l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t20 -15.5t13 -24.5t7.5 -26.5t5.5 -29.5t4.5 -25.5h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M212 768l623 -665l-300 665h-323zM1024 -4l349 772h-698zM538 896l204 384h-262l-288 -384h346zM1213 103l623 665h-323zM683 896h682l-204 384h-274zM1510 896h346l-288 384h-262zM1651 1382l384 -512q14 -18 13 -41.5t-17 -40.5l-960 -1024q-18 -20 -47 -20t-47 20 l-960 1024q-16 17 -17 40.5t13 41.5l384 512q18 26 51 26h1152q33 0 51 -26z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1811 -19q19 19 45 19t45 -19l128 -128l-90 -90l-83 83l-83 -83q-18 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83 q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-128 128l90 90l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83 q19 19 45 19t45 -19l83 -83zM237 19q-19 -19 -45 -19t-45 19l-128 128l90 90l83 -82l83 82q19 19 45 19t45 -19l83 -82l64 64v293l-210 314q-17 26 -7 56.5t40 40.5l177 58v299h128v128h256v128h256v-128h256v-128h128v-299l177 -58q30 -10 40 -40.5t-7 -56.5l-210 -314 v-293l19 18q19 19 45 19t45 -19l83 -82l83 82q19 19 45 19t45 -19l128 -128l-90 -90l-83 83l-83 -83q-18 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83 q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83zM640 1152v-128l384 128l384 -128v128h-128v128h-512v-128h-128z" /> +<glyph unicode="" d="M576 0l96 448l-96 128l-128 64zM832 0l128 640l-128 -64l-96 -128zM992 1010q-2 4 -4 6q-10 8 -96 8q-70 0 -167 -19q-7 -2 -21 -2t-21 2q-97 19 -167 19q-86 0 -96 -8q-2 -2 -4 -6q2 -18 4 -27q2 -3 7.5 -6.5t7.5 -10.5q2 -4 7.5 -20.5t7 -20.5t7.5 -17t8.5 -17t9 -14 t12 -13.5t14 -9.5t17.5 -8t20.5 -4t24.5 -2q36 0 59 12.5t32.5 30t14.5 34.5t11.5 29.5t17.5 12.5h12q11 0 17.5 -12.5t11.5 -29.5t14.5 -34.5t32.5 -30t59 -12.5q13 0 24.5 2t20.5 4t17.5 8t14 9.5t12 13.5t9 14t8.5 17t7.5 17t7 20.5t7.5 20.5q2 7 7.5 10.5t7.5 6.5 q2 9 4 27zM1408 131q0 -121 -73 -190t-194 -69h-874q-121 0 -194 69t-73 190q0 61 4.5 118t19 125.5t37.5 123.5t63.5 103.5t93.5 74.5l-90 220h214q-22 64 -22 128q0 12 2 32q-194 40 -194 96q0 57 210 99q17 62 51.5 134t70.5 114q32 37 76 37q30 0 84 -31t84 -31t84 31 t84 31q44 0 76 -37q36 -42 70.5 -114t51.5 -134q210 -42 210 -99q0 -56 -194 -96q7 -81 -20 -160h214l-82 -225q63 -33 107.5 -96.5t65.5 -143.5t29 -151.5t8 -148.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2301 500q12 -103 -22 -198.5t-99 -163.5t-158.5 -106t-196.5 -31q-161 11 -279.5 125t-134.5 274q-12 111 27.5 210.5t118.5 170.5l-71 107q-96 -80 -151 -194t-55 -244q0 -27 -18.5 -46.5t-45.5 -19.5h-256h-69q-23 -164 -149 -274t-294 -110q-185 0 -316.5 131.5 t-131.5 316.5t131.5 316.5t316.5 131.5q76 0 152 -27l24 45q-123 110 -304 110h-64q-26 0 -45 19t-19 45t19 45t45 19h128q78 0 145 -13.5t116.5 -38.5t71.5 -39.5t51 -36.5h512h115l-85 128h-222q-30 0 -49 22.5t-14 52.5q4 23 23 38t43 15h253q33 0 53 -28l70 -105 l114 114q19 19 46 19h101q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-179l115 -172q131 63 275 36q143 -26 244 -134.5t118 -253.5zM448 128q115 0 203 72.5t111 183.5h-314q-35 0 -55 31q-18 32 -1 63l147 277q-47 13 -91 13q-132 0 -226 -94t-94 -226t94 -226 t226 -94zM1856 128q132 0 226 94t94 226t-94 226t-226 94q-60 0 -121 -24l174 -260q15 -23 10 -49t-27 -40q-15 -11 -36 -11q-35 0 -53 29l-174 260q-93 -95 -93 -225q0 -132 94 -226t226 -94z" /> +<glyph unicode="" d="M1408 0q0 -63 -61.5 -113.5t-164 -81t-225 -46t-253.5 -15.5t-253.5 15.5t-225 46t-164 81t-61.5 113.5q0 49 33 88.5t91 66.5t118 44.5t131 29.5q26 5 48 -10.5t26 -41.5q5 -26 -10.5 -48t-41.5 -26q-58 -10 -106 -23.5t-76.5 -25.5t-48.5 -23.5t-27.5 -19.5t-8.5 -12 q3 -11 27 -26.5t73 -33t114 -32.5t160.5 -25t201.5 -10t201.5 10t160.5 25t114 33t73 33.5t27 27.5q-1 4 -8.5 11t-27.5 19t-48.5 23.5t-76.5 25t-106 23.5q-26 4 -41.5 26t-10.5 48q4 26 26 41.5t48 10.5q71 -12 131 -29.5t118 -44.5t91 -66.5t33 -88.5zM1024 896v-384 q0 -26 -19 -45t-45 -19h-64v-384q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v384h-64q-26 0 -45 19t-19 45v384q0 53 37.5 90.5t90.5 37.5h384q53 0 90.5 -37.5t37.5 -90.5zM928 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5 t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 512h305q-5 -6 -10 -10.5t-9 -7.5l-3 -4l-623 -600q-18 -18 -44 -18t-44 18l-624 602q-5 2 -21 20h369q22 0 39.5 13.5t22.5 34.5l70 281l190 -667q6 -20 23 -33t39 -13q21 0 38 13t23 33l146 485l56 -112q18 -35 57 -35zM1792 940q0 -145 -103 -300h-369l-111 221 q-8 17 -25.5 27t-36.5 8q-45 -5 -56 -46l-129 -430l-196 686q-6 20 -23.5 33t-39.5 13t-39 -13.5t-22 -34.5l-116 -464h-423q-103 155 -103 300q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5q224 0 351 -124 t127 -344z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 960q0 -221 -147.5 -384.5t-364.5 -187.5v-260h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v260q-150 16 -271.5 103t-186 224t-52.5 292 q11 134 80.5 249t182 188t245.5 88q170 19 319 -54t236 -212t87 -306zM128 960q0 -185 131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5z" /> +<glyph unicode="" d="M1472 1408q26 0 45 -19t19 -45v-416q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v262l-382 -383q126 -156 126 -359q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123t223.5 45.5 q203 0 359 -126l382 382h-261q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h416zM576 0q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M830 1220q145 -72 233.5 -210.5t88.5 -305.5q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-217 24 -364.5 187.5 t-147.5 384.5q0 167 88.5 305.5t233.5 210.5q-165 96 -228 273q-6 16 3.5 29.5t26.5 13.5h69q21 0 29 -20q44 -106 140 -171t214 -65t214 65t140 171q8 20 37 20h61q17 0 26.5 -13.5t3.5 -29.5q-63 -177 -228 -273zM576 256q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" d="M1024 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q126 -158 126 -359q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64 q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-149 16 -270.5 103t-186.5 223.5t-53 291.5q16 204 160 353.5t347 172.5q118 14 228 -19t198 -103l255 254h-134q-14 0 -23 9t-9 23v64zM576 256q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q126 -158 126 -359q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64 q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-217 24 -364.5 187.5t-147.5 384.5q0 201 126 359l-52 53l-101 -111q-9 -10 -22 -10.5t-23 7.5l-48 44q-10 8 -10.5 21.5t8.5 23.5l105 115l-111 112v-134q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9 t-9 23v288q0 26 19 45t45 19h288q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-133l106 -107l86 94q9 10 22 10.5t23 -7.5l48 -44q10 -8 10.5 -21.5t-8.5 -23.5l-90 -99l57 -56q158 126 359 126t359 -126l255 254h-134q-14 0 -23 9t-9 23v64zM832 256q185 0 316.5 131.5 t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1790 1007q12 -155 -52.5 -292t-186 -224t-271.5 -103v-260h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-512v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23 t23 9h224v260q-150 16 -271.5 103t-186 224t-52.5 292q17 206 164.5 356.5t352.5 169.5q206 21 377 -94q171 115 377 94q205 -19 352.5 -169.5t164.5 -356.5zM896 647q128 131 128 313t-128 313q-128 -131 -128 -313t128 -313zM576 512q115 0 218 57q-154 165 -154 391 q0 224 154 391q-103 57 -218 57q-185 0 -316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5zM1152 128v260q-137 15 -256 94q-119 -79 -256 -94v-260h512zM1216 512q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5q-115 0 -218 -57q154 -167 154 -391 q0 -226 -154 -391q103 -57 218 -57z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1536 1120q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q76 -95 107.5 -214t9.5 -247q-31 -182 -166 -312t-318 -156q-210 -29 -384.5 80t-241.5 300q-117 6 -221 57.5t-177.5 133t-113.5 192.5t-32 230 q9 135 78 252t182 191.5t248 89.5q118 14 227.5 -19t198.5 -103l255 254h-134q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q59 -74 93 -169q182 -9 328 -124l255 254h-134q-14 0 -23 9 t-9 23v64zM1024 704q0 20 -4 58q-162 -25 -271 -150t-109 -292q0 -20 4 -58q162 25 271 150t109 292zM128 704q0 -168 111 -294t276 -149q-3 29 -3 59q0 210 135 369.5t338 196.5q-53 120 -163.5 193t-245.5 73q-185 0 -316.5 -131.5t-131.5 -316.5zM1088 -128 q185 0 316.5 131.5t131.5 316.5q0 168 -111 294t-276 149q3 -29 3 -59q0 -210 -135 -369.5t-338 -196.5q53 -120 163.5 -193t245.5 -73z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1664 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q76 -95 107.5 -214t9.5 -247q-32 -180 -164.5 -310t-313.5 -157q-223 -34 -409 90q-117 -78 -256 -93v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23 t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-155 17 -279.5 109.5t-187 237.5t-39.5 307q25 187 159.5 322.5t320.5 164.5q224 34 410 -90q146 97 320 97q201 0 359 -126l255 254h-134q-14 0 -23 9 t-9 23v64zM896 391q128 131 128 313t-128 313q-128 -131 -128 -313t128 -313zM128 704q0 -185 131.5 -316.5t316.5 -131.5q117 0 218 57q-154 167 -154 391t154 391q-101 57 -218 57q-185 0 -316.5 -131.5t-131.5 -316.5zM1216 256q185 0 316.5 131.5t131.5 316.5 t-131.5 316.5t-316.5 131.5q-117 0 -218 -57q154 -167 154 -391t-154 -391q101 -57 218 -57z" /> +<glyph unicode="" d="M1472 1408q26 0 45 -19t19 -45v-416q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v262l-213 -214l140 -140q9 -10 9 -23t-9 -22l-46 -46q-9 -9 -22 -9t-23 9l-140 141l-78 -79q126 -156 126 -359q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5 t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123t223.5 45.5q203 0 359 -126l78 78l-172 172q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l172 -172l213 213h-261q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h416zM576 0q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M640 892q217 -24 364.5 -187.5t147.5 -384.5q0 -167 -87 -306t-236 -212t-319 -54q-133 15 -245.5 88t-182 188t-80.5 249q-12 155 52.5 292t186 224t271.5 103v132h-160q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h160v165l-92 -92q-10 -9 -23 -9t-22 9l-46 46q-9 9 -9 22 t9 23l202 201q19 19 45 19t45 -19l202 -201q9 -10 9 -23t-9 -22l-46 -46q-9 -9 -22 -9t-23 9l-92 92v-165h160q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-160v-132zM576 -128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5 t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1901 621q19 -19 19 -45t-19 -45l-294 -294q-9 -10 -22.5 -10t-22.5 10l-45 45q-10 9 -10 22.5t10 22.5l185 185h-294v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-132q-24 -217 -187.5 -364.5t-384.5 -147.5q-167 0 -306 87t-212 236t-54 319q15 133 88 245.5 t188 182t249 80.5q155 12 292 -52.5t224 -186t103 -271.5h132v224q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-224h294l-185 185q-10 9 -10 22.5t10 22.5l45 45q9 10 22.5 10t22.5 -10zM576 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5 t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 960q0 -221 -147.5 -384.5t-364.5 -187.5v-612q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v612q-217 24 -364.5 187.5t-147.5 384.5q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5zM576 512q185 0 316.5 131.5 t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1024 576q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1152 576q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123 t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5z" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" d="M1451 1408q35 0 60 -25t25 -60v-1366q0 -35 -25 -60t-60 -25h-391v595h199l30 232h-229v148q0 56 23.5 84t91.5 28l122 1v207q-63 9 -178 9q-136 0 -217.5 -80t-81.5 -226v-171h-200v-232h200v-595h-735q-35 0 -60 25t-25 60v1366q0 35 25 60t60 25h1366z" /> +<glyph unicode="" horiz-adv-x="1280" d="M0 939q0 108 37.5 203.5t103.5 166.5t152 123t185 78t202 26q158 0 294 -66.5t221 -193.5t85 -287q0 -96 -19 -188t-60 -177t-100 -149.5t-145 -103t-189 -38.5q-68 0 -135 32t-96 88q-10 -39 -28 -112.5t-23.5 -95t-20.5 -71t-26 -71t-32 -62.5t-46 -77.5t-62 -86.5 l-14 -5l-9 10q-15 157 -15 188q0 92 21.5 206.5t66.5 287.5t52 203q-32 65 -32 169q0 83 52 156t132 73q61 0 95 -40.5t34 -102.5q0 -66 -44 -191t-44 -187q0 -63 45 -104.5t109 -41.5q55 0 102 25t78.5 68t56 95t38 110.5t20 111t6.5 99.5q0 173 -109.5 269.5t-285.5 96.5 q-200 0 -334 -129.5t-134 -328.5q0 -44 12.5 -85t27 -65t27 -45.5t12.5 -30.5q0 -28 -15 -73t-37 -45q-2 0 -17 3q-51 15 -90.5 56t-61 94.5t-32.5 108t-11 106.5z" /> +<glyph unicode="" d="M985 562q13 0 97.5 -44t89.5 -53q2 -5 2 -15q0 -33 -17 -76q-16 -39 -71 -65.5t-102 -26.5q-57 0 -190 62q-98 45 -170 118t-148 185q-72 107 -71 194v8q3 91 74 158q24 22 52 22q6 0 18 -1.5t19 -1.5q19 0 26.5 -6.5t15.5 -27.5q8 -20 33 -88t25 -75q0 -21 -34.5 -57.5 t-34.5 -46.5q0 -7 5 -15q34 -73 102 -137q56 -53 151 -101q12 -7 22 -7q15 0 54 48.5t52 48.5zM782 32q127 0 243.5 50t200.5 134t134 200.5t50 243.5t-50 243.5t-134 200.5t-200.5 134t-243.5 50t-243.5 -50t-200.5 -134t-134 -200.5t-50 -243.5q0 -203 120 -368l-79 -233 l242 77q158 -104 345 -104zM782 1414q153 0 292.5 -60t240.5 -161t161 -240.5t60 -292.5t-60 -292.5t-161 -240.5t-240.5 -161t-292.5 -60q-195 0 -365 94l-417 -134l136 405q-108 178 -108 389q0 153 60 292.5t161 240.5t240.5 161t292.5 60z" /> +<glyph unicode="" horiz-adv-x="1792" d="M128 128h1024v128h-1024v-128zM128 640h1024v128h-1024v-128zM1696 192q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM128 1152h1024v128h-1024v-128zM1696 704q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1696 1216 q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1792 384v-384h-1792v384h1792zM1792 896v-384h-1792v384h1792zM1792 1408v-384h-1792v384h1792z" /> +<glyph unicode="" horiz-adv-x="2048" d="M704 640q-159 0 -271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5t-112.5 -271.5t-271.5 -112.5zM1664 512h352q13 0 22.5 -9.5t9.5 -22.5v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-352v-352q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5 t-9.5 22.5v352h-352q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h352v352q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5v-352zM928 288q0 -52 38 -90t90 -38h256v-238q-68 -50 -171 -50h-874q-121 0 -194 69t-73 190q0 53 3.5 103.5t14 109t26.5 108.5 t43 97.5t62 81t85.5 53.5t111.5 20q19 0 39 -17q79 -61 154.5 -91.5t164.5 -30.5t164.5 30.5t154.5 91.5q20 17 39 17q132 0 217 -96h-223q-52 0 -90 -38t-38 -90v-192z" /> +<glyph unicode="" horiz-adv-x="2048" d="M704 640q-159 0 -271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5t-112.5 -271.5t-271.5 -112.5zM1781 320l249 -249q9 -9 9 -23q0 -13 -9 -22l-136 -136q-9 -9 -22 -9q-14 0 -23 9l-249 249l-249 -249q-9 -9 -23 -9q-13 0 -22 9l-136 136 q-9 9 -9 22q0 14 9 23l249 249l-249 249q-9 9 -9 23q0 13 9 22l136 136q9 9 22 9q14 0 23 -9l249 -249l249 249q9 9 23 9q13 0 22 -9l136 -136q9 -9 9 -22q0 -14 -9 -23zM1283 320l-181 -181q-37 -37 -37 -91q0 -53 37 -90l83 -83q-21 -3 -44 -3h-874q-121 0 -194 69 t-73 190q0 53 3.5 103.5t14 109t26.5 108.5t43 97.5t62 81t85.5 53.5t111.5 20q19 0 39 -17q154 -122 319 -122t319 122q20 17 39 17q28 0 57 -6q-28 -27 -41 -50t-13 -56q0 -54 37 -91z" /> +<glyph unicode="" horiz-adv-x="2048" d="M256 512h1728q26 0 45 -19t19 -45v-448h-256v256h-1536v-256h-256v1216q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-704zM832 832q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM2048 576v64q0 159 -112.5 271.5t-271.5 112.5h-704 q-26 0 -45 -19t-19 -45v-384h1152z" /> +<glyph unicode="" d="M1536 1536l-192 -448h192v-192h-274l-55 -128h329v-192h-411l-357 -832l-357 832h-411v192h329l-55 128h-274v192h192l-192 448h256l323 -768h378l323 768h256zM768 320l108 256h-216z" /> +<glyph unicode="" d="M1088 1536q185 0 316.5 -93.5t131.5 -226.5v-896q0 -130 -125.5 -222t-305.5 -97l213 -202q16 -15 8 -35t-30 -20h-1056q-22 0 -30 20t8 35l213 202q-180 5 -305.5 97t-125.5 222v896q0 133 131.5 226.5t316.5 93.5h640zM768 192q80 0 136 56t56 136t-56 136t-136 56 t-136 -56t-56 -136t56 -136t136 -56zM1344 768v512h-1152v-512h1152z" /> +<glyph unicode="" d="M1088 1536q185 0 316.5 -93.5t131.5 -226.5v-896q0 -130 -125.5 -222t-305.5 -97l213 -202q16 -15 8 -35t-30 -20h-1056q-22 0 -30 20t8 35l213 202q-180 5 -305.5 97t-125.5 222v896q0 133 131.5 226.5t316.5 93.5h640zM288 224q66 0 113 47t47 113t-47 113t-113 47 t-113 -47t-47 -113t47 -113t113 -47zM704 768v512h-544v-512h544zM1248 224q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47zM1408 768v512h-576v-512h576z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 204v-209h-642v209h134v926h-6l-314 -1135h-243l-310 1135h-8v-926h135v-209h-538v209h69q21 0 43 19.5t22 37.5v881q0 18 -22 40t-43 22h-69v209h672l221 -821h6l223 821h670v-209h-71q-19 0 -41 -22t-22 -40v-881q0 -18 21.5 -37.5t41.5 -19.5h71z" /> +<glyph unicode="" d="M809 532l266 499h-112l-157 -312q-24 -48 -44 -92l-42 92l-155 312h-120l263 -493v-324h101v318zM1536 1408v-1536h-1536v1536h1536z" /> +<glyph unicode="" horiz-adv-x="2296" d="M478 -139q-8 -16 -27 -34.5t-37 -25.5q-25 -9 -51.5 3.5t-28.5 31.5q-1 22 40 55t68 38q23 4 34 -21.5t2 -46.5zM1819 -139q7 -16 26 -34.5t38 -25.5q25 -9 51.5 3.5t27.5 31.5q2 22 -39.5 55t-68.5 38q-22 4 -33 -21.5t-2 -46.5zM1867 -30q13 -27 56.5 -59.5t77.5 -41.5 q45 -13 82 4.5t37 50.5q0 46 -67.5 100.5t-115.5 59.5q-40 5 -63.5 -37.5t-6.5 -76.5zM428 -30q-13 -27 -56 -59.5t-77 -41.5q-45 -13 -82 4.5t-37 50.5q0 46 67.5 100.5t115.5 59.5q40 5 63 -37.5t6 -76.5zM1158 1094h1q-41 0 -76 -15q27 -8 44 -30.5t17 -49.5 q0 -35 -27 -60t-65 -25q-52 0 -80 43q-5 -23 -5 -42q0 -74 56 -126.5t135 -52.5q80 0 136 52.5t56 126.5t-56 126.5t-136 52.5zM1462 1312q-99 109 -220.5 131.5t-245.5 -44.5q27 60 82.5 96.5t118 39.5t121.5 -17t99.5 -74.5t44.5 -131.5zM2212 73q8 -11 -11 -42 q7 -23 7 -40q1 -56 -44.5 -112.5t-109.5 -91.5t-118 -37q-48 -2 -92 21.5t-66 65.5q-687 -25 -1259 0q-23 -41 -66.5 -65t-92.5 -22q-86 3 -179.5 80.5t-92.5 160.5q2 22 7 40q-19 31 -11 42q6 10 31 1q14 22 41 51q-7 29 2 38q11 10 39 -4q29 20 59 34q0 29 13 37 q23 12 51 -16q35 5 61 -2q18 -4 38 -19v73q-11 0 -18 2q-53 10 -97 44.5t-55 87.5q-9 38 0 81q15 62 93 95q2 17 19 35.5t36 23.5t33 -7.5t19 -30.5h13q46 -5 60 -23q3 -3 5 -7q10 1 30.5 3.5t30.5 3.5q-15 11 -30 17q-23 40 -91 43q0 6 1 10q-62 2 -118.5 18.5t-84.5 47.5 q-32 36 -42.5 92t-2.5 112q16 126 90 179q23 16 52 4.5t32 -40.5q0 -1 1.5 -14t2.5 -21t3 -20t5.5 -19t8.5 -10q27 -14 76 -12q48 46 98 74q-40 4 -162 -14l47 46q61 58 163 111q145 73 282 86q-20 8 -41 15.5t-47 14t-42.5 10.5t-47.5 11t-43 10q595 126 904 -139 q98 -84 158 -222q85 -10 121 9h1q5 3 8.5 10t5.5 19t3 19.5t3 21.5l1 14q3 28 32 40t52 -5q73 -52 91 -178q7 -57 -3.5 -113t-42.5 -91q-28 -32 -83.5 -48.5t-115.5 -18.5v-10q-71 -2 -95 -43q-14 -5 -31 -17q11 -1 32 -3.5t30 -3.5q1 4 5 8q16 18 60 23h13q5 18 19 30t33 8 t36 -23t19 -36q79 -32 93 -95q9 -40 1 -81q-12 -53 -56 -88t-97 -44q-10 -2 -17 -2q0 -49 -1 -73q20 15 38 19q26 7 61 2q28 28 51 16q14 -9 14 -37q33 -16 59 -34q27 13 38 4q10 -10 2 -38q28 -30 41 -51q23 8 31 -1zM1937 1025q0 -29 -9 -54q82 -32 112 -132 q4 37 -9.5 98.5t-41.5 90.5q-20 19 -36 17t-16 -20zM1859 925q35 -42 47.5 -108.5t-0.5 -124.5q67 13 97 45q13 14 18 28q-3 64 -31 114.5t-79 66.5q-15 -15 -52 -21zM1822 921q-30 0 -44 1q42 -115 53 -239q21 0 43 3q16 68 1 135t-53 100zM258 839q30 100 112 132 q-9 25 -9 54q0 18 -16.5 20t-35.5 -17q-28 -29 -41.5 -90.5t-9.5 -98.5zM294 737q29 -31 97 -45q-13 58 -0.5 124.5t47.5 108.5v0q-37 6 -52 21q-51 -16 -78.5 -66t-31.5 -115q9 -17 18 -28zM471 683q14 124 73 235q-19 -4 -55 -18l-45 -19v1q-46 -89 -20 -196q25 -3 47 -3z M1434 644q8 -38 16.5 -108.5t11.5 -89.5q3 -18 9.5 -21.5t23.5 4.5q40 20 62 85.5t23 125.5q-24 2 -146 4zM1152 1285q-116 0 -199 -82.5t-83 -198.5q0 -117 83 -199.5t199 -82.5t199 82.5t83 199.5q0 116 -83 198.5t-199 82.5zM1380 646q-106 2 -211 0v1q-1 -27 2.5 -86 t13.5 -66q29 -14 93.5 -14.5t95.5 10.5q9 3 11 39t-0.5 69.5t-4.5 46.5zM1112 447q8 4 9.5 48t-0.5 88t-4 63v1q-212 -3 -214 -3q-4 -20 -7 -62t0 -83t14 -46q34 -15 101 -16t101 10zM718 636q-16 -59 4.5 -118.5t77.5 -84.5q15 -8 24 -5t12 21q3 16 8 90t10 103 q-69 -2 -136 -6zM591 510q3 -23 -34 -36q132 -141 271.5 -240t305.5 -154q172 49 310.5 146t293.5 250q-33 13 -30 34l3 9v1v-1q-17 2 -50 5.5t-48 4.5q-26 -90 -82 -132q-51 -38 -82 1q-5 6 -9 14q-7 13 -17 62q-2 -5 -5 -9t-7.5 -7t-8 -5.5t-9.5 -4l-10 -2.5t-12 -2 l-12 -1.5t-13.5 -1t-13.5 -0.5q-106 -9 -163 11q-4 -17 -10 -26.5t-21 -15t-23 -7t-36 -3.5q-2 0 -3 -0.5t-3 -0.5h-3q-179 -17 -203 40q-2 -63 -56 -54q-47 8 -91 54q-12 13 -20 26q-17 29 -26 65q-58 -6 -87 -10q1 -2 4 -10zM507 -118q3 14 3 30q-17 71 -51 130t-73 70 q-41 12 -101.5 -14.5t-104.5 -80t-39 -107.5q35 -53 100 -93t119 -42q51 -2 94 28t53 79zM510 53q23 -63 27 -119q195 113 392 174q-98 52 -180.5 120t-179.5 165q-6 -4 -29 -13q0 -2 -1 -5t-1 -4q31 -18 22 -37q-12 -23 -56 -34q-10 -13 -29 -24h-1q-2 -83 1 -150 q19 -34 35 -73zM579 -113q532 -21 1145 0q-254 147 -428 196q-76 -35 -156 -57q-8 -3 -16 0q-65 21 -129 49q-208 -60 -416 -188h-1v-1q1 0 1 1zM1763 -67q4 54 28 120q14 38 33 71l-1 -1q3 77 3 153q-15 8 -30 25q-42 9 -56 33q-9 20 22 38q-2 4 -2 9q-16 4 -28 12 q-204 -190 -383 -284q198 -59 414 -176zM2155 -90q5 54 -39 107.5t-104 80t-102 14.5q-38 -11 -72.5 -70.5t-51.5 -129.5q0 -16 3 -30q10 -49 53 -79t94 -28q54 2 119 42t100 93z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1524 -25q0 -68 -48 -116t-116 -48t-116.5 48t-48.5 116t48.5 116.5t116.5 48.5t116 -48.5t48 -116.5zM775 -25q0 -68 -48.5 -116t-116.5 -48t-116 48t-48 116t48 116.5t116 48.5t116.5 -48.5t48.5 -116.5zM0 1469q57 -60 110.5 -104.5t121 -82t136 -63t166 -45.5 t200 -31.5t250 -18.5t304 -9.5t372.5 -2.5q139 0 244.5 -5t181 -16.5t124 -27.5t71 -39.5t24 -51.5t-19.5 -64t-56.5 -76.5t-89.5 -91t-116 -104.5t-139 -119q-185 -157 -286 -247q29 51 76.5 109t94 105.5t94.5 98.5t83 91.5t54 80.5t13 70t-45.5 55.5t-116.5 41t-204 23.5 t-304 5q-168 -2 -314 6t-256 23t-204.5 41t-159.5 51.5t-122.5 62.5t-91.5 66.5t-68 71.5t-50.5 69.5t-40 68t-36.5 59.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1472q-169 0 -323 -66t-265.5 -177.5t-177.5 -265.5t-66 -323t66 -323t177.5 -265.5t265.5 -177.5t323 -66t323 66t265.5 177.5t177.5 265.5t66 323t-66 323t-177.5 265.5t-265.5 177.5t-323 66zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348 t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM496 704q16 0 16 -16v-480q0 -16 -16 -16h-32q-16 0 -16 16v480q0 16 16 16h32zM896 640q53 0 90.5 -37.5t37.5 -90.5q0 -35 -17.5 -64t-46.5 -46v-114q0 -14 -9 -23 t-23 -9h-64q-14 0 -23 9t-9 23v114q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5zM896 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM544 928v-96 q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v96q0 93 65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5v-96q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v96q0 146 -103 249t-249 103t-249 -103t-103 -249zM1408 192v512q0 26 -19 45t-45 19h-896q-26 0 -45 -19t-19 -45v-512 q0 -26 19 -45t45 -19h896q26 0 45 19t19 45z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1920 1024v-768h-1664v768h1664zM2048 448h128v384h-128v288q0 14 -9 23t-23 9h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288zM2304 832v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113 v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h1280v-768h-1280zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h896v-768h-896zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h512v-768h-512zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9h-1856q-14 0 -23 -9t-9 -23 v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1133 493q31 -30 14 -69q-17 -40 -59 -40h-382l201 -476q10 -25 0 -49t-34 -35l-177 -75q-25 -10 -49 0t-35 34l-191 452l-312 -312q-19 -19 -45 -19q-12 0 -24 5q-40 17 -40 59v1504q0 42 40 59q12 5 24 5q27 0 45 -19z" /> +<glyph unicode="" horiz-adv-x="1024" d="M832 1408q-320 0 -320 -224v-416h128v-128h-128v-544q0 -224 320 -224h64v-128h-64q-272 0 -384 146q-112 -146 -384 -146h-64v128h64q320 0 320 224v544h-128v128h128v416q0 224 -320 224h-64v128h64q272 0 384 -146q112 146 384 146h64v-128h-64z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 1152h-128v-1024h128v-384h-384v128h-1280v-128h-384v384h128v1024h-128v384h384v-128h1280v128h384v-384zM1792 1408v-128h128v128h-128zM128 1408v-128h128v128h-128zM256 -128v128h-128v-128h128zM1664 0v128h128v1024h-128v128h-1280v-128h-128v-1024h128v-128 h1280zM1920 -128v128h-128v-128h128zM1280 896h384v-768h-896v256h-384v768h896v-256zM512 512h640v512h-640v-512zM1536 256v512h-256v-384h-384v-128h640z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2304 768h-128v-640h128v-384h-384v128h-896v-128h-384v384h128v128h-384v-128h-384v384h128v640h-128v384h384v-128h896v128h384v-384h-128v-128h384v128h384v-384zM2048 1024v-128h128v128h-128zM1408 1408v-128h128v128h-128zM128 1408v-128h128v128h-128zM256 256 v128h-128v-128h128zM1536 384h-128v-128h128v128zM384 384h896v128h128v640h-128v128h-896v-128h-128v-640h128v-128zM896 -128v128h-128v-128h128zM2176 -128v128h-128v-128h128zM2048 128v640h-128v128h-384v-384h128v-384h-384v128h-384v-128h128v-128h896v128h128z" /> +<glyph unicode="" d="M1024 288v-416h-928q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1344q40 0 68 -28t28 -68v-928h-416q-40 0 -68 -28t-28 -68zM1152 256h381q-15 -82 -65 -132l-184 -184q-50 -50 -132 -65v381z" /> +<glyph unicode="" d="M1400 256h-248v-248q29 10 41 22l185 185q12 12 22 41zM1120 384h288v896h-1280v-1280h896v288q0 40 28 68t68 28zM1536 1312v-1024q0 -40 -20 -88t-48 -76l-184 -184q-28 -28 -76 -48t-88 -20h-1024q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1344q40 0 68 -28t28 -68 z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1951 538q0 -26 -15.5 -44.5t-38.5 -23.5q-8 -2 -18 -2h-153v140h153q10 0 18 -2q23 -5 38.5 -23.5t15.5 -44.5zM1933 751q0 -25 -15 -42t-38 -21q-3 -1 -15 -1h-139v129h139q3 0 8.5 -0.5t6.5 -0.5q23 -4 38 -21.5t15 -42.5zM728 587v308h-228v-308q0 -58 -38 -94.5 t-105 -36.5q-108 0 -229 59v-112q53 -15 121 -23t109 -9l42 -1q328 0 328 217zM1442 403v113q-99 -52 -200 -59q-108 -8 -169 41t-61 142t61 142t169 41q101 -7 200 -58v112q-48 12 -100 19.5t-80 9.5l-28 2q-127 6 -218.5 -14t-140.5 -60t-71 -88t-22 -106t22 -106t71 -88 t140.5 -60t218.5 -14q101 4 208 31zM2176 518q0 54 -43 88.5t-109 39.5v3q57 8 89 41.5t32 79.5q0 55 -41 88t-107 36q-3 0 -12 0.5t-14 0.5h-455v-510h491q74 0 121.5 36.5t47.5 96.5zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90 t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M858 295v693q-106 -41 -172 -135.5t-66 -211.5t66 -211.5t172 -134.5zM1362 641q0 117 -66 211.5t-172 135.5v-694q106 41 172 135.5t66 211.5zM1577 641q0 -159 -78.5 -294t-213.5 -213.5t-294 -78.5q-119 0 -227.5 46.5t-187 125t-125 187t-46.5 227.5q0 159 78.5 294 t213.5 213.5t294 78.5t294 -78.5t213.5 -213.5t78.5 -294zM1960 634q0 139 -55.5 261.5t-147.5 205.5t-213.5 131t-252.5 48h-301q-176 0 -323.5 -81t-235 -230t-87.5 -335q0 -171 87 -317.5t236 -231.5t323 -85h301q129 0 251.5 50.5t214.5 135t147.5 202.5t55.5 246z M2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 -96v1088q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5v-1088q0 -13 9.5 -22.5t22.5 -9.5h1088q13 0 22.5 9.5t9.5 22.5zM1792 992v-1088q0 -66 -47 -113t-113 -47h-1088q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1088q66 0 113 -47t47 -113 zM1408 1376v-160h-128v160q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5v-1088q0 -13 9.5 -22.5t22.5 -9.5h160v-128h-160q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1088q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1728 1088l-384 -704h768zM448 1088l-384 -704h768zM1269 1280q-14 -40 -45.5 -71.5t-71.5 -45.5v-1291h608q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1344q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h608v1291q-40 14 -71.5 45.5t-45.5 71.5h-491q-14 0 -23 9t-9 23v64 q0 14 9 23t23 9h491q21 57 70 92.5t111 35.5t111 -35.5t70 -92.5h491q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-491zM1088 1264q33 0 56.5 23.5t23.5 56.5t-23.5 56.5t-56.5 23.5t-56.5 -23.5t-23.5 -56.5t23.5 -56.5t56.5 -23.5zM2176 384q0 -73 -46.5 -131t-117.5 -91 t-144.5 -49.5t-139.5 -16.5t-139.5 16.5t-144.5 49.5t-117.5 91t-46.5 131q0 11 35 81t92 174.5t107 195.5t102 184t56 100q18 33 56 33t56 -33q4 -7 56 -100t102 -184t107 -195.5t92 -174.5t35 -81zM896 384q0 -73 -46.5 -131t-117.5 -91t-144.5 -49.5t-139.5 -16.5 t-139.5 16.5t-144.5 49.5t-117.5 91t-46.5 131q0 11 35 81t92 174.5t107 195.5t102 184t56 100q18 33 56 33t56 -33q4 -7 56 -100t102 -184t107 -195.5t92 -174.5t35 -81z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM874 700q77 29 149 92.5t129.5 152.5t92.5 210t35 253h-1024q0 -132 35 -253t92.5 -210t129.5 -152.5t149 -92.5q19 -7 30.5 -23.5t11.5 -36.5t-11.5 -36.5t-30.5 -23.5q-77 -29 -149 -92.5 t-129.5 -152.5t-92.5 -210t-35 -253h1024q0 132 -35 253t-92.5 210t-129.5 152.5t-149 92.5q-19 7 -30.5 23.5t-11.5 36.5t11.5 36.5t30.5 23.5z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM1280 1408h-1024q0 -66 9 -128h1006q9 61 9 128zM1280 -128q0 130 -34 249.5t-90.5 208t-126.5 152t-146 94.5h-230q-76 -31 -146 -94.5t-126.5 -152t-90.5 -208t-34 -249.5h1024z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM1280 1408h-1024q0 -206 85 -384h854q85 178 85 384zM1223 192q-54 141 -145.5 241.5t-194.5 142.5h-230q-103 -42 -194.5 -142.5t-145.5 -241.5h910z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM874 700q77 29 149 92.5t129.5 152.5t92.5 210t35 253h-1024q0 -132 35 -253t92.5 -210t129.5 -152.5t149 -92.5q19 -7 30.5 -23.5t11.5 -36.5t-11.5 -36.5t-30.5 -23.5q-137 -51 -244 -196 h700q-107 145 -244 196q-19 7 -30.5 23.5t-11.5 36.5t11.5 36.5t30.5 23.5z" /> +<glyph unicode="" d="M1504 -64q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v128q0 14 9 23t23 9h1472zM130 0q3 55 16 107t30 95t46 87t53.5 76t64.5 69.5t66 60t70.5 55t66.5 47.5t65 43q-43 28 -65 43t-66.5 47.5t-70.5 55t-66 60t-64.5 69.5t-53.5 76t-46 87 t-30 95t-16 107h1276q-3 -55 -16 -107t-30 -95t-46 -87t-53.5 -76t-64.5 -69.5t-66 -60t-70.5 -55t-66.5 -47.5t-65 -43q43 -28 65 -43t66.5 -47.5t70.5 -55t66 -60t64.5 -69.5t53.5 -76t46 -87t30 -95t16 -107h-1276zM1504 1536q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9 h-1472q-14 0 -23 9t-9 23v128q0 14 9 23t23 9h1472z" /> +<glyph unicode="" d="M768 1152q-53 0 -90.5 -37.5t-37.5 -90.5v-128h-32v93q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-429l-32 30v172q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-224q0 -47 35 -82l310 -296q39 -39 39 -102q0 -26 19 -45t45 -19h640q26 0 45 19t19 45v25 q0 41 10 77l108 436q10 36 10 77v246q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-32h-32v125q0 40 -25 72.5t-64 40.5q-14 2 -23 2q-46 0 -79 -33t-33 -79v-128h-32v122q0 51 -32.5 89.5t-82.5 43.5q-5 1 -13 1zM768 1280q84 0 149 -50q57 34 123 34q59 0 111 -27 t86 -76q27 7 59 7q100 0 170 -71.5t70 -171.5v-246q0 -51 -13 -108l-109 -436q-6 -24 -6 -71q0 -80 -56 -136t-136 -56h-640q-84 0 -138 58.5t-54 142.5l-308 296q-76 73 -76 175v224q0 99 70.5 169.5t169.5 70.5q11 0 16 -1q6 95 75.5 160t164.5 65q52 0 98 -21 q72 69 174 69z" /> +<glyph unicode="" horiz-adv-x="1792" d="M880 1408q-46 0 -79 -33t-33 -79v-656h-32v528q0 46 -33 79t-79 33t-79 -33t-33 -79v-528v-256l-154 205q-38 51 -102 51q-53 0 -90.5 -37.5t-37.5 -90.5q0 -43 26 -77l384 -512q38 -51 102 -51h688q34 0 61 22t34 56l76 405q5 32 5 59v498q0 46 -33 79t-79 33t-79 -33 t-33 -79v-272h-32v528q0 46 -33 79t-79 33t-79 -33t-33 -79v-528h-32v656q0 46 -33 79t-79 33zM880 1536q68 0 125.5 -35.5t88.5 -96.5q19 4 42 4q99 0 169.5 -70.5t70.5 -169.5v-17q105 6 180.5 -64t75.5 -175v-498q0 -40 -8 -83l-76 -404q-14 -79 -76.5 -131t-143.5 -52 h-688q-60 0 -114.5 27.5t-90.5 74.5l-384 512q-51 68 -51 154q0 106 75 181t181 75q78 0 128 -34v434q0 99 70.5 169.5t169.5 70.5q23 0 42 -4q31 61 88.5 96.5t125.5 35.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1073 -128h-177q-163 0 -226 141q-23 49 -23 102v5q-62 30 -98.5 88.5t-36.5 127.5q0 38 5 48h-261q-106 0 -181 75t-75 181t75 181t181 75h113l-44 17q-74 28 -119.5 93.5t-45.5 145.5q0 106 75 181t181 75q46 0 91 -17l628 -239h401q106 0 181 -75t75 -181v-668 q0 -88 -54 -157.5t-140 -90.5l-339 -85q-92 -23 -186 -23zM1024 583l-155 -71l-163 -74q-30 -14 -48 -41.5t-18 -60.5q0 -46 33 -79t79 -33q26 0 46 10l338 154q-49 10 -80.5 50t-31.5 90v55zM1344 272q0 46 -33 79t-79 33q-26 0 -46 -10l-290 -132q-28 -13 -37 -17 t-30.5 -17t-29.5 -23.5t-16 -29t-8 -40.5q0 -50 31.5 -82t81.5 -32q20 0 38 9l352 160q30 14 48 41.5t18 60.5zM1112 1024l-650 248q-24 8 -46 8q-53 0 -90.5 -37.5t-37.5 -90.5q0 -40 22.5 -73t59.5 -47l526 -200v-64h-640q-53 0 -90.5 -37.5t-37.5 -90.5t37.5 -90.5 t90.5 -37.5h535l233 106v198q0 63 46 106l111 102h-69zM1073 0q82 0 155 19l339 85q43 11 70 45.5t27 78.5v668q0 53 -37.5 90.5t-90.5 37.5h-308l-136 -126q-36 -33 -36 -82v-296q0 -46 33 -77t79 -31t79 35t33 81v208h32v-208q0 -70 -57 -114q52 -8 86.5 -48.5t34.5 -93.5 q0 -42 -23 -78t-61 -53l-310 -141h91z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1151 1536q61 0 116 -28t91 -77l572 -781q118 -159 118 -359v-355q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v177l-286 143h-546q-80 0 -136 56t-56 136v32q0 119 84.5 203.5t203.5 84.5h420l42 128h-686q-100 0 -173.5 67.5t-81.5 166.5q-65 79 -65 182v32 q0 80 56 136t136 56h959zM1920 -64v355q0 157 -93 284l-573 781q-39 52 -103 52h-959q-26 0 -45 -19t-19 -45q0 -32 1.5 -49.5t9.5 -40.5t25 -43q10 31 35.5 50t56.5 19h832v-32h-832q-26 0 -45 -19t-19 -45q0 -44 3 -58q8 -44 44 -73t81 -29h640h91q40 0 68 -28t28 -68 q0 -15 -5 -30l-64 -192q-10 -29 -35 -47.5t-56 -18.5h-443q-66 0 -113 -47t-47 -113v-32q0 -26 19 -45t45 -19h561q16 0 29 -7l317 -158q24 -13 38.5 -36t14.5 -50v-197q0 -26 19 -45t45 -19h384q26 0 45 19t19 45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M816 1408q-48 0 -79.5 -34t-31.5 -82q0 -14 3 -28l150 -624h-26l-116 482q-9 38 -39.5 62t-69.5 24q-47 0 -79 -34t-32 -81q0 -11 4 -29q3 -13 39 -161t68 -282t32 -138v-227l-307 230q-34 26 -77 26q-52 0 -89.5 -36.5t-37.5 -88.5q0 -67 56 -110l507 -379 q34 -26 76 -26h694q33 0 59 20.5t34 52.5l100 401q8 30 10 88t9 86l116 478q3 12 3 26q0 46 -33 79t-80 33q-38 0 -69 -25.5t-40 -62.5l-99 -408h-26l132 547q3 14 3 28q0 47 -32 80t-80 33q-38 0 -68.5 -24t-39.5 -62l-145 -602h-127l-164 682q-9 38 -39.5 62t-68.5 24z M1461 -256h-694q-85 0 -153 51l-507 380q-50 38 -78.5 94t-28.5 118q0 105 75 179t180 74q25 0 49.5 -5.5t41.5 -11t41 -20.5t35 -23t38.5 -29.5t37.5 -28.5l-123 512q-7 35 -7 59q0 93 60 162t152 79q14 87 80.5 144.5t155.5 57.5q83 0 148 -51.5t85 -132.5l103 -428 l83 348q20 81 85 132.5t148 51.5q87 0 152.5 -54t82.5 -139q93 -10 155 -78t62 -161q0 -30 -7 -57l-116 -477q-5 -22 -5 -67q0 -51 -13 -108l-101 -401q-19 -75 -79.5 -122.5t-137.5 -47.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1408q-53 0 -90.5 -37.5t-37.5 -90.5v-512v-384l-151 202q-41 54 -107 54q-52 0 -89 -38t-37 -90q0 -43 26 -77l384 -512q38 -51 102 -51h718q22 0 39.5 13.5t22.5 34.5l92 368q24 96 24 194v217q0 41 -28 71t-68 30t-68 -28t-28 -68h-32v61q0 48 -32 81.5t-80 33.5 q-46 0 -79 -33t-33 -79v-64h-32v90q0 55 -37 94.5t-91 39.5q-53 0 -90.5 -37.5t-37.5 -90.5v-96h-32v570q0 55 -37 94.5t-91 39.5zM640 1536q107 0 181.5 -77.5t74.5 -184.5v-220q22 2 32 2q99 0 173 -69q47 21 99 21q113 0 184 -87q27 7 56 7q94 0 159 -67.5t65 -161.5 v-217q0 -116 -28 -225l-92 -368q-16 -64 -68 -104.5t-118 -40.5h-718q-60 0 -114.5 27.5t-90.5 74.5l-384 512q-51 68 -51 154q0 105 74.5 180.5t179.5 75.5q71 0 130 -35v547q0 106 75 181t181 75zM768 128v384h-32v-384h32zM1024 128v384h-32v-384h32zM1280 128v384h-32 v-384h32z" /> +<glyph unicode="" d="M1288 889q60 0 107 -23q141 -63 141 -226v-177q0 -94 -23 -186l-85 -339q-21 -86 -90.5 -140t-157.5 -54h-668q-106 0 -181 75t-75 181v401l-239 628q-17 45 -17 91q0 106 75 181t181 75q80 0 145.5 -45.5t93.5 -119.5l17 -44v113q0 106 75 181t181 75t181 -75t75 -181 v-261q27 5 48 5q69 0 127.5 -36.5t88.5 -98.5zM1072 896q-33 0 -60.5 -18t-41.5 -48l-74 -163l-71 -155h55q50 0 90 -31.5t50 -80.5l154 338q10 20 10 46q0 46 -33 79t-79 33zM1293 761q-22 0 -40.5 -8t-29 -16t-23.5 -29.5t-17 -30.5t-17 -37l-132 -290q-10 -20 -10 -46 q0 -46 33 -79t79 -33q33 0 60.5 18t41.5 48l160 352q9 18 9 38q0 50 -32 81.5t-82 31.5zM128 1120q0 -22 8 -46l248 -650v-69l102 111q43 46 106 46h198l106 233v535q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5v-640h-64l-200 526q-14 37 -47 59.5t-73 22.5 q-53 0 -90.5 -37.5t-37.5 -90.5zM1180 -128q44 0 78.5 27t45.5 70l85 339q19 73 19 155v91l-141 -310q-17 -38 -53 -61t-78 -23q-53 0 -93.5 34.5t-48.5 86.5q-44 -57 -114 -57h-208v32h208q46 0 81 33t35 79t-31 79t-77 33h-296q-49 0 -82 -36l-126 -136v-308 q0 -53 37.5 -90.5t90.5 -37.5h668z" /> +<glyph unicode="" horiz-adv-x="1973" d="M857 992v-117q0 -13 -9.5 -22t-22.5 -9h-298v-812q0 -13 -9 -22.5t-22 -9.5h-135q-13 0 -22.5 9t-9.5 23v812h-297q-13 0 -22.5 9t-9.5 22v117q0 14 9 23t23 9h793q13 0 22.5 -9.5t9.5 -22.5zM1895 995l77 -961q1 -13 -8 -24q-10 -10 -23 -10h-134q-12 0 -21 8.5 t-10 20.5l-46 588l-189 -425q-8 -19 -29 -19h-120q-20 0 -29 19l-188 427l-45 -590q-1 -12 -10 -20.5t-21 -8.5h-135q-13 0 -23 10q-9 10 -9 24l78 961q1 12 10 20.5t21 8.5h142q20 0 29 -19l220 -520q10 -24 20 -51q3 7 9.5 24.5t10.5 26.5l221 520q9 19 29 19h141 q13 0 22 -8.5t10 -20.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1042 833q0 88 -60 121q-33 18 -117 18h-123v-281h162q66 0 102 37t36 105zM1094 548l205 -373q8 -17 -1 -31q-8 -16 -27 -16h-152q-20 0 -28 17l-194 365h-155v-350q0 -14 -9 -23t-23 -9h-134q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h294q128 0 190 -24q85 -31 134 -109 t49 -180q0 -92 -42.5 -165.5t-115.5 -109.5q6 -10 9 -16zM896 1376q-150 0 -286 -58.5t-234.5 -157t-157 -234.5t-58.5 -286t58.5 -286t157 -234.5t234.5 -157t286 -58.5t286 58.5t234.5 157t157 234.5t58.5 286t-58.5 286t-157 234.5t-234.5 157t-286 58.5zM1792 640 q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M605 303q153 0 257 104q14 18 3 36l-45 82q-6 13 -24 17q-16 2 -27 -11l-4 -3q-4 -4 -11.5 -10t-17.5 -13t-23.5 -14.5t-28.5 -13.5t-33.5 -9.5t-37.5 -3.5q-76 0 -125 50t-49 127q0 76 48 125.5t122 49.5q37 0 71.5 -14t50.5 -28l16 -14q11 -11 26 -10q16 2 24 14l53 78 q13 20 -2 39q-3 4 -11 12t-30 23.5t-48.5 28t-67.5 22.5t-86 10q-148 0 -246 -96.5t-98 -240.5q0 -146 97 -241.5t247 -95.5zM1235 303q153 0 257 104q14 18 4 36l-45 82q-8 14 -25 17q-16 2 -27 -11l-4 -3q-4 -4 -11.5 -10t-17.5 -13t-23.5 -14.5t-28.5 -13.5t-33.5 -9.5 t-37.5 -3.5q-76 0 -125 50t-49 127q0 76 48 125.5t122 49.5q37 0 71.5 -14t50.5 -28l16 -14q11 -11 26 -10q16 2 24 14l53 78q13 20 -2 39q-3 4 -11 12t-30 23.5t-48.5 28t-67.5 22.5t-86 10q-147 0 -245.5 -96.5t-98.5 -240.5q0 -146 97 -241.5t247 -95.5zM896 1376 q-150 0 -286 -58.5t-234.5 -157t-157 -234.5t-58.5 -286t58.5 -286t157 -234.5t234.5 -157t286 -58.5t286 58.5t234.5 157t157 234.5t58.5 286t-58.5 286t-157 234.5t-234.5 157t-286 58.5zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191 t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71z" /> +<glyph unicode="" horiz-adv-x="2048" d="M736 736l384 -384l-384 -384l-672 672l672 672l168 -168l-96 -96l-72 72l-480 -480l480 -480l193 193l-289 287zM1312 1312l672 -672l-672 -672l-168 168l96 96l72 -72l480 480l-480 480l-193 -193l289 -287l-96 -96l-384 384z" /> +<glyph unicode="" horiz-adv-x="1792" d="M717 182l271 271l-279 279l-88 -88l192 -191l-96 -96l-279 279l279 279l40 -40l87 87l-127 128l-454 -454zM1075 190l454 454l-454 454l-271 -271l279 -279l88 88l-192 191l96 96l279 -279l-279 -279l-40 40l-87 -88zM1792 640q0 -182 -71 -348t-191 -286t-286 -191 t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="2304" d="M651 539q0 -39 -27.5 -66.5t-65.5 -27.5q-39 0 -66.5 27.5t-27.5 66.5q0 38 27.5 65.5t66.5 27.5q38 0 65.5 -27.5t27.5 -65.5zM1805 540q0 -39 -27.5 -66.5t-66.5 -27.5t-66.5 27.5t-27.5 66.5t27.5 66t66.5 27t66.5 -27t27.5 -66zM765 539q0 79 -56.5 136t-136.5 57 t-136.5 -56.5t-56.5 -136.5t56.5 -136.5t136.5 -56.5t136.5 56.5t56.5 136.5zM1918 540q0 80 -56.5 136.5t-136.5 56.5q-79 0 -136 -56.5t-57 -136.5t56.5 -136.5t136.5 -56.5t136.5 56.5t56.5 136.5zM850 539q0 -116 -81.5 -197.5t-196.5 -81.5q-116 0 -197.5 82t-81.5 197 t82 196.5t197 81.5t196.5 -81.5t81.5 -196.5zM2004 540q0 -115 -81.5 -196.5t-197.5 -81.5q-115 0 -196.5 81.5t-81.5 196.5t81.5 196.5t196.5 81.5q116 0 197.5 -81.5t81.5 -196.5zM1040 537q0 191 -135.5 326.5t-326.5 135.5q-125 0 -231 -62t-168 -168.5t-62 -231.5 t62 -231.5t168 -168.5t231 -62q191 0 326.5 135.5t135.5 326.5zM1708 1110q-254 111 -556 111q-319 0 -573 -110q117 0 223 -45.5t182.5 -122.5t122 -183t45.5 -223q0 115 43.5 219.5t118 180.5t177.5 123t217 50zM2187 537q0 191 -135 326.5t-326 135.5t-326.5 -135.5 t-135.5 -326.5t135.5 -326.5t326.5 -135.5t326 135.5t135 326.5zM1921 1103h383q-44 -51 -75 -114.5t-40 -114.5q110 -151 110 -337q0 -156 -77 -288t-209 -208.5t-287 -76.5q-133 0 -249 56t-196 155q-47 -56 -129 -179q-11 22 -53.5 82.5t-74.5 97.5 q-80 -99 -196.5 -155.5t-249.5 -56.5q-155 0 -287 76.5t-209 208.5t-77 288q0 186 110 337q-9 51 -40 114.5t-75 114.5h365q149 100 355 156.5t432 56.5q224 0 421 -56t348 -157z" /> +<glyph unicode="" horiz-adv-x="1280" d="M640 629q-188 0 -321 133t-133 320q0 188 133 321t321 133t321 -133t133 -321q0 -187 -133 -320t-321 -133zM640 1306q-92 0 -157.5 -65.5t-65.5 -158.5q0 -92 65.5 -157.5t157.5 -65.5t157.5 65.5t65.5 157.5q0 93 -65.5 158.5t-157.5 65.5zM1163 574q13 -27 15 -49.5 t-4.5 -40.5t-26.5 -38.5t-42.5 -37t-61.5 -41.5q-115 -73 -315 -94l73 -72l267 -267q30 -31 30 -74t-30 -73l-12 -13q-31 -30 -74 -30t-74 30q-67 68 -267 268l-267 -268q-31 -30 -74 -30t-73 30l-12 13q-31 30 -31 73t31 74l267 267l72 72q-203 21 -317 94 q-39 25 -61.5 41.5t-42.5 37t-26.5 38.5t-4.5 40.5t15 49.5q10 20 28 35t42 22t56 -2t65 -35q5 -4 15 -11t43 -24.5t69 -30.5t92 -24t113 -11q91 0 174 25.5t120 50.5l38 25q33 26 65 35t56 2t42 -22t28 -35z" /> +<glyph unicode="" d="M927 956q0 -66 -46.5 -112.5t-112.5 -46.5t-112.5 46.5t-46.5 112.5t46.5 112.5t112.5 46.5t112.5 -46.5t46.5 -112.5zM1141 593q-10 20 -28 32t-47.5 9.5t-60.5 -27.5q-10 -8 -29 -20t-81 -32t-127 -20t-124 18t-86 36l-27 18q-31 25 -60.5 27.5t-47.5 -9.5t-28 -32 q-22 -45 -2 -74.5t87 -73.5q83 -53 226 -67l-51 -52q-142 -142 -191 -190q-22 -22 -22 -52.5t22 -52.5l9 -9q22 -22 52.5 -22t52.5 22l191 191q114 -115 191 -191q22 -22 52.5 -22t52.5 22l9 9q22 22 22 52.5t-22 52.5l-191 190l-52 52q141 14 225 67q67 44 87 73.5t-2 74.5 zM1092 956q0 134 -95 229t-229 95t-229 -95t-95 -229t95 -229t229 -95t229 95t95 229zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1720" d="M1565 1408q65 0 110 -45.5t45 -110.5v-519q0 -176 -68 -336t-182.5 -275t-274 -182.5t-334.5 -67.5q-176 0 -335.5 67.5t-274.5 182.5t-183 275t-68 336v519q0 64 46 110t110 46h1409zM861 344q47 0 82 33l404 388q37 35 37 85q0 49 -34.5 83.5t-83.5 34.5q-47 0 -82 -33 l-323 -310l-323 310q-35 33 -81 33q-49 0 -83.5 -34.5t-34.5 -83.5q0 -51 36 -85l405 -388q33 -33 81 -33z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1494 -103l-295 695q-25 -49 -158.5 -305.5t-198.5 -389.5q-1 -1 -27.5 -0.5t-26.5 1.5q-82 193 -255.5 587t-259.5 596q-21 50 -66.5 107.5t-103.5 100.5t-102 43q0 5 -0.5 24t-0.5 27h583v-50q-39 -2 -79.5 -16t-66.5 -43t-10 -64q26 -59 216.5 -499t235.5 -540 q31 61 140 266.5t131 247.5q-19 39 -126 281t-136 295q-38 69 -201 71v50l513 -1v-47q-60 -2 -93.5 -25t-12.5 -69q33 -70 87 -189.5t86 -187.5q110 214 173 363q24 55 -10 79.5t-129 26.5q1 7 1 25v24q64 0 170.5 0.5t180 1t92.5 0.5v-49q-62 -2 -119 -33t-90 -81 l-213 -442q13 -33 127.5 -290t121.5 -274l441 1017q-14 38 -49.5 62.5t-65 31.5t-55.5 8v50l460 -4l1 -2l-1 -44q-139 -4 -201 -145q-526 -1216 -559 -1291h-49z" /> +<glyph unicode="" horiz-adv-x="1792" d="M949 643q0 -26 -16.5 -45t-41.5 -19q-26 0 -45 16.5t-19 41.5q0 26 17 45t42 19t44 -16.5t19 -41.5zM964 585l350 581q-9 -8 -67.5 -62.5t-125.5 -116.5t-136.5 -127t-117 -110.5t-50.5 -51.5l-349 -580q7 7 67 62t126 116.5t136 127t117 111t50 50.5zM1611 640 q0 -201 -104 -371q-3 2 -17 11t-26.5 16.5t-16.5 7.5q-13 0 -13 -13q0 -10 59 -44q-74 -112 -184.5 -190.5t-241.5 -110.5l-16 67q-1 10 -15 10q-5 0 -8 -5.5t-2 -9.5l16 -68q-72 -15 -146 -15q-199 0 -372 105q1 2 13 20.5t21.5 33.5t9.5 19q0 13 -13 13q-6 0 -17 -14.5 t-22.5 -34.5t-13.5 -23q-113 75 -192 187.5t-110 244.5l69 15q10 3 10 15q0 5 -5.5 8t-10.5 2l-68 -15q-14 72 -14 139q0 206 109 379q2 -1 18.5 -12t30 -19t17.5 -8q13 0 13 12q0 6 -12.5 15.5t-32.5 21.5l-20 12q77 112 189 189t244 107l15 -67q2 -10 15 -10q5 0 8 5.5 t2 10.5l-15 66q71 13 134 13q204 0 379 -109q-39 -56 -39 -65q0 -13 12 -13q11 0 48 64q111 -75 187.5 -186t107.5 -241l-56 -12q-10 -2 -10 -16q0 -5 5.5 -8t9.5 -2l57 13q14 -72 14 -140zM1696 640q0 163 -63.5 311t-170.5 255t-255 170.5t-311 63.5t-311 -63.5 t-255 -170.5t-170.5 -255t-63.5 -311t63.5 -311t170.5 -255t255 -170.5t311 -63.5t311 63.5t255 170.5t170.5 255t63.5 311zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191 t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M893 1536q240 2 451 -120q232 -134 352 -372l-742 39q-160 9 -294 -74.5t-185 -229.5l-276 424q128 159 311 245.5t383 87.5zM146 1131l337 -663q72 -143 211 -217t293 -45l-230 -451q-212 33 -385 157.5t-272.5 316t-99.5 411.5q0 267 146 491zM1732 962 q58 -150 59.5 -310.5t-48.5 -306t-153 -272t-246 -209.5q-230 -133 -498 -119l405 623q88 131 82.5 290.5t-106.5 277.5zM896 942q125 0 213.5 -88.5t88.5 -213.5t-88.5 -213.5t-213.5 -88.5t-213.5 88.5t-88.5 213.5t88.5 213.5t213.5 88.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M903 -256q-283 0 -504.5 150.5t-329.5 398.5q-58 131 -67 301t26 332.5t111 312t179 242.5l-11 -281q11 14 68 15.5t70 -15.5q42 81 160.5 138t234.5 59q-54 -45 -119.5 -148.5t-58.5 -163.5q25 -8 62.5 -13.5t63 -7.5t68 -4t50.5 -3q15 -5 9.5 -45.5t-30.5 -75.5 q-5 -7 -16.5 -18.5t-56.5 -35.5t-101 -34l15 -189l-139 67q-18 -43 -7.5 -81.5t36 -66.5t65.5 -41.5t81 -6.5q51 9 98 34.5t83.5 45t73.5 17.5q61 -4 89.5 -33t19.5 -65q-1 -2 -2.5 -5.5t-8.5 -12.5t-18 -15.5t-31.5 -10.5t-46.5 -1q-60 -95 -144.5 -135.5t-209.5 -29.5 q74 -61 162.5 -82.5t168.5 -6t154.5 52t128 87.5t80.5 104q43 91 39 192.5t-37.5 188.5t-78.5 125q87 -38 137 -79.5t77 -112.5q15 170 -57.5 343t-209.5 284q265 -77 412 -279.5t151 -517.5q2 -127 -40.5 -255t-123.5 -238t-189 -196t-247.5 -135.5t-288.5 -49.5z" /> +<glyph unicode="" d="M768 -92q77 0 139.5 63t100.5 166t59 234.5t21 268.5t-21 268.5t-59 234.5t-100.5 166t-139.5 63t-139.5 -63t-100.5 -166t-59 -234.5t-21 -268.5t21 -268.5t59 -234.5t100.5 -166t139.5 -63zM768 -256q-184 0 -333 77t-240 203t-141 287t-50 329t50 329t141 287t240 203 t333 77q148 0 274 -50t214.5 -136t151.5 -201t92.5 -244t29.5 -265t-29.5 -265t-92.5 -244t-151.5 -201t-214.5 -136t-274 -50z" /> +<glyph unicode="" horiz-adv-x="1792" d="M716 -69q-143 35 -261.5 114t-197.5 191q-139 -300 -17 -398q26 -21 85 -24.5t127.5 9.5t141 41.5t122.5 66.5zM693 762h452q0 108 -61.5 169t-168.5 61q-103 0 -162.5 -62.5t-59.5 -167.5zM1724 1137h-34q26 102 22.5 170t-25 110t-63.5 57t-93.5 11t-115 -26.5 t-128.5 -56.5t-134 -79q129 -37 238.5 -113.5t185 -179t110 -231.5t15.5 -262h-1005q0 -60 10 -106t34 -85t69.5 -60t112.5 -21q87 0 142.5 44t72.5 122h540q-71 -230 -281.5 -377t-477.5 -147q-83 0 -159 15q-35 -40 -151 -94t-248 -78t-219 35q-78 60 -100 159t7 214 t88 242t143.5 248t173.5 226.5t177.5 183.5t156.5 112v24q-120 -37 -258.5 -137.5t-240.5 -207t-159 -195.5q4 106 34 201t80 169t118 135.5t147.5 100.5t168 65.5t180.5 29.5t185 -8q310 186 503 189h7q57 0 103 -18q80 -30 98 -132.5t-30 -248.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1792 288v960q0 13 -9.5 22.5t-22.5 9.5h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5zM1920 1248v-960q0 -66 -47 -113t-113 -47h-736v-128h352q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23 v64q0 14 9 23t23 9h352v128h-736q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1792" d="M138 1408h197q-70 -64 -126 -149q-36 -56 -59 -115t-30 -125.5t-8.5 -120t10.5 -132t21 -126t28 -136.5q4 -19 6 -28q51 -238 81 -329q57 -171 152 -275h-272q-48 0 -82 34t-34 82v1304q0 48 34 82t82 34zM1346 1408h308q48 0 82 -34t34 -82v-1304q0 -48 -34 -82t-82 -34 h-178q212 210 196 565l-469 -101q-2 -45 -12 -82t-31 -72t-59.5 -59.5t-93.5 -36.5q-123 -26 -199 40q-32 27 -53 61t-51.5 129t-64.5 258q-35 163 -45.5 263t-5.5 139t23 77q20 41 62.5 73t102.5 45q45 12 83.5 6.5t67 -17t54 -35t43 -48t34.5 -56.5l468 100 q-68 175 -180 287z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1391 390v0l-1 1q-15 18 -34.5 37.5t-62.5 57.5t-93.5 62t-95.5 24q-48 0 -83 -21.5t-51 -54t-23 -59t-7 -47.5v0v0q0 -21 7 -48t23 -59t51 -53.5t83 -21.5q45 0 95.5 24t94 62.5t62 57t34.5 37.5zM2103 390q0 21 -7 47.5t-23 59t-51 54t-83 21.5q-45 0 -95.5 -24 t-94 -62.5t-62 -57t-34.5 -37.5l-1 -1v0v0l1 -1q15 -18 34.5 -37.5t62.5 -57.5t93.5 -62t95.5 -24q48 0 83 21.5t51 53.5t23 59t7 48zM2304 393q0 -69 -24 -137.5t-68 -126t-116 -93.5t-159 -36q-68 0 -134 24t-113.5 58.5t-84.5 69.5t-59.5 59t-25.5 24t-22.5 -24 t-54.5 -58.5t-81.5 -69.5t-115 -59t-143.5 -24q-65 0 -123.5 22.5t-96.5 54t-66.5 66.5t-41 59.5t-12.5 32.5q0 -8 -8.5 -26.5t-25 -45.5t-47 -55t-69 -52.5t-96.5 -40t-125 -15.5q-71 0 -130 15.5t-98.5 39.5t-70.5 56.5t-48 63.5t-27.5 63.5t-14 54t-3.5 36.5h217 q0 -55 49 -107.5t126 -52.5q79 0 134.5 67t55.5 148q0 80 -52 136.5t-138 56.5q-5 0 -13 -0.5t-31 -5t-43 -12t-42 -24.5t-34 -40h-195l102 583h602v-174h-445q-27 -159 -41 -248q4 0 16.5 13t31.5 28.5t65 28.5t108 13t114 -20.5t82.5 -49.5t51.5 -58.5t31 -50t11 -20.5 t13 25t36.5 60.5t60.5 71.5t97 61t133 25t140.5 -25t115.5 -60.5t83.5 -71.5t56.5 -61t21 -25q2 0 22 25t56 60.5t83.5 71.5t115.5 61t140 25q92 0 164.5 -35t115.5 -93t65 -125t22 -137z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1551 60q15 6 26 3t11 -17.5t-15 -33.5q-13 -16 -44 -43.5t-95.5 -68t-141 -74t-188 -58t-229.5 -24.5q-119 0 -238 31t-209 76.5t-172.5 104t-132.5 105t-84 87.5q-8 9 -10 16.5t1 12t8 7t11.5 2t11.5 -4.5q192 -117 300 -166q389 -176 799 -90q190 40 391 135z M1758 175q11 -16 2.5 -69.5t-28.5 -102.5q-34 -83 -85 -124q-17 -14 -26 -9t0 24q21 45 44.5 121.5t6.5 98.5q-5 7 -15.5 11.5t-27 6t-29.5 2.5t-35 0t-31.5 -2t-31 -3t-22.5 -2q-6 -1 -13 -1.5t-11 -1t-8.5 -1t-7 -0.5h-5.5h-4.5t-3 0.5t-2 1.5l-1.5 3q-6 16 47 40t103 30 q46 7 108 1t76 -24zM1364 618q0 -31 13.5 -64t32 -58t37.5 -46t33 -32l13 -11l-227 -224q-40 37 -79 75.5t-58 58.5l-19 20q-11 11 -25 33q-38 -59 -97.5 -102.5t-127.5 -63.5t-140 -23t-137.5 21t-117.5 65.5t-83 113t-31 162.5q0 84 28 154t72 116.5t106.5 83t122.5 57 t130 34.5t119.5 18.5t99.5 6.5v127q0 65 -21 97q-34 53 -121 53q-6 0 -16.5 -1t-40.5 -12t-56 -29.5t-56 -59.5t-48 -96l-294 27q0 60 22 119t67 113t108 95t151.5 65.5t190.5 24.5q100 0 181 -25t129.5 -61.5t81 -83t45 -86t12.5 -73.5v-589zM692 597q0 -86 70 -133 q66 -44 139 -22q84 25 114 123q14 45 14 101v162q-59 -2 -111 -12t-106.5 -33.5t-87 -71t-32.5 -114.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1536 1280q52 0 90 -38t38 -90v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128zM1152 1376v-288q0 -14 9 -23t23 -9 h64q14 0 23 9t9 23v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM384 1376v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM1536 -128v1024h-1408v-1024h1408zM896 448h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224 v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v224q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-224z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1152 416v-64q0 -14 -9 -23t-23 -9h-576q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h576q14 0 23 -9t9 -23zM128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23 t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47 t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1111 151l-46 -46q-9 -9 -22 -9t-23 9l-188 189l-188 -189q-10 -9 -23 -9t-22 9l-46 46q-9 9 -9 22t9 23l189 188l-189 188q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l188 -188l188 188q10 9 23 9t22 -9l46 -46q9 -9 9 -22t-9 -23l-188 -188l188 -188q9 -10 9 -23t-9 -22z M128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280 q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1303 572l-512 -512q-10 -9 -23 -9t-23 9l-288 288q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l220 -220l444 444q10 9 23 9t22 -9l46 -46q9 -9 9 -22t-9 -23zM128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23 t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47 t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M448 1536q26 0 45 -19t19 -45v-891l536 429q17 14 40 14q26 0 45 -19t19 -45v-379l536 429q17 14 40 14q26 0 45 -19t19 -45v-1152q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h384z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 448q66 0 128 15v-655q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v655q61 -15 128 -15zM512 1536q212 0 362 -150t150 -362t-150 -362t-362 -150t-362 150t-150 362t150 362t362 150zM512 1312q14 0 23 9t9 23t-9 23t-23 9q-146 0 -249 -103t-103 -249 q0 -14 9 -23t23 -9t23 9t9 23q0 119 84.5 203.5t203.5 84.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1745 1239q10 -10 10 -23t-10 -23l-141 -141q-28 -28 -68 -28h-1344q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h576v64q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-64h512q40 0 68 -28zM768 320h256v-512q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v512zM1600 768 q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-1344q-40 0 -68 28l-141 141q-10 10 -10 23t10 23l141 141q28 28 68 28h512v192h256v-192h576z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2020 1525q28 -20 28 -53v-1408q0 -20 -11 -36t-29 -23l-640 -256q-24 -11 -48 0l-616 246l-616 -246q-10 -5 -24 -5q-19 0 -36 11q-28 20 -28 53v1408q0 20 11 36t29 23l640 256q24 11 48 0l616 -246l616 246q32 13 60 -6zM736 1390v-1270l576 -230v1270zM128 1173 v-1270l544 217v1270zM1920 107v1270l-544 -217v-1270z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 1536q13 0 22.5 -9.5t9.5 -22.5v-1472q0 -20 -17 -28l-480 -256q-7 -4 -15 -4q-13 0 -22.5 9.5t-9.5 22.5v1472q0 20 17 28l480 256q7 4 15 4zM1760 1536q13 0 22.5 -9.5t9.5 -22.5v-1472q0 -20 -17 -28l-480 -256q-7 -4 -15 -4q-13 0 -22.5 9.5t-9.5 22.5v1472 q0 20 17 28l480 256q7 4 15 4zM640 1536q8 0 14 -3l512 -256q18 -10 18 -29v-1472q0 -13 -9.5 -22.5t-22.5 -9.5q-8 0 -14 3l-512 256q-18 10 -18 29v1472q0 13 9.5 22.5t22.5 9.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1408 640q0 53 -37.5 90.5t-90.5 37.5 t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-110 0 -211 18q-173 -173 -435 -229q-52 -10 -86 -13q-12 -1 -22 6t-13 18q-4 15 20 37q5 5 23.5 21.5t25.5 23.5t23.5 25.5t24 31.5t20.5 37 t20 48t14.5 57.5t12.5 72.5q-146 90 -229.5 216.5t-83.5 269.5q0 174 120 321.5t326 233t450 85.5t450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1024 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 -53 -37.5 -90.5t-90.5 -37.5 t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM896 1152q-204 0 -381.5 -69.5t-282 -187.5t-104.5 -255q0 -112 71.5 -213.5t201.5 -175.5l87 -50l-27 -96q-24 -91 -70 -172q152 63 275 171l43 38l57 -6q69 -8 130 -8q204 0 381.5 69.5t282 187.5 t104.5 255t-104.5 255t-282 187.5t-381.5 69.5zM1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22h-5q-15 0 -27 10.5t-16 27.5v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51 t27 59t26 76q-157 89 -247.5 220t-90.5 281q0 130 71 248.5t191 204.5t286 136.5t348 50.5t348 -50.5t286 -136.5t191 -204.5t71 -248.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 345l512 295v-591l-512 -296v592zM0 640v-591l512 296zM512 1527v-591l-512 -296v591zM512 936l512 295v-591z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1709 1018q-10 -236 -332 -651q-333 -431 -562 -431q-142 0 -240 263q-44 160 -132 482q-72 262 -157 262q-18 0 -127 -76l-77 98q24 21 108 96.5t130 115.5q156 138 241 146q95 9 153 -55.5t81 -203.5q44 -287 66 -373q55 -249 120 -249q51 0 154 161q101 161 109 246 q13 139 -109 139q-57 0 -121 -26q120 393 459 382q251 -8 236 -326z" /> +<glyph unicode="" d="M0 1408h1536v-1536h-1536v1536zM1085 293l-221 631l221 297h-634l221 -297l-221 -631l317 -304z" /> +<glyph unicode="" d="M0 1408h1536v-1536h-1536v1536zM908 1088l-12 -33l75 -83l-31 -114l25 -25l107 57l107 -57l25 25l-31 114l75 83l-12 33h-95l-53 96h-32l-53 -96h-95zM641 925q32 0 44.5 -16t11.5 -63l174 21q0 55 -17.5 92.5t-50.5 56t-69 25.5t-85 7q-133 0 -199 -57.5t-66 -182.5v-72 h-96v-128h76q20 0 20 -8v-382q0 -14 -5 -20t-18 -7l-73 -7v-88h448v86l-149 14q-6 1 -8.5 1.5t-3.5 2.5t-0.5 4t1 7t0.5 10v387h191l38 128h-231q-6 0 -2 6t4 9v80q0 27 1.5 40.5t7.5 28t19.5 20t36.5 5.5zM1248 96v86l-54 9q-7 1 -9.5 2.5t-2.5 3t1 7.5t1 12v520h-275 l-23 -101l83 -22q23 -7 23 -27v-370q0 -14 -6 -18.5t-20 -6.5l-70 -9v-86h352z" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +</font> +</defs></svg> diff --git a/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.ttf b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000..d7994e1 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.ttf Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000..6fd4ede --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff2 b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000..5560193 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff2 Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.eot b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000..b93a495 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.eot Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.svg b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 0000000..187805a --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > +<svg xmlns="http://www.w3.org/2000/svg"> +<metadata></metadata> +<defs> +<font id="glyphicons_halflingsregular" horiz-adv-x="1200" > +<font-face units-per-em="1200" ascent="960" descent="-240" /> +<missing-glyph horiz-adv-x="500" /> +<glyph horiz-adv-x="0" /> +<glyph horiz-adv-x="400" /> +<glyph unicode=" " /> +<glyph unicode="*" d="M600 1100q15 0 34 -1.5t30 -3.5l11 -1q10 -2 17.5 -10.5t7.5 -18.5v-224l158 158q7 7 18 8t19 -6l106 -106q7 -8 6 -19t-8 -18l-158 -158h224q10 0 18.5 -7.5t10.5 -17.5q6 -41 6 -75q0 -15 -1.5 -34t-3.5 -30l-1 -11q-2 -10 -10.5 -17.5t-18.5 -7.5h-224l158 -158 q7 -7 8 -18t-6 -19l-106 -106q-8 -7 -19 -6t-18 8l-158 158v-224q0 -10 -7.5 -18.5t-17.5 -10.5q-41 -6 -75 -6q-15 0 -34 1.5t-30 3.5l-11 1q-10 2 -17.5 10.5t-7.5 18.5v224l-158 -158q-7 -7 -18 -8t-19 6l-106 106q-7 8 -6 19t8 18l158 158h-224q-10 0 -18.5 7.5 t-10.5 17.5q-6 41 -6 75q0 15 1.5 34t3.5 30l1 11q2 10 10.5 17.5t18.5 7.5h224l-158 158q-7 7 -8 18t6 19l106 106q8 7 19 6t18 -8l158 -158v224q0 10 7.5 18.5t17.5 10.5q41 6 75 6z" /> +<glyph unicode="+" d="M450 1100h200q21 0 35.5 -14.5t14.5 -35.5v-350h350q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-350v-350q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v350h-350q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5 h350v350q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode=" " /> +<glyph unicode="¥" d="M825 1100h250q10 0 12.5 -5t-5.5 -13l-364 -364q-6 -6 -11 -18h268q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-125v-100h275q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-125v-174q0 -11 -7.5 -18.5t-18.5 -7.5h-148q-11 0 -18.5 7.5t-7.5 18.5v174 h-275q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h125v100h-275q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h118q-5 12 -11 18l-364 364q-8 8 -5.5 13t12.5 5h250q25 0 43 -18l164 -164q8 -8 18 -8t18 8l164 164q18 18 43 18z" /> +<glyph unicode=" " horiz-adv-x="650" /> +<glyph unicode=" " horiz-adv-x="1300" /> +<glyph unicode=" " horiz-adv-x="650" /> +<glyph unicode=" " horiz-adv-x="1300" /> +<glyph unicode=" " horiz-adv-x="433" /> +<glyph unicode=" " horiz-adv-x="325" /> +<glyph unicode=" " horiz-adv-x="216" /> +<glyph unicode=" " horiz-adv-x="216" /> +<glyph unicode=" " horiz-adv-x="162" /> +<glyph unicode=" " horiz-adv-x="260" /> +<glyph unicode=" " horiz-adv-x="72" /> +<glyph unicode=" " horiz-adv-x="260" /> +<glyph unicode=" " horiz-adv-x="325" /> +<glyph unicode="€" d="M744 1198q242 0 354 -189q60 -104 66 -209h-181q0 45 -17.5 82.5t-43.5 61.5t-58 40.5t-60.5 24t-51.5 7.5q-19 0 -40.5 -5.5t-49.5 -20.5t-53 -38t-49 -62.5t-39 -89.5h379l-100 -100h-300q-6 -50 -6 -100h406l-100 -100h-300q9 -74 33 -132t52.5 -91t61.5 -54.5t59 -29 t47 -7.5q22 0 50.5 7.5t60.5 24.5t58 41t43.5 61t17.5 80h174q-30 -171 -128 -278q-107 -117 -274 -117q-206 0 -324 158q-36 48 -69 133t-45 204h-217l100 100h112q1 47 6 100h-218l100 100h134q20 87 51 153.5t62 103.5q117 141 297 141z" /> +<glyph unicode="₽" d="M428 1200h350q67 0 120 -13t86 -31t57 -49.5t35 -56.5t17 -64.5t6.5 -60.5t0.5 -57v-16.5v-16.5q0 -36 -0.5 -57t-6.5 -61t-17 -65t-35 -57t-57 -50.5t-86 -31.5t-120 -13h-178l-2 -100h288q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-138v-175q0 -11 -5.5 -18 t-15.5 -7h-149q-10 0 -17.5 7.5t-7.5 17.5v175h-267q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h117v100h-267q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h117v475q0 10 7.5 17.5t17.5 7.5zM600 1000v-300h203q64 0 86.5 33t22.5 119q0 84 -22.5 116t-86.5 32h-203z" /> +<glyph unicode="−" d="M250 700h800q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="⌛" d="M1000 1200v-150q0 -21 -14.5 -35.5t-35.5 -14.5h-50v-100q0 -91 -49.5 -165.5t-130.5 -109.5q81 -35 130.5 -109.5t49.5 -165.5v-150h50q21 0 35.5 -14.5t14.5 -35.5v-150h-800v150q0 21 14.5 35.5t35.5 14.5h50v150q0 91 49.5 165.5t130.5 109.5q-81 35 -130.5 109.5 t-49.5 165.5v100h-50q-21 0 -35.5 14.5t-14.5 35.5v150h800zM400 1000v-100q0 -60 32.5 -109.5t87.5 -73.5q28 -12 44 -37t16 -55t-16 -55t-44 -37q-55 -24 -87.5 -73.5t-32.5 -109.5v-150h400v150q0 60 -32.5 109.5t-87.5 73.5q-28 12 -44 37t-16 55t16 55t44 37 q55 24 87.5 73.5t32.5 109.5v100h-400z" /> +<glyph unicode="◼" horiz-adv-x="500" d="M0 0z" /> +<glyph unicode="☁" d="M503 1089q110 0 200.5 -59.5t134.5 -156.5q44 14 90 14q120 0 205 -86.5t85 -206.5q0 -121 -85 -207.5t-205 -86.5h-750q-79 0 -135.5 57t-56.5 137q0 69 42.5 122.5t108.5 67.5q-2 12 -2 37q0 153 108 260.5t260 107.5z" /> +<glyph unicode="⛺" d="M774 1193.5q16 -9.5 20.5 -27t-5.5 -33.5l-136 -187l467 -746h30q20 0 35 -18.5t15 -39.5v-42h-1200v42q0 21 15 39.5t35 18.5h30l468 746l-135 183q-10 16 -5.5 34t20.5 28t34 5.5t28 -20.5l111 -148l112 150q9 16 27 20.5t34 -5zM600 200h377l-182 112l-195 534v-646z " /> +<glyph unicode="✉" d="M25 1100h1150q10 0 12.5 -5t-5.5 -13l-564 -567q-8 -8 -18 -8t-18 8l-564 567q-8 8 -5.5 13t12.5 5zM18 882l264 -264q8 -8 8 -18t-8 -18l-264 -264q-8 -8 -13 -5.5t-5 12.5v550q0 10 5 12.5t13 -5.5zM918 618l264 264q8 8 13 5.5t5 -12.5v-550q0 -10 -5 -12.5t-13 5.5 l-264 264q-8 8 -8 18t8 18zM818 482l364 -364q8 -8 5.5 -13t-12.5 -5h-1150q-10 0 -12.5 5t5.5 13l364 364q8 8 18 8t18 -8l164 -164q8 -8 18 -8t18 8l164 164q8 8 18 8t18 -8z" /> +<glyph unicode="✏" d="M1011 1210q19 0 33 -13l153 -153q13 -14 13 -33t-13 -33l-99 -92l-214 214l95 96q13 14 32 14zM1013 800l-615 -614l-214 214l614 614zM317 96l-333 -112l110 335z" /> +<glyph unicode="" d="M700 650v-550h250q21 0 35.5 -14.5t14.5 -35.5v-50h-800v50q0 21 14.5 35.5t35.5 14.5h250v550l-500 550h1200z" /> +<glyph unicode="" d="M368 1017l645 163q39 15 63 0t24 -49v-831q0 -55 -41.5 -95.5t-111.5 -63.5q-79 -25 -147 -4.5t-86 75t25.5 111.5t122.5 82q72 24 138 8v521l-600 -155v-606q0 -42 -44 -90t-109 -69q-79 -26 -147 -5.5t-86 75.5t25.5 111.5t122.5 82.5q72 24 138 7v639q0 38 14.5 59 t53.5 34z" /> +<glyph unicode="" d="M500 1191q100 0 191 -39t156.5 -104.5t104.5 -156.5t39 -191l-1 -2l1 -5q0 -141 -78 -262l275 -274q23 -26 22.5 -44.5t-22.5 -42.5l-59 -58q-26 -20 -46.5 -20t-39.5 20l-275 274q-119 -77 -261 -77l-5 1l-2 -1q-100 0 -191 39t-156.5 104.5t-104.5 156.5t-39 191 t39 191t104.5 156.5t156.5 104.5t191 39zM500 1022q-88 0 -162 -43t-117 -117t-43 -162t43 -162t117 -117t162 -43t162 43t117 117t43 162t-43 162t-117 117t-162 43z" /> +<glyph unicode="" d="M649 949q48 68 109.5 104t121.5 38.5t118.5 -20t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-150 152.5t-126.5 127.5t-93.5 124.5t-33.5 117.5q0 64 28 123t73 100.5t104 64t119 20 t120.5 -38.5t104.5 -104z" /> +<glyph unicode="" d="M407 800l131 353q7 19 17.5 19t17.5 -19l129 -353h421q21 0 24 -8.5t-14 -20.5l-342 -249l130 -401q7 -20 -0.5 -25.5t-24.5 6.5l-343 246l-342 -247q-17 -12 -24.5 -6.5t-0.5 25.5l130 400l-347 251q-17 12 -14 20.5t23 8.5h429z" /> +<glyph unicode="" d="M407 800l131 353q7 19 17.5 19t17.5 -19l129 -353h421q21 0 24 -8.5t-14 -20.5l-342 -249l130 -401q7 -20 -0.5 -25.5t-24.5 6.5l-343 246l-342 -247q-17 -12 -24.5 -6.5t-0.5 25.5l130 400l-347 251q-17 12 -14 20.5t23 8.5h429zM477 700h-240l197 -142l-74 -226 l193 139l195 -140l-74 229l192 140h-234l-78 211z" /> +<glyph unicode="" d="M600 1200q124 0 212 -88t88 -212v-250q0 -46 -31 -98t-69 -52v-75q0 -10 6 -21.5t15 -17.5l358 -230q9 -5 15 -16.5t6 -21.5v-93q0 -10 -7.5 -17.5t-17.5 -7.5h-1150q-10 0 -17.5 7.5t-7.5 17.5v93q0 10 6 21.5t15 16.5l358 230q9 6 15 17.5t6 21.5v75q-38 0 -69 52 t-31 98v250q0 124 88 212t212 88z" /> +<glyph unicode="" d="M25 1100h1150q10 0 17.5 -7.5t7.5 -17.5v-1050q0 -10 -7.5 -17.5t-17.5 -7.5h-1150q-10 0 -17.5 7.5t-7.5 17.5v1050q0 10 7.5 17.5t17.5 7.5zM100 1000v-100h100v100h-100zM875 1000h-550q-10 0 -17.5 -7.5t-7.5 -17.5v-350q0 -10 7.5 -17.5t17.5 -7.5h550 q10 0 17.5 7.5t7.5 17.5v350q0 10 -7.5 17.5t-17.5 7.5zM1000 1000v-100h100v100h-100zM100 800v-100h100v100h-100zM1000 800v-100h100v100h-100zM100 600v-100h100v100h-100zM1000 600v-100h100v100h-100zM875 500h-550q-10 0 -17.5 -7.5t-7.5 -17.5v-350q0 -10 7.5 -17.5 t17.5 -7.5h550q10 0 17.5 7.5t7.5 17.5v350q0 10 -7.5 17.5t-17.5 7.5zM100 400v-100h100v100h-100zM1000 400v-100h100v100h-100zM100 200v-100h100v100h-100zM1000 200v-100h100v100h-100z" /> +<glyph unicode="" d="M50 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM650 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5zM50 500h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM650 500h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5zM850 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM850 700h200q21 0 35.5 -14.5t14.5 -35.5v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 300h200 q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM850 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5 t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 1100h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5zM50 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 700h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 300h700q21 0 35.5 -14.5t14.5 -35.5v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M465 477l571 571q8 8 18 8t17 -8l177 -177q8 -7 8 -17t-8 -18l-783 -784q-7 -8 -17.5 -8t-17.5 8l-384 384q-8 8 -8 18t8 17l177 177q7 8 17 8t18 -8l171 -171q7 -7 18 -7t18 7z" /> +<glyph unicode="" d="M904 1083l178 -179q8 -8 8 -18.5t-8 -17.5l-267 -268l267 -268q8 -7 8 -17.5t-8 -18.5l-178 -178q-8 -8 -18.5 -8t-17.5 8l-268 267l-268 -267q-7 -8 -17.5 -8t-18.5 8l-178 178q-8 8 -8 18.5t8 17.5l267 268l-267 268q-8 7 -8 17.5t8 18.5l178 178q8 8 18.5 8t17.5 -8 l268 -267l268 268q7 7 17.5 7t18.5 -7z" /> +<glyph unicode="" d="M507 1177q98 0 187.5 -38.5t154.5 -103.5t103.5 -154.5t38.5 -187.5q0 -141 -78 -262l300 -299q8 -8 8 -18.5t-8 -18.5l-109 -108q-7 -8 -17.5 -8t-18.5 8l-300 299q-119 -77 -261 -77q-98 0 -188 38.5t-154.5 103t-103 154.5t-38.5 188t38.5 187.5t103 154.5 t154.5 103.5t188 38.5zM506.5 1023q-89.5 0 -165.5 -44t-120 -120.5t-44 -166t44 -165.5t120 -120t165.5 -44t166 44t120.5 120t44 165.5t-44 166t-120.5 120.5t-166 44zM425 900h150q10 0 17.5 -7.5t7.5 -17.5v-75h75q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5 t-17.5 -7.5h-75v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-75q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h75v75q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M507 1177q98 0 187.5 -38.5t154.5 -103.5t103.5 -154.5t38.5 -187.5q0 -141 -78 -262l300 -299q8 -8 8 -18.5t-8 -18.5l-109 -108q-7 -8 -17.5 -8t-18.5 8l-300 299q-119 -77 -261 -77q-98 0 -188 38.5t-154.5 103t-103 154.5t-38.5 188t38.5 187.5t103 154.5 t154.5 103.5t188 38.5zM506.5 1023q-89.5 0 -165.5 -44t-120 -120.5t-44 -166t44 -165.5t120 -120t165.5 -44t166 44t120.5 120t44 165.5t-44 166t-120.5 120.5t-166 44zM325 800h350q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-350q-10 0 -17.5 7.5 t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M550 1200h100q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM800 975v166q167 -62 272 -209.5t105 -331.5q0 -117 -45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5 t-184.5 123t-123 184.5t-45.5 224q0 184 105 331.5t272 209.5v-166q-103 -55 -165 -155t-62 -220q0 -116 57 -214.5t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5q0 120 -62 220t-165 155z" /> +<glyph unicode="" d="M1025 1200h150q10 0 17.5 -7.5t7.5 -17.5v-1150q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v1150q0 10 7.5 17.5t17.5 7.5zM725 800h150q10 0 17.5 -7.5t7.5 -17.5v-750q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v750 q0 10 7.5 17.5t17.5 7.5zM425 500h150q10 0 17.5 -7.5t7.5 -17.5v-450q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v450q0 10 7.5 17.5t17.5 7.5zM125 300h150q10 0 17.5 -7.5t7.5 -17.5v-250q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5 v250q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M600 1174q33 0 74 -5l38 -152l5 -1q49 -14 94 -39l5 -2l134 80q61 -48 104 -105l-80 -134l3 -5q25 -44 39 -93l1 -6l152 -38q5 -43 5 -73q0 -34 -5 -74l-152 -38l-1 -6q-15 -49 -39 -93l-3 -5l80 -134q-48 -61 -104 -105l-134 81l-5 -3q-44 -25 -94 -39l-5 -2l-38 -151 q-43 -5 -74 -5q-33 0 -74 5l-38 151l-5 2q-49 14 -94 39l-5 3l-134 -81q-60 48 -104 105l80 134l-3 5q-25 45 -38 93l-2 6l-151 38q-6 42 -6 74q0 33 6 73l151 38l2 6q13 48 38 93l3 5l-80 134q47 61 105 105l133 -80l5 2q45 25 94 39l5 1l38 152q43 5 74 5zM600 815 q-89 0 -152 -63t-63 -151.5t63 -151.5t152 -63t152 63t63 151.5t-63 151.5t-152 63z" /> +<glyph unicode="" d="M500 1300h300q41 0 70.5 -29.5t29.5 -70.5v-100h275q10 0 17.5 -7.5t7.5 -17.5v-75h-1100v75q0 10 7.5 17.5t17.5 7.5h275v100q0 41 29.5 70.5t70.5 29.5zM500 1200v-100h300v100h-300zM1100 900v-800q0 -41 -29.5 -70.5t-70.5 -29.5h-700q-41 0 -70.5 29.5t-29.5 70.5 v800h900zM300 800v-700h100v700h-100zM500 800v-700h100v700h-100zM700 800v-700h100v700h-100zM900 800v-700h100v700h-100z" /> +<glyph unicode="" d="M18 618l620 608q8 7 18.5 7t17.5 -7l608 -608q8 -8 5.5 -13t-12.5 -5h-175v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v375h-300v-375q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v575h-175q-10 0 -12.5 5t5.5 13z" /> +<glyph unicode="" d="M600 1200v-400q0 -41 29.5 -70.5t70.5 -29.5h300v-650q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v1100q0 21 14.5 35.5t35.5 14.5h450zM1000 800h-250q-21 0 -35.5 14.5t-14.5 35.5v250z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM525 900h50q10 0 17.5 -7.5t7.5 -17.5v-275h175q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M1300 0h-538l-41 400h-242l-41 -400h-538l431 1200h209l-21 -300h162l-20 300h208zM515 800l-27 -300h224l-27 300h-170z" /> +<glyph unicode="" d="M550 1200h200q21 0 35.5 -14.5t14.5 -35.5v-450h191q20 0 25.5 -11.5t-7.5 -27.5l-327 -400q-13 -16 -32 -16t-32 16l-327 400q-13 16 -7.5 27.5t25.5 11.5h191v450q0 21 14.5 35.5t35.5 14.5zM1125 400h50q10 0 17.5 -7.5t7.5 -17.5v-350q0 -10 -7.5 -17.5t-17.5 -7.5 h-1050q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h50q10 0 17.5 -7.5t7.5 -17.5v-175h900v175q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM525 900h150q10 0 17.5 -7.5t7.5 -17.5v-275h137q21 0 26 -11.5t-8 -27.5l-223 -275q-13 -16 -32 -16t-32 16l-223 275q-13 16 -8 27.5t26 11.5h137v275q0 10 7.5 17.5t17.5 7.5z " /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM632 914l223 -275q13 -16 8 -27.5t-26 -11.5h-137v-275q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v275h-137q-21 0 -26 11.5t8 27.5l223 275q13 16 32 16 t32 -16z" /> +<glyph unicode="" d="M225 1200h750q10 0 19.5 -7t12.5 -17l186 -652q7 -24 7 -49v-425q0 -12 -4 -27t-9 -17q-12 -6 -37 -6h-1100q-12 0 -27 4t-17 8q-6 13 -6 38l1 425q0 25 7 49l185 652q3 10 12.5 17t19.5 7zM878 1000h-556q-10 0 -19 -7t-11 -18l-87 -450q-2 -11 4 -18t16 -7h150 q10 0 19.5 -7t11.5 -17l38 -152q2 -10 11.5 -17t19.5 -7h250q10 0 19.5 7t11.5 17l38 152q2 10 11.5 17t19.5 7h150q10 0 16 7t4 18l-87 450q-2 11 -11 18t-19 7z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM540 820l253 -190q17 -12 17 -30t-17 -30l-253 -190q-16 -12 -28 -6.5t-12 26.5v400q0 21 12 26.5t28 -6.5z" /> +<glyph unicode="" d="M947 1060l135 135q7 7 12.5 5t5.5 -13v-362q0 -10 -7.5 -17.5t-17.5 -7.5h-362q-11 0 -13 5.5t5 12.5l133 133q-109 76 -238 76q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5h150q0 -117 -45.5 -224 t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5q192 0 347 -117z" /> +<glyph unicode="" d="M947 1060l135 135q7 7 12.5 5t5.5 -13v-361q0 -11 -7.5 -18.5t-18.5 -7.5h-361q-11 0 -13 5.5t5 12.5l134 134q-110 75 -239 75q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5h-150q0 117 45.5 224t123 184.5t184.5 123t224 45.5q192 0 347 -117zM1027 600h150 q0 -117 -45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5q-192 0 -348 118l-134 -134q-7 -8 -12.5 -5.5t-5.5 12.5v360q0 11 7.5 18.5t18.5 7.5h360q10 0 12.5 -5.5t-5.5 -12.5l-133 -133q110 -76 240 -76q116 0 214.5 57t155.5 155.5t57 214.5z" /> +<glyph unicode="" d="M125 1200h1050q10 0 17.5 -7.5t7.5 -17.5v-1150q0 -10 -7.5 -17.5t-17.5 -7.5h-1050q-10 0 -17.5 7.5t-7.5 17.5v1150q0 10 7.5 17.5t17.5 7.5zM1075 1000h-850q-10 0 -17.5 -7.5t-7.5 -17.5v-850q0 -10 7.5 -17.5t17.5 -7.5h850q10 0 17.5 7.5t7.5 17.5v850 q0 10 -7.5 17.5t-17.5 7.5zM325 900h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 900h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 700h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 700h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 500h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 500h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 300h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 300h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M900 800v200q0 83 -58.5 141.5t-141.5 58.5h-300q-82 0 -141 -59t-59 -141v-200h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h900q41 0 70.5 29.5t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5h-100zM400 800v150q0 21 15 35.5t35 14.5h200 q20 0 35 -14.5t15 -35.5v-150h-300z" /> +<glyph unicode="" d="M125 1100h50q10 0 17.5 -7.5t7.5 -17.5v-1075h-100v1075q0 10 7.5 17.5t17.5 7.5zM1075 1052q4 0 9 -2q16 -6 16 -23v-421q0 -6 -3 -12q-33 -59 -66.5 -99t-65.5 -58t-56.5 -24.5t-52.5 -6.5q-26 0 -57.5 6.5t-52.5 13.5t-60 21q-41 15 -63 22.5t-57.5 15t-65.5 7.5 q-85 0 -160 -57q-7 -5 -15 -5q-6 0 -11 3q-14 7 -14 22v438q22 55 82 98.5t119 46.5q23 2 43 0.5t43 -7t32.5 -8.5t38 -13t32.5 -11q41 -14 63.5 -21t57 -14t63.5 -7q103 0 183 87q7 8 18 8z" /> +<glyph unicode="" d="M600 1175q116 0 227 -49.5t192.5 -131t131 -192.5t49.5 -227v-300q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v300q0 127 -70.5 231.5t-184.5 161.5t-245 57t-245 -57t-184.5 -161.5t-70.5 -231.5v-300q0 -10 -7.5 -17.5t-17.5 -7.5h-50 q-10 0 -17.5 7.5t-7.5 17.5v300q0 116 49.5 227t131 192.5t192.5 131t227 49.5zM220 500h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460q0 8 6 14t14 6zM820 500h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460 q0 8 6 14t14 6z" /> +<glyph unicode="" d="M321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM900 668l120 120q7 7 17 7t17 -7l34 -34q7 -7 7 -17t-7 -17l-120 -120l120 -120q7 -7 7 -17 t-7 -17l-34 -34q-7 -7 -17 -7t-17 7l-120 119l-120 -119q-7 -7 -17 -7t-17 7l-34 34q-7 7 -7 17t7 17l119 120l-119 120q-7 7 -7 17t7 17l34 34q7 8 17 8t17 -8z" /> +<glyph unicode="" d="M321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM766 900h4q10 -1 16 -10q96 -129 96 -290q0 -154 -90 -281q-6 -9 -17 -10l-3 -1q-9 0 -16 6 l-29 23q-7 7 -8.5 16.5t4.5 17.5q72 103 72 229q0 132 -78 238q-6 8 -4.5 18t9.5 17l29 22q7 5 15 5z" /> +<glyph unicode="" d="M967 1004h3q11 -1 17 -10q135 -179 135 -396q0 -105 -34 -206.5t-98 -185.5q-7 -9 -17 -10h-3q-9 0 -16 6l-42 34q-8 6 -9 16t5 18q111 150 111 328q0 90 -29.5 176t-84.5 157q-6 9 -5 19t10 16l42 33q7 5 15 5zM321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5 t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM766 900h4q10 -1 16 -10q96 -129 96 -290q0 -154 -90 -281q-6 -9 -17 -10l-3 -1q-9 0 -16 6l-29 23q-7 7 -8.5 16.5t4.5 17.5q72 103 72 229q0 132 -78 238 q-6 8 -4.5 18.5t9.5 16.5l29 22q7 5 15 5z" /> +<glyph unicode="" d="M500 900h100v-100h-100v-100h-400v-100h-100v600h500v-300zM1200 700h-200v-100h200v-200h-300v300h-200v300h-100v200h600v-500zM100 1100v-300h300v300h-300zM800 1100v-300h300v300h-300zM300 900h-100v100h100v-100zM1000 900h-100v100h100v-100zM300 500h200v-500 h-500v500h200v100h100v-100zM800 300h200v-100h-100v-100h-200v100h-100v100h100v200h-200v100h300v-300zM100 400v-300h300v300h-300zM300 200h-100v100h100v-100zM1200 200h-100v100h100v-100zM700 0h-100v100h100v-100zM1200 0h-300v100h300v-100z" /> +<glyph unicode="" d="M100 200h-100v1000h100v-1000zM300 200h-100v1000h100v-1000zM700 200h-200v1000h200v-1000zM900 200h-100v1000h100v-1000zM1200 200h-200v1000h200v-1000zM400 0h-300v100h300v-100zM600 0h-100v91h100v-91zM800 0h-100v91h100v-91zM1100 0h-200v91h200v-91z" /> +<glyph unicode="" d="M500 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-682 682l1 475q0 10 7.5 17.5t17.5 7.5h474zM319.5 1024.5q-29.5 29.5 -71 29.5t-71 -29.5t-29.5 -71.5t29.5 -71.5t71 -29.5t71 29.5t29.5 71.5t-29.5 71.5z" /> +<glyph unicode="" d="M500 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-682 682l1 475q0 10 7.5 17.5t17.5 7.5h474zM800 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-56 56l424 426l-700 700h150zM319.5 1024.5q-29.5 29.5 -71 29.5t-71 -29.5 t-29.5 -71.5t29.5 -71.5t71 -29.5t71 29.5t29.5 71.5t-29.5 71.5z" /> +<glyph unicode="" d="M300 1200h825q75 0 75 -75v-900q0 -25 -18 -43l-64 -64q-8 -8 -13 -5.5t-5 12.5v950q0 10 -7.5 17.5t-17.5 7.5h-700q-25 0 -43 -18l-64 -64q-8 -8 -5.5 -13t12.5 -5h700q10 0 17.5 -7.5t7.5 -17.5v-950q0 -10 -7.5 -17.5t-17.5 -7.5h-850q-10 0 -17.5 7.5t-7.5 17.5v975 q0 25 18 43l139 139q18 18 43 18z" /> +<glyph unicode="" d="M250 1200h800q21 0 35.5 -14.5t14.5 -35.5v-1150l-450 444l-450 -445v1151q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M822 1200h-444q-11 0 -19 -7.5t-9 -17.5l-78 -301q-7 -24 7 -45l57 -108q6 -9 17.5 -15t21.5 -6h450q10 0 21.5 6t17.5 15l62 108q14 21 7 45l-83 301q-1 10 -9 17.5t-19 7.5zM1175 800h-150q-10 0 -21 -6.5t-15 -15.5l-78 -156q-4 -9 -15 -15.5t-21 -6.5h-550 q-10 0 -21 6.5t-15 15.5l-78 156q-4 9 -15 15.5t-21 6.5h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-650q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h750q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5 t7.5 17.5v650q0 10 -7.5 17.5t-17.5 7.5zM850 200h-500q-10 0 -19.5 -7t-11.5 -17l-38 -152q-2 -10 3.5 -17t15.5 -7h600q10 0 15.5 7t3.5 17l-38 152q-2 10 -11.5 17t-19.5 7z" /> +<glyph unicode="" d="M500 1100h200q56 0 102.5 -20.5t72.5 -50t44 -59t25 -50.5l6 -20h150q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5h150q2 8 6.5 21.5t24 48t45 61t72 48t102.5 21.5zM900 800v-100 h100v100h-100zM600 730q-95 0 -162.5 -67.5t-67.5 -162.5t67.5 -162.5t162.5 -67.5t162.5 67.5t67.5 162.5t-67.5 162.5t-162.5 67.5zM600 603q43 0 73 -30t30 -73t-30 -73t-73 -30t-73 30t-30 73t30 73t73 30z" /> +<glyph unicode="" d="M681 1199l385 -998q20 -50 60 -92q18 -19 36.5 -29.5t27.5 -11.5l10 -2v-66h-417v66q53 0 75 43.5t5 88.5l-82 222h-391q-58 -145 -92 -234q-11 -34 -6.5 -57t25.5 -37t46 -20t55 -6v-66h-365v66q56 24 84 52q12 12 25 30.5t20 31.5l7 13l399 1006h93zM416 521h340 l-162 457z" /> +<glyph unicode="" d="M753 641q5 -1 14.5 -4.5t36 -15.5t50.5 -26.5t53.5 -40t50.5 -54.5t35.5 -70t14.5 -87q0 -67 -27.5 -125.5t-71.5 -97.5t-98.5 -66.5t-108.5 -40.5t-102 -13h-500v89q41 7 70.5 32.5t29.5 65.5v827q0 24 -0.5 34t-3.5 24t-8.5 19.5t-17 13.5t-28 12.5t-42.5 11.5v71 l471 -1q57 0 115.5 -20.5t108 -57t80.5 -94t31 -124.5q0 -51 -15.5 -96.5t-38 -74.5t-45 -50.5t-38.5 -30.5zM400 700h139q78 0 130.5 48.5t52.5 122.5q0 41 -8.5 70.5t-29.5 55.5t-62.5 39.5t-103.5 13.5h-118v-350zM400 200h216q80 0 121 50.5t41 130.5q0 90 -62.5 154.5 t-156.5 64.5h-159v-400z" /> +<glyph unicode="" d="M877 1200l2 -57q-83 -19 -116 -45.5t-40 -66.5l-132 -839q-9 -49 13 -69t96 -26v-97h-500v97q186 16 200 98l173 832q3 17 3 30t-1.5 22.5t-9 17.5t-13.5 12.5t-21.5 10t-26 8.5t-33.5 10q-13 3 -19 5v57h425z" /> +<glyph unicode="" d="M1300 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-850q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v850h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM175 1000h-75v-800h75l-125 -167l-125 167h75v800h-75l125 167z" /> +<glyph unicode="" d="M1100 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-650q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v650h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM1167 50l-167 -125v75h-800v-75l-167 125l167 125v-75h800v75z" /> +<glyph unicode="" d="M50 1100h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 500h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M250 1100h700q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM250 500h700q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M500 950v100q0 21 14.5 35.5t35.5 14.5h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5zM100 650v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000 q-21 0 -35.5 14.5t-14.5 35.5zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5zM0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100 q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5z" /> +<glyph unicode="" d="M50 1100h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 500h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 1100h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 800h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 500h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 500h800q21 0 35.5 -14.5t14.5 -35.5v-100 q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 200h800 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M400 0h-100v1100h100v-1100zM550 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM550 800h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM267 550l-167 -125v75h-200v100h200v75zM550 500h300q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM550 200h600 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM900 0h-100v1100h100v-1100zM50 800h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM1100 600h200v-100h-200v-75l-167 125l167 125v-75zM50 500h300q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h600 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M75 1000h750q31 0 53 -22t22 -53v-650q0 -31 -22 -53t-53 -22h-750q-31 0 -53 22t-22 53v650q0 31 22 53t53 22zM1200 300l-300 300l300 300v-600z" /> +<glyph unicode="" d="M44 1100h1112q18 0 31 -13t13 -31v-1012q0 -18 -13 -31t-31 -13h-1112q-18 0 -31 13t-13 31v1012q0 18 13 31t31 13zM100 1000v-737l247 182l298 -131l-74 156l293 318l236 -288v500h-1000zM342 884q56 0 95 -39t39 -94.5t-39 -95t-95 -39.5t-95 39.5t-39 95t39 94.5 t95 39z" /> +<glyph unicode="" d="M648 1169q117 0 216 -60t156.5 -161t57.5 -218q0 -115 -70 -258q-69 -109 -158 -225.5t-143 -179.5l-54 -62q-9 8 -25.5 24.5t-63.5 67.5t-91 103t-98.5 128t-95.5 148q-60 132 -60 249q0 88 34 169.5t91.5 142t137 96.5t166.5 36zM652.5 974q-91.5 0 -156.5 -65 t-65 -157t65 -156.5t156.5 -64.5t156.5 64.5t65 156.5t-65 157t-156.5 65z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 173v854q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57z" /> +<glyph unicode="" d="M554 1295q21 -72 57.5 -143.5t76 -130t83 -118t82.5 -117t70 -116t49.5 -126t18.5 -136.5q0 -71 -25.5 -135t-68.5 -111t-99 -82t-118.5 -54t-125.5 -23q-84 5 -161.5 34t-139.5 78.5t-99 125t-37 164.5q0 69 18 136.5t49.5 126.5t69.5 116.5t81.5 117.5t83.5 119 t76.5 131t58.5 143zM344 710q-23 -33 -43.5 -70.5t-40.5 -102.5t-17 -123q1 -37 14.5 -69.5t30 -52t41 -37t38.5 -24.5t33 -15q21 -7 32 -1t13 22l6 34q2 10 -2.5 22t-13.5 19q-5 4 -14 12t-29.5 40.5t-32.5 73.5q-26 89 6 271q2 11 -6 11q-8 1 -15 -10z" /> +<glyph unicode="" d="M1000 1013l108 115q2 1 5 2t13 2t20.5 -1t25 -9.5t28.5 -21.5q22 -22 27 -43t0 -32l-6 -10l-108 -115zM350 1100h400q50 0 105 -13l-187 -187h-368q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v182l200 200v-332 q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5zM1009 803l-362 -362l-161 -50l55 170l355 355z" /> +<glyph unicode="" d="M350 1100h361q-164 -146 -216 -200h-195q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5l200 153v-103q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5z M824 1073l339 -301q8 -7 8 -17.5t-8 -17.5l-340 -306q-7 -6 -12.5 -4t-6.5 11v203q-26 1 -54.5 0t-78.5 -7.5t-92 -17.5t-86 -35t-70 -57q10 59 33 108t51.5 81.5t65 58.5t68.5 40.5t67 24.5t56 13.5t40 4.5v210q1 10 6.5 12.5t13.5 -4.5z" /> +<glyph unicode="" d="M350 1100h350q60 0 127 -23l-178 -177h-349q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v69l200 200v-219q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5z M643 639l395 395q7 7 17.5 7t17.5 -7l101 -101q7 -7 7 -17.5t-7 -17.5l-531 -532q-7 -7 -17.5 -7t-17.5 7l-248 248q-7 7 -7 17.5t7 17.5l101 101q7 7 17.5 7t17.5 -7l111 -111q8 -7 18 -7t18 7z" /> +<glyph unicode="" d="M318 918l264 264q8 8 18 8t18 -8l260 -264q7 -8 4.5 -13t-12.5 -5h-170v-200h200v173q0 10 5 12t13 -5l264 -260q8 -7 8 -17.5t-8 -17.5l-264 -265q-8 -7 -13 -5t-5 12v173h-200v-200h170q10 0 12.5 -5t-4.5 -13l-260 -264q-8 -8 -18 -8t-18 8l-264 264q-8 8 -5.5 13 t12.5 5h175v200h-200v-173q0 -10 -5 -12t-13 5l-264 265q-8 7 -8 17.5t8 17.5l264 260q8 7 13 5t5 -12v-173h200v200h-175q-10 0 -12.5 5t5.5 13z" /> +<glyph unicode="" d="M250 1100h100q21 0 35.5 -14.5t14.5 -35.5v-438l464 453q15 14 25.5 10t10.5 -25v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-438l464 453q15 14 25.5 10t10.5 -25v-438l464 453q15 14 25.5 10t10.5 -25v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5 t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M1200 1050v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -10.5 -25t-25.5 10l-492 480q-15 14 -15 35t15 35l492 480q15 14 25.5 10t10.5 -25v-438l464 453q15 14 25.5 10t10.5 -25z" /> +<glyph unicode="" d="M243 1074l814 -498q18 -11 18 -26t-18 -26l-814 -498q-18 -11 -30.5 -4t-12.5 28v1000q0 21 12.5 28t30.5 -4z" /> +<glyph unicode="" d="M250 1000h200q21 0 35.5 -14.5t14.5 -35.5v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5zM650 1000h200q21 0 35.5 -14.5t14.5 -35.5v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v800 q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M1100 950v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5z" /> +<glyph unicode="" d="M500 612v438q0 21 10.5 25t25.5 -10l492 -480q15 -14 15 -35t-15 -35l-492 -480q-15 -14 -25.5 -10t-10.5 25v438l-464 -453q-15 -14 -25.5 -10t-10.5 25v1000q0 21 10.5 25t25.5 -10z" /> +<glyph unicode="" d="M1048 1102l100 1q20 0 35 -14.5t15 -35.5l5 -1000q0 -21 -14.5 -35.5t-35.5 -14.5l-100 -1q-21 0 -35.5 14.5t-14.5 35.5l-2 437l-463 -454q-14 -15 -24.5 -10.5t-10.5 25.5l-2 437l-462 -455q-15 -14 -25.5 -9.5t-10.5 24.5l-5 1000q0 21 10.5 25.5t25.5 -10.5l466 -450 l-2 438q0 20 10.5 24.5t25.5 -9.5l466 -451l-2 438q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M850 1100h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-464 -453q-15 -14 -25.5 -10t-10.5 25v1000q0 21 10.5 25t25.5 -10l464 -453v438q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M686 1081l501 -540q15 -15 10.5 -26t-26.5 -11h-1042q-22 0 -26.5 11t10.5 26l501 540q15 15 36 15t36 -15zM150 400h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M885 900l-352 -353l352 -353l-197 -198l-552 552l552 550z" /> +<glyph unicode="" d="M1064 547l-551 -551l-198 198l353 353l-353 353l198 198z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM650 900h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-150h-150 q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5t35.5 -14.5h150v-150q0 -21 14.5 -35.5t35.5 -14.5h100q21 0 35.5 14.5t14.5 35.5v150h150q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5h-150v150q0 21 -14.5 35.5t-35.5 14.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM850 700h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5 t35.5 -14.5h500q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM741.5 913q-12.5 0 -21.5 -9l-120 -120l-120 120q-9 9 -21.5 9 t-21.5 -9l-141 -141q-9 -9 -9 -21.5t9 -21.5l120 -120l-120 -120q-9 -9 -9 -21.5t9 -21.5l141 -141q9 -9 21.5 -9t21.5 9l120 120l120 -120q9 -9 21.5 -9t21.5 9l141 141q9 9 9 21.5t-9 21.5l-120 120l120 120q9 9 9 21.5t-9 21.5l-141 141q-9 9 -21.5 9z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM546 623l-84 85q-7 7 -17.5 7t-18.5 -7l-139 -139q-7 -8 -7 -18t7 -18 l242 -241q7 -8 17.5 -8t17.5 8l375 375q7 7 7 17.5t-7 18.5l-139 139q-7 7 -17.5 7t-17.5 -7z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM588 941q-29 0 -59 -5.5t-63 -20.5t-58 -38.5t-41.5 -63t-16.5 -89.5 q0 -25 20 -25h131q30 -5 35 11q6 20 20.5 28t45.5 8q20 0 31.5 -10.5t11.5 -28.5q0 -23 -7 -34t-26 -18q-1 0 -13.5 -4t-19.5 -7.5t-20 -10.5t-22 -17t-18.5 -24t-15.5 -35t-8 -46q-1 -8 5.5 -16.5t20.5 -8.5h173q7 0 22 8t35 28t37.5 48t29.5 74t12 100q0 47 -17 83 t-42.5 57t-59.5 34.5t-64 18t-59 4.5zM675 400h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM675 1000h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5 t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5zM675 700h-250q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h75v-200h-75q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h350q10 0 17.5 7.5t7.5 17.5v50q0 10 -7.5 17.5 t-17.5 7.5h-75v275q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M525 1200h150q10 0 17.5 -7.5t7.5 -17.5v-194q103 -27 178.5 -102.5t102.5 -178.5h194q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-194q-27 -103 -102.5 -178.5t-178.5 -102.5v-194q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v194 q-103 27 -178.5 102.5t-102.5 178.5h-194q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h194q27 103 102.5 178.5t178.5 102.5v194q0 10 7.5 17.5t17.5 7.5zM700 893v-168q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v168q-68 -23 -119 -74 t-74 -119h168q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-168q23 -68 74 -119t119 -74v168q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-168q68 23 119 74t74 119h-168q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h168 q-23 68 -74 119t-119 74z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM759 823l64 -64q7 -7 7 -17.5t-7 -17.5l-124 -124l124 -124q7 -7 7 -17.5t-7 -17.5l-64 -64q-7 -7 -17.5 -7t-17.5 7l-124 124l-124 -124q-7 -7 -17.5 -7t-17.5 7l-64 64 q-7 7 -7 17.5t7 17.5l124 124l-124 124q-7 7 -7 17.5t7 17.5l64 64q7 7 17.5 7t17.5 -7l124 -124l124 124q7 7 17.5 7t17.5 -7z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM782 788l106 -106q7 -7 7 -17.5t-7 -17.5l-320 -321q-8 -7 -18 -7t-18 7l-202 203q-8 7 -8 17.5t8 17.5l106 106q7 8 17.5 8t17.5 -8l79 -79l197 197q7 7 17.5 7t17.5 -7z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5q0 -120 65 -225 l587 587q-105 65 -225 65zM965 819l-584 -584q104 -62 219 -62q116 0 214.5 57t155.5 155.5t57 214.5q0 115 -62 219z" /> +<glyph unicode="" d="M39 582l522 427q16 13 27.5 8t11.5 -26v-291h550q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-550v-291q0 -21 -11.5 -26t-27.5 8l-522 427q-16 13 -16 32t16 32z" /> +<glyph unicode="" d="M639 1009l522 -427q16 -13 16 -32t-16 -32l-522 -427q-16 -13 -27.5 -8t-11.5 26v291h-550q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h550v291q0 21 11.5 26t27.5 -8z" /> +<glyph unicode="" d="M682 1161l427 -522q13 -16 8 -27.5t-26 -11.5h-291v-550q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v550h-291q-21 0 -26 11.5t8 27.5l427 522q13 16 32 16t32 -16z" /> +<glyph unicode="" d="M550 1200h200q21 0 35.5 -14.5t14.5 -35.5v-550h291q21 0 26 -11.5t-8 -27.5l-427 -522q-13 -16 -32 -16t-32 16l-427 522q-13 16 -8 27.5t26 11.5h291v550q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M639 1109l522 -427q16 -13 16 -32t-16 -32l-522 -427q-16 -13 -27.5 -8t-11.5 26v291q-94 -2 -182 -20t-170.5 -52t-147 -92.5t-100.5 -135.5q5 105 27 193.5t67.5 167t113 135t167 91.5t225.5 42v262q0 21 11.5 26t27.5 -8z" /> +<glyph unicode="" d="M850 1200h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94l-249 -249q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l249 249l-94 94q-14 14 -10 24.5t25 10.5zM350 0h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l249 249 q8 7 18 7t18 -7l106 -106q7 -8 7 -18t-7 -18l-249 -249l94 -94q14 -14 10 -24.5t-25 -10.5z" /> +<glyph unicode="" d="M1014 1120l106 -106q7 -8 7 -18t-7 -18l-249 -249l94 -94q14 -14 10 -24.5t-25 -10.5h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l249 249q8 7 18 7t18 -7zM250 600h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94 l-249 -249q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l249 249l-94 94q-14 14 -10 24.5t25 10.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM704 900h-208q-20 0 -32 -14.5t-8 -34.5l58 -302q4 -20 21.5 -34.5 t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5zM675 400h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M260 1200q9 0 19 -2t15 -4l5 -2q22 -10 44 -23l196 -118q21 -13 36 -24q29 -21 37 -12q11 13 49 35l196 118q22 13 45 23q17 7 38 7q23 0 47 -16.5t37 -33.5l13 -16q14 -21 18 -45l25 -123l8 -44q1 -9 8.5 -14.5t17.5 -5.5h61q10 0 17.5 -7.5t7.5 -17.5v-50 q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 -7.5t-7.5 -17.5v-175h-400v300h-200v-300h-400v175q0 10 -7.5 17.5t-17.5 7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5h61q11 0 18 3t7 8q0 4 9 52l25 128q5 25 19 45q2 3 5 7t13.5 15t21.5 19.5t26.5 15.5 t29.5 7zM915 1079l-166 -162q-7 -7 -5 -12t12 -5h219q10 0 15 7t2 17l-51 149q-3 10 -11 12t-15 -6zM463 917l-177 157q-8 7 -16 5t-11 -12l-51 -143q-3 -10 2 -17t15 -7h231q11 0 12.5 5t-5.5 12zM500 0h-375q-10 0 -17.5 7.5t-7.5 17.5v375h400v-400zM1100 400v-375 q0 -10 -7.5 -17.5t-17.5 -7.5h-375v400h400z" /> +<glyph unicode="" d="M1165 1190q8 3 21 -6.5t13 -17.5q-2 -178 -24.5 -323.5t-55.5 -245.5t-87 -174.5t-102.5 -118.5t-118 -68.5t-118.5 -33t-120 -4.5t-105 9.5t-90 16.5q-61 12 -78 11q-4 1 -12.5 0t-34 -14.5t-52.5 -40.5l-153 -153q-26 -24 -37 -14.5t-11 43.5q0 64 42 102q8 8 50.5 45 t66.5 58q19 17 35 47t13 61q-9 55 -10 102.5t7 111t37 130t78 129.5q39 51 80 88t89.5 63.5t94.5 45t113.5 36t129 31t157.5 37t182 47.5zM1116 1098q-8 9 -22.5 -3t-45.5 -50q-38 -47 -119 -103.5t-142 -89.5l-62 -33q-56 -30 -102 -57t-104 -68t-102.5 -80.5t-85.5 -91 t-64 -104.5q-24 -56 -31 -86t2 -32t31.5 17.5t55.5 59.5q25 30 94 75.5t125.5 77.5t147.5 81q70 37 118.5 69t102 79.5t99 111t86.5 148.5q22 50 24 60t-6 19z" /> +<glyph unicode="" d="M653 1231q-39 -67 -54.5 -131t-10.5 -114.5t24.5 -96.5t47.5 -80t63.5 -62.5t68.5 -46.5t65 -30q-4 7 -17.5 35t-18.5 39.5t-17 39.5t-17 43t-13 42t-9.5 44.5t-2 42t4 43t13.5 39t23 38.5q96 -42 165 -107.5t105 -138t52 -156t13 -159t-19 -149.5q-13 -55 -44 -106.5 t-68 -87t-78.5 -64.5t-72.5 -45t-53 -22q-72 -22 -127 -11q-31 6 -13 19q6 3 17 7q13 5 32.5 21t41 44t38.5 63.5t21.5 81.5t-6.5 94.5t-50 107t-104 115.5q10 -104 -0.5 -189t-37 -140.5t-65 -93t-84 -52t-93.5 -11t-95 24.5q-80 36 -131.5 114t-53.5 171q-2 23 0 49.5 t4.5 52.5t13.5 56t27.5 60t46 64.5t69.5 68.5q-8 -53 -5 -102.5t17.5 -90t34 -68.5t44.5 -39t49 -2q31 13 38.5 36t-4.5 55t-29 64.5t-36 75t-26 75.5q-15 85 2 161.5t53.5 128.5t85.5 92.5t93.5 61t81.5 25.5z" /> +<glyph unicode="" d="M600 1094q82 0 160.5 -22.5t140 -59t116.5 -82.5t94.5 -95t68 -95t42.5 -82.5t14 -57.5t-14 -57.5t-43 -82.5t-68.5 -95t-94.5 -95t-116.5 -82.5t-140 -59t-159.5 -22.5t-159.5 22.5t-140 59t-116.5 82.5t-94.5 95t-68.5 95t-43 82.5t-14 57.5t14 57.5t42.5 82.5t68 95 t94.5 95t116.5 82.5t140 59t160.5 22.5zM888 829q-15 15 -18 12t5 -22q25 -57 25 -119q0 -124 -88 -212t-212 -88t-212 88t-88 212q0 59 23 114q8 19 4.5 22t-17.5 -12q-70 -69 -160 -184q-13 -16 -15 -40.5t9 -42.5q22 -36 47 -71t70 -82t92.5 -81t113 -58.5t133.5 -24.5 t133.5 24t113 58.5t92.5 81.5t70 81.5t47 70.5q11 18 9 42.5t-14 41.5q-90 117 -163 189zM448 727l-35 -36q-15 -15 -19.5 -38.5t4.5 -41.5q37 -68 93 -116q16 -13 38.5 -11t36.5 17l35 34q14 15 12.5 33.5t-16.5 33.5q-44 44 -89 117q-11 18 -28 20t-32 -12z" /> +<glyph unicode="" d="M592 0h-148l31 120q-91 20 -175.5 68.5t-143.5 106.5t-103.5 119t-66.5 110t-22 76q0 21 14 57.5t42.5 82.5t68 95t94.5 95t116.5 82.5t140 59t160.5 22.5q61 0 126 -15l32 121h148zM944 770l47 181q108 -85 176.5 -192t68.5 -159q0 -26 -19.5 -71t-59.5 -102t-93 -112 t-129 -104.5t-158 -75.5l46 173q77 49 136 117t97 131q11 18 9 42.5t-14 41.5q-54 70 -107 130zM310 824q-70 -69 -160 -184q-13 -16 -15 -40.5t9 -42.5q18 -30 39 -60t57 -70.5t74 -73t90 -61t105 -41.5l41 154q-107 18 -178.5 101.5t-71.5 193.5q0 59 23 114q8 19 4.5 22 t-17.5 -12zM448 727l-35 -36q-15 -15 -19.5 -38.5t4.5 -41.5q37 -68 93 -116q16 -13 38.5 -11t36.5 17l12 11l22 86l-3 4q-44 44 -89 117q-11 18 -28 20t-32 -12z" /> +<glyph unicode="" d="M-90 100l642 1066q20 31 48 28.5t48 -35.5l642 -1056q21 -32 7.5 -67.5t-50.5 -35.5h-1294q-37 0 -50.5 34t7.5 66zM155 200h345v75q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-75h345l-445 723zM496 700h208q20 0 32 -14.5t8 -34.5l-58 -252 q-4 -20 -21.5 -34.5t-37.5 -14.5h-54q-20 0 -37.5 14.5t-21.5 34.5l-58 252q-4 20 8 34.5t32 14.5z" /> +<glyph unicode="" d="M650 1200q62 0 106 -44t44 -106v-339l363 -325q15 -14 26 -38.5t11 -44.5v-41q0 -20 -12 -26.5t-29 5.5l-359 249v-263q100 -93 100 -113v-64q0 -21 -13 -29t-32 1l-205 128l-205 -128q-19 -9 -32 -1t-13 29v64q0 20 100 113v263l-359 -249q-17 -12 -29 -5.5t-12 26.5v41 q0 20 11 44.5t26 38.5l363 325v339q0 62 44 106t106 44z" /> +<glyph unicode="" d="M850 1200h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-150h-1100v150q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-50h500v50q0 21 14.5 35.5t35.5 14.5zM1100 800v-750q0 -21 -14.5 -35.5 t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v750h1100zM100 600v-100h100v100h-100zM300 600v-100h100v100h-100zM500 600v-100h100v100h-100zM700 600v-100h100v100h-100zM900 600v-100h100v100h-100zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400 v-100h100v100h-100zM700 400v-100h100v100h-100zM900 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100zM500 200v-100h100v100h-100zM700 200v-100h100v100h-100zM900 200v-100h100v100h-100z" /> +<glyph unicode="" d="M1135 1165l249 -230q15 -14 15 -35t-15 -35l-249 -230q-14 -14 -24.5 -10t-10.5 25v150h-159l-600 -600h-291q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h209l600 600h241v150q0 21 10.5 25t24.5 -10zM522 819l-141 -141l-122 122h-209q-21 0 -35.5 14.5 t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h291zM1135 565l249 -230q15 -14 15 -35t-15 -35l-249 -230q-14 -14 -24.5 -10t-10.5 25v150h-241l-181 181l141 141l122 -122h159v150q0 21 10.5 25t24.5 -10z" /> +<glyph unicode="" d="M100 1100h1000q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-596l-304 -300v300h-100q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5z" /> +<glyph unicode="" d="M150 1200h200q21 0 35.5 -14.5t14.5 -35.5v-250h-300v250q0 21 14.5 35.5t35.5 14.5zM850 1200h200q21 0 35.5 -14.5t14.5 -35.5v-250h-300v250q0 21 14.5 35.5t35.5 14.5zM1100 800v-300q0 -41 -3 -77.5t-15 -89.5t-32 -96t-58 -89t-89 -77t-129 -51t-174 -20t-174 20 t-129 51t-89 77t-58 89t-32 96t-15 89.5t-3 77.5v300h300v-250v-27v-42.5t1.5 -41t5 -38t10 -35t16.5 -30t25.5 -24.5t35 -19t46.5 -12t60 -4t60 4.5t46.5 12.5t35 19.5t25 25.5t17 30.5t10 35t5 38t2 40.5t-0.5 42v25v250h300z" /> +<glyph unicode="" d="M1100 411l-198 -199l-353 353l-353 -353l-197 199l551 551z" /> +<glyph unicode="" d="M1101 789l-550 -551l-551 551l198 199l353 -353l353 353z" /> +<glyph unicode="" d="M404 1000h746q21 0 35.5 -14.5t14.5 -35.5v-551h150q21 0 25 -10.5t-10 -24.5l-230 -249q-14 -15 -35 -15t-35 15l-230 249q-14 14 -10 24.5t25 10.5h150v401h-381zM135 984l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-400h385l215 -200h-750q-21 0 -35.5 14.5 t-14.5 35.5v550h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" /> +<glyph unicode="" d="M56 1200h94q17 0 31 -11t18 -27l38 -162h896q24 0 39 -18.5t10 -42.5l-100 -475q-5 -21 -27 -42.5t-55 -21.5h-633l48 -200h535q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-50q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v50h-300v-50 q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v50h-31q-18 0 -32.5 10t-20.5 19l-5 10l-201 961h-54q-20 0 -35 14.5t-15 35.5t15 35.5t35 14.5z" /> +<glyph unicode="" d="M1200 1000v-100h-1200v100h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500zM0 800h1200v-800h-1200v800z" /> +<glyph unicode="" d="M200 800l-200 -400v600h200q0 41 29.5 70.5t70.5 29.5h300q42 0 71 -29.5t29 -70.5h500v-200h-1000zM1500 700l-300 -700h-1200l300 700h1200z" /> +<glyph unicode="" d="M635 1184l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-601h150q21 0 25 -10.5t-10 -24.5l-230 -249q-14 -15 -35 -15t-35 15l-230 249q-14 14 -10 24.5t25 10.5h150v601h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" /> +<glyph unicode="" d="M936 864l249 -229q14 -15 14 -35.5t-14 -35.5l-249 -229q-15 -15 -25.5 -10.5t-10.5 24.5v151h-600v-151q0 -20 -10.5 -24.5t-25.5 10.5l-249 229q-14 15 -14 35.5t14 35.5l249 229q15 15 25.5 10.5t10.5 -25.5v-149h600v149q0 21 10.5 25.5t25.5 -10.5z" /> +<glyph unicode="" d="M1169 400l-172 732q-5 23 -23 45.5t-38 22.5h-672q-20 0 -38 -20t-23 -41l-172 -739h1138zM1100 300h-1000q-41 0 -70.5 -29.5t-29.5 -70.5v-100q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5v100q0 41 -29.5 70.5t-70.5 29.5zM800 100v100h100v-100h-100 zM1000 100v100h100v-100h-100z" /> +<glyph unicode="" d="M1150 1100q21 0 35.5 -14.5t14.5 -35.5v-850q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v850q0 21 14.5 35.5t35.5 14.5zM1000 200l-675 200h-38l47 -276q3 -16 -5.5 -20t-29.5 -4h-7h-84q-20 0 -34.5 14t-18.5 35q-55 337 -55 351v250v6q0 16 1 23.5t6.5 14 t17.5 6.5h200l675 250v-850zM0 750v-250q-4 0 -11 0.5t-24 6t-30 15t-24 30t-11 48.5v50q0 26 10.5 46t25 30t29 16t25.5 7z" /> +<glyph unicode="" d="M553 1200h94q20 0 29 -10.5t3 -29.5l-18 -37q83 -19 144 -82.5t76 -140.5l63 -327l118 -173h17q19 0 33 -14.5t14 -35t-13 -40.5t-31 -27q-8 -4 -23 -9.5t-65 -19.5t-103 -25t-132.5 -20t-158.5 -9q-57 0 -115 5t-104 12t-88.5 15.5t-73.5 17.5t-54.5 16t-35.5 12l-11 4 q-18 8 -31 28t-13 40.5t14 35t33 14.5h17l118 173l63 327q15 77 76 140t144 83l-18 32q-6 19 3.5 32t28.5 13zM498 110q50 -6 102 -6q53 0 102 6q-12 -49 -39.5 -79.5t-62.5 -30.5t-63 30.5t-39 79.5z" /> +<glyph unicode="" d="M800 946l224 78l-78 -224l234 -45l-180 -155l180 -155l-234 -45l78 -224l-224 78l-45 -234l-155 180l-155 -180l-45 234l-224 -78l78 224l-234 45l180 155l-180 155l234 45l-78 224l224 -78l45 234l155 -180l155 180z" /> +<glyph unicode="" d="M650 1200h50q40 0 70 -40.5t30 -84.5v-150l-28 -125h328q40 0 70 -40.5t30 -84.5v-100q0 -45 -29 -74l-238 -344q-16 -24 -38 -40.5t-45 -16.5h-250q-7 0 -42 25t-66 50l-31 25h-61q-45 0 -72.5 18t-27.5 57v400q0 36 20 63l145 196l96 198q13 28 37.5 48t51.5 20z M650 1100l-100 -212l-150 -213v-375h100l136 -100h214l250 375v125h-450l50 225v175h-50zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1100h250q23 0 45 -16.5t38 -40.5l238 -344q29 -29 29 -74v-100q0 -44 -30 -84.5t-70 -40.5h-328q28 -118 28 -125v-150q0 -44 -30 -84.5t-70 -40.5h-50q-27 0 -51.5 20t-37.5 48l-96 198l-145 196q-20 27 -20 63v400q0 39 27.5 57t72.5 18h61q124 100 139 100z M50 1000h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5zM636 1000l-136 -100h-100v-375l150 -213l100 -212h50v175l-50 225h450v125l-250 375h-214z" /> +<glyph unicode="" d="M356 873l363 230q31 16 53 -6l110 -112q13 -13 13.5 -32t-11.5 -34l-84 -121h302q84 0 138 -38t54 -110t-55 -111t-139 -39h-106l-131 -339q-6 -21 -19.5 -41t-28.5 -20h-342q-7 0 -90 81t-83 94v525q0 17 14 35.5t28 28.5zM400 792v-503l100 -89h293l131 339 q6 21 19.5 41t28.5 20h203q21 0 30.5 25t0.5 50t-31 25h-456h-7h-6h-5.5t-6 0.5t-5 1.5t-5 2t-4 2.5t-4 4t-2.5 4.5q-12 25 5 47l146 183l-86 83zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500 q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M475 1103l366 -230q2 -1 6 -3.5t14 -10.5t18 -16.5t14.5 -20t6.5 -22.5v-525q0 -13 -86 -94t-93 -81h-342q-15 0 -28.5 20t-19.5 41l-131 339h-106q-85 0 -139.5 39t-54.5 111t54 110t138 38h302l-85 121q-11 15 -10.5 34t13.5 32l110 112q22 22 53 6zM370 945l146 -183 q17 -22 5 -47q-2 -2 -3.5 -4.5t-4 -4t-4 -2.5t-5 -2t-5 -1.5t-6 -0.5h-6h-6.5h-6h-475v-100h221q15 0 29 -20t20 -41l130 -339h294l106 89v503l-342 236zM1050 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5 v500q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M550 1294q72 0 111 -55t39 -139v-106l339 -131q21 -6 41 -19.5t20 -28.5v-342q0 -7 -81 -90t-94 -83h-525q-17 0 -35.5 14t-28.5 28l-9 14l-230 363q-16 31 6 53l112 110q13 13 32 13.5t34 -11.5l121 -84v302q0 84 38 138t110 54zM600 972v203q0 21 -25 30.5t-50 0.5 t-25 -31v-456v-7v-6v-5.5t-0.5 -6t-1.5 -5t-2 -5t-2.5 -4t-4 -4t-4.5 -2.5q-25 -12 -47 5l-183 146l-83 -86l236 -339h503l89 100v293l-339 131q-21 6 -41 19.5t-20 28.5zM450 200h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M350 1100h500q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5t35.5 -14.5zM600 306v-106q0 -84 -39 -139t-111 -55t-110 54t-38 138v302l-121 -84q-15 -12 -34 -11.5t-32 13.5l-112 110 q-22 22 -6 53l230 363q1 2 3.5 6t10.5 13.5t16.5 17t20 13.5t22.5 6h525q13 0 94 -83t81 -90v-342q0 -15 -20 -28.5t-41 -19.5zM308 900l-236 -339l83 -86l183 146q22 17 47 5q2 -1 4.5 -2.5t4 -4t2.5 -4t2 -5t1.5 -5t0.5 -6v-5.5v-6v-7v-456q0 -22 25 -31t50 0.5t25 30.5 v203q0 15 20 28.5t41 19.5l339 131v293l-89 100h-503z" /> +<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM914 632l-275 223q-16 13 -27.5 8t-11.5 -26v-137h-275 q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h275v-137q0 -21 11.5 -26t27.5 8l275 223q16 13 16 32t-16 32z" /> +<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM561 855l-275 -223q-16 -13 -16 -32t16 -32l275 -223q16 -13 27.5 -8 t11.5 26v137h275q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5h-275v137q0 21 -11.5 26t-27.5 -8z" /> +<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM855 639l-223 275q-13 16 -32 16t-32 -16l-223 -275q-13 -16 -8 -27.5 t26 -11.5h137v-275q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v275h137q21 0 26 11.5t-8 27.5z" /> +<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM675 900h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-275h-137q-21 0 -26 -11.5 t8 -27.5l223 -275q13 -16 32 -16t32 16l223 275q13 16 8 27.5t-26 11.5h-137v275q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M600 1176q116 0 222.5 -46t184 -123.5t123.5 -184t46 -222.5t-46 -222.5t-123.5 -184t-184 -123.5t-222.5 -46t-222.5 46t-184 123.5t-123.5 184t-46 222.5t46 222.5t123.5 184t184 123.5t222.5 46zM627 1101q-15 -12 -36.5 -20.5t-35.5 -12t-43 -8t-39 -6.5 q-15 -3 -45.5 0t-45.5 -2q-20 -7 -51.5 -26.5t-34.5 -34.5q-3 -11 6.5 -22.5t8.5 -18.5q-3 -34 -27.5 -91t-29.5 -79q-9 -34 5 -93t8 -87q0 -9 17 -44.5t16 -59.5q12 0 23 -5t23.5 -15t19.5 -14q16 -8 33 -15t40.5 -15t34.5 -12q21 -9 52.5 -32t60 -38t57.5 -11 q7 -15 -3 -34t-22.5 -40t-9.5 -38q13 -21 23 -34.5t27.5 -27.5t36.5 -18q0 -7 -3.5 -16t-3.5 -14t5 -17q104 -2 221 112q30 29 46.5 47t34.5 49t21 63q-13 8 -37 8.5t-36 7.5q-15 7 -49.5 15t-51.5 19q-18 0 -41 -0.5t-43 -1.5t-42 -6.5t-38 -16.5q-51 -35 -66 -12 q-4 1 -3.5 25.5t0.5 25.5q-6 13 -26.5 17.5t-24.5 6.5q1 15 -0.5 30.5t-7 28t-18.5 11.5t-31 -21q-23 -25 -42 4q-19 28 -8 58q6 16 22 22q6 -1 26 -1.5t33.5 -4t19.5 -13.5q7 -12 18 -24t21.5 -20.5t20 -15t15.5 -10.5l5 -3q2 12 7.5 30.5t8 34.5t-0.5 32q-3 18 3.5 29 t18 22.5t15.5 24.5q6 14 10.5 35t8 31t15.5 22.5t34 22.5q-6 18 10 36q8 0 24 -1.5t24.5 -1.5t20 4.5t20.5 15.5q-10 23 -31 42.5t-37.5 29.5t-49 27t-43.5 23q0 1 2 8t3 11.5t1.5 10.5t-1 9.5t-4.5 4.5q31 -13 58.5 -14.5t38.5 2.5l12 5q5 28 -9.5 46t-36.5 24t-50 15 t-41 20q-18 -4 -37 0zM613 994q0 -17 8 -42t17 -45t9 -23q-8 1 -39.5 5.5t-52.5 10t-37 16.5q3 11 16 29.5t16 25.5q10 -10 19 -10t14 6t13.5 14.5t16.5 12.5z" /> +<glyph unicode="" d="M756 1157q164 92 306 -9l-259 -138l145 -232l251 126q6 -89 -34 -156.5t-117 -110.5q-60 -34 -127 -39.5t-126 16.5l-596 -596q-15 -16 -36.5 -16t-36.5 16l-111 110q-15 15 -15 36.5t15 37.5l600 599q-34 101 5.5 201.5t135.5 154.5z" /> +<glyph unicode="" horiz-adv-x="1220" d="M100 1196h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 1096h-200v-100h200v100zM100 796h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 696h-500v-100h500v100zM100 396h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 296h-300v-100h300v100z " /> +<glyph unicode="" d="M150 1200h900q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM700 500v-300l-200 -200v500l-350 500h900z" /> +<glyph unicode="" d="M500 1200h200q41 0 70.5 -29.5t29.5 -70.5v-100h300q41 0 70.5 -29.5t29.5 -70.5v-400h-500v100h-200v-100h-500v400q0 41 29.5 70.5t70.5 29.5h300v100q0 41 29.5 70.5t70.5 29.5zM500 1100v-100h200v100h-200zM1200 400v-200q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v200h1200z" /> +<glyph unicode="" d="M50 1200h300q21 0 25 -10.5t-10 -24.5l-94 -94l199 -199q7 -8 7 -18t-7 -18l-106 -106q-8 -7 -18 -7t-18 7l-199 199l-94 -94q-14 -14 -24.5 -10t-10.5 25v300q0 21 14.5 35.5t35.5 14.5zM850 1200h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94 l-199 -199q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l199 199l-94 94q-14 14 -10 24.5t25 10.5zM364 470l106 -106q7 -8 7 -18t-7 -18l-199 -199l94 -94q14 -14 10 -24.5t-25 -10.5h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l199 199 q8 7 18 7t18 -7zM1071 271l94 94q14 14 24.5 10t10.5 -25v-300q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -25 10.5t10 24.5l94 94l-199 199q-7 8 -7 18t7 18l106 106q8 7 18 7t18 -7z" /> +<glyph unicode="" d="M596 1192q121 0 231.5 -47.5t190 -127t127 -190t47.5 -231.5t-47.5 -231.5t-127 -190.5t-190 -127t-231.5 -47t-231.5 47t-190.5 127t-127 190.5t-47 231.5t47 231.5t127 190t190.5 127t231.5 47.5zM596 1010q-112 0 -207.5 -55.5t-151 -151t-55.5 -207.5t55.5 -207.5 t151 -151t207.5 -55.5t207.5 55.5t151 151t55.5 207.5t-55.5 207.5t-151 151t-207.5 55.5zM454.5 905q22.5 0 38.5 -16t16 -38.5t-16 -39t-38.5 -16.5t-38.5 16.5t-16 39t16 38.5t38.5 16zM754.5 905q22.5 0 38.5 -16t16 -38.5t-16 -39t-38 -16.5q-14 0 -29 10l-55 -145 q17 -23 17 -51q0 -36 -25.5 -61.5t-61.5 -25.5t-61.5 25.5t-25.5 61.5q0 32 20.5 56.5t51.5 29.5l122 126l1 1q-9 14 -9 28q0 23 16 39t38.5 16zM345.5 709q22.5 0 38.5 -16t16 -38.5t-16 -38.5t-38.5 -16t-38.5 16t-16 38.5t16 38.5t38.5 16zM854.5 709q22.5 0 38.5 -16 t16 -38.5t-16 -38.5t-38.5 -16t-38.5 16t-16 38.5t16 38.5t38.5 16z" /> +<glyph unicode="" d="M546 173l469 470q91 91 99 192q7 98 -52 175.5t-154 94.5q-22 4 -47 4q-34 0 -66.5 -10t-56.5 -23t-55.5 -38t-48 -41.5t-48.5 -47.5q-376 -375 -391 -390q-30 -27 -45 -41.5t-37.5 -41t-32 -46.5t-16 -47.5t-1.5 -56.5q9 -62 53.5 -95t99.5 -33q74 0 125 51l548 548 q36 36 20 75q-7 16 -21.5 26t-32.5 10q-26 0 -50 -23q-13 -12 -39 -38l-341 -338q-15 -15 -35.5 -15.5t-34.5 13.5t-14 34.5t14 34.5q327 333 361 367q35 35 67.5 51.5t78.5 16.5q14 0 29 -1q44 -8 74.5 -35.5t43.5 -68.5q14 -47 2 -96.5t-47 -84.5q-12 -11 -32 -32 t-79.5 -81t-114.5 -115t-124.5 -123.5t-123 -119.5t-96.5 -89t-57 -45q-56 -27 -120 -27q-70 0 -129 32t-93 89q-48 78 -35 173t81 163l511 511q71 72 111 96q91 55 198 55q80 0 152 -33q78 -36 129.5 -103t66.5 -154q17 -93 -11 -183.5t-94 -156.5l-482 -476 q-15 -15 -36 -16t-37 14t-17.5 34t14.5 35z" /> +<glyph unicode="" d="M649 949q48 68 109.5 104t121.5 38.5t118.5 -20t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-150 152.5t-126.5 127.5t-93.5 124.5t-33.5 117.5q0 64 28 123t73 100.5t104 64t119 20 t120.5 -38.5t104.5 -104zM896 972q-33 0 -64.5 -19t-56.5 -46t-47.5 -53.5t-43.5 -45.5t-37.5 -19t-36 19t-40 45.5t-43 53.5t-54 46t-65.5 19q-67 0 -122.5 -55.5t-55.5 -132.5q0 -23 13.5 -51t46 -65t57.5 -63t76 -75l22 -22q15 -14 44 -44t50.5 -51t46 -44t41 -35t23 -12 t23.5 12t42.5 36t46 44t52.5 52t44 43q4 4 12 13q43 41 63.5 62t52 55t46 55t26 46t11.5 44q0 79 -53 133.5t-120 54.5z" /> +<glyph unicode="" d="M776.5 1214q93.5 0 159.5 -66l141 -141q66 -66 66 -160q0 -42 -28 -95.5t-62 -87.5l-29 -29q-31 53 -77 99l-18 18l95 95l-247 248l-389 -389l212 -212l-105 -106l-19 18l-141 141q-66 66 -66 159t66 159l283 283q65 66 158.5 66zM600 706l105 105q10 -8 19 -17l141 -141 q66 -66 66 -159t-66 -159l-283 -283q-66 -66 -159 -66t-159 66l-141 141q-66 66 -66 159.5t66 159.5l55 55q29 -55 75 -102l18 -17l-95 -95l247 -248l389 389z" /> +<glyph unicode="" d="M603 1200q85 0 162 -15t127 -38t79 -48t29 -46v-953q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5v953q0 21 30 46.5t81 48t129 37.5t163 15zM300 1000v-700h600v700h-600zM600 254q-43 0 -73.5 -30.5t-30.5 -73.5t30.5 -73.5t73.5 -30.5t73.5 30.5 t30.5 73.5t-30.5 73.5t-73.5 30.5z" /> +<glyph unicode="" d="M902 1185l283 -282q15 -15 15 -36t-14.5 -35.5t-35.5 -14.5t-35 15l-36 35l-279 -267v-300l-212 210l-308 -307l-280 -203l203 280l307 308l-210 212h300l267 279l-35 36q-15 14 -15 35t14.5 35.5t35.5 14.5t35 -15z" /> +<glyph unicode="" d="M700 1248v-78q38 -5 72.5 -14.5t75.5 -31.5t71 -53.5t52 -84t24 -118.5h-159q-4 36 -10.5 59t-21 45t-40 35.5t-64.5 20.5v-307l64 -13q34 -7 64 -16.5t70 -32t67.5 -52.5t47.5 -80t20 -112q0 -139 -89 -224t-244 -97v-77h-100v79q-150 16 -237 103q-40 40 -52.5 93.5 t-15.5 139.5h139q5 -77 48.5 -126t117.5 -65v335l-27 8q-46 14 -79 26.5t-72 36t-63 52t-40 72.5t-16 98q0 70 25 126t67.5 92t94.5 57t110 27v77h100zM600 754v274q-29 -4 -50 -11t-42 -21.5t-31.5 -41.5t-10.5 -65q0 -29 7 -50.5t16.5 -34t28.5 -22.5t31.5 -14t37.5 -10 q9 -3 13 -4zM700 547v-310q22 2 42.5 6.5t45 15.5t41.5 27t29 42t12 59.5t-12.5 59.5t-38 44.5t-53 31t-66.5 24.5z" /> +<glyph unicode="" d="M561 1197q84 0 160.5 -40t123.5 -109.5t47 -147.5h-153q0 40 -19.5 71.5t-49.5 48.5t-59.5 26t-55.5 9q-37 0 -79 -14.5t-62 -35.5q-41 -44 -41 -101q0 -26 13.5 -63t26.5 -61t37 -66q6 -9 9 -14h241v-100h-197q8 -50 -2.5 -115t-31.5 -95q-45 -62 -99 -112 q34 10 83 17.5t71 7.5q32 1 102 -16t104 -17q83 0 136 30l50 -147q-31 -19 -58 -30.5t-55 -15.5t-42 -4.5t-46 -0.5q-23 0 -76 17t-111 32.5t-96 11.5q-39 -3 -82 -16t-67 -25l-23 -11l-55 145q4 3 16 11t15.5 10.5t13 9t15.5 12t14.5 14t17.5 18.5q48 55 54 126.5 t-30 142.5h-221v100h166q-23 47 -44 104q-7 20 -12 41.5t-6 55.5t6 66.5t29.5 70.5t58.5 71q97 88 263 88z" /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM935 1184l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-900h-200v900h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" /> +<glyph unicode="" d="M1000 700h-100v100h-100v-100h-100v500h300v-500zM400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM801 1100v-200h100v200h-100zM1000 350l-200 -250h200v-100h-300v150l200 250h-200v100h300v-150z " /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1000 1050l-200 -250h200v-100h-300v150l200 250h-200v100h300v-150zM1000 0h-100v100h-100v-100h-100v500h300v-500zM801 400v-200h100v200h-100z " /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1000 700h-100v400h-100v100h200v-500zM1100 0h-100v100h-200v400h300v-500zM901 400v-200h100v200h-100z" /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1100 700h-100v100h-200v400h300v-500zM901 1100v-200h100v200h-100zM1000 0h-100v400h-100v100h200v-500z" /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM900 1000h-200v200h200v-200zM1000 700h-300v200h300v-200zM1100 400h-400v200h400v-200zM1200 100h-500v200h500v-200z" /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1200 1000h-500v200h500v-200zM1100 700h-400v200h400v-200zM1000 400h-300v200h300v-200zM900 100h-200v200h200v-200z" /> +<glyph unicode="" d="M350 1100h400q162 0 256 -93.5t94 -256.5v-400q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5z" /> +<glyph unicode="" d="M350 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-163 0 -256.5 92.5t-93.5 257.5v400q0 163 94 256.5t256 93.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM440 770l253 -190q17 -12 17 -30t-17 -30l-253 -190q-16 -12 -28 -6.5t-12 26.5v400q0 21 12 26.5t28 -6.5z" /> +<glyph unicode="" d="M350 1100h400q163 0 256.5 -94t93.5 -256v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 163 92.5 256.5t257.5 93.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM350 700h400q21 0 26.5 -12t-6.5 -28l-190 -253q-12 -17 -30 -17t-30 17l-190 253q-12 16 -6.5 28t26.5 12z" /> +<glyph unicode="" d="M350 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -163 -92.5 -256.5t-257.5 -93.5h-400q-163 0 -256.5 94t-93.5 256v400q0 165 92.5 257.5t257.5 92.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM580 693l190 -253q12 -16 6.5 -28t-26.5 -12h-400q-21 0 -26.5 12t6.5 28l190 253q12 17 30 17t30 -17z" /> +<glyph unicode="" d="M550 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h450q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-450q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM338 867l324 -284q16 -14 16 -33t-16 -33l-324 -284q-16 -14 -27 -9t-11 26v150h-250q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h250v150q0 21 11 26t27 -9z" /> +<glyph unicode="" d="M793 1182l9 -9q8 -10 5 -27q-3 -11 -79 -225.5t-78 -221.5l300 1q24 0 32.5 -17.5t-5.5 -35.5q-1 0 -133.5 -155t-267 -312.5t-138.5 -162.5q-12 -15 -26 -15h-9l-9 8q-9 11 -4 32q2 9 42 123.5t79 224.5l39 110h-302q-23 0 -31 19q-10 21 6 41q75 86 209.5 237.5 t228 257t98.5 111.5q9 16 25 16h9z" /> +<glyph unicode="" d="M350 1100h400q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-450q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h450q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400 q0 165 92.5 257.5t257.5 92.5zM938 867l324 -284q16 -14 16 -33t-16 -33l-324 -284q-16 -14 -27 -9t-11 26v150h-250q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h250v150q0 21 11 26t27 -9z" /> +<glyph unicode="" d="M750 1200h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -10.5 -25t-24.5 10l-109 109l-312 -312q-15 -15 -35.5 -15t-35.5 15l-141 141q-15 15 -15 35.5t15 35.5l312 312l-109 109q-14 14 -10 24.5t25 10.5zM456 900h-156q-41 0 -70.5 -29.5t-29.5 -70.5v-500 q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v148l200 200v-298q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5h300z" /> +<glyph unicode="" d="M600 1186q119 0 227.5 -46.5t187 -125t125 -187t46.5 -227.5t-46.5 -227.5t-125 -187t-187 -125t-227.5 -46.5t-227.5 46.5t-187 125t-125 187t-46.5 227.5t46.5 227.5t125 187t187 125t227.5 46.5zM600 1022q-115 0 -212 -56.5t-153.5 -153.5t-56.5 -212t56.5 -212 t153.5 -153.5t212 -56.5t212 56.5t153.5 153.5t56.5 212t-56.5 212t-153.5 153.5t-212 56.5zM600 794q80 0 137 -57t57 -137t-57 -137t-137 -57t-137 57t-57 137t57 137t137 57z" /> +<glyph unicode="" d="M450 1200h200q21 0 35.5 -14.5t14.5 -35.5v-350h245q20 0 25 -11t-9 -26l-383 -426q-14 -15 -33.5 -15t-32.5 15l-379 426q-13 15 -8.5 26t25.5 11h250v350q0 21 14.5 35.5t35.5 14.5zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5z M900 200v-50h100v50h-100z" /> +<glyph unicode="" d="M583 1182l378 -435q14 -15 9 -31t-26 -16h-244v-250q0 -20 -17 -35t-39 -15h-200q-20 0 -32 14.5t-12 35.5v250h-250q-20 0 -25.5 16.5t8.5 31.5l383 431q14 16 33.5 17t33.5 -14zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5z M900 200v-50h100v50h-100z" /> +<glyph unicode="" d="M396 723l369 369q7 7 17.5 7t17.5 -7l139 -139q7 -8 7 -18.5t-7 -17.5l-525 -525q-7 -8 -17.5 -8t-17.5 8l-292 291q-7 8 -7 18t7 18l139 139q8 7 18.5 7t17.5 -7zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50 h-100z" /> +<glyph unicode="" d="M135 1023l142 142q14 14 35 14t35 -14l77 -77l-212 -212l-77 76q-14 15 -14 36t14 35zM655 855l210 210q14 14 24.5 10t10.5 -25l-2 -599q-1 -20 -15.5 -35t-35.5 -15l-597 -1q-21 0 -25 10.5t10 24.5l208 208l-154 155l212 212zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5 v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50h-100z" /> +<glyph unicode="" d="M350 1200l599 -2q20 -1 35 -15.5t15 -35.5l1 -597q0 -21 -10.5 -25t-24.5 10l-208 208l-155 -154l-212 212l155 154l-210 210q-14 14 -10 24.5t25 10.5zM524 512l-76 -77q-15 -14 -36 -14t-35 14l-142 142q-14 14 -14 35t14 35l77 77zM50 300h1000q21 0 35.5 -14.5 t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50h-100z" /> +<glyph unicode="" d="M1200 103l-483 276l-314 -399v423h-399l1196 796v-1096zM483 424v-230l683 953z" /> +<glyph unicode="" d="M1100 1000v-850q0 -21 -14.5 -35.5t-35.5 -14.5h-150v400h-700v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200z" /> +<glyph unicode="" d="M1100 1000l-2 -149l-299 -299l-95 95q-9 9 -21.5 9t-21.5 -9l-149 -147h-312v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM1132 638l106 -106q7 -7 7 -17.5t-7 -17.5l-420 -421q-8 -7 -18 -7 t-18 7l-202 203q-8 7 -8 17.5t8 17.5l106 106q7 8 17.5 8t17.5 -8l79 -79l297 297q7 7 17.5 7t17.5 -7z" /> +<glyph unicode="" d="M1100 1000v-269l-103 -103l-134 134q-15 15 -33.5 16.5t-34.5 -12.5l-266 -266h-329v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM1202 572l70 -70q15 -15 15 -35.5t-15 -35.5l-131 -131 l131 -131q15 -15 15 -35.5t-15 -35.5l-70 -70q-15 -15 -35.5 -15t-35.5 15l-131 131l-131 -131q-15 -15 -35.5 -15t-35.5 15l-70 70q-15 15 -15 35.5t15 35.5l131 131l-131 131q-15 15 -15 35.5t15 35.5l70 70q15 15 35.5 15t35.5 -15l131 -131l131 131q15 15 35.5 15 t35.5 -15z" /> +<glyph unicode="" d="M1100 1000v-300h-350q-21 0 -35.5 -14.5t-14.5 -35.5v-150h-500v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM850 600h100q21 0 35.5 -14.5t14.5 -35.5v-250h150q21 0 25 -10.5t-10 -24.5 l-230 -230q-14 -14 -35 -14t-35 14l-230 230q-14 14 -10 24.5t25 10.5h150v250q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M1100 1000v-400l-165 165q-14 15 -35 15t-35 -15l-263 -265h-402v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM935 565l230 -229q14 -15 10 -25.5t-25 -10.5h-150v-250q0 -20 -14.5 -35 t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35v250h-150q-21 0 -25 10.5t10 25.5l230 229q14 15 35 15t35 -15z" /> +<glyph unicode="" d="M50 1100h1100q21 0 35.5 -14.5t14.5 -35.5v-150h-1200v150q0 21 14.5 35.5t35.5 14.5zM1200 800v-550q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v550h1200zM100 500v-200h400v200h-400z" /> +<glyph unicode="" d="M935 1165l248 -230q14 -14 14 -35t-14 -35l-248 -230q-14 -14 -24.5 -10t-10.5 25v150h-400v200h400v150q0 21 10.5 25t24.5 -10zM200 800h-50q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v-200zM400 800h-100v200h100v-200zM18 435l247 230 q14 14 24.5 10t10.5 -25v-150h400v-200h-400v-150q0 -21 -10.5 -25t-24.5 10l-247 230q-15 14 -15 35t15 35zM900 300h-100v200h100v-200zM1000 500h51q20 0 34.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-34.5 -14.5h-51v200z" /> +<glyph unicode="" d="M862 1073l276 116q25 18 43.5 8t18.5 -41v-1106q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v397q-4 1 -11 5t-24 17.5t-30 29t-24 42t-11 56.5v359q0 31 18.5 65t43.5 52zM550 1200q22 0 34.5 -12.5t14.5 -24.5l1 -13v-450q0 -28 -10.5 -59.5 t-25 -56t-29 -45t-25.5 -31.5l-10 -11v-447q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v447q-4 4 -11 11.5t-24 30.5t-30 46t-24 55t-11 60v450q0 2 0.5 5.5t4 12t8.5 15t14.5 12t22.5 5.5q20 0 32.5 -12.5t14.5 -24.5l3 -13v-350h100v350v5.5t2.5 12 t7 15t15 12t25.5 5.5q23 0 35.5 -12.5t13.5 -24.5l1 -13v-350h100v350q0 2 0.5 5.5t3 12t7 15t15 12t24.5 5.5z" /> +<glyph unicode="" d="M1200 1100v-56q-4 0 -11 -0.5t-24 -3t-30 -7.5t-24 -15t-11 -24v-888q0 -22 25 -34.5t50 -13.5l25 -2v-56h-400v56q75 0 87.5 6.5t12.5 43.5v394h-500v-394q0 -37 12.5 -43.5t87.5 -6.5v-56h-400v56q4 0 11 0.5t24 3t30 7.5t24 15t11 24v888q0 22 -25 34.5t-50 13.5 l-25 2v56h400v-56q-75 0 -87.5 -6.5t-12.5 -43.5v-394h500v394q0 37 -12.5 43.5t-87.5 6.5v56h400z" /> +<glyph unicode="" d="M675 1000h375q21 0 35.5 -14.5t14.5 -35.5v-150h-105l-295 -98v98l-200 200h-400l100 100h375zM100 900h300q41 0 70.5 -29.5t29.5 -70.5v-500q0 -41 -29.5 -70.5t-70.5 -29.5h-300q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5zM100 800v-200h300v200 h-300zM1100 535l-400 -133v163l400 133v-163zM100 500v-200h300v200h-300zM1100 398v-248q0 -21 -14.5 -35.5t-35.5 -14.5h-375l-100 -100h-375l-100 100h400l200 200h105z" /> +<glyph unicode="" d="M17 1007l162 162q17 17 40 14t37 -22l139 -194q14 -20 11 -44.5t-20 -41.5l-119 -118q102 -142 228 -268t267 -227l119 118q17 17 42.5 19t44.5 -12l192 -136q19 -14 22.5 -37.5t-13.5 -40.5l-163 -162q-3 -1 -9.5 -1t-29.5 2t-47.5 6t-62.5 14.5t-77.5 26.5t-90 42.5 t-101.5 60t-111 83t-119 108.5q-74 74 -133.5 150.5t-94.5 138.5t-60 119.5t-34.5 100t-15 74.5t-4.5 48z" /> +<glyph unicode="" d="M600 1100q92 0 175 -10.5t141.5 -27t108.5 -36.5t81.5 -40t53.5 -37t31 -27l9 -10v-200q0 -21 -14.5 -33t-34.5 -9l-202 34q-20 3 -34.5 20t-14.5 38v146q-141 24 -300 24t-300 -24v-146q0 -21 -14.5 -38t-34.5 -20l-202 -34q-20 -3 -34.5 9t-14.5 33v200q3 4 9.5 10.5 t31 26t54 37.5t80.5 39.5t109 37.5t141 26.5t175 10.5zM600 795q56 0 97 -9.5t60 -23.5t30 -28t12 -24l1 -10v-50l365 -303q14 -15 24.5 -40t10.5 -45v-212q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v212q0 20 10.5 45t24.5 40l365 303v50 q0 4 1 10.5t12 23t30 29t60 22.5t97 10z" /> +<glyph unicode="" d="M1100 700l-200 -200h-600l-200 200v500h200v-200h200v200h200v-200h200v200h200v-500zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-12l137 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5 t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M700 1100h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-1000h300v1000q0 41 -29.5 70.5t-70.5 29.5zM1100 800h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-700h300v700q0 41 -29.5 70.5t-70.5 29.5zM400 0h-300v400q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-400z " /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-100h200v-300h-300v100h200v100h-200v300h300v-100zM900 700v-300l-100 -100h-200v500h200z M700 700v-300h100v300h-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 300h-100v200h-100v-200h-100v500h100v-200h100v200h100v-500zM900 700v-300l-100 -100h-200v500h200z M700 700v-300h100v300h-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-300h200v-100h-300v500h300v-100zM900 700h-200v-300h200v-100h-300v500h300v-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 400l-300 150l300 150v-300zM900 550l-300 -150v300z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM900 300h-700v500h700v-500zM800 700h-130q-38 0 -66.5 -43t-28.5 -108t27 -107t68 -42h130v300zM300 700v-300 h130q41 0 68 42t27 107t-28.5 108t-66.5 43h-130z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-100h200v-300h-300v100h200v100h-200v300h300v-100zM900 300h-100v400h-100v100h200v-500z M700 300h-100v100h100v-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM300 700h200v-400h-300v500h100v-100zM900 300h-100v400h-100v100h200v-500zM300 600v-200h100v200h-100z M700 300h-100v100h100v-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 500l-199 -200h-100v50l199 200v150h-200v100h300v-300zM900 300h-100v400h-100v100h200v-500zM701 300h-100 v100h100v-100z" /> +<glyph unicode="" d="M600 1191q120 0 229.5 -47t188.5 -126t126 -188.5t47 -229.5t-47 -229.5t-126 -188.5t-188.5 -126t-229.5 -47t-229.5 47t-188.5 126t-126 188.5t-47 229.5t47 229.5t126 188.5t188.5 126t229.5 47zM600 1021q-114 0 -211 -56.5t-153.5 -153.5t-56.5 -211t56.5 -211 t153.5 -153.5t211 -56.5t211 56.5t153.5 153.5t56.5 211t-56.5 211t-153.5 153.5t-211 56.5zM800 700h-300v-200h300v-100h-300l-100 100v200l100 100h300v-100z" /> +<glyph unicode="" d="M600 1191q120 0 229.5 -47t188.5 -126t126 -188.5t47 -229.5t-47 -229.5t-126 -188.5t-188.5 -126t-229.5 -47t-229.5 47t-188.5 126t-126 188.5t-47 229.5t47 229.5t126 188.5t188.5 126t229.5 47zM600 1021q-114 0 -211 -56.5t-153.5 -153.5t-56.5 -211t56.5 -211 t153.5 -153.5t211 -56.5t211 56.5t153.5 153.5t56.5 211t-56.5 211t-153.5 153.5t-211 56.5zM800 700v-100l-50 -50l100 -100v-50h-100l-100 100h-150v-100h-100v400h300zM500 700v-100h200v100h-200z" /> +<glyph unicode="" d="M503 1089q110 0 200.5 -59.5t134.5 -156.5q44 14 90 14q120 0 205 -86.5t85 -207t-85 -207t-205 -86.5h-128v250q0 21 -14.5 35.5t-35.5 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-250h-222q-80 0 -136 57.5t-56 136.5q0 69 43 122.5t108 67.5q-2 19 -2 37q0 100 49 185 t134 134t185 49zM525 500h150q10 0 17.5 -7.5t7.5 -17.5v-275h137q21 0 26 -11.5t-8 -27.5l-223 -244q-13 -16 -32 -16t-32 16l-223 244q-13 16 -8 27.5t26 11.5h137v275q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M502 1089q110 0 201 -59.5t135 -156.5q43 15 89 15q121 0 206 -86.5t86 -206.5q0 -99 -60 -181t-150 -110l-378 360q-13 16 -31.5 16t-31.5 -16l-381 -365h-9q-79 0 -135.5 57.5t-56.5 136.5q0 69 43 122.5t108 67.5q-2 19 -2 38q0 100 49 184.5t133.5 134t184.5 49.5z M632 467l223 -228q13 -16 8 -27.5t-26 -11.5h-137v-275q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v275h-137q-21 0 -26 11.5t8 27.5q199 204 223 228q19 19 31.5 19t32.5 -19z" /> +<glyph unicode="" d="M700 100v100h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170l-270 -300h400v-100h-50q-21 0 -35.5 -14.5t-14.5 -35.5v-50h400v50q0 21 -14.5 35.5t-35.5 14.5h-50z" /> +<glyph unicode="" d="M600 1179q94 0 167.5 -56.5t99.5 -145.5q89 -6 150.5 -71.5t61.5 -155.5q0 -61 -29.5 -112.5t-79.5 -82.5q9 -29 9 -55q0 -74 -52.5 -126.5t-126.5 -52.5q-55 0 -100 30v-251q21 0 35.5 -14.5t14.5 -35.5v-50h-300v50q0 21 14.5 35.5t35.5 14.5v251q-45 -30 -100 -30 q-74 0 -126.5 52.5t-52.5 126.5q0 18 4 38q-47 21 -75.5 65t-28.5 97q0 74 52.5 126.5t126.5 52.5q5 0 23 -2q0 2 -1 10t-1 13q0 116 81.5 197.5t197.5 81.5z" /> +<glyph unicode="" d="M1010 1010q111 -111 150.5 -260.5t0 -299t-150.5 -260.5q-83 -83 -191.5 -126.5t-218.5 -43.5t-218.5 43.5t-191.5 126.5q-111 111 -150.5 260.5t0 299t150.5 260.5q83 83 191.5 126.5t218.5 43.5t218.5 -43.5t191.5 -126.5zM476 1065q-4 0 -8 -1q-121 -34 -209.5 -122.5 t-122.5 -209.5q-4 -12 2.5 -23t18.5 -14l36 -9q3 -1 7 -1q23 0 29 22q27 96 98 166q70 71 166 98q11 3 17.5 13.5t3.5 22.5l-9 35q-3 13 -14 19q-7 4 -15 4zM512 920q-4 0 -9 -2q-80 -24 -138.5 -82.5t-82.5 -138.5q-4 -13 2 -24t19 -14l34 -9q4 -1 8 -1q22 0 28 21 q18 58 58.5 98.5t97.5 58.5q12 3 18 13.5t3 21.5l-9 35q-3 12 -14 19q-7 4 -15 4zM719.5 719.5q-49.5 49.5 -119.5 49.5t-119.5 -49.5t-49.5 -119.5t49.5 -119.5t119.5 -49.5t119.5 49.5t49.5 119.5t-49.5 119.5zM855 551q-22 0 -28 -21q-18 -58 -58.5 -98.5t-98.5 -57.5 q-11 -4 -17 -14.5t-3 -21.5l9 -35q3 -12 14 -19q7 -4 15 -4q4 0 9 2q80 24 138.5 82.5t82.5 138.5q4 13 -2.5 24t-18.5 14l-34 9q-4 1 -8 1zM1000 515q-23 0 -29 -22q-27 -96 -98 -166q-70 -71 -166 -98q-11 -3 -17.5 -13.5t-3.5 -22.5l9 -35q3 -13 14 -19q7 -4 15 -4 q4 0 8 1q121 34 209.5 122.5t122.5 209.5q4 12 -2.5 23t-18.5 14l-36 9q-3 1 -7 1z" /> +<glyph unicode="" d="M700 800h300v-380h-180v200h-340v-200h-380v755q0 10 7.5 17.5t17.5 7.5h575v-400zM1000 900h-200v200zM700 300h162l-212 -212l-212 212h162v200h100v-200zM520 0h-395q-10 0 -17.5 7.5t-7.5 17.5v395zM1000 220v-195q0 -10 -7.5 -17.5t-17.5 -7.5h-195z" /> +<glyph unicode="" d="M700 800h300v-520l-350 350l-550 -550v1095q0 10 7.5 17.5t17.5 7.5h575v-400zM1000 900h-200v200zM862 200h-162v-200h-100v200h-162l212 212zM480 0h-355q-10 0 -17.5 7.5t-7.5 17.5v55h380v-80zM1000 80v-55q0 -10 -7.5 -17.5t-17.5 -7.5h-155v80h180z" /> +<glyph unicode="" d="M1162 800h-162v-200h100l100 -100h-300v300h-162l212 212zM200 800h200q27 0 40 -2t29.5 -10.5t23.5 -30t7 -57.5h300v-100h-600l-200 -350v450h100q0 36 7 57.5t23.5 30t29.5 10.5t40 2zM800 400h240l-240 -400h-800l300 500h500v-100z" /> +<glyph unicode="" d="M650 1100h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5zM1000 850v150q41 0 70.5 -29.5t29.5 -70.5v-800 q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-1 0 -20 4l246 246l-326 326v324q0 41 29.5 70.5t70.5 29.5v-150q0 -62 44 -106t106 -44h300q62 0 106 44t44 106zM412 250l-212 -212v162h-200v100h200v162z" /> +<glyph unicode="" d="M450 1100h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5zM800 850v150q41 0 70.5 -29.5t29.5 -70.5v-500 h-200v-300h200q0 -36 -7 -57.5t-23.5 -30t-29.5 -10.5t-40 -2h-600q-41 0 -70.5 29.5t-29.5 70.5v800q0 41 29.5 70.5t70.5 29.5v-150q0 -62 44 -106t106 -44h300q62 0 106 44t44 106zM1212 250l-212 -212v162h-200v100h200v162z" /> +<glyph unicode="" d="M658 1197l637 -1104q23 -38 7 -65.5t-60 -27.5h-1276q-44 0 -60 27.5t7 65.5l637 1104q22 39 54 39t54 -39zM704 800h-208q-20 0 -32 -14.5t-8 -34.5l58 -302q4 -20 21.5 -34.5t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5zM500 300v-100h200 v100h-200z" /> +<glyph unicode="" d="M425 1100h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM425 800h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5 t17.5 7.5zM825 800h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM25 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150 q0 10 7.5 17.5t17.5 7.5zM425 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM825 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5 v150q0 10 7.5 17.5t17.5 7.5zM25 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM425 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5 t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM825 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M700 1200h100v-200h-100v-100h350q62 0 86.5 -39.5t-3.5 -94.5l-66 -132q-41 -83 -81 -134h-772q-40 51 -81 134l-66 132q-28 55 -3.5 94.5t86.5 39.5h350v100h-100v200h100v100h200v-100zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-12l137 -100 h-950l138 100h-13q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1300q40 0 68.5 -29.5t28.5 -70.5h-194q0 41 28.5 70.5t68.5 29.5zM443 1100h314q18 -37 18 -75q0 -8 -3 -25h328q41 0 44.5 -16.5t-30.5 -38.5l-175 -145h-678l-178 145q-34 22 -29 38.5t46 16.5h328q-3 17 -3 25q0 38 18 75zM250 700h700q21 0 35.5 -14.5 t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-150v-200l275 -200h-950l275 200v200h-150q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1181q75 0 128 -53t53 -128t-53 -128t-128 -53t-128 53t-53 128t53 128t128 53zM602 798h46q34 0 55.5 -28.5t21.5 -86.5q0 -76 39 -183h-324q39 107 39 183q0 58 21.5 86.5t56.5 28.5h45zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13 l138 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1300q47 0 92.5 -53.5t71 -123t25.5 -123.5q0 -78 -55.5 -133.5t-133.5 -55.5t-133.5 55.5t-55.5 133.5q0 62 34 143l144 -143l111 111l-163 163q34 26 63 26zM602 798h46q34 0 55.5 -28.5t21.5 -86.5q0 -76 39 -183h-324q39 107 39 183q0 58 21.5 86.5t56.5 28.5h45 zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13l138 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1200l300 -161v-139h-300q0 -57 18.5 -108t50 -91.5t63 -72t70 -67.5t57.5 -61h-530q-60 83 -90.5 177.5t-30.5 178.5t33 164.5t87.5 139.5t126 96.5t145.5 41.5v-98zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13l138 -100h-950l137 100 h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1300q41 0 70.5 -29.5t29.5 -70.5v-78q46 -26 73 -72t27 -100v-50h-400v50q0 54 27 100t73 72v78q0 41 29.5 70.5t70.5 29.5zM400 800h400q54 0 100 -27t72 -73h-172v-100h200v-100h-200v-100h200v-100h-200v-100h200q0 -83 -58.5 -141.5t-141.5 -58.5h-400 q-83 0 -141.5 58.5t-58.5 141.5v400q0 83 58.5 141.5t141.5 58.5z" /> +<glyph unicode="" d="M150 1100h900q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5zM125 400h950q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-283l224 -224q13 -13 13 -31.5t-13 -32 t-31.5 -13.5t-31.5 13l-88 88h-524l-87 -88q-13 -13 -32 -13t-32 13.5t-13 32t13 31.5l224 224h-289q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM541 300l-100 -100h324l-100 100h-124z" /> +<glyph unicode="" d="M200 1100h800q83 0 141.5 -58.5t58.5 -141.5v-200h-100q0 41 -29.5 70.5t-70.5 29.5h-250q-41 0 -70.5 -29.5t-29.5 -70.5h-100q0 41 -29.5 70.5t-70.5 29.5h-250q-41 0 -70.5 -29.5t-29.5 -70.5h-100v200q0 83 58.5 141.5t141.5 58.5zM100 600h1000q41 0 70.5 -29.5 t29.5 -70.5v-300h-1200v300q0 41 29.5 70.5t70.5 29.5zM300 100v-50q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v50h200zM1100 100v-50q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v50h200z" /> +<glyph unicode="" d="M480 1165l682 -683q31 -31 31 -75.5t-31 -75.5l-131 -131h-481l-517 518q-32 31 -32 75.5t32 75.5l295 296q31 31 75.5 31t76.5 -31zM108 794l342 -342l303 304l-341 341zM250 100h800q21 0 35.5 -14.5t14.5 -35.5v-50h-900v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M1057 647l-189 506q-8 19 -27.5 33t-40.5 14h-400q-21 0 -40.5 -14t-27.5 -33l-189 -506q-8 -19 1.5 -33t30.5 -14h625v-150q0 -21 14.5 -35.5t35.5 -14.5t35.5 14.5t14.5 35.5v150h125q21 0 30.5 14t1.5 33zM897 0h-595v50q0 21 14.5 35.5t35.5 14.5h50v50 q0 21 14.5 35.5t35.5 14.5h48v300h200v-300h47q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-50z" /> +<glyph unicode="" d="M900 800h300v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-375v591l-300 300v84q0 10 7.5 17.5t17.5 7.5h375v-400zM1200 900h-200v200zM400 600h300v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-650q-10 0 -17.5 7.5t-7.5 17.5v950q0 10 7.5 17.5t17.5 7.5h375v-400zM700 700h-200v200z " /> +<glyph unicode="" d="M484 1095h195q75 0 146 -32.5t124 -86t89.5 -122.5t48.5 -142q18 -14 35 -20q31 -10 64.5 6.5t43.5 48.5q10 34 -15 71q-19 27 -9 43q5 8 12.5 11t19 -1t23.5 -16q41 -44 39 -105q-3 -63 -46 -106.5t-104 -43.5h-62q-7 -55 -35 -117t-56 -100l-39 -234q-3 -20 -20 -34.5 t-38 -14.5h-100q-21 0 -33 14.5t-9 34.5l12 70q-49 -14 -91 -14h-195q-24 0 -65 8l-11 -64q-3 -20 -20 -34.5t-38 -14.5h-100q-21 0 -33 14.5t-9 34.5l26 157q-84 74 -128 175l-159 53q-19 7 -33 26t-14 40v50q0 21 14.5 35.5t35.5 14.5h124q11 87 56 166l-111 95 q-16 14 -12.5 23.5t24.5 9.5h203q116 101 250 101zM675 1000h-250q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h250q10 0 17.5 7.5t7.5 17.5v50q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M641 900l423 247q19 8 42 2.5t37 -21.5l32 -38q14 -15 12.5 -36t-17.5 -34l-139 -120h-390zM50 1100h106q67 0 103 -17t66 -71l102 -212h823q21 0 35.5 -14.5t14.5 -35.5v-50q0 -21 -14 -40t-33 -26l-737 -132q-23 -4 -40 6t-26 25q-42 67 -100 67h-300q-62 0 -106 44 t-44 106v200q0 62 44 106t106 44zM173 928h-80q-19 0 -28 -14t-9 -35v-56q0 -51 42 -51h134q16 0 21.5 8t5.5 24q0 11 -16 45t-27 51q-18 28 -43 28zM550 727q-32 0 -54.5 -22.5t-22.5 -54.5t22.5 -54.5t54.5 -22.5t54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5zM130 389 l152 130q18 19 34 24t31 -3.5t24.5 -17.5t25.5 -28q28 -35 50.5 -51t48.5 -13l63 5l48 -179q13 -61 -3.5 -97.5t-67.5 -79.5l-80 -69q-47 -40 -109 -35.5t-103 51.5l-130 151q-40 47 -35.5 109.5t51.5 102.5zM380 377l-102 -88q-31 -27 2 -65l37 -43q13 -15 27.5 -19.5 t31.5 6.5l61 53q19 16 14 49q-2 20 -12 56t-17 45q-11 12 -19 14t-23 -8z" /> +<glyph unicode="" d="M625 1200h150q10 0 17.5 -7.5t7.5 -17.5v-109q79 -33 131 -87.5t53 -128.5q1 -46 -15 -84.5t-39 -61t-46 -38t-39 -21.5l-17 -6q6 0 15 -1.5t35 -9t50 -17.5t53 -30t50 -45t35.5 -64t14.5 -84q0 -59 -11.5 -105.5t-28.5 -76.5t-44 -51t-49.5 -31.5t-54.5 -16t-49.5 -6.5 t-43.5 -1v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-100v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-175q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h75v600h-75q-10 0 -17.5 7.5t-7.5 17.5v150 q0 10 7.5 17.5t17.5 7.5h175v75q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-75h100v75q0 10 7.5 17.5t17.5 7.5zM400 900v-200h263q28 0 48.5 10.5t30 25t15 29t5.5 25.5l1 10q0 4 -0.5 11t-6 24t-15 30t-30 24t-48.5 11h-263zM400 500v-200h363q28 0 48.5 10.5 t30 25t15 29t5.5 25.5l1 10q0 4 -0.5 11t-6 24t-15 30t-30 24t-48.5 11h-363z" /> +<glyph unicode="" d="M212 1198h780q86 0 147 -61t61 -147v-416q0 -51 -18 -142.5t-36 -157.5l-18 -66q-29 -87 -93.5 -146.5t-146.5 -59.5h-572q-82 0 -147 59t-93 147q-8 28 -20 73t-32 143.5t-20 149.5v416q0 86 61 147t147 61zM600 1045q-70 0 -132.5 -11.5t-105.5 -30.5t-78.5 -41.5 t-57 -45t-36 -41t-20.5 -30.5l-6 -12l156 -243h560l156 243q-2 5 -6 12.5t-20 29.5t-36.5 42t-57 44.5t-79 42t-105 29.5t-132.5 12zM762 703h-157l195 261z" /> +<glyph unicode="" d="M475 1300h150q103 0 189 -86t86 -189v-500q0 -41 -42 -83t-83 -42h-450q-41 0 -83 42t-42 83v500q0 103 86 189t189 86zM700 300v-225q0 -21 -27 -48t-48 -27h-150q-21 0 -48 27t-27 48v225h300z" /> +<glyph unicode="" d="M475 1300h96q0 -150 89.5 -239.5t239.5 -89.5v-446q0 -41 -42 -83t-83 -42h-450q-41 0 -83 42t-42 83v500q0 103 86 189t189 86zM700 300v-225q0 -21 -27 -48t-48 -27h-150q-21 0 -48 27t-27 48v225h300z" /> +<glyph unicode="" d="M1294 767l-638 -283l-378 170l-78 -60v-224l100 -150v-199l-150 148l-150 -149v200l100 150v250q0 4 -0.5 10.5t0 9.5t1 8t3 8t6.5 6l47 40l-147 65l642 283zM1000 380l-350 -166l-350 166v147l350 -165l350 165v-147z" /> +<glyph unicode="" d="M250 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM650 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM1050 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" /> +<glyph unicode="" d="M550 1100q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM550 700q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM550 300q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" /> +<glyph unicode="" d="M125 1100h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM125 700h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5 t17.5 7.5zM125 300h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M350 1200h500q162 0 256 -93.5t94 -256.5v-500q0 -165 -93.5 -257.5t-256.5 -92.5h-500q-165 0 -257.5 92.5t-92.5 257.5v500q0 165 92.5 257.5t257.5 92.5zM900 1000h-600q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h600q41 0 70.5 29.5 t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5zM350 900h500q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -14.5 -35.5t-35.5 -14.5h-500q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 14.5 35.5t35.5 14.5zM400 800v-200h400v200h-400z" /> +<glyph unicode="" d="M150 1100h1000q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5 t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M650 1187q87 -67 118.5 -156t0 -178t-118.5 -155q-87 66 -118.5 155t0 178t118.5 156zM300 800q124 0 212 -88t88 -212q-124 0 -212 88t-88 212zM1000 800q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM300 500q124 0 212 -88t88 -212q-124 0 -212 88t-88 212z M1000 500q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM700 199v-144q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v142q40 -4 43 -4q17 0 57 6z" /> +<glyph unicode="" d="M745 878l69 19q25 6 45 -12l298 -295q11 -11 15 -26.5t-2 -30.5q-5 -14 -18 -23.5t-28 -9.5h-8q1 0 1 -13q0 -29 -2 -56t-8.5 -62t-20 -63t-33 -53t-51 -39t-72.5 -14h-146q-184 0 -184 288q0 24 10 47q-20 4 -62 4t-63 -4q11 -24 11 -47q0 -288 -184 -288h-142 q-48 0 -84.5 21t-56 51t-32 71.5t-16 75t-3.5 68.5q0 13 2 13h-7q-15 0 -27.5 9.5t-18.5 23.5q-6 15 -2 30.5t15 25.5l298 296q20 18 46 11l76 -19q20 -5 30.5 -22.5t5.5 -37.5t-22.5 -31t-37.5 -5l-51 12l-182 -193h891l-182 193l-44 -12q-20 -5 -37.5 6t-22.5 31t6 37.5 t31 22.5z" /> +<glyph unicode="" d="M1200 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-850q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v850h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM500 450h-25q0 15 -4 24.5t-9 14.5t-17 7.5t-20 3t-25 0.5h-100v-425q0 -11 12.5 -17.5t25.5 -7.5h12v-50h-200v50q50 0 50 25v425h-100q-17 0 -25 -0.5t-20 -3t-17 -7.5t-9 -14.5t-4 -24.5h-25v150h500v-150z" /> +<glyph unicode="" d="M1000 300v50q-25 0 -55 32q-14 14 -25 31t-16 27l-4 11l-289 747h-69l-300 -754q-18 -35 -39 -56q-9 -9 -24.5 -18.5t-26.5 -14.5l-11 -5v-50h273v50q-49 0 -78.5 21.5t-11.5 67.5l69 176h293l61 -166q13 -34 -3.5 -66.5t-55.5 -32.5v-50h312zM412 691l134 342l121 -342 h-255zM1100 150v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5z" /> +<glyph unicode="" d="M50 1200h1100q21 0 35.5 -14.5t14.5 -35.5v-1100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v1100q0 21 14.5 35.5t35.5 14.5zM611 1118h-70q-13 0 -18 -12l-299 -753q-17 -32 -35 -51q-18 -18 -56 -34q-12 -5 -12 -18v-50q0 -8 5.5 -14t14.5 -6 h273q8 0 14 6t6 14v50q0 8 -6 14t-14 6q-55 0 -71 23q-10 14 0 39l63 163h266l57 -153q11 -31 -6 -55q-12 -17 -36 -17q-8 0 -14 -6t-6 -14v-50q0 -8 6 -14t14 -6h313q8 0 14 6t6 14v50q0 7 -5.5 13t-13.5 7q-17 0 -42 25q-25 27 -40 63h-1l-288 748q-5 12 -19 12zM639 611 h-197l103 264z" /> +<glyph unicode="" d="M1200 1100h-1200v100h1200v-100zM50 1000h400q21 0 35.5 -14.5t14.5 -35.5v-900q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v900q0 21 14.5 35.5t35.5 14.5zM650 1000h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM700 900v-300h300v300h-300z" /> +<glyph unicode="" d="M50 1200h400q21 0 35.5 -14.5t14.5 -35.5v-900q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v900q0 21 14.5 35.5t35.5 14.5zM650 700h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5zM700 600v-300h300v300h-300zM1200 0h-1200v100h1200v-100z" /> +<glyph unicode="" d="M50 1000h400q21 0 35.5 -14.5t14.5 -35.5v-350h100v150q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-150h100v-100h-100v-150q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v150h-100v-350q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5zM700 700v-300h300v300h-300z" /> +<glyph unicode="" d="M100 0h-100v1200h100v-1200zM250 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM300 1000v-300h300v300h-300zM250 500h900q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1100h150q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-150v-100h450q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h350v100h-150q-21 0 -35.5 14.5 t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h150v100h100v-100zM400 1000v-300h300v300h-300z" /> +<glyph unicode="" d="M1200 0h-100v1200h100v-1200zM550 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM600 1000v-300h300v300h-300zM50 500h900q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M865 565l-494 -494q-23 -23 -41 -23q-14 0 -22 13.5t-8 38.5v1000q0 25 8 38.5t22 13.5q18 0 41 -23l494 -494q14 -14 14 -35t-14 -35z" /> +<glyph unicode="" d="M335 635l494 494q29 29 50 20.5t21 -49.5v-1000q0 -41 -21 -49.5t-50 20.5l-494 494q-14 14 -14 35t14 35z" /> +<glyph unicode="" d="M100 900h1000q41 0 49.5 -21t-20.5 -50l-494 -494q-14 -14 -35 -14t-35 14l-494 494q-29 29 -20.5 50t49.5 21z" /> +<glyph unicode="" d="M635 865l494 -494q29 -29 20.5 -50t-49.5 -21h-1000q-41 0 -49.5 21t20.5 50l494 494q14 14 35 14t35 -14z" /> +<glyph unicode="" d="M700 741v-182l-692 -323v221l413 193l-413 193v221zM1200 0h-800v200h800v-200z" /> +<glyph unicode="" d="M1200 900h-200v-100h200v-100h-300v300h200v100h-200v100h300v-300zM0 700h50q0 21 4 37t9.5 26.5t18 17.5t22 11t28.5 5.5t31 2t37 0.5h100v-550q0 -22 -25 -34.5t-50 -13.5l-25 -2v-100h400v100q-4 0 -11 0.5t-24 3t-30 7t-24 15t-11 24.5v550h100q25 0 37 -0.5t31 -2 t28.5 -5.5t22 -11t18 -17.5t9.5 -26.5t4 -37h50v300h-800v-300z" /> +<glyph unicode="" d="M800 700h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-100v-550q0 -22 25 -34.5t50 -14.5l25 -1v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v550h-100q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h800v-300zM1100 200h-200v-100h200v-100h-300v300h200v100h-200v100h300v-300z" /> +<glyph unicode="" d="M701 1098h160q16 0 21 -11t-7 -23l-464 -464l464 -464q12 -12 7 -23t-21 -11h-160q-13 0 -23 9l-471 471q-7 8 -7 18t7 18l471 471q10 9 23 9z" /> +<glyph unicode="" d="M339 1098h160q13 0 23 -9l471 -471q7 -8 7 -18t-7 -18l-471 -471q-10 -9 -23 -9h-160q-16 0 -21 11t7 23l464 464l-464 464q-12 12 -7 23t21 11z" /> +<glyph unicode="" d="M1087 882q11 -5 11 -21v-160q0 -13 -9 -23l-471 -471q-8 -7 -18 -7t-18 7l-471 471q-9 10 -9 23v160q0 16 11 21t23 -7l464 -464l464 464q12 12 23 7z" /> +<glyph unicode="" d="M618 993l471 -471q9 -10 9 -23v-160q0 -16 -11 -21t-23 7l-464 464l-464 -464q-12 -12 -23 -7t-11 21v160q0 13 9 23l471 471q8 7 18 7t18 -7z" /> +<glyph unicode="" d="M1000 1200q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM450 1000h100q21 0 40 -14t26 -33l79 -194q5 1 16 3q34 6 54 9.5t60 7t65.5 1t61 -10t56.5 -23t42.5 -42t29 -64t5 -92t-19.5 -121.5q-1 -7 -3 -19.5t-11 -50t-20.5 -73t-32.5 -81.5t-46.5 -83t-64 -70 t-82.5 -50q-13 -5 -42 -5t-65.5 2.5t-47.5 2.5q-14 0 -49.5 -3.5t-63 -3.5t-43.5 7q-57 25 -104.5 78.5t-75 111.5t-46.5 112t-26 90l-7 35q-15 63 -18 115t4.5 88.5t26 64t39.5 43.5t52 25.5t58.5 13t62.5 2t59.5 -4.5t55.5 -8l-147 192q-12 18 -5.5 30t27.5 12z" /> +<glyph unicode="🔑" d="M250 1200h600q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-150v-500l-255 -178q-19 -9 -32 -1t-13 29v650h-150q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM400 1100v-100h300v100h-300z" /> +<glyph unicode="🚪" d="M250 1200h750q39 0 69.5 -40.5t30.5 -84.5v-933l-700 -117v950l600 125h-700v-1000h-100v1025q0 23 15.5 49t34.5 26zM500 525v-100l100 20v100z" /> +</font> +</defs></svg> diff --git a/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.ttf b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 0000000..1413fc6 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.ttf Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 0000000..9e61285 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff2 b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 0000000..64539b5 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff2 Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/img/bg.png b/user/guns-admin/src/main/webapp/static/img/bg.png new file mode 100644 index 0000000..73d102d --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/img/bg.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/img/boy.gif b/user/guns-admin/src/main/webapp/static/img/boy.gif new file mode 100644 index 0000000..e1ba77e --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/img/boy.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/img/girl.gif b/user/guns-admin/src/main/webapp/static/img/girl.gif new file mode 100644 index 0000000..8ef9a59 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/img/girl.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/img/icons.png b/user/guns-admin/src/main/webapp/static/img/icons.png new file mode 100644 index 0000000..12e4700 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/img/icons.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/img/loading-upload.gif b/user/guns-admin/src/main/webapp/static/img/loading-upload.gif new file mode 100644 index 0000000..6fba776 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/img/loading-upload.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/img/locked.png b/user/guns-admin/src/main/webapp/static/img/locked.png new file mode 100644 index 0000000..c831c1f --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/img/locked.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/img/user.png b/user/guns-admin/src/main/webapp/static/img/user.png new file mode 100644 index 0000000..7f77fd0 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/img/user.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/bootstrap.min.js b/user/guns-admin/src/main/webapp/static/js/bootstrap.min.js new file mode 100644 index 0000000..e364a13 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/bootstrap.min.js @@ -0,0 +1,7 @@ +/*! + * Bootstrap v3.3.6 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under the MIT license + */ +if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.6",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.6",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.6",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.6",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.6",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.6",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active"); +d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.6",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); diff --git a/user/guns-admin/src/main/webapp/static/js/common/DateUtils.js b/user/guns-admin/src/main/webapp/static/js/common/DateUtils.js new file mode 100644 index 0000000..c80481c --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/common/DateUtils.js @@ -0,0 +1,173 @@ +var DateUtils = { + /** + * 扩展Date 对象格式化方法 + */ + expandDate : function() { + Date.prototype.format = function(fmt) + { //author: meizz + var o = { + "M+" : this.getMonth()+1, //月份 + "d+" : this.getDate(), //日 + "h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时 + "H+" : this.getHours(), //小时 + "m+" : this.getMinutes(), //分 + "s+" : this.getSeconds(), //秒 + "q+" : Math.floor((this.getMonth()+3)/3), //季度 + "S" : this.getMilliseconds() //毫秒 + }; + if(/(y+)/.test(fmt)) + fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); + for(var k in o) + if(new RegExp("("+ k +")").test(fmt)) + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); + return fmt; + } + }, + /** + * 获取具体年龄 + * @param {} beginStr + * @param {} endStr + * @return {} + */ + getAgeInfo: function (beginStr, endStr) { + var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})(\s)(\d{1,2})(:)(\d{1,2})(:{0,1})(\d{0,2})$/); + var beginArr = beginStr.match(reg); + var endArr = endStr.match(reg); + + var days = 0; + var month = 0; + var year = 0; + + days = endArr[5] - beginArr[5]; + if (days < 0) { + month = -1; + days = 30 + days; + } + + month = month + (endArr[3] - beginArr[3]); + if (month < 0) { + year = -1; + month = 12 + month; + } + + year = year + (endArr[1] - beginArr[1]); + + var yearString = year > 0 ? year + "岁" : ""; + var mnthString = month > 0 ? month + "月" : ""; + var dayString = days > 0 ? days + "天" : ""; + + /* + * 1 如果岁 大于等于1 那么年龄取 几岁 2 如果 岁等于0 但是月大于1 那么如果天等于0天小于3天 取小时 例如出生2天 就取 48小时 + */ + var result = ""; + if (year >= 1) { + result = yearString + mnthString; + } else { + if (month >= 1) { + result = days > 0 ? mnthString + dayString : mnthString; + } else { + var begDate = new Date(beginArr[1], beginArr[3] - 1, beginArr[5], + beginArr[7], beginArr[9], beginArr[11]); + var endDate = new Date(endArr[1], endArr[3] - 1, endArr[5], + endArr[7], endArr[9], endArr[11]); + + var between = (endDate.getTime() - begDate.getTime()) / 1000; + days = Math.floor(between / (24 * 3600)); + var hours = Math.floor(between / 3600 - (days * 24)); + var dayString = days > 0 ? days + "天" : ""; + result = days >= 3 ? dayString : days * 24 + hours + "小时"; + } + } + + return result; + }, + /** + * 获取年龄,不满一天算天 + * @param {} birthday + * @param {} today + * @return {} + */ + getAge :function(birthday,today) { + var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/); + var beginArr = birthday.match(reg); + var endArr = today.match(reg); + + var days = 0; + var month = 0; + var year = 0; + + days = endArr[5] - beginArr[5]; + if (days < 0) { + month = -1; + days = 30 + days; + } + + month = month + (endArr[3] - beginArr[3]); + if (month < 0) { + year = -1; + month = 12 + month; + } + + year = year + (endArr[1] - beginArr[1]); + + var yearString = year > 0 ? year + "岁" : ""; + var mnthString = month > 0 ? month + "月" : ""; + var dayString = days > 0 ? days + "天" : "1天"; + + /* + * 1 如果岁 大于等于1 那么年龄取 几岁 2 如果 岁等于0 但是月大于1 name取几月 3 如果不足月, 则取天数 4 不满一天算一天 + */ + var result = ""; + if (year >= 1) { + result = yearString + mnthString + dayString; + } else { + if (month >= 1) { + result = days > 0 ? mnthString + dayString : mnthString; + } else { + result = dayString; + } + } + return result; + }, + /** + * 获取月龄 + * @param {} birthday + * @param {} today + * @return {} + */ + getMonthage :function(birthday,today) { + var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/); + var beginArr = birthday.match(reg); + var endArr = today.match(reg); + + var days = 0; + var month = 0; + var year = 0; + + days = endArr[5] - beginArr[5]; + if (days < 0) { + month = -1; + days = 30 + days; + } + + month = month + (endArr[3] - beginArr[3]); + if (month < 0) { + year = -1; + month = 12 + month; + } + + year = year + (endArr[1] - beginArr[1]); + + var result = ""; + if (year >= 1) { + result = (year * 12 + month + 1) + "个月"; + } else { + if (month >= 1) { + result = (month + 1) + "个月"; + } else { + result = "1个月"; + } + } + return result; + } +} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/common/Feng.js b/user/guns-admin/src/main/webapp/static/js/common/Feng.js new file mode 100644 index 0000000..9e42fbb --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/common/Feng.js @@ -0,0 +1,196 @@ +var Feng = { + ctxPath: "", + addCtx: function (ctx) { + if (this.ctxPath == "") { + this.ctxPath = ctx; + } + }, + confirm: function (tip, ensure) {//询问框 + parent.layer.confirm(tip, { + btn: ['确定', '取消'] + }, function (index) { + ensure(); + parent.layer.close(index); + }, function (index) { + parent.layer.close(index); + }); + }, + log: function (info) { + console.log(info); + }, + alert: function (info, iconIndex) { + parent.layer.msg(info, { + icon: iconIndex + }); + }, + info: function (info) { + Feng.alert(info, 0); + }, + success: function (info) { + Feng.alert(info, 1); + }, + error: function (info) { + Feng.alert(info, 2); + }, + infoDetail: function (title, info) { + var display = ""; + if (typeof info == "string") { + display = info; + } else { + if (info instanceof Array) { + for (var x in info) { + display = display + info[x] + "<br/>"; + } + } else { + display = info; + } + } + parent.layer.open({ + title: title, + type: 1, + skin: 'layui-layer-rim', //加上边框 + area: ['950px', '600px'], //宽高 + content: '<div style="padding: 20px;">' + display + '</div>' + }); + }, + writeObj: function (obj) { + var description = ""; + for (var i in obj) { + var property = obj[i]; + description += i + " = " + property + ","; + } + layer.alert(description, { + skin: 'layui-layer-molv', + closeBtn: 0 + }); + }, + showInputTree: function (inputId, inputTreeContentId, leftOffset, rightOffset) { + var onBodyDown = function (event) { + if (!(event.target.id == "menuBtn" || event.target.id == inputTreeContentId || $(event.target).parents("#" + inputTreeContentId).length > 0)) { + $("#" + inputTreeContentId).fadeOut("fast"); + $("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起 + } + }; + + if (leftOffset == undefined && rightOffset == undefined) { + var inputDiv = $("#" + inputId); + var inputDivOffset = $("#" + inputId).offset(); + $("#" + inputTreeContentId).css({ + left: inputDivOffset.left + "px", + top: inputDivOffset.top + inputDiv.outerHeight() + "px" + }).slideDown("fast"); + } else { + $("#" + inputTreeContentId).css({ + left: leftOffset + "px", + top: rightOffset + "px" + }).slideDown("fast"); + } + + $("body").bind("mousedown", onBodyDown); + }, + baseAjax: function (url, tip) { + var ajax = new $ax(Feng.ctxPath + url, function (data) { + Feng.success(tip + "成功!"); + }, function (data) { + Feng.error(tip + "失败!" + data.responseJSON.message + "!"); + }); + return ajax; + }, + changeAjax: function (url) { + return Feng.baseAjax(url, "修改"); + }, + zTreeCheckedNodes: function (zTreeId) { + var zTree = $.fn.zTree.getZTreeObj(zTreeId); + var nodes = zTree.getCheckedNodes(); + var ids = ""; + for (var i = 0, l = nodes.length; i < l; i++) { + ids += "," + nodes[i].id; + } + return ids.substring(1); + }, + eventParseObject: function (event) {//获取点击事件的源对象 + event = event ? event : window.event; + var obj = event.srcElement ? event.srcElement : event.target; + return $(obj); + }, + sessionTimeoutRegistry: function () { + $.ajaxSetup({ + contentType: "application/x-www-form-urlencoded;charset=utf-8", + complete: function (XMLHttpRequest, textStatus) { + //通过XMLHttpRequest取得响应头,sessionstatus, + var sessionstatus = XMLHttpRequest.getResponseHeader("sessionstatus"); + if (sessionstatus == "timeout") { + //如果超时就处理 ,指定要跳转的页面 + window.location = Feng.ctxPath + "/global/sessionError"; + } + } + }); + }, + initValidator: function (formId, fields) { + $('#' + formId).bootstrapValidator({ + feedbackIcons: { + valid: 'glyphicon glyphicon-ok', + invalid: 'glyphicon glyphicon-remove', + validating: 'glyphicon glyphicon-refresh' + }, + fields: fields, + live: 'enabled', + message: '该字段不能为空' + }); + }, + underLineToCamel: function (str) { + var strArr = str.split('_'); + for (var i = 1; i < strArr.length; i++) { + strArr[i] = strArr[i].charAt(0).toUpperCase() + strArr[i].substring(1); + } + var result = strArr.join(''); + return result.charAt(0).toUpperCase() + result.substring(1); + }, + randomNum: function (minNum, maxNum) { + switch (arguments.length) { + case 1: + return parseInt(Math.random() * minNum + 1, 10); + break; + case 2: + return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10); + break; + default: + return 0; + break; + } + }, + newCrontab: function (href, menuName) { + var dataUrl = href; + var needCreateCrontab = true; + + // 轮询已有的标签,判断是否已经存在标签 + parent.$('.J_menuTab').each(function () { + if ($(this).data('id') == dataUrl) { + if (!$(this).hasClass('active')) { + $(this).addClass('active').siblings('.J_menuTab').removeClass('active'); + parent.MyCrontab.scrollToTab(this); + parent.MyCrontab.$('.J_mainContent .J_iframe').each(function () { + if ($(this).data('id') == dataUrl) { + $(this).show().siblings('.J_iframe').hide(); + $(this).attr('src', $(this).attr('src')); + return false; + } + }); + } + needCreateCrontab = false; + return false; + } + }); + + //创建标签 + if (needCreateCrontab) { + var tabLink = '<a href="javascript:;" class="active J_menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>'; + parent.$('.J_menuTab').removeClass('active'); + parent.$('.J_menuTabs .page-tabs-content').append(tabLink); + + var iframeContent = '<iframe class="J_iframe" name="iframe' + Feng.randomNum(100,999) + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>'; + parent.$('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(iframeContent); + parent.MyCrontab.scrollToTab($('.J_menuTab.active')); + } + } +}; diff --git a/user/guns-admin/src/main/webapp/static/js/common/ajax-object.js b/user/guns-admin/src/main/webapp/static/js/common/ajax-object.js new file mode 100644 index 0000000..d3b88c0 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/common/ajax-object.js @@ -0,0 +1,66 @@ +(function () { + var $ax = function (url, success, error) { + this.url = url; + this.type = "post"; + this.data = {}; + this.dataType = "json"; + this.async = false; + this.success = success; + this.error = error; + }; + + $ax.prototype = { + start : function () { + var me = this; + + if (this.url.indexOf("?") == -1) { + this.url = this.url + "?jstime=" + new Date().getTime(); + } else { + this.url = this.url + "&jstime=" + new Date().getTime(); + } + + $.ajax({ + type: this.type, + url: this.url, + dataType: this.dataType, + async: this.async, + data: this.data, + beforeSend: function(data) { + + }, + success: function(data) { + me.success(data); + }, + error: function(data) { + me.error(data); + } + }); + }, + + set : function (key, value) { + if (typeof key == "object") { + for (var i in key) { + if (typeof i == "function") + continue; + this.data[i] = key[i]; + } + } else { + this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + } + return this; + }, + + setData : function(data){ + this.data = data; + return this; + }, + + clear : function () { + this.data = {}; + return this; + } + }; + + window.$ax = $ax; + +} ()); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/common/bootstrap-table-object.js b/user/guns-admin/src/main/webapp/static/js/common/bootstrap-table-object.js new file mode 100644 index 0000000..46a33e8 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/common/bootstrap-table-object.js @@ -0,0 +1,134 @@ +/** + * 初始化 BootStrap Table 的封装 + * + * 约定:toolbar的id为 (bstableId + "Toolbar") + * + * @author fengshuonan + */ +(function () { + var BSTable = function (bstableId, url, columns) { + this.btInstance = null; //jquery和BootStrapTable绑定的对象 + this.bstableId = bstableId; + this.url = Feng.ctxPath + url; + this.method = "post"; + this.paginationType = "server"; //默认分页方式是服务器分页,可选项"client" + this.toolbarId = bstableId + "Toolbar"; + this.columns = columns; + this.height = 665; //默认表格高度665 + this.data = {}; + this.queryParams = {}; // 向后台传递的自定义参数 + }; + + BSTable.prototype = { + /** + * 初始化bootstrap table + */ + init: function () { + var tableId = this.bstableId; + var me = this; + this.btInstance = + $('#' + tableId).bootstrapTable({ + contentType: "application/x-www-form-urlencoded", + url: this.url, //请求地址 + method: this.method, //ajax方式,post还是get + ajaxOptions: { //ajax请求的附带参数 + data: this.data + }, + toolbar: "#" + this.toolbarId,//顶部工具条 + striped: true, //是否显示行间隔色 + cache: false, //是否使用缓存,默认为true + pagination: true, //是否显示分页(*) + sortable: true, //是否启用排序 + sortOrder: "desc", //排序方式 + pageNumber: 1, //初始化加载第一页,默认第一页 + pageSize: 14, //每页的记录行数(*) + pageList: [14, 50, 100], //可供选择的每页的行数(*) + queryParamsType: 'limit', //默认值为 'limit' ,在默认情况下 传给服务端的参数为:offset,limit,sort + queryParams: function (param) { + return $.extend(me.queryParams, param); + }, // 向后台传递的自定义参数 + sidePagination: this.paginationType, //分页方式:client客户端分页,server服务端分页(*) + search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端 + strictSearch: true, //设置为 true启用 全匹配搜索,否则为模糊搜索 + showColumns: true, //是否显示所有的列 + showRefresh: true, //是否显示刷新按钮 + minimumCountColumns: 2, //最少允许的列数 + clickToSelect: true, //是否启用点击选中行 + searchOnEnterKey: true, //设置为 true时,按回车触发搜索方法,否则自动触发搜索方法 + columns: this.columns, //列数组 + pagination: true, //是否显示分页条 + height: this.height, + icons: { + refresh: 'glyphicon-repeat', + toggle: 'glyphicon-list-alt', + columns: 'glyphicon-list' + }, + iconSize: 'outline' + }); + return this; + }, + /** + * 向后台传递的自定义参数 + * @param param + */ + setQueryParams: function (param) { + this.queryParams = param; + }, + /** + * 设置分页方式:server 或者 client + */ + setPaginationType: function (type) { + this.paginationType = type; + }, + + /** + * 设置ajax post请求时候附带的参数 + */ + set: function (key, value) { + if (typeof key == "object") { + for (var i in key) { + if (typeof i == "function") + continue; + this.data[i] = key[i]; + } + } else { + this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + } + return this; + }, + + /** + * 设置ajax post请求时候附带的参数 + */ + setData: function (data) { + this.data = data; + return this; + }, + + /** + * 清空ajax post请求参数 + */ + clear: function () { + this.data = {}; + return this; + }, + + /** + * 刷新 bootstrap 表格 + * Refresh the remote server data, + * you can set {silent: true} to refresh the data silently, + * and set {url: newUrl} to change the url. + * To supply query params specific to this request, set {query: {foo: 'bar'}} + */ + refresh: function (parms) { + if (typeof parms != "undefined") { + this.btInstance.bootstrapTable('refresh', parms); + } else { + this.btInstance.bootstrapTable('refresh'); + } + } + }; + + window.BSTable = BSTable; + +}()); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/common/select-list-object.js b/user/guns-admin/src/main/webapp/static/js/common/select-list-object.js new file mode 100644 index 0000000..5ef2df1 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/common/select-list-object.js @@ -0,0 +1,36 @@ +var SelectList = {}; +SelectList.singelSelect = function (eleName, attr, data) { + var result = false; + $("#" + eleName).find("a").each(function (i, d) { + if ($(this).attr(attr) == data) { + if ($(this).hasClass('active')) { + $(this).removeClass('active'); + } else { + $(this).addClass('active'); + result = true; + } + } else { + $(this).removeClass('active'); + } + }); + return result; +}; +SelectList.mutiSelect = function (eleName, attr, data) { + var result = false; + $("#" + eleName).find("a").each(function (i, d) { + if ($(this).attr(attr) == data) { + if ($(this).hasClass('active')) { + $(this).removeClass('active'); + } else { + $(this).addClass('active'); + result = true; + } + } + }); + return result; +}; +SelectList.clearSelect = function (eleName) { + $("#" + eleName).find("a").each(function (i, d) { + $(this).removeClass('active'); + }); +}; \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/common/tree-table-object.js b/user/guns-admin/src/main/webapp/static/js/common/tree-table-object.js new file mode 100644 index 0000000..a67c6d9 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/common/tree-table-object.js @@ -0,0 +1,136 @@ +/** + * 初始化 Tree Table 的封装 + * + * @author cyf + */ +(function () { + var BSTreeTable = function (bstableId, url, columns) { + this.btInstance = null; //jquery和bootstrapTreeTable绑定的对象 + this.bstableId = bstableId; + this.url = Feng.ctxPath + url; + this.method = "post"; + this.columns = columns; + this.data = {};// ajax的参数 + this.expandColumn = null;// 展开显示的列 + this.id = 'id';// 选取记录返回的值 + this.code = 'code';// 用于设置父子关系 + this.parentCode = 'pcode';// 用于设置父子关系 + this.expandAll = false;// 是否默认全部展开 + this.toolbarId = bstableId + "Toolbar"; + this.height = 665; //默认表格高度665 + }; + + BSTreeTable.prototype = { + /** + * 初始化bootstrap table + */ + init: function () { + var tableId = this.bstableId; + this.btInstance = + $('#'+tableId).bootstrapTreeTable({ + id: this.id,// 选取记录返回的值 + code: this.code,// 用于设置父子关系 + parentCode: this.parentCode,// 用于设置父子关系 + rootCodeValue: this.rootCodeValue,//设置根节点code值----可指定根节点,默认为null,"",0,"0" + type: this.method, //请求数据的ajax类型 + url: this.url, //请求数据的ajax的url + ajaxParams: this.data, //请求数据的ajax的data属性 + expandColumn: this.expandColumn,//在哪一列上面显示展开按钮,从0开始 + striped: true, //是否各行渐变色 + expandAll: this.expandAll, //是否全部展开 + columns: this.columns, //列数组 + toolbar: "#" + this.toolbarId,//顶部工具条 + height: this.height, + }); + return this; + }, + + /** + * 设置在哪一列上面显示展开按钮,从0开始 + */ + setExpandColumn: function (expandColumn) { + this.expandColumn = expandColumn; + }, + /** + * 设置记录返回的id值 + */ + setIdField: function (id) { + this.id = id; + }, + /** + * 设置记录分级的字段 + */ + setCodeField: function (code) { + this.code = code; + }, + /** + * 设置记录分级的父级字段 + */ + setParentCodeField: function (parentCode) { + this.parentCode = parentCode; + }, + /** + * 设置根节点code值----可指定根节点,默认为null,"",0,"0" + */ + setRootCodeValue: function (rootCodeValue) { + this.rootCodeValue = rootCodeValue; + }, + /** + * 设置是否默认全部展开 + */ + setExpandAll: function (expandAll) { + this.expandAll = expandAll; + }, + /** + * 设置表格高度 + */ + setHeight: function (height) { + this.height = height; + }, + /** + * 设置ajax post请求时候附带的参数 + */ + set: function (key, value) { + if (typeof key == "object") { + for (var i in key) { + if (typeof i == "function") + continue; + this.data[i] = key[i]; + } + } else { + this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + } + return this; + }, + + /** + * 设置ajax post请求时候附带的参数 + */ + setData: function (data) { + this.data = data; + return this; + }, + + /** + * 清空ajax post请求参数 + */ + clear: function () { + this.data = {}; + return this; + }, + + /** + * 刷新表格 + */ + refresh: function (parms) { + if (typeof parms != "undefined") { + this.btInstance.bootstrapTreeTable('refresh', parms.query);// 为了兼容bootstrap-table的写法 + } else { + this.btInstance.bootstrapTreeTable('refresh'); + } + } + }; + + window.BSTreeTable = BSTreeTable; + +}()); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/common/web-upload-object.js b/user/guns-admin/src/main/webapp/static/js/common/web-upload-object.js new file mode 100644 index 0000000..5ceded7 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/common/web-upload-object.js @@ -0,0 +1,126 @@ +/** + * web-upload 工具类 + * + * 约定: + * 上传按钮的id = 图片隐藏域id + 'BtnId' + * 图片预览框的id = 图片隐藏域id + 'PreId' + * + * @author fengshuonan + */ +(function() { + + var $WebUpload = function(pictureId) { + this.pictureId = pictureId; + this.uploadBtnId = pictureId + "BtnId"; + this.uploadPreId = pictureId + "PreId"; + this.uploadUrl = Feng.ctxPath + '/mgr/upload'; + this.fileSizeLimit = 100 * 1024 * 1024; + this.picWidth = 800; + this.picHeight = 800; + this.uploadBarId = null; + }; + + $WebUpload.prototype = { + /** + * 初始化webUploader + */ + init : function() { + var uploader = this.create(); + this.bindEvent(uploader); + return uploader; + }, + + /** + * 创建webuploader对象 + */ + create : function() { + var webUploader = WebUploader.create({ + auto : true, + pick : { + id : '#' + this.uploadBtnId, + multiple : false,// 只上传一个 + }, + accept : { + title : 'Images', + extensions : 'gif,jpg,jpeg,bmp,png', + mimeTypes : 'image/gif,image/jpg,image/jpeg,image/bmp,image/png' + }, + swf : Feng.ctxPath + + '/static/js/plugins/webuploader/Uploader.swf', + disableGlobalDnd : true, + duplicate : true, + server : this.uploadUrl, + fileSingleSizeLimit : this.fileSizeLimit + }); + + return webUploader; + }, + + /** + * 绑定事件 + */ + bindEvent : function(bindedObj) { + var me = this; + bindedObj.on('fileQueued', function(file) { + var $li = $('<div><img width="100px" height="100px"></div>'); + var $img = $li.find('img'); + + $("#" + me.uploadPreId).html($li); + + // 生成缩略图 + bindedObj.makeThumb(file, function(error, src) { + if (error) { + $img.replaceWith('<span>不能预览</span>'); + return; + } + $img.attr('src', src); + }, me.picWidth, me.picHeight); + }); + + // 文件上传过程中创建进度条实时显示。 + bindedObj.on('uploadProgress', function(file, percentage) { + $("#"+me.uploadBarId).css("width",percentage * 100 + "%"); + }); + + // 文件上传成功,给item添加成功class, 用样式标记上传成功。 + bindedObj.on('uploadSuccess', function(file,response) { + Feng.success("上传成功"); + $("#" + me.pictureId).val(response); + }); + + // 文件上传失败,显示上传出错。 + bindedObj.on('uploadError', function(file) { + Feng.error("上传失败"); + }); + + // 其他错误 + bindedObj.on('error', function(type) { + if ("Q_EXCEED_SIZE_LIMIT" == type) { + Feng.error("文件大小超出了限制"); + } else if ("Q_TYPE_DENIED" == type) { + Feng.error("文件类型不满足"); + } else if ("Q_EXCEED_NUM_LIMIT" == type) { + Feng.error("上传数量超过限制"); + } else if ("F_DUPLICATE" == type) { + Feng.error("图片选择重复"); + } else { + Feng.error("上传过程中出错"); + } + }); + + // 完成上传完了,成功或者失败 + bindedObj.on('uploadComplete', function(file) { + }); + }, + + /** + * 设置图片上传的进度条的id + */ + setUploadBarId: function (id) { + this.uploadBarId = id; + } + }; + + window.$WebUpload = $WebUpload; + +}()); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/common/ztree-object.js b/user/guns-admin/src/main/webapp/static/js/common/ztree-object.js new file mode 100644 index 0000000..eee6cb2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/common/ztree-object.js @@ -0,0 +1,94 @@ +/** + * ztree插件的封装 + */ +(function() { + + var $ZTree = function(id, url) { + this.id = id; + this.url = url; + this.onClick = null; + this.settings = null; + this.ondblclick=null; + }; + + $ZTree.prototype = { + /** + * 初始化ztree的设置 + */ + initSetting : function() { + var settings = { + view : { + dblClickExpand : true, + selectedMulti : false + }, + data : {simpleData : {enable : true}}, + callback : { + onClick : this.onClick, + onDblClick:this.ondblclick + } + }; + return settings; + }, + + /** + * 手动设置ztree的设置 + */ + setSettings : function(val) { + this.settings = val; + }, + + /** + * 初始化ztree + */ + init : function() { + var zNodeSeting = null; + if(this.settings != null){ + zNodeSeting = this.settings; + }else{ + zNodeSeting = this.initSetting(); + } + var zNodes = this.loadNodes(); + $.fn.zTree.init($("#" + this.id), zNodeSeting, zNodes); + }, + + /** + * 绑定onclick事件 + */ + bindOnClick : function(func) { + this.onClick = func; + }, + /** + * 绑定双击事件 + */ + bindOnDblClick : function(func) { + this.ondblclick=func; + }, + + + /** + * 加载节点 + */ + loadNodes : function() { + var zNodes = null; + var ajax = new $ax(Feng.ctxPath + this.url, function(data) { + zNodes = data; + }, function(data) { + Feng.error("加载ztree信息失败!"); + }); + ajax.start(); + return zNodes; + }, + + /** + * 获取选中的值 + */ + getSelectedVal : function(){ + var zTree = $.fn.zTree.getZTreeObj(this.id); + var nodes = zTree.getSelectedNodes(); + return nodes[0].name; + } + }; + + window.$ZTree = $ZTree; + +}()); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/contabs.js b/user/guns-admin/src/main/webapp/static/js/contabs.js new file mode 100644 index 0000000..1d4ebde --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/contabs.js @@ -0,0 +1,339 @@ +var MyCrontab = {}; + + +/** + * 滚动到指定选项卡 + */ +MyCrontab.scrollToTab = function (element) { + var marginLeftVal = MyCrontab.calSumWidth($(element).prevAll()), + marginRightVal = MyCrontab.calSumWidth($(element).nextAll()); + // 可视区域非tab宽度 + var tabOuterWidth = MyCrontab.calSumWidth($(".content-tabs").children().not(".J_menuTabs")); + //可视区域tab宽度 + var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth; + //实际滚动宽度 + var scrollVal = 0; + if ($(".page-tabs-content").outerWidth() < visibleWidth) { + scrollVal = 0; + } else if (marginRightVal <= (visibleWidth - $(element).outerWidth(true) - $(element).next().outerWidth(true))) { + if ((visibleWidth - $(element).next().outerWidth(true)) > marginRightVal) { + scrollVal = marginLeftVal; + var tabElement = element; + while ((scrollVal - $(tabElement).outerWidth()) > ($(".page-tabs-content").outerWidth() - visibleWidth)) { + scrollVal -= $(tabElement).prev().outerWidth(); + tabElement = $(tabElement).prev(); + } + } + } else if (marginLeftVal > (visibleWidth - $(element).outerWidth(true) - $(element).prev().outerWidth(true))) { + scrollVal = marginLeftVal - $(element).prev().outerWidth(true); + } + $('.page-tabs-content').animate({ + marginLeft: 0 - scrollVal + 'px' + }, "fast"); +}; + + +/** + * 计算元素集合的总宽度 + */ +MyCrontab.calSumWidth = function (elements) { + var width = 0; + $(elements).each(function () { + width += $(this).outerWidth(true); + }); + return width; +}; + + +$(function () { + + //计算元素集合的总宽度 + function calSumWidth(elements) { + MyCrontab.calSumWidth(elements); + } + + //滚动到指定选项卡 + function scrollToTab(element) { + MyCrontab.scrollToTab(element); + } + + //查看左侧隐藏的选项卡 + function scrollTabLeft() { + var marginLeftVal = Math.abs(parseInt($('.page-tabs-content').css('margin-left'))); + // 可视区域非tab宽度 + var tabOuterWidth = calSumWidth($(".content-tabs").children().not(".J_menuTabs")); + //可视区域tab宽度 + var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth; + //实际滚动宽度 + var scrollVal = 0; + if ($(".page-tabs-content").width() < visibleWidth) { + return false; + } else { + var tabElement = $(".J_menuTab:first"); + var offsetVal = 0; + while ((offsetVal + $(tabElement).outerWidth(true)) <= marginLeftVal) {//找到离当前tab最近的元素 + offsetVal += $(tabElement).outerWidth(true); + tabElement = $(tabElement).next(); + } + offsetVal = 0; + if (calSumWidth($(tabElement).prevAll()) > visibleWidth) { + while ((offsetVal + $(tabElement).outerWidth(true)) < (visibleWidth) && tabElement.length > 0) { + offsetVal += $(tabElement).outerWidth(true); + tabElement = $(tabElement).prev(); + } + scrollVal = calSumWidth($(tabElement).prevAll()); + } + } + $('.page-tabs-content').animate({ + marginLeft: 0 - scrollVal + 'px' + }, "fast"); + } + + //查看右侧隐藏的选项卡 + function scrollTabRight() { + var marginLeftVal = Math.abs(parseInt($('.page-tabs-content').css('margin-left'))); + // 可视区域非tab宽度 + var tabOuterWidth = calSumWidth($(".content-tabs").children().not(".J_menuTabs")); + //可视区域tab宽度 + var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth; + //实际滚动宽度 + var scrollVal = 0; + if ($(".page-tabs-content").width() < visibleWidth) { + return false; + } else { + var tabElement = $(".J_menuTab:first"); + var offsetVal = 0; + while ((offsetVal + $(tabElement).outerWidth(true)) <= marginLeftVal) {//找到离当前tab最近的元素 + offsetVal += $(tabElement).outerWidth(true); + tabElement = $(tabElement).next(); + } + offsetVal = 0; + while ((offsetVal + $(tabElement).outerWidth(true)) < (visibleWidth) && tabElement.length > 0) { + offsetVal += $(tabElement).outerWidth(true); + tabElement = $(tabElement).next(); + } + scrollVal = calSumWidth($(tabElement).prevAll()); + if (scrollVal > 0) { + $('.page-tabs-content').animate({ + marginLeft: 0 - scrollVal + 'px' + }, "fast"); + } + } + } + + //通过遍历给菜单项加上data-index属性 + $(".J_menuItem").each(function (index) { + if (!$(this).attr('data-index')) { + $(this).attr('data-index', index); + } + }); + + function menuItem() { + // 获取标识数据 + var dataUrl = $(this).attr('href'), + dataIndex = $(this).data('index'), + menuName = $.trim($(this).text()), + flag = true; + if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false; + + // 选项卡菜单已存在 + $('.J_menuTab').each(function () { + if ($(this).data('id') == dataUrl) { + if (!$(this).hasClass('active')) { + $(this).addClass('active').siblings('.J_menuTab').removeClass('active'); + scrollToTab(this); + // 显示tab对应的内容区 + $('.J_mainContent .J_iframe').each(function () { + if ($(this).data('id') == dataUrl) { + $(this).show().siblings('.J_iframe').hide(); + $(this).attr('src', $(this).attr('src')); + return false; + } + }); + } + flag = false; + return false; + } + }); + + // 选项卡菜单不存在 + if (flag) { + var str = '<a href="javascript:;" class="active J_menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>'; + $('.J_menuTab').removeClass('active'); + + // 添加选项卡对应的iframe + var str1 = '<iframe class="J_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>'; + $('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(str1); + + //显示loading提示 + var loading = layer.load(); + + $('.J_mainContent iframe:visible').load(function () { + //iframe加载完成后隐藏loading提示 + layer.close(loading); + }); + // 添加选项卡 + $('.J_menuTabs .page-tabs-content').append(str); + scrollToTab($('.J_menuTab.active')); + } + return false; + } + + $('.J_menuItem').on('click', menuItem); + + // 关闭选项卡菜单 + function closeTab() { + var closeTabId = $(this).parents('.J_menuTab').data('id'); + var currentWidth = $(this).parents('.J_menuTab').width(); + + // 当前元素处于活动状态 + if ($(this).parents('.J_menuTab').hasClass('active')) { + + // 当前元素后面有同辈元素,使后面的一个元素处于活动状态 + if ($(this).parents('.J_menuTab').next('.J_menuTab').size()) { + + var activeId = $(this).parents('.J_menuTab').next('.J_menuTab:eq(0)').data('id'); + highLightMenuItem(activeId); //高亮对应的tab菜单 + $(this).parents('.J_menuTab').next('.J_menuTab:eq(0)').addClass('active'); + + $('.J_mainContent .J_iframe').each(function () { + if ($(this).data('id') == activeId) { + $(this).show().siblings('.J_iframe').hide(); + return false; + } + }); + + var marginLeftVal = parseInt($('.page-tabs-content').css('margin-left')); + if (marginLeftVal < 0) { + $('.page-tabs-content').animate({ + marginLeft: (marginLeftVal + currentWidth) + 'px' + }, "fast"); + } + + // 移除当前选项卡 + $(this).parents('.J_menuTab').remove(); + + // 移除tab对应的内容区 + $('.J_mainContent .J_iframe').each(function () { + if ($(this).data('id') == closeTabId) { + $(this).remove(); + return false; + } + }); + } + + // 当前元素后面没有同辈元素,使当前元素的上一个元素处于活动状态 + if ($(this).parents('.J_menuTab').prev('.J_menuTab').size()) { + var activeId = $(this).parents('.J_menuTab').prev('.J_menuTab:last').data('id'); + $(this).parents('.J_menuTab').prev('.J_menuTab:last').addClass('active'); + $('.J_mainContent .J_iframe').each(function () { + if ($(this).data('id') == activeId) { + $(this).show().siblings('.J_iframe').hide(); + return false; + } + }); + + // 移除当前选项卡 + $(this).parents('.J_menuTab').remove(); + + // 移除tab对应的内容区 + $('.J_mainContent .J_iframe').each(function () { + if ($(this).data('id') == closeTabId) { + $(this).remove(); + return false; + } + }); + highLightMenuItem(activeId);//高亮对应的tab菜单 + } + } + // 当前元素不处于活动状态 + else { + // 移除当前选项卡 + $(this).parents('.J_menuTab').remove(); + + // 移除相应tab对应的内容区 + $('.J_mainContent .J_iframe').each(function () { + if ($(this).data('id') == closeTabId) { + $(this).remove(); + return false; + } + }); + scrollToTab($('.J_menuTab.active')); + } + return false; + } + + $('.J_menuTabs').on('click', '.J_menuTab i', closeTab); + + //关闭其他选项卡 + function closeOtherTabs() { + $('.page-tabs-content').children("[data-id]").not(":first").not(".active").each(function () { + $('.J_iframe[data-id="' + $(this).data('id') + '"]').remove(); + $(this).remove(); + }); + $('.page-tabs-content').css("margin-left", "0"); + } + + $('.J_tabCloseOther').on('click', closeOtherTabs); + + //滚动到已激活的选项卡 + function showActiveTab() { + scrollToTab($('.J_menuTab.active')); + } + + $('.J_tabShowActive').on('click', showActiveTab); + + + // 点击选项卡菜单 + function activeTab() { + if (!$(this).hasClass('active')) { + var currentId = $(this).data('id'); + highLightMenuItem(currentId); //高亮对应的tab菜单 + // 显示tab对应的内容区 + $('.J_mainContent .J_iframe').each(function () { + if ($(this).data('id') == currentId) { + $(this).show().siblings('.J_iframe').hide(); + return false; + } + }); + $(this).addClass('active').siblings('.J_menuTab').removeClass('active'); + scrollToTab(this); + } + } + + $('.J_menuTabs').on('click', '.J_menuTab', activeTab); + + //刷新iframe + function refreshTab() { + var target = $('.J_iframe[data-id="' + $(this).data('id') + '"]'); + var url = target.attr('src'); + //显示loading提示 + // var loading = layer.load(); + // target.attr('src', url).load(function () { + // //关闭loading提示 + // layer.close(loading); + // }); + } + + $('.J_menuTabs').on('dblclick', '.J_menuTab', refreshTab); + + // 左移按扭 + $('.J_tabLeft').on('click', scrollTabLeft); + + // 右移按扭 + $('.J_tabRight').on('click', scrollTabRight); + + // 关闭全部 + $('.J_tabCloseAll').on('click', function () { + $('.page-tabs-content').children("[data-id]").not(":first").each(function () { + $('.J_iframe[data-id="' + $(this).data('id') + '"]').remove(); + $(this).remove(); + }); + $('.page-tabs-content').children("[data-id]:first").each(function () { + $('.J_iframe[data-id="' + $(this).data('id') + '"]').show(); + $(this).addClass("active"); + }); + $('.page-tabs-content').css("margin-left", "0"); + }); + +}); diff --git a/user/guns-admin/src/main/webapp/static/js/content.js b/user/guns-admin/src/main/webapp/static/js/content.js new file mode 100644 index 0000000..8252e9f --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/content.js @@ -0,0 +1,98 @@ +var $parentNode = window.parent.document; + +function $childNode(name) { + return window.frames[name] +} + +// tooltips +$('.tooltip-demo').tooltip({ + selector: "[data-toggle=tooltip]", + container: "body" +}); + +// 使用animation.css修改Bootstrap Modal +$('.modal').appendTo("body"); + +$("[data-toggle=popover]").popover(); + +//折叠ibox +$('.collapse-link').click(function () { + var ibox = $(this).closest('div.ibox'); + var button = $(this).find('i'); + var content = ibox.find('div.ibox-content'); + content.slideToggle(200); + button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down'); + ibox.toggleClass('').toggleClass('border-bottom'); + setTimeout(function () { + ibox.resize(); + ibox.find('[id^=map-]').resize(); + }, 50); +}); + +//关闭ibox +$('.close-link').click(function () { + var content = $(this).closest('div.ibox'); + content.remove(); +}); + +//判断当前页面是否在iframe中 +if (top == this) { + var gohome = '<div class="gohome"><a class="animated bounceInUp" href="' + Feng.ctxPath + '/" title="返回首页"><i class="fa fa-home"></i></a></div>'; + $('body').append(gohome); +} + +//animation.css +function animationHover(element, animation) { + element = $(element); + element.hover( + function () { + element.addClass('animated ' + animation); + }, + function () { + //动画完成之前移除class + window.setTimeout(function () { + element.removeClass('animated ' + animation); + }, 2000); + }); +} + +//拖动面板 +function WinMove() { + var element = "[class*=col]"; + var handle = ".ibox-title"; + var connect = "[class*=col]"; + $(element).sortable({ + handle: handle, + connectWith: connect, + tolerance: 'pointer', + forcePlaceholderSize: true, + opacity: 0.8, + }) + .disableSelection(); +}; + +$(function () { +//初始化下拉框 + var config = { + '.chosen-select': {}, + '.chosen-select-deselect': { + allow_single_deselect: true + }, + '.chosen-select-no-single': { + disable_search_threshold: 10 + }, + '.chosen-select-no-results': { + no_results_text: '没有要显示的数据!' + }, + '.chosen-select-width': { + width: "95%" + } + } + for (var selector in config) { + $(selector).chosen(config[selector]); + } + $('.i-checks').iCheck({ + checkboxClass: 'icheckbox_square-green', + radioClass: 'iradio_square-green', + }); +}); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/hplus.js b/user/guns-admin/src/main/webapp/static/js/hplus.js new file mode 100644 index 0000000..b639026 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/hplus.js @@ -0,0 +1,294 @@ +//自定义js + +//公共配置 + + +$(document).ready(function () { + + // MetsiMenu + $('#side-menu').metisMenu(); + // 打开右侧边栏 + $('.right-sidebar-toggle').click(function () { + $('#right-sidebar').toggleClass('sidebar-open'); + }); + + // 右侧边栏使用slimscroll + $('.sidebar-container').slimScroll({ + height: '100%', + railOpacity: 0.4, + wheelStep: 10 + }); + + // 打开聊天窗口 + $('.open-small-chat').click(function () { + $(this).children().toggleClass('fa-comments').toggleClass('fa-remove'); + $('.small-chat-box').toggleClass('active'); + }); + + // 聊天窗口使用slimscroll + $('.small-chat-box .content').slimScroll({ + height: '234px', + railOpacity: 0.4 + }); + + // Small todo handler + $('.check-link').click(function () { + var button = $(this).find('i'); + var label = $(this).next('span'); + button.toggleClass('fa-check-square').toggleClass('fa-square-o'); + label.toggleClass('todo-completed'); + return false; + }); + + //固定菜单栏 + $(function () { + $('.sidebar-collapse').slimScroll({ + height: '100%', + railOpacity: 0.9, + alwaysVisible: false + }); + }); + + + // 菜单切换 + $('.navbar-minimalize').click(function () { + $("body").toggleClass("mini-navbar"); + SmoothlyMenu(); + }); + + + // 侧边栏高度 + function fix_height() { + var heightWithoutNavbar = $("body > #wrapper").height() - 61; + $(".sidebard-panel").css("min-height", heightWithoutNavbar + "px"); + } + fix_height(); + + $(window).bind("load resize click scroll", function () { + if (!$("body").hasClass('body-small')) { + fix_height(); + } + }); + + //侧边栏滚动 + $(window).scroll(function () { + if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) { + $('#right-sidebar').addClass('sidebar-top'); + } else { + $('#right-sidebar').removeClass('sidebar-top'); + } + }); + + $('.full-height-scroll').slimScroll({ + height: '100%' + }); + + $('#side-menu>li').click(function () { + if ($('body').hasClass('mini-navbar')) { + NavToggle(); + } + }); + $('#side-menu>li li a').click(function () { + if ($(window).width() < 769) { + NavToggle(); + } + }); + + //点击菜单的时候高亮显示菜单 + $("a[name='tabMenuItem']").click(function(){ + clearTabMenuItem(); + $(this).addClass("tab-menu-selected"); + }); + + $('.nav-close').click(NavToggle); + + //ios浏览器兼容性处理 + if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { + $('#content-main').css('overflow-y', 'auto'); + } + +}); + +$(window).bind("load resize", function () { + if ($(this).width() < 769) { + $('body').addClass('mini-navbar'); + $('.navbar-static-side').fadeIn(); + } +}); + +function clearTabMenuItem(){ + $("a[name='tabMenuItem']").each(function(){ + $(this).removeClass("tab-menu-selected"); + }); +} + +function highLightMenuItem(hrefVal){ + clearTabMenuItem(); + $("a[href='" + hrefVal + "']").addClass("tab-menu-selected"); +} + +function NavToggle() { + $('.navbar-minimalize').trigger('click'); +} + +function SmoothlyMenu() { + if (!$('body').hasClass('mini-navbar')) { + $('#side-menu').hide(); + setTimeout( + function () { + $('#side-menu').fadeIn(500); + }, 100); + } else if ($('body').hasClass('fixed-sidebar')) { + $('#side-menu').hide(); + setTimeout( + function () { + $('#side-menu').fadeIn(500); + }, 300); + } else { + $('#side-menu').removeAttr('style'); + } +} + + +//主题设置 +$(function () { + + // 顶部菜单固定 + $('#fixednavbar').click(function () { + if ($('#fixednavbar').is(':checked')) { + $(".navbar-static-top").removeClass('navbar-static-top').addClass('navbar-fixed-top'); + $("body").removeClass('boxed-layout'); + $("body").addClass('fixed-nav'); + $('#boxedlayout').prop('checked', false); + + if (localStorageSupport) { + localStorage.setItem("boxedlayout", 'off'); + } + + if (localStorageSupport) { + localStorage.setItem("fixednavbar", 'on'); + } + } else { + $(".navbar-fixed-top").removeClass('navbar-fixed-top').addClass('navbar-static-top'); + $("body").removeClass('fixed-nav'); + + if (localStorageSupport) { + localStorage.setItem("fixednavbar", 'off'); + } + } + }); + + + // 收起左侧菜单 + $('#collapsemenu').click(function () { + if ($('#collapsemenu').is(':checked')) { + $("body").addClass('mini-navbar'); + SmoothlyMenu(); + + if (localStorageSupport) { + localStorage.setItem("collapse_menu", 'on'); + } + + } else { + $("body").removeClass('mini-navbar'); + SmoothlyMenu(); + + if (localStorageSupport) { + localStorage.setItem("collapse_menu", 'off'); + } + } + }); + + // 固定宽度 + $('#boxedlayout').click(function () { + if ($('#boxedlayout').is(':checked')) { + $("body").addClass('boxed-layout'); + $('#fixednavbar').prop('checked', false); + $(".navbar-fixed-top").removeClass('navbar-fixed-top').addClass('navbar-static-top'); + $("body").removeClass('fixed-nav'); + if (localStorageSupport) { + localStorage.setItem("fixednavbar", 'off'); + } + + + if (localStorageSupport) { + localStorage.setItem("boxedlayout", 'on'); + } + } else { + $("body").removeClass('boxed-layout'); + + if (localStorageSupport) { + localStorage.setItem("boxedlayout", 'off'); + } + } + }); + + // 默认主题 + $('.s-skin-0').click(function () { + $("body").removeClass("skin-1"); + $("body").removeClass("skin-2"); + $("body").removeClass("skin-3"); + return false; + }); + + // 蓝色主题 + $('.s-skin-1').click(function () { + $("body").removeClass("skin-2"); + $("body").removeClass("skin-3"); + $("body").addClass("skin-1"); + return false; + }); + + // 黄色主题 + $('.s-skin-3').click(function () { + $("body").removeClass("skin-1"); + $("body").removeClass("skin-2"); + $("body").addClass("skin-3"); + return false; + }); + + if (localStorageSupport) { + var collapse = localStorage.getItem("collapse_menu"); + var fixednavbar = localStorage.getItem("fixednavbar"); + var boxedlayout = localStorage.getItem("boxedlayout"); + + if (collapse == 'on') { + $('#collapsemenu').prop('checked', 'checked') + } + if (fixednavbar == 'on') { + $('#fixednavbar').prop('checked', 'checked') + } + if (boxedlayout == 'on') { + $('#boxedlayout').prop('checked', 'checked') + } + } + + if (localStorageSupport) { + + var collapse = localStorage.getItem("collapse_menu"); + var fixednavbar = localStorage.getItem("fixednavbar"); + var boxedlayout = localStorage.getItem("boxedlayout"); + + var body = $('body'); + + if (collapse == 'on') { + if (!body.hasClass('body-small')) { + body.addClass('mini-navbar'); + } + } + + if (fixednavbar == 'on') { + $(".navbar-static-top").removeClass('navbar-static-top').addClass('navbar-fixed-top'); + body.addClass('fixed-nav'); + } + + if (boxedlayout == 'on') { + body.addClass('boxed-layout'); + } + } +}); + +//判断浏览器是否支持html5本地存储 +function localStorageSupport() { + return (('localStorage' in window) && window['localStorage'] !== null) +} diff --git a/user/guns-admin/src/main/webapp/static/js/jquery.min.js b/user/guns-admin/src/main/webapp/static/js/jquery.min.js new file mode 100644 index 0000000..49990d6 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){ +return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ia={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qa[0].contentDocument,b.write(),b.close(),c=sa(a,b),qa.detach()),ra[a]=c),c}var ua=/^margin/,va=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wa=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)};function xa(a,b,c){var d,e,f,g,h=a.style;return c=c||wa(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),va.test(g)&&ua.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function ya(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var za=/^(none|table(?!-c[ea]).+)/,Aa=new RegExp("^("+Q+")(.*)$","i"),Ba=new RegExp("^([+-])=("+Q+")","i"),Ca={position:"absolute",visibility:"hidden",display:"block"},Da={letterSpacing:"0",fontWeight:"400"},Ea=["Webkit","O","Moz","ms"];function Fa(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Ea.length;while(e--)if(b=Ea[e]+c,b in a)return b;return d}function Ga(a,b,c){var d=Aa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Ha(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ia(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wa(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xa(a,b,f),(0>e||null==e)&&(e=a.style[b]),va.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Ha(a,b,c||(g?"border":"content"),d,f)+"px"}function Ja(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",ta(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xa(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fa(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Ba.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fa(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xa(a,b,d)),"normal"===e&&b in Da&&(e=Da[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?za.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Ca,function(){return Ia(a,b,d)}):Ia(a,b,d):void 0},set:function(a,c,d){var e=d&&wa(a);return Ga(a,c,d?Ha(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=ya(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ua.test(a)||(n.cssHooks[a+b].set=Ga)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wa(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Ja(this,!0)},hide:function(){return Ja(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Ka(a,b,c,d,e){return new Ka.prototype.init(a,b,c,d,e)}n.Tween=Ka,Ka.prototype={constructor:Ka,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ka.propHooks[this.prop];return a&&a.get?a.get(this):Ka.propHooks._default.get(this)},run:function(a){var b,c=Ka.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ka.propHooks._default.set(this),this}},Ka.prototype.init.prototype=Ka.prototype,Ka.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Ka.propHooks.scrollTop=Ka.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Ka.prototype.init,n.fx.step={};var La,Ma,Na=/^(?:toggle|show|hide)$/,Oa=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pa=/queueHooks$/,Qa=[Va],Ra={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Oa.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Oa.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sa(){return setTimeout(function(){La=void 0}),La=n.now()}function Ta(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ua(a,b,c){for(var d,e=(Ra[b]||[]).concat(Ra["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Va(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||ta(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Na.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?ta(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ua(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wa(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xa(a,b,c){var d,e,f=0,g=Qa.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=La||Sa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:La||Sa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wa(k,j.opts.specialEasing);g>f;f++)if(d=Qa[f].call(j,a,k,j.opts))return d;return n.map(k,Ua,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xa,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Ra[c]=Ra[c]||[],Ra[c].unshift(b)},prefilter:function(a,b){b?Qa.unshift(a):Qa.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xa(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pa.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Ta(b,!0),a,d,e)}}),n.each({slideDown:Ta("show"),slideUp:Ta("hide"),slideToggle:Ta("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(La=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),La=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ma||(Ma=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Ma),Ma=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Ya,Za,$a=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Za:Ya)), +void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Za={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$a[b]||n.find.attr;$a[b]=function(a,b,d){var e,f;return d||(f=$a[b],$a[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$a[b]=f),e}});var _a=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_a.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ab=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ab," ").indexOf(b)>=0)return!0;return!1}});var bb=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cb=n.now(),db=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var eb=/#.*$/,fb=/([?&])_=[^&]*/,gb=/^(.*?):[ \t]*([^\r\n]*)$/gm,hb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ib=/^(?:GET|HEAD)$/,jb=/^\/\//,kb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lb={},mb={},nb="*/".concat("*"),ob=a.location.href,pb=kb.exec(ob.toLowerCase())||[];function qb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function rb(a,b,c,d){var e={},f=a===mb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function sb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function tb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function ub(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ob,type:"GET",isLocal:hb.test(pb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?sb(sb(a,n.ajaxSettings),b):sb(n.ajaxSettings,a)},ajaxPrefilter:qb(lb),ajaxTransport:qb(mb),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=gb.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||ob)+"").replace(eb,"").replace(jb,pb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kb.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pb[1]&&h[2]===pb[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pb[3]||("http:"===pb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rb(lb,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ib.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(db.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=fb.test(d)?d.replace(fb,"$1_="+cb++):d+(db.test(d)?"&":"?")+"_="+cb++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+nb+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=rb(mb,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=tb(k,v,f)),u=ub(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vb=/%20/g,wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&").replace(vb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bb=0,Cb={},Db={0:200,1223:204},Eb=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cb)Cb[a]()}),k.cors=!!Eb&&"withCredentials"in Eb,k.ajax=Eb=!!Eb,n.ajaxTransport(function(a){var b;return k.cors||Eb&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Cb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Db[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Cb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Fb=[],Gb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Fb.pop()||n.expando+"_"+cb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Gb.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Gb,"$1"+e):b.jsonp!==!1&&(b.url+=(db.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Fb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Hb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Hb)return Hb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Ib=a.document.documentElement;function Jb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Jb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Ib;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ib})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Jb(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=ya(k.pixelPosition,function(a,c){return c?(c=xa(a,b),va.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kb=a.jQuery,Lb=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Lb),b&&a.jQuery===n&&(a.jQuery=Kb),n},typeof b===U&&(a.jQuery=a.$=n),n}); diff --git a/user/guns-admin/src/main/webapp/static/js/jquery.min.map b/user/guns-admin/src/main/webapp/static/js/jquery.min.map new file mode 100644 index 0000000..0056ad2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/jquery.min.map @@ -0,0 +1 @@ +{"version":3,"file":"jquery-2.1.4.min.js","sources":["jquery-2.1.4.js"],"names":["global","factory","module","exports","document","w","Error","window","this","noGlobal","arr","slice","concat","push","indexOf","class2type","toString","hasOwn","hasOwnProperty","support","version","jQuery","selector","context","fn","init","rtrim","rmsPrefix","rdashAlpha","fcamelCase","all","letter","toUpperCase","prototype","jquery","constructor","length","toArray","call","get","num","pushStack","elems","ret","merge","prevObject","each","callback","args","map","elem","i","apply","arguments","first","eq","last","len","j","end","sort","splice","extend","options","name","src","copy","copyIsArray","clone","target","deep","isFunction","isPlainObject","isArray","undefined","expando","Math","random","replace","isReady","error","msg","noop","obj","type","Array","isWindow","isNumeric","parseFloat","nodeType","isEmptyObject","globalEval","code","script","indirect","eval","trim","createElement","text","head","appendChild","parentNode","removeChild","camelCase","string","nodeName","toLowerCase","value","isArraylike","makeArray","results","Object","inArray","second","grep","invert","callbackInverse","matches","callbackExpect","arg","guid","proxy","tmp","now","Date","split","Sizzle","Expr","getText","isXML","tokenize","compile","select","outermostContext","sortInput","hasDuplicate","setDocument","docElem","documentIsHTML","rbuggyQSA","rbuggyMatches","contains","preferredDoc","dirruns","done","classCache","createCache","tokenCache","compilerCache","sortOrder","a","b","MAX_NEGATIVE","pop","push_native","list","booleans","whitespace","characterEncoding","identifier","attributes","pseudos","rwhitespace","RegExp","rcomma","rcombinators","rattributeQuotes","rpseudo","ridentifier","matchExpr","ID","CLASS","TAG","ATTR","PSEUDO","CHILD","bool","needsContext","rinputs","rheader","rnative","rquickExpr","rsibling","rescape","runescape","funescape","_","escaped","escapedWhitespace","high","String","fromCharCode","unloadHandler","childNodes","e","els","seed","match","m","groups","old","nid","newContext","newSelector","ownerDocument","exec","getElementById","id","getElementsByTagName","getElementsByClassName","qsa","test","getAttribute","setAttribute","toSelector","testContext","join","querySelectorAll","qsaError","removeAttribute","keys","cache","key","cacheLength","shift","markFunction","assert","div","addHandle","attrs","handler","attrHandle","siblingCheck","cur","diff","sourceIndex","nextSibling","createInputPseudo","createButtonPseudo","createPositionalPseudo","argument","matchIndexes","documentElement","node","hasCompare","parent","doc","defaultView","top","addEventListener","attachEvent","className","createComment","getById","getElementsByName","find","filter","attrId","getAttributeNode","tag","innerHTML","input","matchesSelector","webkitMatchesSelector","mozMatchesSelector","oMatchesSelector","msMatchesSelector","disconnectedMatch","compareDocumentPosition","adown","bup","compare","sortDetached","aup","ap","bp","unshift","expr","elements","attr","val","specified","uniqueSort","duplicates","detectDuplicates","sortStable","textContent","firstChild","nodeValue","selectors","createPseudo","relative",">","dir"," ","+","~","preFilter","excess","unquoted","nodeNameSelector","pattern","operator","check","result","what","simple","forward","ofType","xml","outerCache","nodeIndex","start","useCache","lastChild","pseudo","setFilters","idx","matched","not","matcher","unmatched","has","innerText","lang","elemLang","hash","location","root","focus","activeElement","hasFocus","href","tabIndex","enabled","disabled","checked","selected","selectedIndex","empty","header","button","even","odd","lt","gt","radio","checkbox","file","password","image","submit","reset","filters","parseOnly","tokens","soFar","preFilters","cached","addCombinator","combinator","base","checkNonElements","doneName","oldCache","newCache","elementMatcher","matchers","multipleContexts","contexts","condense","newUnmatched","mapped","setMatcher","postFilter","postFinder","postSelector","temp","preMap","postMap","preexisting","matcherIn","matcherOut","matcherFromTokens","checkContext","leadingRelative","implicitRelative","matchContext","matchAnyContext","matcherFromGroupMatchers","elementMatchers","setMatchers","bySet","byElement","superMatcher","outermost","matchedCount","setMatched","contextBackup","dirrunsUnique","token","compiled","div1","defaultValue","unique","isXMLDoc","rneedsContext","rsingleTag","risSimple","winnow","qualifier","self","is","rootjQuery","parseHTML","ready","rparentsprev","guaranteedUnique","children","contents","next","prev","until","truncate","sibling","n","targets","l","closest","pos","index","prevAll","add","addBack","parents","parentsUntil","nextAll","nextUntil","prevUntil","siblings","contentDocument","reverse","rnotwhite","optionsCache","createOptions","object","flag","Callbacks","memory","fired","firing","firingStart","firingLength","firingIndex","stack","once","fire","data","stopOnFalse","disable","remove","lock","locked","fireWith","Deferred","func","tuples","state","promise","always","deferred","fail","then","fns","newDefer","tuple","returned","resolve","reject","progress","notify","pipe","stateString","when","subordinate","resolveValues","remaining","updateFunc","values","progressValues","notifyWith","resolveWith","progressContexts","resolveContexts","readyList","readyWait","holdReady","hold","wait","triggerHandler","off","completed","removeEventListener","readyState","setTimeout","access","chainable","emptyGet","raw","bulk","acceptData","owner","Data","defineProperty","uid","accepts","descriptor","unlock","defineProperties","set","prop","stored","camel","hasData","discard","data_priv","data_user","rbrace","rmultiDash","dataAttr","parseJSON","removeData","_data","_removeData","camelKey","queue","dequeue","startLength","hooks","_queueHooks","stop","setter","clearQueue","count","defer","pnum","source","cssExpand","isHidden","el","css","rcheckableType","fragment","createDocumentFragment","checkClone","cloneNode","noCloneChecked","strundefined","focusinBubbles","rkeyEvent","rmouseEvent","rfocusMorph","rtypenamespace","returnTrue","returnFalse","safeActiveElement","err","event","types","handleObjIn","eventHandle","events","t","handleObj","special","handlers","namespaces","origType","elemData","handle","triggered","dispatch","delegateType","bindType","namespace","delegateCount","setup","mappedTypes","origCount","teardown","removeEvent","trigger","onlyHandlers","bubbleType","ontype","eventPath","Event","isTrigger","namespace_re","noBubble","parentWindow","isPropagationStopped","preventDefault","isDefaultPrevented","_default","fix","handlerQueue","delegateTarget","preDispatch","currentTarget","isImmediatePropagationStopped","stopPropagation","postDispatch","sel","props","fixHooks","keyHooks","original","which","charCode","keyCode","mouseHooks","eventDoc","body","pageX","clientX","scrollLeft","clientLeft","pageY","clientY","scrollTop","clientTop","originalEvent","fixHook","load","blur","click","beforeunload","returnValue","simulate","bubble","isSimulated","defaultPrevented","timeStamp","stopImmediatePropagation","mouseenter","mouseleave","pointerenter","pointerleave","orig","related","relatedTarget","attaches","on","one","origFn","rxhtmlTag","rtagName","rhtml","rnoInnerhtml","rchecked","rscriptType","rscriptTypeMasked","rcleanScript","wrapMap","option","thead","col","tr","td","optgroup","tbody","tfoot","colgroup","caption","th","manipulationTarget","content","disableScript","restoreScript","setGlobalEval","refElements","cloneCopyEvent","dest","pdataOld","pdataCur","udataOld","udataCur","getAll","fixInput","dataAndEvents","deepDataAndEvents","srcElements","destElements","inPage","buildFragment","scripts","selection","wrap","nodes","createTextNode","cleanData","append","domManip","prepend","insertBefore","before","after","keepData","html","replaceWith","replaceChild","detach","hasScripts","iNoClone","_evalUrl","appendTo","prependTo","insertAfter","replaceAll","insert","iframe","elemdisplay","actualDisplay","style","display","getDefaultComputedStyle","defaultDisplay","write","close","rmargin","rnumnonpx","getStyles","opener","getComputedStyle","curCSS","computed","width","minWidth","maxWidth","getPropertyValue","addGetHookIf","conditionFn","hookFn","pixelPositionVal","boxSizingReliableVal","container","backgroundClip","clearCloneStyle","cssText","computePixelPositionAndBoxSizingReliable","divStyle","pixelPosition","boxSizingReliable","reliableMarginRight","marginDiv","marginRight","swap","rdisplayswap","rnumsplit","rrelNum","cssShow","position","visibility","cssNormalTransform","letterSpacing","fontWeight","cssPrefixes","vendorPropName","capName","origName","setPositiveNumber","subtract","max","augmentWidthOrHeight","extra","isBorderBox","styles","getWidthOrHeight","valueIsBorderBox","offsetWidth","offsetHeight","showHide","show","hidden","cssHooks","opacity","cssNumber","columnCount","fillOpacity","flexGrow","flexShrink","lineHeight","order","orphans","widows","zIndex","zoom","cssProps","float","margin","padding","border","prefix","suffix","expand","expanded","parts","hide","toggle","Tween","easing","unit","propHooks","run","percent","eased","duration","step","tween","fx","linear","p","swing","cos","PI","fxNow","timerId","rfxtypes","rfxnum","rrun","animationPrefilters","defaultPrefilter","tweeners","*","createTween","scale","maxIterations","createFxNow","genFx","includeWidth","height","animation","collection","opts","oldfire","checkDisplay","anim","dataShow","unqueued","overflow","overflowX","overflowY","propFilter","specialEasing","Animation","properties","stopped","tick","currentTime","startTime","tweens","originalProperties","originalOptions","gotoEnd","rejectWith","timer","complete","tweener","prefilter","speed","opt","speeds","fadeTo","to","animate","optall","doAnimation","finish","stopQueue","timers","cssFn","slideDown","slideUp","slideToggle","fadeIn","fadeOut","fadeToggle","interval","setInterval","clearInterval","slow","fast","delay","time","timeout","clearTimeout","checkOn","optSelected","optDisabled","radioValue","nodeHook","boolHook","removeAttr","nType","attrHooks","propName","attrNames","propFix","getter","rfocusable","removeProp","for","class","notxml","hasAttribute","rclass","addClass","classes","clazz","finalValue","proceed","removeClass","toggleClass","stateVal","classNames","hasClass","rreturn","valHooks","optionSet","hover","fnOver","fnOut","bind","unbind","delegate","undelegate","nonce","rquery","JSON","parse","parseXML","DOMParser","parseFromString","rhash","rts","rheaders","rlocalProtocol","rnoContent","rprotocol","rurl","prefilters","transports","allTypes","ajaxLocation","ajaxLocParts","addToPrefiltersOrTransports","structure","dataTypeExpression","dataType","dataTypes","inspectPrefiltersOrTransports","jqXHR","inspected","seekingTransport","inspect","prefilterOrFactory","dataTypeOrTransport","ajaxExtend","flatOptions","ajaxSettings","ajaxHandleResponses","s","responses","ct","finalDataType","firstDataType","mimeType","getResponseHeader","converters","ajaxConvert","response","isSuccess","conv2","current","conv","responseFields","dataFilter","active","lastModified","etag","url","isLocal","processData","async","contentType","json","* text","text html","text json","text xml","ajaxSetup","settings","ajaxPrefilter","ajaxTransport","ajax","transport","cacheURL","responseHeadersString","responseHeaders","timeoutTimer","fireGlobals","callbackContext","globalEventContext","completeDeferred","statusCode","requestHeaders","requestHeadersNames","strAbort","getAllResponseHeaders","setRequestHeader","lname","overrideMimeType","status","abort","statusText","finalText","success","method","crossDomain","param","traditional","hasContent","ifModified","headers","beforeSend","send","nativeStatusText","modified","getJSON","getScript","throws","wrapAll","firstElementChild","wrapInner","unwrap","visible","r20","rbracket","rCRLF","rsubmitterTypes","rsubmittable","buildParams","v","encodeURIComponent","serialize","serializeArray","xhr","XMLHttpRequest","xhrId","xhrCallbacks","xhrSuccessStatus",1223,"xhrSupported","cors","open","username","xhrFields","onload","onerror","responseText","text script","charset","scriptCharset","evt","oldCallbacks","rjsonp","jsonp","jsonpCallback","originalSettings","callbackName","overwritten","responseContainer","jsonProp","keepScripts","parsed","_load","params","animated","getWindow","offset","setOffset","curPosition","curLeft","curCSSTop","curTop","curOffset","curCSSLeft","calculatePosition","curElem","left","using","win","box","getBoundingClientRect","pageYOffset","pageXOffset","offsetParent","parentOffset","scrollTo","Height","Width","defaultExtra","funcName","size","andSelf","define","amd","_jQuery","_$","$","noConflict"],"mappings":";CAcC,SAAUA,EAAQC,GAEK,gBAAXC,SAAiD,gBAAnBA,QAAOC,QAQhDD,OAAOC,QAAUH,EAAOI,SACvBH,EAASD,GAAQ,GACjB,SAAUK,GACT,IAAMA,EAAED,SACP,KAAM,IAAIE,OAAO,2CAElB,OAAOL,GAASI,IAGlBJ,EAASD,IAIS,mBAAXO,QAAyBA,OAASC,KAAM,SAAUD,EAAQE,GAQnE,GAAIC,MAEAC,EAAQD,EAAIC,MAEZC,EAASF,EAAIE,OAEbC,EAAOH,EAAIG,KAEXC,EAAUJ,EAAII,QAEdC,KAEAC,EAAWD,EAAWC,SAEtBC,EAASF,EAAWG,eAEpBC,KAMHf,EAAWG,EAAOH,SAElBgB,EAAU,QAGVC,EAAS,SAAUC,EAAUC,GAG5B,MAAO,IAAIF,GAAOG,GAAGC,KAAMH,EAAUC,IAKtCG,EAAQ,qCAGRC,EAAY,QACZC,EAAa,eAGbC,EAAa,SAAUC,EAAKC,GAC3B,MAAOA,GAAOC,cAGhBX,GAAOG,GAAKH,EAAOY,WAElBC,OAAQd,EAERe,YAAad,EAGbC,SAAU,GAGVc,OAAQ,EAERC,QAAS,WACR,MAAO1B,GAAM2B,KAAM9B,OAKpB+B,IAAK,SAAUC,GACd,MAAc,OAAPA,EAGE,EAANA,EAAUhC,KAAMgC,EAAMhC,KAAK4B,QAAW5B,KAAMgC,GAG9C7B,EAAM2B,KAAM9B,OAKdiC,UAAW,SAAUC,GAGpB,GAAIC,GAAMtB,EAAOuB,MAAOpC,KAAK2B,cAAeO,EAO5C,OAJAC,GAAIE,WAAarC,KACjBmC,EAAIpB,QAAUf,KAAKe,QAGZoB,GAMRG,KAAM,SAAUC,EAAUC,GACzB,MAAO3B,GAAOyB,KAAMtC,KAAMuC,EAAUC,IAGrCC,IAAK,SAAUF,GACd,MAAOvC,MAAKiC,UAAWpB,EAAO4B,IAAIzC,KAAM,SAAU0C,EAAMC,GACvD,MAAOJ,GAAST,KAAMY,EAAMC,EAAGD,OAIjCvC,MAAO,WACN,MAAOH,MAAKiC,UAAW9B,EAAMyC,MAAO5C,KAAM6C,aAG3CC,MAAO,WACN,MAAO9C,MAAK+C,GAAI,IAGjBC,KAAM,WACL,MAAOhD,MAAK+C,GAAI,KAGjBA,GAAI,SAAUJ,GACb,GAAIM,GAAMjD,KAAK4B,OACdsB,GAAKP,GAAU,EAAJA,EAAQM,EAAM,EAC1B,OAAOjD,MAAKiC,UAAWiB,GAAK,GAASD,EAAJC,GAAYlD,KAAKkD,SAGnDC,IAAK,WACJ,MAAOnD,MAAKqC,YAAcrC,KAAK2B,YAAY,OAK5CtB,KAAMA,EACN+C,KAAMlD,EAAIkD,KACVC,OAAQnD,EAAImD,QAGbxC,EAAOyC,OAASzC,EAAOG,GAAGsC,OAAS,WAClC,GAAIC,GAASC,EAAMC,EAAKC,EAAMC,EAAaC,EAC1CC,EAAShB,UAAU,OACnBF,EAAI,EACJf,EAASiB,UAAUjB,OACnBkC,GAAO,CAsBR,KAnBuB,iBAAXD,KACXC,EAAOD,EAGPA,EAAShB,UAAWF,OACpBA,KAIsB,gBAAXkB,IAAwBhD,EAAOkD,WAAWF,KACrDA,MAIIlB,IAAMf,IACViC,EAAS7D,KACT2C,KAGWf,EAAJe,EAAYA,IAEnB,GAAmC,OAA7BY,EAAUV,UAAWF,IAE1B,IAAMa,IAAQD,GACbE,EAAMI,EAAQL,GACdE,EAAOH,EAASC,GAGXK,IAAWH,IAKXI,GAAQJ,IAAU7C,EAAOmD,cAAcN,KAAUC,EAAc9C,EAAOoD,QAAQP,MAC7EC,GACJA,GAAc,EACdC,EAAQH,GAAO5C,EAAOoD,QAAQR,GAAOA,MAGrCG,EAAQH,GAAO5C,EAAOmD,cAAcP,GAAOA,KAI5CI,EAAQL,GAAS3C,EAAOyC,OAAQQ,EAAMF,EAAOF,IAGzBQ,SAATR,IACXG,EAAQL,GAASE,GAOrB,OAAOG,IAGRhD,EAAOyC,QAENa,QAAS,UAAavD,EAAUwD,KAAKC,UAAWC,QAAS,MAAO,IAGhEC,SAAS,EAETC,MAAO,SAAUC,GAChB,KAAM,IAAI3E,OAAO2E,IAGlBC,KAAM,aAENX,WAAY,SAAUY,GACrB,MAA4B,aAArB9D,EAAO+D,KAAKD,IAGpBV,QAASY,MAAMZ,QAEfa,SAAU,SAAUH,GACnB,MAAc,OAAPA,GAAeA,IAAQA,EAAI5E,QAGnCgF,UAAW,SAAUJ,GAKpB,OAAQ9D,EAAOoD,QAASU,IAAUA,EAAMK,WAAYL,GAAQ,GAAM,GAGnEX,cAAe,SAAUW,GAKxB,MAA4B,WAAvB9D,EAAO+D,KAAMD,IAAsBA,EAAIM,UAAYpE,EAAOiE,SAAUH,IACjE,EAGHA,EAAIhD,cACNlB,EAAOqB,KAAM6C,EAAIhD,YAAYF,UAAW,kBACnC,GAKD,GAGRyD,cAAe,SAAUP,GACxB,GAAInB,EACJ,KAAMA,IAAQmB,GACb,OAAO,CAER,QAAO,GAGRC,KAAM,SAAUD,GACf,MAAY,OAAPA,EACGA,EAAM,GAGQ,gBAARA,IAAmC,kBAARA,GACxCpE,EAAYC,EAASsB,KAAK6C,KAAU,eAC7BA,IAITQ,WAAY,SAAUC,GACrB,GAAIC,GACHC,EAAWC,IAEZH,GAAOvE,EAAO2E,KAAMJ,GAEfA,IAIgC,IAA/BA,EAAK9E,QAAQ,eACjB+E,EAASzF,EAAS6F,cAAc,UAChCJ,EAAOK,KAAON,EACdxF,EAAS+F,KAAKC,YAAaP,GAASQ,WAAWC,YAAaT,IAI5DC,EAAUF,KAQbW,UAAW,SAAUC,GACpB,MAAOA,GAAO1B,QAASnD,EAAW,OAAQmD,QAASlD,EAAYC,IAGhE4E,SAAU,SAAUvD,EAAMc,GACzB,MAAOd,GAAKuD,UAAYvD,EAAKuD,SAASC,gBAAkB1C,EAAK0C,eAI9D5D,KAAM,SAAUqC,EAAKpC,EAAUC,GAC9B,GAAI2D,GACHxD,EAAI,EACJf,EAAS+C,EAAI/C,OACbqC,EAAUmC,EAAazB,EAExB,IAAKnC,GACJ,GAAKyB,GACJ,KAAYrC,EAAJe,EAAYA,IAGnB,GAFAwD,EAAQ5D,EAASK,MAAO+B,EAAKhC,GAAKH,GAE7B2D,KAAU,EACd,UAIF,KAAMxD,IAAKgC,GAGV,GAFAwB,EAAQ5D,EAASK,MAAO+B,EAAKhC,GAAKH,GAE7B2D,KAAU,EACd,UAOH,IAAKlC,GACJ,KAAYrC,EAAJe,EAAYA,IAGnB,GAFAwD,EAAQ5D,EAAST,KAAM6C,EAAKhC,GAAKA,EAAGgC,EAAKhC,IAEpCwD,KAAU,EACd,UAIF,KAAMxD,IAAKgC,GAGV,GAFAwB,EAAQ5D,EAAST,KAAM6C,EAAKhC,GAAKA,EAAGgC,EAAKhC,IAEpCwD,KAAU,EACd,KAMJ,OAAOxB,IAIRa,KAAM,SAAUE,GACf,MAAe,OAARA,EACN,IACEA,EAAO,IAAKpB,QAASpD,EAAO,KAIhCmF,UAAW,SAAUnG,EAAKoG,GACzB,GAAInE,GAAMmE,KAaV,OAXY,OAAPpG,IACCkG,EAAaG,OAAOrG,IACxBW,EAAOuB,MAAOD,EACE,gBAARjC,IACLA,GAAQA,GAGXG,EAAKyB,KAAMK,EAAKjC,IAIXiC,GAGRqE,QAAS,SAAU9D,EAAMxC,EAAKyC,GAC7B,MAAc,OAAPzC,EAAc,GAAKI,EAAQwB,KAAM5B,EAAKwC,EAAMC,IAGpDP,MAAO,SAAUU,EAAO2D,GAKvB,IAJA,GAAIxD,IAAOwD,EAAO7E,OACjBsB,EAAI,EACJP,EAAIG,EAAMlB,OAECqB,EAAJC,EAASA,IAChBJ,EAAOH,KAAQ8D,EAAQvD,EAKxB,OAFAJ,GAAMlB,OAASe,EAERG,GAGR4D,KAAM,SAAUxE,EAAOK,EAAUoE,GAShC,IARA,GAAIC,GACHC,KACAlE,EAAI,EACJf,EAASM,EAAMN,OACfkF,GAAkBH,EAIP/E,EAAJe,EAAYA,IACnBiE,GAAmBrE,EAAUL,EAAOS,GAAKA,GACpCiE,IAAoBE,GACxBD,EAAQxG,KAAM6B,EAAOS,GAIvB,OAAOkE,IAIRpE,IAAK,SAAUP,EAAOK,EAAUwE,GAC/B,GAAIZ,GACHxD,EAAI,EACJf,EAASM,EAAMN,OACfqC,EAAUmC,EAAalE,GACvBC,IAGD,IAAK8B,EACJ,KAAYrC,EAAJe,EAAYA,IACnBwD,EAAQ5D,EAAUL,EAAOS,GAAKA,EAAGoE,GAEnB,MAATZ,GACJhE,EAAI9B,KAAM8F,OAMZ,KAAMxD,IAAKT,GACViE,EAAQ5D,EAAUL,EAAOS,GAAKA,EAAGoE,GAEnB,MAATZ,GACJhE,EAAI9B,KAAM8F,EAMb,OAAO/F,GAAOwC,SAAWT,IAI1B6E,KAAM,EAINC,MAAO,SAAUjG,EAAID,GACpB,GAAImG,GAAK1E,EAAMyE,CAUf,OARwB,gBAAZlG,KACXmG,EAAMlG,EAAID,GACVA,EAAUC,EACVA,EAAKkG,GAKArG,EAAOkD,WAAY/C,IAKzBwB,EAAOrC,EAAM2B,KAAMe,UAAW,GAC9BoE,EAAQ,WACP,MAAOjG,GAAG4B,MAAO7B,GAAWf,KAAMwC,EAAKpC,OAAQD,EAAM2B,KAAMe,cAI5DoE,EAAMD,KAAOhG,EAAGgG,KAAOhG,EAAGgG,MAAQnG,EAAOmG,OAElCC,GAZC/C,QAeTiD,IAAKC,KAAKD,IAIVxG,QAASA,IAIVE,EAAOyB,KAAK,gEAAgE+E,MAAM,KAAM,SAAS1E,EAAGa,GACnGjD,EAAY,WAAaiD,EAAO,KAAQA,EAAK0C,eAG9C,SAASE,GAAazB,GAMrB,GAAI/C,GAAS,UAAY+C,IAAOA,EAAI/C,OACnCgD,EAAO/D,EAAO+D,KAAMD,EAErB,OAAc,aAATC,GAAuB/D,EAAOiE,SAAUH,IACrC,EAGc,IAAjBA,EAAIM,UAAkBrD,GACnB,EAGQ,UAATgD,GAA+B,IAAXhD,GACR,gBAAXA,IAAuBA,EAAS,GAAOA,EAAS,IAAO+C,GAEhE,GAAI2C,GAWJ,SAAWvH,GAEX,GAAI4C,GACHhC,EACA4G,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAGAC,EACApI,EACAqI,EACAC,EACAC,EACAC,EACAvB,EACAwB,EAGAlE,EAAU,SAAW,EAAI,GAAIiD,MAC7BkB,EAAevI,EAAOH,SACtB2I,EAAU,EACVC,EAAO,EACPC,EAAaC,KACbC,EAAaD,KACbE,EAAgBF,KAChBG,EAAY,SAAUC,EAAGC,GAIxB,MAHKD,KAAMC,IACVhB,GAAe,GAET,GAIRiB,EAAe,GAAK,GAGpBvI,KAAcC,eACdR,KACA+I,EAAM/I,EAAI+I,IACVC,EAAchJ,EAAIG,KAClBA,EAAOH,EAAIG,KACXF,EAAQD,EAAIC,MAGZG,EAAU,SAAU6I,EAAMzG,GAGzB,IAFA,GAAIC,GAAI,EACPM,EAAMkG,EAAKvH,OACAqB,EAAJN,EAASA,IAChB,GAAKwG,EAAKxG,KAAOD,EAChB,MAAOC,EAGT,OAAO,IAGRyG,EAAW,6HAKXC,EAAa,sBAEbC,EAAoB,mCAKpBC,EAAaD,EAAkBhF,QAAS,IAAK,MAG7CkF,EAAa,MAAQH,EAAa,KAAOC,EAAoB,OAASD,EAErE,gBAAkBA,EAElB,2DAA6DE,EAAa,OAASF,EACnF,OAEDI,EAAU,KAAOH,EAAoB,wFAKPE,EAAa,eAM3CE,EAAc,GAAIC,QAAQN,EAAa,IAAK,KAC5CnI,EAAQ,GAAIyI,QAAQ,IAAMN,EAAa,8BAAgCA,EAAa,KAAM,KAE1FO,EAAS,GAAID,QAAQ,IAAMN,EAAa,KAAOA,EAAa,KAC5DQ,EAAe,GAAIF,QAAQ,IAAMN,EAAa,WAAaA,EAAa,IAAMA,EAAa,KAE3FS,EAAmB,GAAIH,QAAQ,IAAMN,EAAa,iBAAmBA,EAAa,OAAQ,KAE1FU,EAAU,GAAIJ,QAAQF,GACtBO,EAAc,GAAIL,QAAQ,IAAMJ,EAAa,KAE7CU,GACCC,GAAM,GAAIP,QAAQ,MAAQL,EAAoB,KAC9Ca,MAAS,GAAIR,QAAQ,QAAUL,EAAoB,KACnDc,IAAO,GAAIT,QAAQ,KAAOL,EAAkBhF,QAAS,IAAK,MAAS,KACnE+F,KAAQ,GAAIV,QAAQ,IAAMH,GAC1Bc,OAAU,GAAIX,QAAQ,IAAMF,GAC5Bc,MAAS,GAAIZ,QAAQ,yDAA2DN,EAC/E,+BAAiCA,EAAa,cAAgBA,EAC9D,aAAeA,EAAa,SAAU,KACvCmB,KAAQ,GAAIb,QAAQ,OAASP,EAAW,KAAM,KAG9CqB,aAAgB,GAAId,QAAQ,IAAMN,EAAa,mDAC9CA,EAAa,mBAAqBA,EAAa,mBAAoB,MAGrEqB,EAAU,sCACVC,EAAU,SAEVC,EAAU,yBAGVC,EAAa,mCAEbC,GAAW,OACXC,GAAU,QAGVC,GAAY,GAAIrB,QAAQ,qBAAuBN,EAAa,MAAQA,EAAa,OAAQ,MACzF4B,GAAY,SAAUC,EAAGC,EAASC,GACjC,GAAIC,GAAO,KAAOF,EAAU,KAI5B,OAAOE,KAASA,GAAQD,EACvBD,EACO,EAAPE,EAECC,OAAOC,aAAcF,EAAO,OAE5BC,OAAOC,aAAcF,GAAQ,GAAK,MAAe,KAAPA,EAAe,QAO5DG,GAAgB,WACfxD,IAIF,KACC3H,EAAKuC,MACH1C,EAAMC,EAAM2B,KAAMwG,EAAamD,YAChCnD,EAAamD,YAIdvL,EAAKoI,EAAamD,WAAW7J,QAASqD,SACrC,MAAQyG,IACTrL,GAASuC,MAAO1C,EAAI0B,OAGnB,SAAUiC,EAAQ8H,GACjBzC,EAAYtG,MAAOiB,EAAQ1D,EAAM2B,KAAK6J,KAKvC,SAAU9H,EAAQ8H,GACjB,GAAIzI,GAAIW,EAAOjC,OACde,EAAI,CAEL,OAASkB,EAAOX,KAAOyI,EAAIhJ,MAC3BkB,EAAOjC,OAASsB,EAAI,IAKvB,QAASoE,IAAQxG,EAAUC,EAASuF,EAASsF,GAC5C,GAAIC,GAAOnJ,EAAMoJ,EAAG7G,EAEnBtC,EAAGoJ,EAAQC,EAAKC,EAAKC,EAAYC,CAUlC,KAROpL,EAAUA,EAAQqL,eAAiBrL,EAAUuH,KAAmB1I,GACtEoI,EAAajH,GAGdA,EAAUA,GAAWnB,EACrB0G,EAAUA,MACVrB,EAAWlE,EAAQkE,SAEM,gBAAbnE,KAA0BA,GACxB,IAAbmE,GAA+B,IAAbA,GAA+B,KAAbA,EAEpC,MAAOqB,EAGR,KAAMsF,GAAQ1D,EAAiB,CAG9B,GAAkB,KAAbjD,IAAoB4G,EAAQhB,EAAWwB,KAAMvL,IAEjD,GAAMgL,EAAID,EAAM,IACf,GAAkB,IAAb5G,EAAiB,CAIrB,GAHAvC,EAAO3B,EAAQuL,eAAgBR,IAG1BpJ,IAAQA,EAAKmD,WAQjB,MAAOS,EALP,IAAK5D,EAAK6J,KAAOT,EAEhB,MADAxF,GAAQjG,KAAMqC,GACP4D,MAOT,IAAKvF,EAAQqL,gBAAkB1J,EAAO3B,EAAQqL,cAAcE,eAAgBR,KAC3EzD,EAAUtH,EAAS2B,IAAUA,EAAK6J,KAAOT,EAEzC,MADAxF,GAAQjG,KAAMqC,GACP4D,MAKH,CAAA,GAAKuF,EAAM,GAEjB,MADAxL,GAAKuC,MAAO0D,EAASvF,EAAQyL,qBAAsB1L,IAC5CwF,CAGD,KAAMwF,EAAID,EAAM,KAAOlL,EAAQ8L,uBAErC,MADApM,GAAKuC,MAAO0D,EAASvF,EAAQ0L,uBAAwBX,IAC9CxF,EAKT,GAAK3F,EAAQ+L,OAASvE,IAAcA,EAAUwE,KAAM7L,IAAc,CASjE,GARAmL,EAAMD,EAAM7H,EACZ+H,EAAanL,EACboL,EAA2B,IAAblH,GAAkBnE,EAMd,IAAbmE,GAAqD,WAAnClE,EAAQkF,SAASC,cAA6B,CACpE6F,EAASrE,EAAU5G,IAEbkL,EAAMjL,EAAQ6L,aAAa,OAChCX,EAAMD,EAAI1H,QAASyG,GAAS,QAE5BhK,EAAQ8L,aAAc,KAAMZ,GAE7BA,EAAM,QAAUA,EAAM,MAEtBtJ,EAAIoJ,EAAOnK,MACX,OAAQe,IACPoJ,EAAOpJ,GAAKsJ,EAAMa,GAAYf,EAAOpJ,GAEtCuJ,GAAapB,GAAS6B,KAAM7L,IAAciM,GAAahM,EAAQ8E,aAAgB9E,EAC/EoL,EAAcJ,EAAOiB,KAAK,KAG3B,GAAKb,EACJ,IAIC,MAHA9L,GAAKuC,MAAO0D,EACX4F,EAAWe,iBAAkBd,IAEvB7F,EACN,MAAM4G,IACN,QACKlB,GACLjL,EAAQoM,gBAAgB,QAQ7B,MAAOvF,GAAQ9G,EAASwD,QAASpD,EAAO,MAAQH,EAASuF,EAASsF,GASnE,QAASlD,MACR,GAAI0E,KAEJ,SAASC,GAAOC,EAAKnH,GAMpB,MAJKiH,GAAK/M,KAAMiN,EAAM,KAAQ/F,EAAKgG,mBAE3BF,GAAOD,EAAKI,SAEZH,EAAOC,EAAM,KAAQnH,EAE9B,MAAOkH,GAOR,QAASI,IAAczM,GAEtB,MADAA,GAAImD,IAAY,EACTnD,EAOR,QAAS0M,IAAQ1M,GAChB,GAAI2M,GAAM/N,EAAS6F,cAAc,MAEjC,KACC,QAASzE,EAAI2M,GACZ,MAAOjC,GACR,OAAO,EACN,QAEIiC,EAAI9H,YACR8H,EAAI9H,WAAWC,YAAa6H,GAG7BA,EAAM,MASR,QAASC,IAAWC,EAAOC,GAC1B,GAAI5N,GAAM2N,EAAMxG,MAAM,KACrB1E,EAAIkL,EAAMjM,MAEX,OAAQe,IACP4E,EAAKwG,WAAY7N,EAAIyC,IAAOmL,EAU9B,QAASE,IAAclF,EAAGC,GACzB,GAAIkF,GAAMlF,GAAKD,EACdoF,EAAOD,GAAsB,IAAfnF,EAAE7D,UAAiC,IAAf8D,EAAE9D,YAChC8D,EAAEoF,aAAenF,KACjBF,EAAEqF,aAAenF,EAGtB,IAAKkF,EACJ,MAAOA,EAIR,IAAKD,EACJ,MAASA,EAAMA,EAAIG,YAClB,GAAKH,IAAQlF,EACZ,MAAO,EAKV,OAAOD,GAAI,EAAI,GAOhB,QAASuF,IAAmBzJ,GAC3B,MAAO,UAAUlC,GAChB,GAAIc,GAAOd,EAAKuD,SAASC,aACzB,OAAgB,UAAT1C,GAAoBd,EAAKkC,OAASA,GAQ3C,QAAS0J,IAAoB1J,GAC5B,MAAO,UAAUlC,GAChB,GAAIc,GAAOd,EAAKuD,SAASC,aACzB,QAAiB,UAAT1C,GAA6B,WAATA,IAAsBd,EAAKkC,OAASA,GAQlE,QAAS2J,IAAwBvN,GAChC,MAAOyM,IAAa,SAAUe,GAE7B,MADAA,IAAYA,EACLf,GAAa,SAAU7B,EAAM/E,GACnC,GAAI3D,GACHuL,EAAezN,KAAQ4K,EAAKhK,OAAQ4M,GACpC7L,EAAI8L,EAAa7M,MAGlB,OAAQe,IACFiJ,EAAO1I,EAAIuL,EAAa9L,MAC5BiJ,EAAK1I,KAAO2D,EAAQ3D,GAAK0I,EAAK1I,SAYnC,QAAS6J,IAAahM,GACrB,MAAOA,IAAmD,mBAAjCA,GAAQyL,sBAAwCzL,EAI1EJ,EAAU2G,GAAO3G,WAOjB8G,EAAQH,GAAOG,MAAQ,SAAU/E,GAGhC,GAAIgM,GAAkBhM,IAASA,EAAK0J,eAAiB1J,GAAMgM,eAC3D,OAAOA,GAA+C,SAA7BA,EAAgBzI,UAAsB,GAQhE+B,EAAcV,GAAOU,YAAc,SAAU2G,GAC5C,GAAIC,GAAYC,EACfC,EAAMH,EAAOA,EAAKvC,eAAiBuC,EAAOrG,CAG3C,OAAKwG,KAAQlP,GAA6B,IAAjBkP,EAAI7J,UAAmB6J,EAAIJ,iBAKpD9O,EAAWkP,EACX7G,EAAU6G,EAAIJ,gBACdG,EAASC,EAAIC,YAMRF,GAAUA,IAAWA,EAAOG,MAE3BH,EAAOI,iBACXJ,EAAOI,iBAAkB,SAAUzD,IAAe,GACvCqD,EAAOK,aAClBL,EAAOK,YAAa,WAAY1D,KAMlCtD,GAAkBT,EAAOqH,GAQzBnO,EAAQ6I,WAAakE,GAAO,SAAUC,GAErC,MADAA,GAAIwB,UAAY,KACRxB,EAAIf,aAAa,eAO1BjM,EAAQ6L,qBAAuBkB,GAAO,SAAUC,GAE/C,MADAA,GAAI/H,YAAakJ,EAAIM,cAAc,MAC3BzB,EAAInB,qBAAqB,KAAK5K,SAIvCjB,EAAQ8L,uBAAyB7B,EAAQ+B,KAAMmC,EAAIrC,wBAMnD9L,EAAQ0O,QAAU3B,GAAO,SAAUC,GAElC,MADA1F,GAAQrC,YAAa+H,GAAMpB,GAAKpI,GACxB2K,EAAIQ,oBAAsBR,EAAIQ,kBAAmBnL,GAAUvC,SAI/DjB,EAAQ0O,SACZ9H,EAAKgI,KAAS,GAAI,SAAUhD,EAAIxL,GAC/B,GAAuC,mBAA3BA,GAAQuL,gBAAkCpE,EAAiB,CACtE,GAAI4D,GAAI/K,EAAQuL,eAAgBC,EAGhC,OAAOT,IAAKA,EAAEjG,YAAeiG,QAG/BvE,EAAKiI,OAAW,GAAI,SAAUjD,GAC7B,GAAIkD,GAASlD,EAAGjI,QAAS0G,GAAWC,GACpC,OAAO,UAAUvI,GAChB,MAAOA,GAAKkK,aAAa,QAAU6C,YAM9BlI,GAAKgI,KAAS,GAErBhI,EAAKiI,OAAW,GAAK,SAAUjD,GAC9B,GAAIkD,GAASlD,EAAGjI,QAAS0G,GAAWC,GACpC,OAAO,UAAUvI,GAChB,GAAIiM,GAAwC,mBAA1BjM,GAAKgN,kBAAoChN,EAAKgN,iBAAiB,KACjF,OAAOf,IAAQA,EAAKxI,QAAUsJ,KAMjClI,EAAKgI,KAAU,IAAI5O,EAAQ6L,qBAC1B,SAAUmD,EAAK5O,GACd,MAA6C,mBAAjCA,GAAQyL,qBACZzL,EAAQyL,qBAAsBmD,GAG1BhP,EAAQ+L,IACZ3L,EAAQkM,iBAAkB0C,GAD3B,QAKR,SAAUA,EAAK5O,GACd,GAAI2B,GACHwE,KACAvE,EAAI,EAEJ2D,EAAUvF,EAAQyL,qBAAsBmD,EAGzC,IAAa,MAARA,EAAc,CAClB,MAASjN,EAAO4D,EAAQ3D,KACA,IAAlBD,EAAKuC,UACTiC,EAAI7G,KAAMqC,EAIZ,OAAOwE,GAER,MAAOZ,IAITiB,EAAKgI,KAAY,MAAI5O,EAAQ8L,wBAA0B,SAAU0C,EAAWpO,GAC3E,MAAKmH,GACGnH,EAAQ0L,uBAAwB0C,GADxC,QAWD/G,KAOAD,MAEMxH,EAAQ+L,IAAM9B,EAAQ+B,KAAMmC,EAAI7B,qBAGrCS,GAAO,SAAUC,GAMhB1F,EAAQrC,YAAa+H,GAAMiC,UAAY,UAAYzL,EAAU,qBAC3CA,EAAU,iEAOvBwJ,EAAIV,iBAAiB,wBAAwBrL,QACjDuG,EAAU9H,KAAM,SAAWgJ,EAAa,gBAKnCsE,EAAIV,iBAAiB,cAAcrL,QACxCuG,EAAU9H,KAAM,MAAQgJ,EAAa,aAAeD,EAAW,KAI1DuE,EAAIV,iBAAkB,QAAU9I,EAAU,MAAOvC,QACtDuG,EAAU9H,KAAK,MAMVsN,EAAIV,iBAAiB,YAAYrL,QACtCuG,EAAU9H,KAAK,YAMVsN,EAAIV,iBAAkB,KAAO9I,EAAU,MAAOvC,QACnDuG,EAAU9H,KAAK,cAIjBqN,GAAO,SAAUC,GAGhB,GAAIkC,GAAQf,EAAIrJ,cAAc,QAC9BoK,GAAMhD,aAAc,OAAQ,UAC5Bc,EAAI/H,YAAaiK,GAAQhD,aAAc,OAAQ,KAI1Cc,EAAIV,iBAAiB,YAAYrL,QACrCuG,EAAU9H,KAAM,OAASgJ,EAAa,eAKjCsE,EAAIV,iBAAiB,YAAYrL,QACtCuG,EAAU9H,KAAM,WAAY,aAI7BsN,EAAIV,iBAAiB,QACrB9E,EAAU9H,KAAK,YAIXM,EAAQmP,gBAAkBlF,EAAQ+B,KAAO9F,EAAUoB,EAAQpB,SAChEoB,EAAQ8H,uBACR9H,EAAQ+H,oBACR/H,EAAQgI,kBACRhI,EAAQiI,qBAERxC,GAAO,SAAUC,GAGhBhN,EAAQwP,kBAAoBtJ,EAAQ/E,KAAM6L,EAAK,OAI/C9G,EAAQ/E,KAAM6L,EAAK,aACnBvF,EAAc/H,KAAM,KAAMoJ,KAI5BtB,EAAYA,EAAUvG,QAAU,GAAI+H,QAAQxB,EAAU6E,KAAK,MAC3D5E,EAAgBA,EAAcxG,QAAU,GAAI+H,QAAQvB,EAAc4E,KAAK,MAIvE4B,EAAahE,EAAQ+B,KAAM1E,EAAQmI,yBAKnC/H,EAAWuG,GAAchE,EAAQ+B,KAAM1E,EAAQI,UAC9C,SAAUS,EAAGC,GACZ,GAAIsH,GAAuB,IAAfvH,EAAE7D,SAAiB6D,EAAE4F,gBAAkB5F,EAClDwH,EAAMvH,GAAKA,EAAElD,UACd,OAAOiD,KAAMwH,MAAWA,GAAwB,IAAjBA,EAAIrL,YAClCoL,EAAMhI,SACLgI,EAAMhI,SAAUiI,GAChBxH,EAAEsH,yBAA8D,GAAnCtH,EAAEsH,wBAAyBE,MAG3D,SAAUxH,EAAGC,GACZ,GAAKA,EACJ,MAASA,EAAIA,EAAElD,WACd,GAAKkD,IAAMD,EACV,OAAO,CAIV,QAAO,GAOTD,EAAY+F,EACZ,SAAU9F,EAAGC,GAGZ,GAAKD,IAAMC,EAEV,MADAhB,IAAe,EACR,CAIR,IAAIwI,IAAWzH,EAAEsH,yBAA2BrH,EAAEqH,uBAC9C,OAAKG,GACGA,GAIRA,GAAYzH,EAAEsD,eAAiBtD,MAAUC,EAAEqD,eAAiBrD,GAC3DD,EAAEsH,wBAAyBrH,GAG3B,EAGc,EAAVwH,IACF5P,EAAQ6P,cAAgBzH,EAAEqH,wBAAyBtH,KAAQyH,EAGxDzH,IAAMgG,GAAOhG,EAAEsD,gBAAkB9D,GAAgBD,EAASC,EAAcQ,GACrE,GAEHC,IAAM+F,GAAO/F,EAAEqD,gBAAkB9D,GAAgBD,EAASC,EAAcS,GACrE,EAIDjB,EACJxH,EAASwH,EAAWgB,GAAMxI,EAASwH,EAAWiB,GAChD,EAGe,EAAVwH,EAAc,GAAK,IAE3B,SAAUzH,EAAGC,GAEZ,GAAKD,IAAMC,EAEV,MADAhB,IAAe,EACR,CAGR,IAAIkG,GACHtL,EAAI,EACJ8N,EAAM3H,EAAEjD,WACRyK,EAAMvH,EAAElD,WACR6K,GAAO5H,GACP6H,GAAO5H,EAGR,KAAM0H,IAAQH,EACb,MAAOxH,KAAMgG,EAAM,GAClB/F,IAAM+F,EAAM,EACZ2B,EAAM,GACNH,EAAM,EACNxI,EACExH,EAASwH,EAAWgB,GAAMxI,EAASwH,EAAWiB,GAChD,CAGK,IAAK0H,IAAQH,EACnB,MAAOtC,IAAclF,EAAGC,EAIzBkF,GAAMnF,CACN,OAASmF,EAAMA,EAAIpI,WAClB6K,EAAGE,QAAS3C,EAEbA,GAAMlF,CACN,OAASkF,EAAMA,EAAIpI,WAClB8K,EAAGC,QAAS3C,EAIb,OAAQyC,EAAG/N,KAAOgO,EAAGhO,GACpBA,GAGD,OAAOA,GAENqL,GAAc0C,EAAG/N,GAAIgO,EAAGhO,IAGxB+N,EAAG/N,KAAO2F,EAAe,GACzBqI,EAAGhO,KAAO2F,EAAe,EACzB,GAGKwG,GA1WClP,GA6WT0H,GAAOT,QAAU,SAAUgK,EAAMC,GAChC,MAAOxJ,IAAQuJ,EAAM,KAAM,KAAMC,IAGlCxJ,GAAOwI,gBAAkB,SAAUpN,EAAMmO,GASxC,IAPOnO,EAAK0J,eAAiB1J,KAAW9C,GACvCoI,EAAatF,GAIdmO,EAAOA,EAAKvM,QAASwF,EAAkB,aAElCnJ,EAAQmP,kBAAmB5H,GAC5BE,GAAkBA,EAAcuE,KAAMkE,IACtC1I,GAAkBA,EAAUwE,KAAMkE,IAErC,IACC,GAAI1O,GAAM0E,EAAQ/E,KAAMY,EAAMmO,EAG9B,IAAK1O,GAAOxB,EAAQwP,mBAGlBzN,EAAK9C,UAAuC,KAA3B8C,EAAK9C,SAASqF,SAChC,MAAO9C,GAEP,MAAOuJ,IAGV,MAAOpE,IAAQuJ,EAAMjR,EAAU,MAAQ8C,IAASd,OAAS,GAG1D0F,GAAOe,SAAW,SAAUtH,EAAS2B,GAKpC,OAHO3B,EAAQqL,eAAiBrL,KAAcnB,GAC7CoI,EAAajH,GAEPsH,EAAUtH,EAAS2B,IAG3B4E,GAAOyJ,KAAO,SAAUrO,EAAMc,IAEtBd,EAAK0J,eAAiB1J,KAAW9C,GACvCoI,EAAatF,EAGd,IAAI1B,GAAKuG,EAAKwG,WAAYvK,EAAK0C,eAE9B8K,EAAMhQ,GAAMP,EAAOqB,KAAMyF,EAAKwG,WAAYvK,EAAK0C,eAC9ClF,EAAI0B,EAAMc,GAAO0E,GACjBhE,MAEF,OAAeA,UAAR8M,EACNA,EACArQ,EAAQ6I,aAAetB,EACtBxF,EAAKkK,aAAcpJ,IAClBwN,EAAMtO,EAAKgN,iBAAiBlM,KAAUwN,EAAIC,UAC1CD,EAAI7K,MACJ,MAGJmB,GAAO9C,MAAQ,SAAUC,GACxB,KAAM,IAAI3E,OAAO,0CAA4C2E,IAO9D6C,GAAO4J,WAAa,SAAU5K,GAC7B,GAAI5D,GACHyO,KACAjO,EAAI,EACJP,EAAI,CAOL,IAJAoF,GAAgBpH,EAAQyQ,iBACxBtJ,GAAanH,EAAQ0Q,YAAc/K,EAAQnG,MAAO,GAClDmG,EAAQlD,KAAMyF,GAETd,EAAe,CACnB,MAASrF,EAAO4D,EAAQ3D,KAClBD,IAAS4D,EAAS3D,KACtBO,EAAIiO,EAAW9Q,KAAMsC,GAGvB,OAAQO,IACPoD,EAAQjD,OAAQ8N,EAAYjO,GAAK,GAQnC,MAFA4E,GAAY,KAELxB,GAORkB,EAAUF,GAAOE,QAAU,SAAU9E,GACpC,GAAIiM,GACHxM,EAAM,GACNQ,EAAI,EACJsC,EAAWvC,EAAKuC,QAEjB,IAAMA,GAMC,GAAkB,IAAbA,GAA+B,IAAbA,GAA+B,KAAbA,EAAkB,CAGjE,GAAiC,gBAArBvC,GAAK4O,YAChB,MAAO5O,GAAK4O,WAGZ,KAAM5O,EAAOA,EAAK6O,WAAY7O,EAAMA,EAAOA,EAAK0L,YAC/CjM,GAAOqF,EAAS9E,OAGZ,IAAkB,IAAbuC,GAA+B,IAAbA,EAC7B,MAAOvC,GAAK8O,cAhBZ,OAAS7C,EAAOjM,EAAKC,KAEpBR,GAAOqF,EAASmH,EAkBlB,OAAOxM,IAGRoF,EAAOD,GAAOmK,WAGblE,YAAa,GAEbmE,aAAcjE,GAEd5B,MAAO5B,EAEP8D,cAEAwB,QAEAoC,UACCC,KAAOC,IAAK,aAAc/O,OAAO,GACjCgP,KAAOD,IAAK,cACZE,KAAOF,IAAK,kBAAmB/O,OAAO,GACtCkP,KAAOH,IAAK,oBAGbI,WACC5H,KAAQ,SAAUwB,GAUjB,MATAA,GAAM,GAAKA,EAAM,GAAGvH,QAAS0G,GAAWC,IAGxCY,EAAM,IAAOA,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAAM,IAAKvH,QAAS0G,GAAWC,IAExD,OAAbY,EAAM,KACVA,EAAM,GAAK,IAAMA,EAAM,GAAK,KAGtBA,EAAM1L,MAAO,EAAG,IAGxBoK,MAAS,SAAUsB,GA6BlB,MAlBAA,GAAM,GAAKA,EAAM,GAAG3F,cAEY,QAA3B2F,EAAM,GAAG1L,MAAO,EAAG,IAEjB0L,EAAM,IACXvE,GAAO9C,MAAOqH,EAAM,IAKrBA,EAAM,KAAQA,EAAM,GAAKA,EAAM,IAAMA,EAAM,IAAM,GAAK,GAAmB,SAAbA,EAAM,IAA8B,QAAbA,EAAM,KACzFA,EAAM,KAAUA,EAAM,GAAKA,EAAM,IAAqB,QAAbA,EAAM,KAGpCA,EAAM,IACjBvE,GAAO9C,MAAOqH,EAAM,IAGdA,GAGRvB,OAAU,SAAUuB,GACnB,GAAIqG,GACHC,GAAYtG,EAAM,IAAMA,EAAM,EAE/B,OAAK5B,GAAiB,MAAE0C,KAAMd,EAAM,IAC5B,MAIHA,EAAM,GACVA,EAAM,GAAKA,EAAM,IAAMA,EAAM,IAAM,GAGxBsG,GAAYpI,EAAQ4C,KAAMwF,KAEpCD,EAASxK,EAAUyK,GAAU,MAE7BD,EAASC,EAAS7R,QAAS,IAAK6R,EAASvQ,OAASsQ,GAAWC,EAASvQ,UAGvEiK,EAAM,GAAKA,EAAM,GAAG1L,MAAO,EAAG+R,GAC9BrG,EAAM,GAAKsG,EAAShS,MAAO,EAAG+R,IAIxBrG,EAAM1L,MAAO,EAAG,MAIzBqP,QAECpF,IAAO,SAAUgI,GAChB,GAAInM,GAAWmM,EAAiB9N,QAAS0G,GAAWC,IAAY/E,aAChE,OAA4B,MAArBkM,EACN,WAAa,OAAO,GACpB,SAAU1P,GACT,MAAOA,GAAKuD,UAAYvD,EAAKuD,SAASC,gBAAkBD,IAI3DkE,MAAS,SAAUgF,GAClB,GAAIkD,GAAU5J,EAAY0G,EAAY,IAEtC,OAAOkD,KACLA,EAAU,GAAI1I,QAAQ,MAAQN,EAAa,IAAM8F,EAAY,IAAM9F,EAAa,SACjFZ,EAAY0G,EAAW,SAAUzM,GAChC,MAAO2P,GAAQ1F,KAAgC,gBAAnBjK,GAAKyM,WAA0BzM,EAAKyM,WAA0C,mBAAtBzM,GAAKkK,cAAgClK,EAAKkK,aAAa,UAAY,OAI1JvC,KAAQ,SAAU7G,EAAM8O,EAAUC,GACjC,MAAO,UAAU7P,GAChB,GAAI8P,GAASlL,GAAOyJ,KAAMrO,EAAMc,EAEhC,OAAe,OAAVgP,EACgB,OAAbF,EAEFA,GAINE,GAAU,GAEU,MAAbF,EAAmBE,IAAWD,EACvB,OAAbD,EAAoBE,IAAWD,EAClB,OAAbD,EAAoBC,GAAqC,IAA5BC,EAAOlS,QAASiS,GAChC,OAAbD,EAAoBC,GAASC,EAAOlS,QAASiS,GAAU,GAC1C,OAAbD,EAAoBC,GAASC,EAAOrS,OAAQoS,EAAM3Q,UAAa2Q,EAClD,OAAbD,GAAsB,IAAME,EAAOlO,QAASoF,EAAa,KAAQ,KAAMpJ,QAASiS,GAAU,GAC7E,OAAbD,EAAoBE,IAAWD,GAASC,EAAOrS,MAAO,EAAGoS,EAAM3Q,OAAS,KAAQ2Q,EAAQ,KACxF,IAZO,IAgBVhI,MAAS,SAAU3F,EAAM6N,EAAMjE,EAAU1L,EAAOE,GAC/C,GAAI0P,GAAgC,QAAvB9N,EAAKzE,MAAO,EAAG,GAC3BwS,EAA+B,SAArB/N,EAAKzE,MAAO,IACtByS,EAAkB,YAATH,CAEV,OAAiB,KAAV3P,GAAwB,IAATE,EAGrB,SAAUN,GACT,QAASA,EAAKmD,YAGf,SAAUnD,EAAM3B,EAAS8R,GACxB,GAAIxF,GAAOyF,EAAYnE,EAAMT,EAAM6E,EAAWC,EAC7CnB,EAAMa,IAAWC,EAAU,cAAgB,kBAC3C9D,EAASnM,EAAKmD,WACdrC,EAAOoP,GAAUlQ,EAAKuD,SAASC,cAC/B+M,GAAYJ,IAAQD,CAErB,IAAK/D,EAAS,CAGb,GAAK6D,EAAS,CACb,MAAQb,EAAM,CACblD,EAAOjM,CACP,OAASiM,EAAOA,EAAMkD,GACrB,GAAKe,EAASjE,EAAK1I,SAASC,gBAAkB1C,EAAyB,IAAlBmL,EAAK1J,SACzD,OAAO,CAIT+N,GAAQnB,EAAe,SAATjN,IAAoBoO,GAAS,cAE5C,OAAO,EAMR,GAHAA,GAAUL,EAAU9D,EAAO0C,WAAa1C,EAAOqE,WAG1CP,GAAWM,EAAW,CAE1BH,EAAajE,EAAQ1K,KAAc0K,EAAQ1K,OAC3CkJ,EAAQyF,EAAYlO,OACpBmO,EAAY1F,EAAM,KAAO9E,GAAW8E,EAAM,GAC1Ca,EAAOb,EAAM,KAAO9E,GAAW8E,EAAM,GACrCsB,EAAOoE,GAAalE,EAAOpD,WAAYsH,EAEvC,OAASpE,IAASoE,GAAapE,GAAQA,EAAMkD,KAG3C3D,EAAO6E,EAAY,IAAMC,EAAM/J,MAGhC,GAAuB,IAAlB0F,EAAK1J,YAAoBiJ,GAAQS,IAASjM,EAAO,CACrDoQ,EAAYlO,IAAW2D,EAASwK,EAAW7E,EAC3C,YAKI,IAAK+E,IAAa5F,GAAS3K,EAAMyB,KAAczB,EAAMyB,QAAkBS,KAAWyI,EAAM,KAAO9E,EACrG2F,EAAOb,EAAM,OAKb,OAASsB,IAASoE,GAAapE,GAAQA,EAAMkD,KAC3C3D,EAAO6E,EAAY,IAAMC,EAAM/J,MAEhC,IAAO2J,EAASjE,EAAK1I,SAASC,gBAAkB1C,EAAyB,IAAlBmL,EAAK1J,aAAsBiJ,IAE5E+E,KACHtE,EAAMxK,KAAcwK,EAAMxK,QAAkBS,IAAW2D,EAAS2F,IAG7DS,IAASjM,GACb,KAQJ,OADAwL,IAAQlL,EACDkL,IAASpL,GAAWoL,EAAOpL,IAAU,GAAKoL,EAAOpL,GAAS,KAKrEwH,OAAU,SAAU6I,EAAQ3E,GAK3B,GAAIhM,GACHxB,EAAKuG,EAAKkC,QAAS0J,IAAY5L,EAAK6L,WAAYD,EAAOjN,gBACtDoB,GAAO9C,MAAO,uBAAyB2O,EAKzC,OAAKnS,GAAImD,GACDnD,EAAIwN,GAIPxN,EAAGY,OAAS,GAChBY,GAAS2Q,EAAQA,EAAQ,GAAI3E,GACtBjH,EAAK6L,WAAW1S,eAAgByS,EAAOjN,eAC7CuH,GAAa,SAAU7B,EAAM/E,GAC5B,GAAIwM,GACHC,EAAUtS,EAAI4K,EAAM4C,GACpB7L,EAAI2Q,EAAQ1R,MACb,OAAQe,IACP0Q,EAAM/S,EAASsL,EAAM0H,EAAQ3Q,IAC7BiJ,EAAMyH,KAAWxM,EAASwM,GAAQC,EAAQ3Q,MAG5C,SAAUD,GACT,MAAO1B,GAAI0B,EAAM,EAAGF,KAIhBxB,IAITyI,SAEC8J,IAAO9F,GAAa,SAAU3M,GAI7B,GAAI+O,MACHvJ,KACAkN,EAAU7L,EAAS7G,EAASwD,QAASpD,EAAO,MAE7C,OAAOsS,GAASrP,GACfsJ,GAAa,SAAU7B,EAAM/E,EAAS9F,EAAS8R,GAC9C,GAAInQ,GACH+Q,EAAYD,EAAS5H,EAAM,KAAMiH,MACjClQ,EAAIiJ,EAAKhK,MAGV,OAAQe,KACDD,EAAO+Q,EAAU9Q,MACtBiJ,EAAKjJ,KAAOkE,EAAQlE,GAAKD,MAI5B,SAAUA,EAAM3B,EAAS8R,GAKxB,MAJAhD,GAAM,GAAKnN,EACX8Q,EAAS3D,EAAO,KAAMgD,EAAKvM,GAE3BuJ,EAAM,GAAK,MACHvJ,EAAQ2C,SAInByK,IAAOjG,GAAa,SAAU3M,GAC7B,MAAO,UAAU4B,GAChB,MAAO4E,IAAQxG,EAAU4B,GAAOd,OAAS,KAI3CyG,SAAYoF,GAAa,SAAU/H,GAElC,MADAA,GAAOA,EAAKpB,QAAS0G,GAAWC,IACzB,SAAUvI,GAChB,OAASA,EAAK4O,aAAe5O,EAAKiR,WAAanM,EAAS9E,IAASpC,QAASoF,GAAS,MAWrFkO,KAAQnG,GAAc,SAAUmG,GAM/B,MAJM5J,GAAY2C,KAAKiH,GAAQ,KAC9BtM,GAAO9C,MAAO,qBAAuBoP,GAEtCA,EAAOA,EAAKtP,QAAS0G,GAAWC,IAAY/E,cACrC,SAAUxD,GAChB,GAAImR,EACJ,GACC,IAAMA,EAAW3L,EAChBxF,EAAKkR,KACLlR,EAAKkK,aAAa,aAAelK,EAAKkK,aAAa,QAGnD,MADAiH,GAAWA,EAAS3N,cACb2N,IAAaD,GAA2C,IAAnCC,EAASvT,QAASsT,EAAO,YAE5ClR,EAAOA,EAAKmD,aAAiC,IAAlBnD,EAAKuC,SAC3C,QAAO,KAKTpB,OAAU,SAAUnB,GACnB,GAAIoR,GAAO/T,EAAOgU,UAAYhU,EAAOgU,SAASD,IAC9C,OAAOA,IAAQA,EAAK3T,MAAO,KAAQuC,EAAK6J,IAGzCyH,KAAQ,SAAUtR,GACjB,MAAOA,KAASuF,GAGjBgM,MAAS,SAAUvR,GAClB,MAAOA,KAAS9C,EAASsU,iBAAmBtU,EAASuU,UAAYvU,EAASuU,gBAAkBzR,EAAKkC,MAAQlC,EAAK0R,OAAS1R,EAAK2R,WAI7HC,QAAW,SAAU5R,GACpB,MAAOA,GAAK6R,YAAa,GAG1BA,SAAY,SAAU7R,GACrB,MAAOA,GAAK6R,YAAa,GAG1BC,QAAW,SAAU9R,GAGpB,GAAIuD,GAAWvD,EAAKuD,SAASC,aAC7B,OAAqB,UAAbD,KAA0BvD,EAAK8R,SAA0B,WAAbvO,KAA2BvD,EAAK+R,UAGrFA,SAAY,SAAU/R,GAOrB,MAJKA,GAAKmD,YACTnD,EAAKmD,WAAW6O,cAGVhS,EAAK+R,YAAa,GAI1BE,MAAS,SAAUjS,GAKlB,IAAMA,EAAOA,EAAK6O,WAAY7O,EAAMA,EAAOA,EAAK0L,YAC/C,GAAK1L,EAAKuC,SAAW,EACpB,OAAO,CAGT,QAAO,GAGR4J,OAAU,SAAUnM,GACnB,OAAQ6E,EAAKkC,QAAe,MAAG/G,IAIhCkS,OAAU,SAAUlS,GACnB,MAAOiI,GAAQgC,KAAMjK,EAAKuD,WAG3B4J,MAAS,SAAUnN,GAClB,MAAOgI,GAAQiC,KAAMjK,EAAKuD,WAG3B4O,OAAU,SAAUnS,GACnB,GAAIc,GAAOd,EAAKuD,SAASC,aACzB,OAAgB,UAAT1C,GAAkC,WAAdd,EAAKkC,MAA8B,WAATpB,GAGtDkC,KAAQ,SAAUhD,GACjB,GAAIqO,EACJ,OAAuC,UAAhCrO,EAAKuD,SAASC,eACN,SAAdxD,EAAKkC,OAImC,OAArCmM,EAAOrO,EAAKkK,aAAa,UAA2C,SAAvBmE,EAAK7K,gBAIvDpD,MAASyL,GAAuB,WAC/B,OAAS,KAGVvL,KAAQuL,GAAuB,SAAUE,EAAc7M,GACtD,OAASA,EAAS,KAGnBmB,GAAMwL,GAAuB,SAAUE,EAAc7M,EAAQ4M,GAC5D,OAAoB,EAAXA,EAAeA,EAAW5M,EAAS4M,KAG7CsG,KAAQvG,GAAuB,SAAUE,EAAc7M,GAEtD,IADA,GAAIe,GAAI,EACIf,EAAJe,EAAYA,GAAK,EACxB8L,EAAapO,KAAMsC,EAEpB,OAAO8L,KAGRsG,IAAOxG,GAAuB,SAAUE,EAAc7M,GAErD,IADA,GAAIe,GAAI,EACIf,EAAJe,EAAYA,GAAK,EACxB8L,EAAapO,KAAMsC,EAEpB,OAAO8L,KAGRuG,GAAMzG,GAAuB,SAAUE,EAAc7M,EAAQ4M,GAE5D,IADA,GAAI7L,GAAe,EAAX6L,EAAeA,EAAW5M,EAAS4M,IACjC7L,GAAK,GACd8L,EAAapO,KAAMsC,EAEpB,OAAO8L,KAGRwG,GAAM1G,GAAuB,SAAUE,EAAc7M,EAAQ4M,GAE5D,IADA,GAAI7L,GAAe,EAAX6L,EAAeA,EAAW5M,EAAS4M,IACjC7L,EAAIf,GACb6M,EAAapO,KAAMsC,EAEpB,OAAO8L,OAKVlH,EAAKkC,QAAa,IAAIlC,EAAKkC,QAAY,EAGvC,KAAM9G,KAAOuS,OAAO,EAAMC,UAAU,EAAMC,MAAM,EAAMC,UAAU,EAAMC,OAAO,GAC5E/N,EAAKkC,QAAS9G,GAAM0L,GAAmB1L,EAExC,KAAMA,KAAO4S,QAAQ,EAAMC,OAAO,GACjCjO,EAAKkC,QAAS9G,GAAM2L,GAAoB3L,EAIzC,SAASyQ,OACTA,GAAW3R,UAAY8F,EAAKkO,QAAUlO,EAAKkC,QAC3ClC,EAAK6L,WAAa,GAAIA,IAEtB1L,EAAWJ,GAAOI,SAAW,SAAU5G,EAAU4U,GAChD,GAAIpC,GAASzH,EAAO8J,EAAQ/Q,EAC3BgR,EAAO7J,EAAQ8J,EACfC,EAASnN,EAAY7H,EAAW,IAEjC,IAAKgV,EACJ,MAAOJ,GAAY,EAAII,EAAO3V,MAAO,EAGtCyV,GAAQ9U,EACRiL,KACA8J,EAAatO,EAAK0K,SAElB,OAAQ2D,EAAQ,GAGTtC,IAAYzH,EAAQjC,EAAOyC,KAAMuJ,OACjC/J,IAEJ+J,EAAQA,EAAMzV,MAAO0L,EAAM,GAAGjK,SAAYgU,GAE3C7J,EAAO1L,KAAOsV,OAGfrC,GAAU,GAGJzH,EAAQhC,EAAawC,KAAMuJ,MAChCtC,EAAUzH,EAAM2B,QAChBmI,EAAOtV,MACN8F,MAAOmN,EAEP1O,KAAMiH,EAAM,GAAGvH,QAASpD,EAAO,OAEhC0U,EAAQA,EAAMzV,MAAOmT,EAAQ1R,QAI9B,KAAMgD,IAAQ2C,GAAKiI,SACZ3D,EAAQ5B,EAAWrF,GAAOyH,KAAMuJ,KAAcC,EAAYjR,MAC9DiH,EAAQgK,EAAYjR,GAAQiH,MAC7ByH,EAAUzH,EAAM2B,QAChBmI,EAAOtV,MACN8F,MAAOmN,EACP1O,KAAMA,EACNiC,QAASgF,IAEV+J,EAAQA,EAAMzV,MAAOmT,EAAQ1R,QAI/B,KAAM0R,EACL,MAOF,MAAOoC,GACNE,EAAMhU,OACNgU,EACCtO,GAAO9C,MAAO1D,GAEd6H,EAAY7H,EAAUiL,GAAS5L,MAAO,GAGzC,SAAS2M,IAAY6I,GAIpB,IAHA,GAAIhT,GAAI,EACPM,EAAM0S,EAAO/T,OACbd,EAAW,GACAmC,EAAJN,EAASA,IAChB7B,GAAY6U,EAAOhT,GAAGwD,KAEvB,OAAOrF,GAGR,QAASiV,IAAevC,EAASwC,EAAYC,GAC5C,GAAIpE,GAAMmE,EAAWnE,IACpBqE,EAAmBD,GAAgB,eAARpE,EAC3BsE,EAAW3N,GAEZ,OAAOwN,GAAWlT,MAEjB,SAAUJ,EAAM3B,EAAS8R,GACxB,MAASnQ,EAAOA,EAAMmP,GACrB,GAAuB,IAAlBnP,EAAKuC,UAAkBiR,EAC3B,MAAO1C,GAAS9Q,EAAM3B,EAAS8R,IAMlC,SAAUnQ,EAAM3B,EAAS8R,GACxB,GAAIuD,GAAUtD,EACbuD,GAAa9N,EAAS4N,EAGvB,IAAKtD,GACJ,MAASnQ,EAAOA,EAAMmP,GACrB,IAAuB,IAAlBnP,EAAKuC,UAAkBiR,IACtB1C,EAAS9Q,EAAM3B,EAAS8R,GAC5B,OAAO,MAKV,OAASnQ,EAAOA,EAAMmP,GACrB,GAAuB,IAAlBnP,EAAKuC,UAAkBiR,EAAmB,CAE9C,GADApD,EAAapQ,EAAMyB,KAAczB,EAAMyB,QACjCiS,EAAWtD,EAAYjB,KAC5BuE,EAAU,KAAQ7N,GAAW6N,EAAU,KAAQD,EAG/C,MAAQE,GAAU,GAAMD,EAAU,EAMlC,IAHAtD,EAAYjB,GAAQwE,EAGdA,EAAU,GAAM7C,EAAS9Q,EAAM3B,EAAS8R,GAC7C,OAAO,IASf,QAASyD,IAAgBC,GACxB,MAAOA,GAAS3U,OAAS,EACxB,SAAUc,EAAM3B,EAAS8R,GACxB,GAAIlQ,GAAI4T,EAAS3U,MACjB,OAAQe,IACP,IAAM4T,EAAS5T,GAAID,EAAM3B,EAAS8R,GACjC,OAAO,CAGT,QAAO,GAER0D,EAAS,GAGX,QAASC,IAAkB1V,EAAU2V,EAAUnQ,GAG9C,IAFA,GAAI3D,GAAI,EACPM,EAAMwT,EAAS7U,OACJqB,EAAJN,EAASA,IAChB2E,GAAQxG,EAAU2V,EAAS9T,GAAI2D,EAEhC,OAAOA,GAGR,QAASoQ,IAAUjD,EAAWhR,EAAK+M,EAAQzO,EAAS8R,GAOnD,IANA,GAAInQ,GACHiU,KACAhU,EAAI,EACJM,EAAMwQ,EAAU7R,OAChBgV,EAAgB,MAAPnU,EAEEQ,EAAJN,EAASA,KACVD,EAAO+Q,EAAU9Q,OAChB6M,GAAUA,EAAQ9M,EAAM3B,EAAS8R,MACtC8D,EAAatW,KAAMqC,GACdkU,GACJnU,EAAIpC,KAAMsC,GAMd,OAAOgU,GAGR,QAASE,IAAY5E,EAAWnR,EAAU0S,EAASsD,EAAYC,EAAYC,GAO1E,MANKF,KAAeA,EAAY3S,KAC/B2S,EAAaD,GAAYC,IAErBC,IAAeA,EAAY5S,KAC/B4S,EAAaF,GAAYE,EAAYC,IAE/BvJ,GAAa,SAAU7B,EAAMtF,EAASvF,EAAS8R,GACrD,GAAIoE,GAAMtU,EAAGD,EACZwU,KACAC,KACAC,EAAc9Q,EAAQ1E,OAGtBM,EAAQ0J,GAAQ4K,GAAkB1V,GAAY,IAAKC,EAAQkE,UAAalE,GAAYA,MAGpFsW,GAAYpF,IAAerG,GAAS9K,EAEnCoB,EADAwU,GAAUxU,EAAOgV,EAAQjF,EAAWlR,EAAS8R,GAG9CyE,EAAa9D,EAEZuD,IAAgBnL,EAAOqG,EAAYmF,GAAeN,MAMjDxQ,EACD+Q,CAQF,IALK7D,GACJA,EAAS6D,EAAWC,EAAYvW,EAAS8R,GAIrCiE,EAAa,CACjBG,EAAOP,GAAUY,EAAYH,GAC7BL,EAAYG,KAAUlW,EAAS8R,GAG/BlQ,EAAIsU,EAAKrV,MACT,OAAQe,KACDD,EAAOuU,EAAKtU,MACjB2U,EAAYH,EAAQxU,MAAS0U,EAAWF,EAAQxU,IAAOD,IAK1D,GAAKkJ,GACJ,GAAKmL,GAAc9E,EAAY,CAC9B,GAAK8E,EAAa,CAEjBE,KACAtU,EAAI2U,EAAW1V,MACf,OAAQe,KACDD,EAAO4U,EAAW3U,KAEvBsU,EAAK5W,KAAOgX,EAAU1U,GAAKD,EAG7BqU,GAAY,KAAOO,KAAkBL,EAAMpE,GAI5ClQ,EAAI2U,EAAW1V,MACf,OAAQe,KACDD,EAAO4U,EAAW3U,MACtBsU,EAAOF,EAAazW,EAASsL,EAAMlJ,GAASwU,EAAOvU,IAAM,KAE1DiJ,EAAKqL,KAAU3Q,EAAQ2Q,GAAQvU,SAOlC4U,GAAaZ,GACZY,IAAehR,EACdgR,EAAWjU,OAAQ+T,EAAaE,EAAW1V,QAC3C0V,GAEGP,EACJA,EAAY,KAAMzQ,EAASgR,EAAYzE,GAEvCxS,EAAKuC,MAAO0D,EAASgR,KAMzB,QAASC,IAAmB5B,GAwB3B,IAvBA,GAAI6B,GAAchE,EAAStQ,EAC1BD,EAAM0S,EAAO/T,OACb6V,EAAkBlQ,EAAKoK,SAAUgE,EAAO,GAAG/Q,MAC3C8S,EAAmBD,GAAmBlQ,EAAKoK,SAAS,KACpDhP,EAAI8U,EAAkB,EAAI,EAG1BE,EAAe5B,GAAe,SAAUrT,GACvC,MAAOA,KAAS8U,GACdE,GAAkB,GACrBE,EAAkB7B,GAAe,SAAUrT,GAC1C,MAAOpC,GAASkX,EAAc9U,GAAS,IACrCgV,GAAkB,GACrBnB,GAAa,SAAU7T,EAAM3B,EAAS8R,GACrC,GAAI1Q,IAASsV,IAAqB5E,GAAO9R,IAAY8G,MACnD2P,EAAezW,GAASkE,SACxB0S,EAAcjV,EAAM3B,EAAS8R,GAC7B+E,EAAiBlV,EAAM3B,EAAS8R,GAGlC,OADA2E,GAAe,KACRrV,IAGGc,EAAJN,EAASA,IAChB,GAAM6Q,EAAUjM,EAAKoK,SAAUgE,EAAOhT,GAAGiC,MACxC2R,GAAaR,GAAcO,GAAgBC,GAAY/C,QACjD,CAIN,GAHAA,EAAUjM,EAAKiI,OAAQmG,EAAOhT,GAAGiC,MAAOhC,MAAO,KAAM+S,EAAOhT,GAAGkE,SAG1D2M,EAASrP,GAAY,CAGzB,IADAjB,IAAMP,EACMM,EAAJC,EAASA,IAChB,GAAKqE,EAAKoK,SAAUgE,EAAOzS,GAAG0B,MAC7B,KAGF,OAAOiS,IACNlU,EAAI,GAAK2T,GAAgBC,GACzB5T,EAAI,GAAKmK,GAER6I,EAAOxV,MAAO,EAAGwC,EAAI,GAAIvC,QAAS+F,MAAgC,MAAzBwP,EAAQhT,EAAI,GAAIiC,KAAe,IAAM,MAC7EN,QAASpD,EAAO,MAClBsS,EACItQ,EAAJP,GAAS4U,GAAmB5B,EAAOxV,MAAOwC,EAAGO,IACzCD,EAAJC,GAAWqU,GAAoB5B,EAASA,EAAOxV,MAAO+C,IAClDD,EAAJC,GAAW4J,GAAY6I,IAGzBY,EAASlW,KAAMmT,GAIjB,MAAO8C,IAAgBC,GAGxB,QAASsB,IAA0BC,EAAiBC,GACnD,GAAIC,GAAQD,EAAYnW,OAAS,EAChCqW,EAAYH,EAAgBlW,OAAS,EACrCsW,EAAe,SAAUtM,EAAM7K,EAAS8R,EAAKvM,EAAS6R,GACrD,GAAIzV,GAAMQ,EAAGsQ,EACZ4E,EAAe,EACfzV,EAAI,IACJ8Q,EAAY7H,MACZyM,KACAC,EAAgBzQ,EAEhB3F,EAAQ0J,GAAQqM,GAAa1Q,EAAKgI,KAAU,IAAG,IAAK4I,GAEpDI,EAAiBhQ,GAA4B,MAAjB+P,EAAwB,EAAIlU,KAAKC,UAAY,GACzEpB,EAAMf,EAAMN,MAUb,KARKuW,IACJtQ,EAAmB9G,IAAYnB,GAAYmB,GAOpC4B,IAAMM,GAA4B,OAApBP,EAAOR,EAAMS,IAAaA,IAAM,CACrD,GAAKsV,GAAavV,EAAO,CACxBQ,EAAI,CACJ,OAASsQ,EAAUsE,EAAgB5U,KAClC,GAAKsQ,EAAS9Q,EAAM3B,EAAS8R,GAAQ,CACpCvM,EAAQjG,KAAMqC,EACd,OAGGyV,IACJ5P,EAAUgQ,GAKPP,KAEEtV,GAAQ8Q,GAAW9Q,IACxB0V,IAIIxM,GACJ6H,EAAUpT,KAAMqC,IAOnB,GADA0V,GAAgBzV,EACXqV,GAASrV,IAAMyV,EAAe,CAClClV,EAAI,CACJ,OAASsQ,EAAUuE,EAAY7U,KAC9BsQ,EAASC,EAAW4E,EAAYtX,EAAS8R,EAG1C,IAAKjH,EAAO,CAEX,GAAKwM,EAAe,EACnB,MAAQzV,IACA8Q,EAAU9Q,IAAM0V,EAAW1V,KACjC0V,EAAW1V,GAAKsG,EAAInH,KAAMwE,GAM7B+R,GAAa3B,GAAU2B,GAIxBhY,EAAKuC,MAAO0D,EAAS+R,GAGhBF,IAAcvM,GAAQyM,EAAWzW,OAAS,GAC5CwW,EAAeL,EAAYnW,OAAW,GAExC0F,GAAO4J,WAAY5K,GAUrB,MALK6R,KACJ5P,EAAUgQ,EACV1Q,EAAmByQ,GAGb7E,EAGT,OAAOuE,GACNvK,GAAcyK,GACdA,EA+KF,MA5KAvQ,GAAUL,GAAOK,QAAU,SAAU7G,EAAU+K,GAC9C,GAAIlJ,GACHoV,KACAD,KACAhC,EAASlN,EAAe9H,EAAW,IAEpC,KAAMgV,EAAS,CAERjK,IACLA,EAAQnE,EAAU5G,IAEnB6B,EAAIkJ,EAAMjK,MACV,OAAQe,IACPmT,EAASyB,GAAmB1L,EAAMlJ,IAC7BmT,EAAQ3R,GACZ4T,EAAY1X,KAAMyV,GAElBgC,EAAgBzX,KAAMyV,EAKxBA,GAASlN,EAAe9H,EAAU+W,GAA0BC,EAAiBC,IAG7EjC,EAAOhV,SAAWA,EAEnB,MAAOgV,IAYRlO,EAASN,GAAOM,OAAS,SAAU9G,EAAUC,EAASuF,EAASsF,GAC9D,GAAIjJ,GAAGgT,EAAQ6C,EAAO5T,EAAM2K,EAC3BkJ,EAA+B,kBAAb3X,IAA2BA,EAC7C+K,GAASD,GAAQlE,EAAW5G,EAAW2X,EAAS3X,UAAYA,EAK7D,IAHAwF,EAAUA,MAGY,IAAjBuF,EAAMjK,OAAe,CAIzB,GADA+T,EAAS9J,EAAM,GAAKA,EAAM,GAAG1L,MAAO,GAC/BwV,EAAO/T,OAAS,GAAkC,QAA5B4W,EAAQ7C,EAAO,IAAI/Q,MAC5CjE,EAAQ0O,SAAgC,IAArBtO,EAAQkE,UAAkBiD,GAC7CX,EAAKoK,SAAUgE,EAAO,GAAG/Q,MAAS,CAGnC,GADA7D,GAAYwG,EAAKgI,KAAS,GAAGiJ,EAAM3R,QAAQ,GAAGvC,QAAQ0G,GAAWC,IAAYlK,QAAkB,IACzFA,EACL,MAAOuF,EAGImS,KACX1X,EAAUA,EAAQ8E,YAGnB/E,EAAWA,EAASX,MAAOwV,EAAOnI,QAAQrH,MAAMvE,QAIjDe,EAAIsH,EAAwB,aAAE0C,KAAM7L,GAAa,EAAI6U,EAAO/T,MAC5D,OAAQe,IAAM,CAIb,GAHA6V,EAAQ7C,EAAOhT,GAGV4E,EAAKoK,SAAW/M,EAAO4T,EAAM5T,MACjC,KAED,KAAM2K,EAAOhI,EAAKgI,KAAM3K,MAEjBgH,EAAO2D,EACZiJ,EAAM3R,QAAQ,GAAGvC,QAAS0G,GAAWC,IACrCH,GAAS6B,KAAMgJ,EAAO,GAAG/Q,OAAUmI,GAAahM,EAAQ8E,aAAgB9E,IACpE,CAKJ,GAFA4U,EAAOtS,OAAQV,EAAG,GAClB7B,EAAW8K,EAAKhK,QAAUkL,GAAY6I,IAChC7U,EAEL,MADAT,GAAKuC,MAAO0D,EAASsF,GACdtF,CAGR,SAeJ,OAPEmS,GAAY9Q,EAAS7G,EAAU+K,IAChCD,EACA7K,GACCmH,EACD5B,EACAwE,GAAS6B,KAAM7L,IAAciM,GAAahM,EAAQ8E,aAAgB9E,GAE5DuF,GAMR3F,EAAQ0Q,WAAalN,EAAQkD,MAAM,IAAIjE,KAAMyF,GAAYmE,KAAK,MAAQ7I,EAItExD,EAAQyQ,mBAAqBrJ,EAG7BC,IAIArH,EAAQ6P,aAAe9C,GAAO,SAAUgL,GAEvC,MAAuE,GAAhEA,EAAKtI,wBAAyBxQ,EAAS6F,cAAc,UAMvDiI,GAAO,SAAUC,GAEtB,MADAA,GAAIiC,UAAY,mBAC+B,MAAxCjC,EAAI4D,WAAW3E,aAAa,WAEnCgB,GAAW,yBAA0B,SAAUlL,EAAMc,EAAMiE,GAC1D,MAAMA,GAAN,OACQ/E,EAAKkK,aAAcpJ,EAA6B,SAAvBA,EAAK0C,cAA2B,EAAI,KAOjEvF,EAAQ6I,YAAekE,GAAO,SAAUC,GAG7C,MAFAA,GAAIiC,UAAY,WAChBjC,EAAI4D,WAAW1E,aAAc,QAAS,IACY,KAA3Cc,EAAI4D,WAAW3E,aAAc,YAEpCgB,GAAW,QAAS,SAAUlL,EAAMc,EAAMiE,GACzC,MAAMA,IAAyC,UAAhC/E,EAAKuD,SAASC,cAA7B,OACQxD,EAAKiW,eAOTjL,GAAO,SAAUC,GACtB,MAAuC,OAAhCA,EAAIf,aAAa,eAExBgB,GAAWxE,EAAU,SAAU1G,EAAMc,EAAMiE,GAC1C,GAAIuJ,EACJ,OAAMvJ,GAAN,OACQ/E,EAAMc,MAAW,EAAOA,EAAK0C,eACjC8K,EAAMtO,EAAKgN,iBAAkBlM,KAAWwN,EAAIC,UAC7CD,EAAI7K,MACL,OAKGmB,IAEHvH,EAIJc,GAAO0O,KAAOjI,EACdzG,EAAOgQ,KAAOvJ,EAAOmK,UACrB5Q,EAAOgQ,KAAK,KAAOhQ,EAAOgQ,KAAKpH,QAC/B5I,EAAO+X,OAAStR,EAAO4J,WACvBrQ,EAAO6E,KAAO4B,EAAOE,QACrB3G,EAAOgY,SAAWvR,EAAOG,MACzB5G,EAAOwH,SAAWf,EAAOe,QAIzB,IAAIyQ,GAAgBjY,EAAOgQ,KAAKhF,MAAMpB,aAElCsO,EAAa,6BAIbC,EAAY,gBAGhB,SAASC,GAAQnI,EAAUoI,EAAW3F,GACrC,GAAK1S,EAAOkD,WAAYmV,GACvB,MAAOrY,GAAO6F,KAAMoK,EAAU,SAAUpO,EAAMC,GAE7C,QAASuW,EAAUpX,KAAMY,EAAMC,EAAGD,KAAW6Q,GAK/C,IAAK2F,EAAUjU,SACd,MAAOpE,GAAO6F,KAAMoK,EAAU,SAAUpO,GACvC,MAASA,KAASwW,IAAgB3F,GAKpC,IAA0B,gBAAd2F,GAAyB,CACpC,GAAKF,EAAUrM,KAAMuM,GACpB,MAAOrY,GAAO2O,OAAQ0J,EAAWpI,EAAUyC,EAG5C2F,GAAYrY,EAAO2O,OAAQ0J,EAAWpI,GAGvC,MAAOjQ,GAAO6F,KAAMoK,EAAU,SAAUpO,GACvC,MAASpC,GAAQwB,KAAMoX,EAAWxW,IAAU,IAAQ6Q,IAItD1S,EAAO2O,OAAS,SAAUqB,EAAM3O,EAAOqR,GACtC,GAAI7Q,GAAOR,EAAO,EAMlB,OAJKqR,KACJ1C,EAAO,QAAUA,EAAO,KAGD,IAAjB3O,EAAMN,QAAkC,IAAlBc,EAAKuC,SACjCpE,EAAO0O,KAAKO,gBAAiBpN,EAAMmO,IAAWnO,MAC9C7B,EAAO0O,KAAK1I,QAASgK,EAAMhQ,EAAO6F,KAAMxE,EAAO,SAAUQ,GACxD,MAAyB,KAAlBA,EAAKuC,aAIfpE,EAAOG,GAAGsC,QACTiM,KAAM,SAAUzO,GACf,GAAI6B,GACHM,EAAMjD,KAAK4B,OACXO,KACAgX,EAAOnZ,IAER,IAAyB,gBAAbc,GACX,MAAOd,MAAKiC,UAAWpB,EAAQC,GAAW0O,OAAO,WAChD,IAAM7M,EAAI,EAAOM,EAAJN,EAASA,IACrB,GAAK9B,EAAOwH,SAAU8Q,EAAMxW,GAAK3C,MAChC,OAAO,IAMX,KAAM2C,EAAI,EAAOM,EAAJN,EAASA,IACrB9B,EAAO0O,KAAMzO,EAAUqY,EAAMxW,GAAKR,EAMnC,OAFAA,GAAMnC,KAAKiC,UAAWgB,EAAM,EAAIpC,EAAO+X,OAAQzW,GAAQA,GACvDA,EAAIrB,SAAWd,KAAKc,SAAWd,KAAKc,SAAW,IAAMA,EAAWA,EACzDqB,GAERqN,OAAQ,SAAU1O,GACjB,MAAOd,MAAKiC,UAAWgX,EAAOjZ,KAAMc,OAAgB,KAErDyS,IAAK,SAAUzS,GACd,MAAOd,MAAKiC,UAAWgX,EAAOjZ,KAAMc,OAAgB,KAErDsY,GAAI,SAAUtY,GACb,QAASmY,EACRjZ,KAIoB,gBAAbc,IAAyBgY,EAAcnM,KAAM7L,GACnDD,EAAQC,GACRA,OACD,GACCc,SASJ,IAAIyX,GAKHxO,EAAa,sCAEb5J,EAAOJ,EAAOG,GAAGC,KAAO,SAAUH,EAAUC,GAC3C,GAAI8K,GAAOnJ,CAGX,KAAM5B,EACL,MAAOd,KAIR,IAAyB,gBAAbc,GAAwB,CAUnC,GAPC+K,EAFoB,MAAhB/K,EAAS,IAAkD,MAApCA,EAAUA,EAASc,OAAS,IAAed,EAASc,QAAU,GAE/E,KAAMd,EAAU,MAGlB+J,EAAWwB,KAAMvL,IAIrB+K,IAAUA,EAAM,IAAO9K,EAgDrB,OAAMA,GAAWA,EAAQW,QACtBX,GAAWsY,GAAa9J,KAAMzO,GAKhCd,KAAK2B,YAAaZ,GAAUwO,KAAMzO,EAnDzC,IAAK+K,EAAM,GAAK,CAYf,GAXA9K,EAAUA,YAAmBF,GAASE,EAAQ,GAAKA,EAInDF,EAAOuB,MAAOpC,KAAMa,EAAOyY,UAC1BzN,EAAM,GACN9K,GAAWA,EAAQkE,SAAWlE,EAAQqL,eAAiBrL,EAAUnB,GACjE,IAIImZ,EAAWpM,KAAMd,EAAM,KAAQhL,EAAOmD,cAAejD,GACzD,IAAM8K,IAAS9K,GAETF,EAAOkD,WAAY/D,KAAM6L,IAC7B7L,KAAM6L,GAAS9K,EAAS8K,IAIxB7L,KAAK+Q,KAAMlF,EAAO9K,EAAS8K,GAK9B,OAAO7L,MAgBP,MAZA0C,GAAO9C,EAAS0M,eAAgBT,EAAM,IAIjCnJ,GAAQA,EAAKmD,aAEjB7F,KAAK4B,OAAS,EACd5B,KAAK,GAAK0C,GAGX1C,KAAKe,QAAUnB,EACfI,KAAKc,SAAWA,EACTd,KAcH,MAAKc,GAASmE,UACpBjF,KAAKe,QAAUf,KAAK,GAAKc,EACzBd,KAAK4B,OAAS,EACP5B,MAIIa,EAAOkD,WAAYjD,GACK,mBAArBuY,GAAWE,MACxBF,EAAWE,MAAOzY,GAElBA,EAAUD,IAGeqD,SAAtBpD,EAASA,WACbd,KAAKc,SAAWA,EAASA,SACzBd,KAAKe,QAAUD,EAASC,SAGlBF,EAAOwF,UAAWvF,EAAUd,OAIrCiB,GAAKQ,UAAYZ,EAAOG,GAGxBqY,EAAaxY,EAAQjB,EAGrB,IAAI4Z,GAAe,iCAElBC,GACCC,UAAU,EACVC,UAAU,EACVC,MAAM,EACNC,MAAM,EAGRhZ,GAAOyC,QACNuO,IAAK,SAAUnP,EAAMmP,EAAKiI,GACzB,GAAIxG,MACHyG,EAAqB7V,SAAV4V,CAEZ,QAASpX,EAAOA,EAAMmP,KAA4B,IAAlBnP,EAAKuC,SACpC,GAAuB,IAAlBvC,EAAKuC,SAAiB,CAC1B,GAAK8U,GAAYlZ,EAAQ6B,GAAO0W,GAAIU,GACnC,KAEDxG,GAAQjT,KAAMqC,GAGhB,MAAO4Q,IAGR0G,QAAS,SAAUC,EAAGvX,GAGrB,IAFA,GAAI4Q,MAEI2G,EAAGA,EAAIA,EAAE7L,YACI,IAAf6L,EAAEhV,UAAkBgV,IAAMvX,GAC9B4Q,EAAQjT,KAAM4Z,EAIhB,OAAO3G,MAITzS,EAAOG,GAAGsC,QACToQ,IAAK,SAAU7P,GACd,GAAIqW,GAAUrZ,EAAQgD,EAAQ7D,MAC7Bma,EAAID,EAAQtY,MAEb,OAAO5B,MAAKwP,OAAO,WAElB,IADA,GAAI7M,GAAI,EACIwX,EAAJxX,EAAOA,IACd,GAAK9B,EAAOwH,SAAUrI,KAAMka,EAAQvX,IACnC,OAAO,KAMXyX,QAAS,SAAU3I,EAAW1Q,GAS7B,IARA,GAAIkN,GACHtL,EAAI,EACJwX,EAAIna,KAAK4B,OACT0R,KACA+G,EAAMvB,EAAcnM,KAAM8E,IAAoC,gBAAdA,GAC/C5Q,EAAQ4Q,EAAW1Q,GAAWf,KAAKe,SACnC,EAEUoZ,EAAJxX,EAAOA,IACd,IAAMsL,EAAMjO,KAAK2C,GAAIsL,GAAOA,IAAQlN,EAASkN,EAAMA,EAAIpI,WAEtD,GAAKoI,EAAIhJ,SAAW,KAAOoV,EAC1BA,EAAIC,MAAMrM,GAAO,GAGA,IAAjBA,EAAIhJ,UACHpE,EAAO0O,KAAKO,gBAAgB7B,EAAKwD,IAAc,CAEhD6B,EAAQjT,KAAM4N,EACd,OAKH,MAAOjO,MAAKiC,UAAWqR,EAAQ1R,OAAS,EAAIf,EAAO+X,OAAQtF,GAAYA,IAIxEgH,MAAO,SAAU5X,GAGhB,MAAMA,GAKe,gBAATA,GACJpC,EAAQwB,KAAMjB,EAAQ6B,GAAQ1C,KAAM,IAIrCM,EAAQwB,KAAM9B,KAGpB0C,EAAKhB,OAASgB,EAAM,GAAMA,GAZjB1C,KAAM,IAAOA,KAAM,GAAI6F,WAAe7F,KAAK8C,QAAQyX,UAAU3Y,OAAS,IAgBjF4Y,IAAK,SAAU1Z,EAAUC,GACxB,MAAOf,MAAKiC,UACXpB,EAAO+X,OACN/X,EAAOuB,MAAOpC,KAAK+B,MAAOlB,EAAQC,EAAUC,OAK/C0Z,QAAS,SAAU3Z,GAClB,MAAOd,MAAKwa,IAAiB,MAAZ1Z,EAChBd,KAAKqC,WAAarC,KAAKqC,WAAWmN,OAAO1O,MAK5C,SAASkZ,GAAS/L,EAAK4D,GACtB,OAAS5D,EAAMA,EAAI4D,KAA0B,IAAjB5D,EAAIhJ,UAChC,MAAOgJ,GAGRpN,EAAOyB,MACNuM,OAAQ,SAAUnM,GACjB,GAAImM,GAASnM,EAAKmD,UAClB,OAAOgJ,IAA8B,KAApBA,EAAO5J,SAAkB4J,EAAS,MAEpD6L,QAAS,SAAUhY,GAClB,MAAO7B,GAAOgR,IAAKnP,EAAM,eAE1BiY,aAAc,SAAUjY,EAAMC,EAAGmX,GAChC,MAAOjZ,GAAOgR,IAAKnP,EAAM,aAAcoX,IAExCF,KAAM,SAAUlX,GACf,MAAOsX,GAAStX,EAAM,gBAEvBmX,KAAM,SAAUnX,GACf,MAAOsX,GAAStX,EAAM,oBAEvBkY,QAAS,SAAUlY,GAClB,MAAO7B,GAAOgR,IAAKnP,EAAM,gBAE1B6X,QAAS,SAAU7X,GAClB,MAAO7B,GAAOgR,IAAKnP,EAAM,oBAE1BmY,UAAW,SAAUnY,EAAMC,EAAGmX,GAC7B,MAAOjZ,GAAOgR,IAAKnP,EAAM,cAAeoX,IAEzCgB,UAAW,SAAUpY,EAAMC,EAAGmX,GAC7B,MAAOjZ,GAAOgR,IAAKnP,EAAM,kBAAmBoX,IAE7CiB,SAAU,SAAUrY,GACnB,MAAO7B,GAAOmZ,SAAWtX,EAAKmD,gBAAmB0L,WAAY7O,IAE9DgX,SAAU,SAAUhX,GACnB,MAAO7B,GAAOmZ,QAAStX,EAAK6O,aAE7BoI,SAAU,SAAUjX,GACnB,MAAOA,GAAKsY,iBAAmBna,EAAOuB,SAAWM,EAAK+I,cAErD,SAAUjI,EAAMxC,GAClBH,EAAOG,GAAIwC,GAAS,SAAUsW,EAAOhZ,GACpC,GAAIwS,GAAUzS,EAAO4B,IAAKzC,KAAMgB,EAAI8Y,EAsBpC,OApB0B,UAArBtW,EAAKrD,MAAO,MAChBW,EAAWgZ,GAGPhZ,GAAgC,gBAAbA,KACvBwS,EAAUzS,EAAO2O,OAAQ1O,EAAUwS,IAG/BtT,KAAK4B,OAAS,IAEZ6X,EAAkBjW,IACvB3C,EAAO+X,OAAQtF,GAIXkG,EAAa7M,KAAMnJ,IACvB8P,EAAQ2H,WAIHjb,KAAKiC,UAAWqR,KAGzB,IAAI4H,GAAY,OAKZC,IAGJ,SAASC,GAAe7X,GACvB,GAAI8X,GAASF,EAAc5X,KAI3B,OAHA1C,GAAOyB,KAAMiB,EAAQsI,MAAOqP,OAAmB,SAAUhQ,EAAGoQ,GAC3DD,EAAQC,IAAS,IAEXD,EAyBRxa,EAAO0a,UAAY,SAAUhY,GAI5BA,EAA6B,gBAAZA,GACd4X,EAAc5X,IAAa6X,EAAe7X,GAC5C1C,EAAOyC,UAAYC,EAEpB,IACCiY,GAEAC,EAEAC,EAEAC,EAEAC,EAEAC,EAEA1S,KAEA2S,GAASvY,EAAQwY,SAEjBC,EAAO,SAAUC,GAOhB,IANAT,EAASjY,EAAQiY,QAAUS,EAC3BR,GAAQ,EACRI,EAAcF,GAAe,EAC7BA,EAAc,EACdC,EAAezS,EAAKvH,OACpB8Z,GAAS,EACDvS,GAAsByS,EAAdC,EAA4BA,IAC3C,GAAK1S,EAAM0S,GAAcjZ,MAAOqZ,EAAM,GAAKA,EAAM,OAAU,GAAS1Y,EAAQ2Y,YAAc,CACzFV,GAAS,CACT,OAGFE,GAAS,EACJvS,IACC2S,EACCA,EAAMla,QACVoa,EAAMF,EAAMtO,SAEFgO,EACXrS,KAEAgQ,EAAKgD,YAKRhD,GAECqB,IAAK,WACJ,GAAKrR,EAAO,CAEX,GAAI6J,GAAQ7J,EAAKvH,QACjB,QAAU4Y,GAAKhY,GACd3B,EAAOyB,KAAME,EAAM,SAAU0I,EAAGnE,GAC/B,GAAInC,GAAO/D,EAAO+D,KAAMmC,EACV,cAATnC,EACErB,EAAQqV,QAAWO,EAAKzF,IAAK3M,IAClCoC,EAAK9I,KAAM0G,GAEDA,GAAOA,EAAInF,QAAmB,WAATgD,GAEhC4V,EAAKzT,MAGJlE,WAGC6Y,EACJE,EAAezS,EAAKvH,OAGT4Z,IACXG,EAAc3I,EACdgJ,EAAMR,IAGR,MAAOxb,OAGRoc,OAAQ,WAkBP,MAjBKjT,IACJtI,EAAOyB,KAAMO,UAAW,SAAUqI,EAAGnE,GACpC,GAAIuT,EACJ,QAAUA,EAAQzZ,EAAO2F,QAASO,EAAKoC,EAAMmR,IAAY,GACxDnR,EAAK9F,OAAQiX,EAAO,GAEfoB,IACUE,GAATtB,GACJsB,IAEaC,GAATvB,GACJuB,OAME7b,MAIR0T,IAAK,SAAU1S,GACd,MAAOA,GAAKH,EAAO2F,QAASxF,EAAImI,GAAS,MAASA,IAAQA,EAAKvH,SAGhE+S,MAAO,WAGN,MAFAxL,MACAyS,EAAe,EACR5b,MAGRmc,QAAS,WAER,MADAhT,GAAO2S,EAAQN,EAAStX,OACjBlE,MAGRuU,SAAU,WACT,OAAQpL,GAGTkT,KAAM,WAKL,MAJAP,GAAQ5X,OACFsX,GACLrC,EAAKgD,UAECnc,MAGRsc,OAAQ,WACP,OAAQR,GAGTS,SAAU,SAAUxb,EAASyB,GAU5B,OATK2G,GAAWsS,IAASK,IACxBtZ,EAAOA,MACPA,GAASzB,EAASyB,EAAKrC,MAAQqC,EAAKrC,QAAUqC,GACzCkZ,EACJI,EAAMzb,KAAMmC,GAEZwZ,EAAMxZ,IAGDxC,MAGRgc,KAAM,WAEL,MADA7C,GAAKoD,SAAUvc,KAAM6C,WACd7C,MAGRyb,MAAO,WACN,QAASA,GAIZ,OAAOtC,IAIRtY,EAAOyC,QAENkZ,SAAU,SAAUC,GACnB,GAAIC,KAEA,UAAW,OAAQ7b,EAAO0a,UAAU,eAAgB,aACpD,SAAU,OAAQ1a,EAAO0a,UAAU,eAAgB,aACnD,SAAU,WAAY1a,EAAO0a,UAAU,YAE1CoB,EAAQ,UACRC,GACCD,MAAO,WACN,MAAOA,IAERE,OAAQ,WAEP,MADAC,GAAStU,KAAM3F,WAAYka,KAAMla,WAC1B7C,MAERgd,KAAM,WACL,GAAIC,GAAMpa,SACV,OAAOhC,GAAO2b,SAAS,SAAUU,GAChCrc,EAAOyB,KAAMoa,EAAQ,SAAU/Z,EAAGwa,GACjC,GAAInc,GAAKH,EAAOkD,WAAYkZ,EAAKta,KAASsa,EAAKta,EAE/Cma,GAAUK,EAAM,IAAK,WACpB,GAAIC,GAAWpc,GAAMA,EAAG4B,MAAO5C,KAAM6C,UAChCua,IAAYvc,EAAOkD,WAAYqZ,EAASR,SAC5CQ,EAASR,UACPpU,KAAM0U,EAASG,SACfN,KAAMG,EAASI,QACfC,SAAUL,EAASM,QAErBN,EAAUC,EAAO,GAAM,QAAUnd,OAAS4c,EAAUM,EAASN,UAAY5c,KAAMgB,GAAOoc,GAAava,eAItGoa,EAAM,OACJL,WAIJA,QAAS,SAAUjY,GAClB,MAAc,OAAPA,EAAc9D,EAAOyC,OAAQqB,EAAKiY,GAAYA,IAGvDE,IAwCD,OArCAF,GAAQa,KAAOb,EAAQI,KAGvBnc,EAAOyB,KAAMoa,EAAQ,SAAU/Z,EAAGwa,GACjC,GAAIhU,GAAOgU,EAAO,GACjBO,EAAcP,EAAO,EAGtBP,GAASO,EAAM,IAAOhU,EAAKqR,IAGtBkD,GACJvU,EAAKqR,IAAI,WAERmC,EAAQe,GAGNhB,EAAY,EAAJ/Z,GAAS,GAAIwZ,QAASO,EAAQ,GAAK,GAAIL,MAInDS,EAAUK,EAAM,IAAO,WAEtB,MADAL,GAAUK,EAAM,GAAK,QAAUnd,OAAS8c,EAAWF,EAAU5c,KAAM6C,WAC5D7C,MAER8c,EAAUK,EAAM,GAAK,QAAWhU,EAAKoT,WAItCK,EAAQA,QAASE,GAGZL,GACJA,EAAK3a,KAAMgb,EAAUA,GAIfA,GAIRa,KAAM,SAAUC,GACf,GAAIjb,GAAI,EACPkb,EAAgB1d,EAAM2B,KAAMe,WAC5BjB,EAASic,EAAcjc,OAGvBkc,EAAuB,IAAXlc,GAAkBgc,GAAe/c,EAAOkD,WAAY6Z,EAAYhB,SAAchb,EAAS,EAGnGkb,EAAyB,IAAdgB,EAAkBF,EAAc/c,EAAO2b,WAGlDuB,EAAa,SAAUpb,EAAG8T,EAAUuH,GACnC,MAAO,UAAU7X,GAChBsQ,EAAU9T,GAAM3C,KAChBge,EAAQrb,GAAME,UAAUjB,OAAS,EAAIzB,EAAM2B,KAAMe,WAAcsD,EAC1D6X,IAAWC,EACfnB,EAASoB,WAAYzH,EAAUuH,KACfF,GAChBhB,EAASqB,YAAa1H,EAAUuH,KAKnCC,EAAgBG,EAAkBC,CAGnC,IAAKzc,EAAS,EAIb,IAHAqc,EAAiB,GAAIpZ,OAAOjD,GAC5Bwc,EAAmB,GAAIvZ,OAAOjD,GAC9Byc,EAAkB,GAAIxZ,OAAOjD,GACjBA,EAAJe,EAAYA,IACdkb,EAAelb,IAAO9B,EAAOkD,WAAY8Z,EAAelb,GAAIia,SAChEiB,EAAelb,GAAIia,UACjBpU,KAAMuV,EAAYpb,EAAG0b,EAAiBR,IACtCd,KAAMD,EAASQ,QACfC,SAAUQ,EAAYpb,EAAGyb,EAAkBH,MAE3CH,CAUL,OAJMA,IACLhB,EAASqB,YAAaE,EAAiBR,GAGjCf,EAASF,YAMlB,IAAI0B,EAEJzd,GAAOG,GAAGuY,MAAQ,SAAUvY,GAI3B,MAFAH,GAAO0Y,MAAMqD,UAAUpU,KAAMxH,GAEtBhB,MAGRa,EAAOyC,QAENiB,SAAS,EAITga,UAAW,EAGXC,UAAW,SAAUC,GACfA,EACJ5d,EAAO0d,YAEP1d,EAAO0Y,OAAO,IAKhBA,MAAO,SAAUmF,IAGXA,KAAS,IAAS7d,EAAO0d,UAAY1d,EAAO0D,WAKjD1D,EAAO0D,SAAU,EAGZma,KAAS,KAAU7d,EAAO0d,UAAY,IAK3CD,EAAUH,YAAave,GAAYiB,IAG9BA,EAAOG,GAAG2d,iBACd9d,EAAQjB,GAAW+e,eAAgB,SACnC9d,EAAQjB,GAAWgf,IAAK,cAQ3B,SAASC,KACRjf,EAASkf,oBAAqB,mBAAoBD,GAAW,GAC7D9e,EAAO+e,oBAAqB,OAAQD,GAAW,GAC/Che,EAAO0Y,QAGR1Y,EAAO0Y,MAAMqD,QAAU,SAAUjY,GAqBhC,MApBM2Z,KAELA,EAAYzd,EAAO2b,WAKU,aAAxB5c,EAASmf,WAEbC,WAAYne,EAAO0Y,QAKnB3Z,EAASqP,iBAAkB,mBAAoB4P,GAAW,GAG1D9e,EAAOkP,iBAAkB,OAAQ4P,GAAW,KAGvCP,EAAU1B,QAASjY,IAI3B9D,EAAO0Y,MAAMqD,SAOb,IAAIqC,GAASpe,EAAOoe,OAAS,SAAU/c,EAAOlB,EAAIsM,EAAKnH,EAAO+Y,EAAWC,EAAUC,GAClF,GAAIzc,GAAI,EACPM,EAAMf,EAAMN,OACZyd,EAAc,MAAP/R,CAGR,IAA4B,WAAvBzM,EAAO+D,KAAM0I,GAAqB,CACtC4R,GAAY,CACZ,KAAMvc,IAAK2K,GACVzM,EAAOoe,OAAQ/c,EAAOlB,EAAI2B,EAAG2K,EAAI3K,IAAI,EAAMwc,EAAUC,OAIhD,IAAelb,SAAViC,IACX+Y,GAAY,EAENre,EAAOkD,WAAYoC,KACxBiZ,GAAM,GAGFC,IAECD,GACJpe,EAAGc,KAAMI,EAAOiE,GAChBnF,EAAK,OAILqe,EAAOre,EACPA,EAAK,SAAU0B,EAAM4K,EAAKnH,GACzB,MAAOkZ,GAAKvd,KAAMjB,EAAQ6B,GAAQyD,MAKhCnF,GACJ,KAAYiC,EAAJN,EAASA,IAChB3B,EAAIkB,EAAMS,GAAI2K,EAAK8R,EAAMjZ,EAAQA,EAAMrE,KAAMI,EAAMS,GAAIA,EAAG3B,EAAIkB,EAAMS,GAAI2K,IAK3E,OAAO4R,GACNhd,EAGAmd,EACCre,EAAGc,KAAMI,GACTe,EAAMjC,EAAIkB,EAAM,GAAIoL,GAAQ6R,EAO/Bte,GAAOye,WAAa,SAAUC,GAQ7B,MAA0B,KAAnBA,EAAMta,UAAqC,IAAnBsa,EAAMta,YAAsBsa,EAAMta,SAIlE,SAASua,KAIRjZ,OAAOkZ,eAAgBzf,KAAKqN,SAAY,GACvCtL,IAAK,WACJ,YAIF/B,KAAKmE,QAAUtD,EAAOsD,QAAUqb,EAAKE,MAGtCF,EAAKE,IAAM,EACXF,EAAKG,QAAU9e,EAAOye,WAEtBE,EAAK/d,WACJ6L,IAAK,SAAUiS,GAId,IAAMC,EAAKG,QAASJ,GACnB,MAAO,EAGR,IAAIK,MAEHC,EAASN,EAAOvf,KAAKmE,QAGtB,KAAM0b,EAAS,CACdA,EAASL,EAAKE,KAGd,KACCE,EAAY5f,KAAKmE,UAAcgC,MAAO0Z,GACtCtZ,OAAOuZ,iBAAkBP,EAAOK,GAI/B,MAAQlU,GACTkU,EAAY5f,KAAKmE,SAAY0b,EAC7Bhf,EAAOyC,OAAQic,EAAOK,IASxB,MAJM5f,MAAKqN,MAAOwS,KACjB7f,KAAKqN,MAAOwS,OAGNA,GAERE,IAAK,SAAUR,EAAOtD,EAAM9V,GAC3B,GAAI6Z,GAIHH,EAAS7f,KAAKsN,IAAKiS,GACnBlS,EAAQrN,KAAKqN,MAAOwS,EAGrB,IAAqB,gBAAT5D,GACX5O,EAAO4O,GAAS9V,MAKhB,IAAKtF,EAAOqE,cAAemI,GAC1BxM,EAAOyC,OAAQtD,KAAKqN,MAAOwS,GAAU5D,OAGrC,KAAM+D,IAAQ/D,GACb5O,EAAO2S,GAAS/D,EAAM+D,EAIzB,OAAO3S,IAERtL,IAAK,SAAUwd,EAAOjS,GAKrB,GAAID,GAAQrN,KAAKqN,MAAOrN,KAAKsN,IAAKiS,GAElC,OAAerb,UAARoJ,EACND,EAAQA,EAAOC,IAEjB2R,OAAQ,SAAUM,EAAOjS,EAAKnH,GAC7B,GAAI8Z,EAYJ,OAAa/b,UAARoJ,GACDA,GAAsB,gBAARA,IAA+BpJ,SAAViC,GAEtC8Z,EAASjgB,KAAK+B,IAAKwd,EAAOjS,GAERpJ,SAAX+b,EACNA,EAASjgB,KAAK+B,IAAKwd,EAAO1e,EAAOkF,UAAUuH,MAS7CtN,KAAK+f,IAAKR,EAAOjS,EAAKnH,GAILjC,SAAViC,EAAsBA,EAAQmH,IAEtC8O,OAAQ,SAAUmD,EAAOjS,GACxB,GAAI3K,GAAGa,EAAM0c,EACZL,EAAS7f,KAAKsN,IAAKiS,GACnBlS,EAAQrN,KAAKqN,MAAOwS,EAErB,IAAa3b,SAARoJ,EACJtN,KAAKqN,MAAOwS,UAEN,CAEDhf,EAAOoD,QAASqJ,GAOpB9J,EAAO8J,EAAIlN,OAAQkN,EAAI7K,IAAK5B,EAAOkF,aAEnCma,EAAQrf,EAAOkF,UAAWuH,GAErBA,IAAOD,GACX7J,GAAS8J,EAAK4S,IAId1c,EAAO0c,EACP1c,EAAOA,IAAQ6J,IACZ7J,GAAWA,EAAKqI,MAAOqP,SAI5BvY,EAAIa,EAAK5B,MACT,OAAQe,UACA0K,GAAO7J,EAAMb,MAIvBwd,QAAS,SAAUZ,GAClB,OAAQ1e,EAAOqE,cACdlF,KAAKqN,MAAOkS,EAAOvf,KAAKmE,gBAG1Bic,QAAS,SAAUb,GACbA,EAAOvf,KAAKmE,gBACTnE,MAAKqN,MAAOkS,EAAOvf,KAAKmE,WAIlC,IAAIkc,GAAY,GAAIb,GAEhBc,EAAY,GAAId,GAchBe,EAAS,gCACZC,EAAa,UAEd,SAASC,GAAU/d,EAAM4K,EAAK2O,GAC7B,GAAIzY,EAIJ,IAAcU,SAAT+X,GAAwC,IAAlBvZ,EAAKuC,SAI/B,GAHAzB,EAAO,QAAU8J,EAAIhJ,QAASkc,EAAY,OAAQta,cAClD+V,EAAOvZ,EAAKkK,aAAcpJ,GAEL,gBAATyY,GAAoB,CAC/B,IACCA,EAAgB,SAATA,GAAkB,EACf,UAATA,GAAmB,EACV,SAATA,EAAkB,MAEjBA,EAAO,KAAOA,GAAQA,EACvBsE,EAAO5T,KAAMsP,GAASpb,EAAO6f,UAAWzE,GACxCA,EACA,MAAOvQ,IAGT4U,EAAUP,IAAKrd,EAAM4K,EAAK2O,OAE1BA,GAAO/X,MAGT,OAAO+X,GAGRpb,EAAOyC,QACN6c,QAAS,SAAUzd,GAClB,MAAO4d,GAAUH,QAASzd,IAAU2d,EAAUF,QAASzd,IAGxDuZ,KAAM,SAAUvZ,EAAMc,EAAMyY;AAC3B,MAAOqE,GAAUrB,OAAQvc,EAAMc,EAAMyY,IAGtC0E,WAAY,SAAUje,EAAMc,GAC3B8c,EAAUlE,OAAQ1Z,EAAMc,IAKzBod,MAAO,SAAUle,EAAMc,EAAMyY,GAC5B,MAAOoE,GAAUpB,OAAQvc,EAAMc,EAAMyY,IAGtC4E,YAAa,SAAUne,EAAMc,GAC5B6c,EAAUjE,OAAQ1Z,EAAMc,MAI1B3C,EAAOG,GAAGsC,QACT2Y,KAAM,SAAU3O,EAAKnH,GACpB,GAAIxD,GAAGa,EAAMyY,EACZvZ,EAAO1C,KAAM,GACb6N,EAAQnL,GAAQA,EAAK8G,UAGtB,IAAatF,SAARoJ,EAAoB,CACxB,GAAKtN,KAAK4B,SACTqa,EAAOqE,EAAUve,IAAKW,GAEC,IAAlBA,EAAKuC,WAAmBob,EAAUte,IAAKW,EAAM,iBAAmB,CACpEC,EAAIkL,EAAMjM,MACV,OAAQe,IAIFkL,EAAOlL,KACXa,EAAOqK,EAAOlL,GAAIa,KACe,IAA5BA,EAAKlD,QAAS,WAClBkD,EAAO3C,EAAOkF,UAAWvC,EAAKrD,MAAM,IACpCsgB,EAAU/d,EAAMc,EAAMyY,EAAMzY,KAI/B6c,GAAUN,IAAKrd,EAAM,gBAAgB,GAIvC,MAAOuZ,GAIR,MAAoB,gBAAR3O,GACJtN,KAAKsC,KAAK,WAChBge,EAAUP,IAAK/f,KAAMsN,KAIhB2R,EAAQjf,KAAM,SAAUmG,GAC9B,GAAI8V,GACH6E,EAAWjgB,EAAOkF,UAAWuH,EAO9B,IAAK5K,GAAkBwB,SAAViC,EAAb,CAIC,GADA8V,EAAOqE,EAAUve,IAAKW,EAAM4K,GACdpJ,SAAT+X,EACJ,MAAOA,EAMR,IADAA,EAAOqE,EAAUve,IAAKW,EAAMoe,GACd5c,SAAT+X,EACJ,MAAOA,EAMR,IADAA,EAAOwE,EAAU/d,EAAMoe,EAAU5c,QACnBA,SAAT+X,EACJ,MAAOA,OAQTjc,MAAKsC,KAAK,WAGT,GAAI2Z,GAAOqE,EAAUve,IAAK/B,KAAM8gB,EAKhCR,GAAUP,IAAK/f,KAAM8gB,EAAU3a,GAKL,KAArBmH,EAAIhN,QAAQ,MAAwB4D,SAAT+X,GAC/BqE,EAAUP,IAAK/f,KAAMsN,EAAKnH,MAG1B,KAAMA,EAAOtD,UAAUjB,OAAS,EAAG,MAAM,IAG7C+e,WAAY,SAAUrT,GACrB,MAAOtN,MAAKsC,KAAK,WAChBge,EAAUlE,OAAQpc,KAAMsN,QAM3BzM,EAAOyC,QACNyd,MAAO,SAAUre,EAAMkC,EAAMqX,GAC5B,GAAI8E,EAEJ,OAAKre,IACJkC,GAASA,GAAQ,MAAS,QAC1Bmc,EAAQV,EAAUte,IAAKW,EAAMkC,GAGxBqX,KACE8E,GAASlgB,EAAOoD,QAASgY,GAC9B8E,EAAQV,EAAUpB,OAAQvc,EAAMkC,EAAM/D,EAAOwF,UAAU4V,IAEvD8E,EAAM1gB,KAAM4b,IAGP8E,OAZR,QAgBDC,QAAS,SAAUte,EAAMkC,GACxBA,EAAOA,GAAQ,IAEf,IAAImc,GAAQlgB,EAAOkgB,MAAOre,EAAMkC,GAC/Bqc,EAAcF,EAAMnf,OACpBZ,EAAK+f,EAAMvT,QACX0T,EAAQrgB,EAAOsgB,YAAaze,EAAMkC,GAClCgV,EAAO,WACN/Y,EAAOmgB,QAASte,EAAMkC,GAIZ,gBAAP5D,IACJA,EAAK+f,EAAMvT,QACXyT,KAGIjgB,IAIU,OAAT4D,GACJmc,EAAMnQ,QAAS,oBAITsQ,GAAME,KACbpgB,EAAGc,KAAMY,EAAMkX,EAAMsH,KAGhBD,GAAeC,GACpBA,EAAMvM,MAAMqH,QAKdmF,YAAa,SAAUze,EAAMkC,GAC5B,GAAI0I,GAAM1I,EAAO,YACjB,OAAOyb,GAAUte,IAAKW,EAAM4K,IAAS+S,EAAUpB,OAAQvc,EAAM4K,GAC5DqH,MAAO9T,EAAO0a,UAAU,eAAef,IAAI,WAC1C6F,EAAUjE,OAAQ1Z,GAAQkC,EAAO,QAAS0I,WAM9CzM,EAAOG,GAAGsC,QACTyd,MAAO,SAAUnc,EAAMqX,GACtB,GAAIoF,GAAS,CAQb,OANqB,gBAATzc,KACXqX,EAAOrX,EACPA,EAAO,KACPyc,KAGIxe,UAAUjB,OAASyf,EAChBxgB,EAAOkgB,MAAO/gB,KAAK,GAAI4E,GAGfV,SAAT+X,EACNjc,KACAA,KAAKsC,KAAK,WACT,GAAIye,GAAQlgB,EAAOkgB,MAAO/gB,KAAM4E,EAAMqX,EAGtCpb,GAAOsgB,YAAanhB,KAAM4E,GAEZ,OAATA,GAA8B,eAAbmc,EAAM,IAC3BlgB,EAAOmgB,QAAShhB,KAAM4E,MAI1Boc,QAAS,SAAUpc,GAClB,MAAO5E,MAAKsC,KAAK,WAChBzB,EAAOmgB,QAAShhB,KAAM4E,MAGxB0c,WAAY,SAAU1c,GACrB,MAAO5E,MAAK+gB,MAAOnc,GAAQ,UAI5BgY,QAAS,SAAUhY,EAAMD,GACxB,GAAIuC,GACHqa,EAAQ,EACRC,EAAQ3gB,EAAO2b,WACf1L,EAAW9Q,KACX2C,EAAI3C,KAAK4B,OACTyb,EAAU,aACCkE,GACTC,EAAMrD,YAAarN,GAAYA,IAIb,iBAATlM,KACXD,EAAMC,EACNA,EAAOV,QAERU,EAAOA,GAAQ,IAEf,OAAQjC,IACPuE,EAAMmZ,EAAUte,IAAK+O,EAAUnO,GAAKiC,EAAO,cACtCsC,GAAOA,EAAIyN,QACf4M,IACAra,EAAIyN,MAAM6F,IAAK6C,GAIjB,OADAA,KACOmE,EAAM5E,QAASjY,KAGxB,IAAI8c,GAAO,sCAAwCC,OAE/CC,GAAc,MAAO,QAAS,SAAU,QAExCC,EAAW,SAAUlf,EAAMmf,GAI7B,MADAnf,GAAOmf,GAAMnf,EAC4B,SAAlC7B,EAAOihB,IAAKpf,EAAM,aAA2B7B,EAAOwH,SAAU3F,EAAK0J,cAAe1J,IAGvFqf,EAAiB,yBAIrB,WACC,GAAIC,GAAWpiB,EAASqiB,yBACvBtU,EAAMqU,EAASpc,YAAahG,EAAS6F,cAAe,QACpDoK,EAAQjQ,EAAS6F,cAAe,QAMjCoK,GAAMhD,aAAc,OAAQ,SAC5BgD,EAAMhD,aAAc,UAAW,WAC/BgD,EAAMhD,aAAc,OAAQ,KAE5Bc,EAAI/H,YAAaiK,GAIjBlP,EAAQuhB,WAAavU,EAAIwU,WAAW,GAAOA,WAAW,GAAOjP,UAAUsB,QAIvE7G,EAAIiC,UAAY,yBAChBjP,EAAQyhB,iBAAmBzU,EAAIwU,WAAW,GAAOjP,UAAUyF,eAE5D,IAAI0J,GAAe,WAInB1hB,GAAQ2hB,eAAiB,aAAeviB,EAGxC,IACCwiB,GAAY,OACZC,EAAc,uCACdC,EAAc,kCACdC,EAAiB,sBAElB,SAASC,KACR,OAAO,EAGR,QAASC,KACR,OAAO,EAGR,QAASC,KACR,IACC,MAAOjjB,GAASsU,cACf,MAAQ4O,KAOXjiB,EAAOkiB,OAENvjB,UAEAgb,IAAK,SAAU9X,EAAMsgB,EAAOlV,EAASmO,EAAMnb,GAE1C,GAAImiB,GAAaC,EAAahc,EAC7Bic,EAAQC,EAAGC,EACXC,EAASC,EAAU3e,EAAM4e,EAAYC,EACrCC,EAAWrD,EAAUte,IAAKW,EAG3B,IAAMghB,EAAN,CAKK5V,EAAQA,UACZmV,EAAcnV,EACdA,EAAUmV,EAAYnV,QACtBhN,EAAWmiB,EAAYniB,UAIlBgN,EAAQ9G,OACb8G,EAAQ9G,KAAOnG,EAAOmG,SAIhBmc,EAASO,EAASP,UACxBA,EAASO,EAASP,YAEZD,EAAcQ,EAASC,UAC7BT,EAAcQ,EAASC,OAAS,SAAUjY,GAGzC,aAAc7K,KAAWwhB,GAAgBxhB,EAAOkiB,MAAMa,YAAclY,EAAE9G,KACrE/D,EAAOkiB,MAAMc,SAASjhB,MAAOF,EAAMG,WAAcqB,SAKpD8e,GAAUA,GAAS,IAAKnX,MAAOqP,KAAiB,IAChDkI,EAAIJ,EAAMphB,MACV,OAAQwhB,IACPlc,EAAMwb,EAAerW,KAAM2W,EAAMI,QACjCxe,EAAO6e,EAAWvc,EAAI,GACtBsc,GAAetc,EAAI,IAAM,IAAKG,MAAO,KAAMjE,OAGrCwB,IAKN0e,EAAUziB,EAAOkiB,MAAMO,QAAS1e,OAGhCA,GAAS9D,EAAWwiB,EAAQQ,aAAeR,EAAQS,WAAcnf,EAGjE0e,EAAUziB,EAAOkiB,MAAMO,QAAS1e,OAGhCye,EAAYxiB,EAAOyC,QAClBsB,KAAMA,EACN6e,SAAUA,EACVxH,KAAMA,EACNnO,QAASA,EACT9G,KAAM8G,EAAQ9G,KACdlG,SAAUA,EACV2J,aAAc3J,GAAYD,EAAOgQ,KAAKhF,MAAMpB,aAAakC,KAAM7L,GAC/DkjB,UAAWR,EAAWxW,KAAK,MACzBiW,IAGIM,EAAWJ,EAAQve,MACzB2e,EAAWJ,EAAQve,MACnB2e,EAASU,cAAgB,EAGnBX,EAAQY,OAASZ,EAAQY,MAAMpiB,KAAMY,EAAMuZ,EAAMuH,EAAYN,MAAkB,GAC/ExgB,EAAKuM,kBACTvM,EAAKuM,iBAAkBrK,EAAMse,GAAa,IAKxCI,EAAQ9I,MACZ8I,EAAQ9I,IAAI1Y,KAAMY,EAAM2gB,GAElBA,EAAUvV,QAAQ9G,OACvBqc,EAAUvV,QAAQ9G,KAAO8G,EAAQ9G,OAK9BlG,EACJyiB,EAASlgB,OAAQkgB,EAASU,gBAAiB,EAAGZ,GAE9CE,EAASljB,KAAMgjB,GAIhBxiB,EAAOkiB,MAAMvjB,OAAQoF,IAAS,KAMhCwX,OAAQ,SAAU1Z,EAAMsgB,EAAOlV,EAAShN,EAAUqjB,GAEjD,GAAIjhB,GAAGkhB,EAAWld,EACjBic,EAAQC,EAAGC,EACXC,EAASC,EAAU3e,EAAM4e,EAAYC,EACrCC,EAAWrD,EAAUF,QAASzd,IAAU2d,EAAUte,IAAKW,EAExD,IAAMghB,IAAcP,EAASO,EAASP,QAAtC,CAKAH,GAAUA,GAAS,IAAKnX,MAAOqP,KAAiB,IAChDkI,EAAIJ,EAAMphB,MACV,OAAQwhB,IAMP,GALAlc,EAAMwb,EAAerW,KAAM2W,EAAMI,QACjCxe,EAAO6e,EAAWvc,EAAI,GACtBsc,GAAetc,EAAI,IAAM,IAAKG,MAAO,KAAMjE,OAGrCwB,EAAN,CAOA0e,EAAUziB,EAAOkiB,MAAMO,QAAS1e,OAChCA,GAAS9D,EAAWwiB,EAAQQ,aAAeR,EAAQS,WAAcnf,EACjE2e,EAAWJ,EAAQve,OACnBsC,EAAMA,EAAI,IAAM,GAAIyC,QAAQ,UAAY6Z,EAAWxW,KAAK,iBAAmB,WAG3EoX,EAAYlhB,EAAIqgB,EAAS3hB,MACzB,OAAQsB,IACPmgB,EAAYE,EAAUrgB,IAEfihB,GAAeV,IAAaJ,EAAUI,UACzC3V,GAAWA,EAAQ9G,OAASqc,EAAUrc,MACtCE,IAAOA,EAAIyF,KAAM0W,EAAUW,YAC3BljB,GAAYA,IAAauiB,EAAUviB,WAAyB,OAAbA,IAAqBuiB,EAAUviB,YACjFyiB,EAASlgB,OAAQH,EAAG,GAEfmgB,EAAUviB,UACdyiB,EAASU,gBAELX,EAAQlH,QACZkH,EAAQlH,OAAOta,KAAMY,EAAM2gB,GAOzBe,KAAcb,EAAS3hB,SACrB0hB,EAAQe,UAAYf,EAAQe,SAASviB,KAAMY,EAAM8gB,EAAYE,EAASC,WAAa,GACxF9iB,EAAOyjB,YAAa5hB,EAAMkC,EAAM8e,EAASC,cAGnCR,GAAQve,QAtCf,KAAMA,IAAQue,GACbtiB,EAAOkiB,MAAM3G,OAAQ1Z,EAAMkC,EAAOoe,EAAOI,GAAKtV,EAAShN,GAAU,EA0C/DD,GAAOqE,cAAeie,WACnBO,GAASC,OAChBtD,EAAUjE,OAAQ1Z,EAAM,aAI1B6hB,QAAS,SAAUxB,EAAO9G,EAAMvZ,EAAM8hB,GAErC,GAAI7hB,GAAGsL,EAAK/G,EAAKud,EAAYC,EAAQf,EAAQL,EAC5CqB,GAAcjiB,GAAQ9C,GACtBgF,EAAOnE,EAAOqB,KAAMihB,EAAO,QAAWA,EAAMne,KAAOme,EACnDS,EAAa/iB,EAAOqB,KAAMihB,EAAO,aAAgBA,EAAMiB,UAAU3c,MAAM,OAKxE,IAHA4G,EAAM/G,EAAMxE,EAAOA,GAAQ9C,EAGJ,IAAlB8C,EAAKuC,UAAoC,IAAlBvC,EAAKuC,WAK5Bwd,EAAY9V,KAAM/H,EAAO/D,EAAOkiB,MAAMa,aAItChf,EAAKtE,QAAQ,MAAQ,IAEzBkjB,EAAa5e,EAAKyC,MAAM,KACxBzC,EAAO4e,EAAWhW,QAClBgW,EAAWpgB,QAEZshB,EAAS9f,EAAKtE,QAAQ,KAAO,GAAK,KAAOsE,EAGzCme,EAAQA,EAAOliB,EAAOsD,SACrB4e,EACA,GAAIliB,GAAO+jB,MAAOhgB,EAAuB,gBAAVme,IAAsBA,GAGtDA,EAAM8B,UAAYL,EAAe,EAAI,EACrCzB,EAAMiB,UAAYR,EAAWxW,KAAK,KAClC+V,EAAM+B,aAAe/B,EAAMiB,UAC1B,GAAIra,QAAQ,UAAY6Z,EAAWxW,KAAK,iBAAmB,WAC3D,KAGD+V,EAAMvQ,OAAStO,OACT6e,EAAMlf,SACXkf,EAAMlf,OAASnB,GAIhBuZ,EAAe,MAARA,GACJ8G,GACFliB,EAAOwF,UAAW4V,GAAQ8G,IAG3BO,EAAUziB,EAAOkiB,MAAMO,QAAS1e,OAC1B4f,IAAgBlB,EAAQiB,SAAWjB,EAAQiB,QAAQ3hB,MAAOF,EAAMuZ,MAAW,GAAjF,CAMA,IAAMuI,IAAiBlB,EAAQyB,WAAalkB,EAAOiE,SAAUpC,GAAS,CAMrE,IAJA+hB,EAAanB,EAAQQ,cAAgBlf,EAC/B6d,EAAY9V,KAAM8X,EAAa7f,KACpCqJ,EAAMA,EAAIpI,YAEHoI,EAAKA,EAAMA,EAAIpI,WACtB8e,EAAUtkB,KAAM4N,GAChB/G,EAAM+G,CAIF/G,MAASxE,EAAK0J,eAAiBxM,IACnC+kB,EAAUtkB,KAAM6G,EAAI6H,aAAe7H,EAAI8d,cAAgBjlB,GAKzD4C,EAAI,CACJ,QAASsL,EAAM0W,EAAUhiB,QAAUogB,EAAMkC,uBAExClC,EAAMne,KAAOjC,EAAI,EAChB8hB,EACAnB,EAAQS,UAAYnf,EAGrB+e,GAAWtD,EAAUte,IAAKkM,EAAK,eAAoB8U,EAAMne,OAAUyb,EAAUte,IAAKkM,EAAK,UAClF0V,GACJA,EAAO/gB,MAAOqL,EAAKgO,GAIpB0H,EAASe,GAAUzW,EAAKyW,GACnBf,GAAUA,EAAO/gB,OAAS/B,EAAOye,WAAYrR,KACjD8U,EAAMvQ,OAASmR,EAAO/gB,MAAOqL,EAAKgO,GAC7B8G,EAAMvQ,UAAW,GACrBuQ,EAAMmC,iBAmCT,OA/BAnC,GAAMne,KAAOA,EAGP4f,GAAiBzB,EAAMoC,sBAErB7B,EAAQ8B,UAAY9B,EAAQ8B,SAASxiB,MAAO+hB,EAAU1b,MAAOgT,MAAW,IAC9Epb,EAAOye,WAAY5c,IAIdgiB,GAAU7jB,EAAOkD,WAAYrB,EAAMkC,MAAa/D,EAAOiE,SAAUpC,KAGrEwE,EAAMxE,EAAMgiB,GAEPxd,IACJxE,EAAMgiB,GAAW,MAIlB7jB,EAAOkiB,MAAMa,UAAYhf,EACzBlC,EAAMkC,KACN/D,EAAOkiB,MAAMa,UAAY1f,OAEpBgD,IACJxE,EAAMgiB,GAAWxd,IAMd6b,EAAMvQ,SAGdqR,SAAU,SAAUd,GAGnBA,EAAQliB,EAAOkiB,MAAMsC,IAAKtC,EAE1B,IAAIpgB,GAAGO,EAAGf,EAAKmR,EAAS+P,EACvBiC,KACA9iB,EAAOrC,EAAM2B,KAAMe,WACnB0gB,GAAalD,EAAUte,IAAK/B,KAAM,eAAoB+iB,EAAMne,UAC5D0e,EAAUziB,EAAOkiB,MAAMO,QAASP,EAAMne,SAOvC,IAJApC,EAAK,GAAKugB,EACVA,EAAMwC,eAAiBvlB,MAGlBsjB,EAAQkC,aAAelC,EAAQkC,YAAY1jB,KAAM9B,KAAM+iB,MAAY,EAAxE,CAKAuC,EAAezkB,EAAOkiB,MAAMQ,SAASzhB,KAAM9B,KAAM+iB,EAAOQ,GAGxD5gB,EAAI,CACJ,QAAS2Q,EAAUgS,EAAc3iB,QAAWogB,EAAMkC,uBAAyB,CAC1ElC,EAAM0C,cAAgBnS,EAAQ5Q,KAE9BQ,EAAI,CACJ,QAASmgB,EAAY/P,EAAQiQ,SAAUrgB,QAAW6f,EAAM2C,kCAIjD3C,EAAM+B,cAAgB/B,EAAM+B,aAAanY,KAAM0W,EAAUW,cAE9DjB,EAAMM,UAAYA,EAClBN,EAAM9G,KAAOoH,EAAUpH,KAEvB9Z,IAAStB,EAAOkiB,MAAMO,QAASD,EAAUI,eAAkBE,QAAUN,EAAUvV,SAC5ElL,MAAO0Q,EAAQ5Q,KAAMF,GAEX0B,SAAR/B,IACE4gB,EAAMvQ,OAASrQ,MAAS,IAC7B4gB,EAAMmC,iBACNnC,EAAM4C,oBAYX,MAJKrC,GAAQsC,cACZtC,EAAQsC,aAAa9jB,KAAM9B,KAAM+iB,GAG3BA,EAAMvQ,SAGd+Q,SAAU,SAAUR,EAAOQ,GAC1B,GAAI5gB,GAAGkE,EAASgf,EAAKxC,EACpBiC,KACArB,EAAgBV,EAASU,cACzBhW,EAAM8U,EAAMlf,MAKb,IAAKogB,GAAiBhW,EAAIhJ,YAAc8d,EAAMlO,QAAyB,UAAfkO,EAAMne,MAE7D,KAAQqJ,IAAQjO,KAAMiO,EAAMA,EAAIpI,YAAc7F,KAG7C,GAAKiO,EAAIsG,YAAa,GAAuB,UAAfwO,EAAMne,KAAmB,CAEtD,IADAiC,KACMlE,EAAI,EAAOshB,EAAJthB,EAAmBA,IAC/B0gB,EAAYE,EAAU5gB,GAGtBkjB,EAAMxC,EAAUviB,SAAW,IAEHoD,SAAnB2C,EAASgf,KACbhf,EAASgf,GAAQxC,EAAU5Y,aAC1B5J,EAAQglB,EAAK7lB,MAAOsa,MAAOrM,IAAS,EACpCpN,EAAO0O,KAAMsW,EAAK7lB,KAAM,MAAQiO,IAAQrM,QAErCiF,EAASgf,IACbhf,EAAQxG,KAAMgjB,EAGXxc,GAAQjF,QACZ0jB,EAAajlB,MAAOqC,KAAMuL,EAAKsV,SAAU1c,IAW7C,MAJKod,GAAgBV,EAAS3hB,QAC7B0jB,EAAajlB,MAAOqC,KAAM1C,KAAMujB,SAAUA,EAASpjB,MAAO8jB,KAGpDqB,GAIRQ,MAAO,wHAAwHze,MAAM,KAErI0e,YAEAC,UACCF,MAAO,4BAA4Bze,MAAM,KACzCmI,OAAQ,SAAUuT,EAAOkD,GAOxB,MAJoB,OAAflD,EAAMmD,QACVnD,EAAMmD,MAA6B,MAArBD,EAASE,SAAmBF,EAASE,SAAWF,EAASG,SAGjErD,IAITsD,YACCP,MAAO,uFAAuFze,MAAM,KACpGmI,OAAQ,SAAUuT,EAAOkD,GACxB,GAAIK,GAAUxX,EAAKyX,EAClB1R,EAASoR,EAASpR,MAkBnB,OAfoB,OAAfkO,EAAMyD,OAAqC,MAApBP,EAASQ,UACpCH,EAAWvD,EAAMlf,OAAOuI,eAAiBxM,EACzCkP,EAAMwX,EAAS5X,gBACf6X,EAAOD,EAASC,KAEhBxD,EAAMyD,MAAQP,EAASQ,SAAY3X,GAAOA,EAAI4X,YAAcH,GAAQA,EAAKG,YAAc,IAAQ5X,GAAOA,EAAI6X,YAAcJ,GAAQA,EAAKI,YAAc,GACnJ5D,EAAM6D,MAAQX,EAASY,SAAY/X,GAAOA,EAAIgY,WAAcP,GAAQA,EAAKO,WAAc,IAAQhY,GAAOA,EAAIiY,WAAcR,GAAQA,EAAKQ,WAAc,IAK9IhE,EAAMmD,OAAoBhiB,SAAX2Q,IACpBkO,EAAMmD,MAAmB,EAATrR,EAAa,EAAe,EAATA,EAAa,EAAe,EAATA,EAAa,EAAI,GAGjEkO,IAITsC,IAAK,SAAUtC,GACd,GAAKA,EAAOliB,EAAOsD,SAClB,MAAO4e,EAIR,IAAIpgB,GAAGqd,EAAMtc,EACZkB,EAAOme,EAAMne,KACboiB,EAAgBjE,EAChBkE,EAAUjnB,KAAK+lB,SAAUnhB,EAEpBqiB,KACLjnB,KAAK+lB,SAAUnhB,GAASqiB,EACvBzE,EAAY7V,KAAM/H,GAAS5E,KAAKqmB,WAChC9D,EAAU5V,KAAM/H,GAAS5E,KAAKgmB,aAGhCtiB,EAAOujB,EAAQnB,MAAQ9lB,KAAK8lB,MAAM1lB,OAAQ6mB,EAAQnB,OAAU9lB,KAAK8lB,MAEjE/C,EAAQ,GAAIliB,GAAO+jB,MAAOoC,GAE1BrkB,EAAIe,EAAK9B,MACT,OAAQe,IACPqd,EAAOtc,EAAMf,GACbogB,EAAO/C,GAASgH,EAAehH,EAehC,OAVM+C,GAAMlf,SACXkf,EAAMlf,OAASjE,GAKe,IAA1BmjB,EAAMlf,OAAOoB,WACjB8d,EAAMlf,OAASkf,EAAMlf,OAAOgC,YAGtBohB,EAAQzX,OAASyX,EAAQzX,OAAQuT,EAAOiE,GAAkBjE,GAGlEO,SACC4D,MAECnC,UAAU,GAEX9Q,OAECsQ,QAAS,WACR,MAAKvkB,QAAS6iB,KAAuB7iB,KAAKiU,OACzCjU,KAAKiU,SACE,GAFR,QAKD6P,aAAc,WAEfqD,MACC5C,QAAS,WACR,MAAKvkB,QAAS6iB,KAAuB7iB,KAAKmnB,MACzCnnB,KAAKmnB,QACE,GAFR,QAKDrD,aAAc,YAEfsD,OAEC7C,QAAS,WACR,MAAmB,aAAdvkB,KAAK4E,MAAuB5E,KAAKonB,OAASvmB,EAAOoF,SAAUjG,KAAM,UACrEA,KAAKonB,SACE,GAFR,QAODhC,SAAU,SAAUrC,GACnB,MAAOliB,GAAOoF,SAAU8c,EAAMlf,OAAQ,OAIxCwjB,cACCzB,aAAc,SAAU7C,GAID7e,SAAjB6e,EAAMvQ,QAAwBuQ,EAAMiE,gBACxCjE,EAAMiE,cAAcM,YAAcvE,EAAMvQ,WAM5C+U,SAAU,SAAU3iB,EAAMlC,EAAMqgB,EAAOyE,GAItC,GAAI9b,GAAI7K,EAAOyC,OACd,GAAIzC,GAAO+jB,MACX7B,GAECne,KAAMA,EACN6iB,aAAa,EACbT,kBAGGQ,GACJ3mB,EAAOkiB,MAAMwB,QAAS7Y,EAAG,KAAMhJ,GAE/B7B,EAAOkiB,MAAMc,SAAS/hB,KAAMY,EAAMgJ,GAE9BA,EAAEyZ,sBACNpC,EAAMmC,mBAKTrkB,EAAOyjB,YAAc,SAAU5hB,EAAMkC,EAAM+e,GACrCjhB,EAAKoc,qBACTpc,EAAKoc,oBAAqBla,EAAM+e,GAAQ,IAI1C9iB,EAAO+jB,MAAQ,SAAUnhB,EAAKqiB,GAE7B,MAAO9lB,gBAAgBa,GAAO+jB,OAKzBnhB,GAAOA,EAAImB,MACf5E,KAAKgnB,cAAgBvjB,EACrBzD,KAAK4E,KAAOnB,EAAImB,KAIhB5E,KAAKmlB,mBAAqB1hB,EAAIikB,kBACHxjB,SAAzBT,EAAIikB,kBAEJjkB,EAAI6jB,eAAgB,EACrB3E,EACAC,GAID5iB,KAAK4E,KAAOnB,EAIRqiB,GACJjlB,EAAOyC,OAAQtD,KAAM8lB,GAItB9lB,KAAK2nB,UAAYlkB,GAAOA,EAAIkkB,WAAa9mB,EAAOsG,WAGhDnH,KAAMa,EAAOsD,UAAY,IA/BjB,GAAItD,GAAO+jB,MAAOnhB,EAAKqiB,IAoChCjlB,EAAO+jB,MAAMnjB,WACZ0jB,mBAAoBvC,EACpBqC,qBAAsBrC,EACtB8C,8BAA+B9C,EAE/BsC,eAAgB,WACf,GAAIxZ,GAAI1L,KAAKgnB,aAEbhnB,MAAKmlB,mBAAqBxC,EAErBjX,GAAKA,EAAEwZ,gBACXxZ,EAAEwZ,kBAGJS,gBAAiB,WAChB,GAAIja,GAAI1L,KAAKgnB,aAEbhnB,MAAKilB,qBAAuBtC,EAEvBjX,GAAKA,EAAEia,iBACXja,EAAEia,mBAGJiC,yBAA0B,WACzB,GAAIlc,GAAI1L,KAAKgnB,aAEbhnB,MAAK0lB,8BAAgC/C,EAEhCjX,GAAKA,EAAEkc,0BACXlc,EAAEkc,2BAGH5nB,KAAK2lB,oBAMP9kB,EAAOyB,MACNulB,WAAY,YACZC,WAAY,WACZC,aAAc,cACdC,aAAc,cACZ,SAAUC,EAAM5C,GAClBxkB,EAAOkiB,MAAMO,QAAS2E,IACrBnE,aAAcuB,EACdtB,SAAUsB,EAEV1B,OAAQ,SAAUZ,GACjB,GAAI5gB,GACH0B,EAAS7D,KACTkoB,EAAUnF,EAAMoF,cAChB9E,EAAYN,EAAMM,SASnB,SALM6E,GAAYA,IAAYrkB,IAAWhD,EAAOwH,SAAUxE,EAAQqkB,MACjEnF,EAAMne,KAAOye,EAAUI,SACvBthB,EAAMkhB,EAAUvV,QAAQlL,MAAO5C,KAAM6C,WACrCkgB,EAAMne,KAAOygB,GAEPljB,MAOJxB,EAAQ2hB,gBACbzhB,EAAOyB,MAAO2R,MAAO,UAAWkT,KAAM,YAAc,SAAUc,EAAM5C,GAGnE,GAAIvX,GAAU,SAAUiV,GACtBliB,EAAOkiB,MAAMwE,SAAUlC,EAAKtC,EAAMlf,OAAQhD,EAAOkiB,MAAMsC,IAAKtC,IAAS,GAGvEliB,GAAOkiB,MAAMO,QAAS+B,IACrBnB,MAAO,WACN,GAAIpV,GAAM9O,KAAKoM,eAAiBpM,KAC/BooB,EAAW/H,EAAUpB,OAAQnQ,EAAKuW,EAE7B+C,IACLtZ,EAAIG,iBAAkBgZ,EAAMna,GAAS,GAEtCuS,EAAUpB,OAAQnQ,EAAKuW,GAAO+C,GAAY,GAAM,IAEjD/D,SAAU,WACT,GAAIvV,GAAM9O,KAAKoM,eAAiBpM,KAC/BooB,EAAW/H,EAAUpB,OAAQnQ,EAAKuW,GAAQ,CAErC+C,GAKL/H,EAAUpB,OAAQnQ,EAAKuW,EAAK+C,IAJ5BtZ,EAAIgQ,oBAAqBmJ,EAAMna,GAAS,GACxCuS,EAAUjE,OAAQtN,EAAKuW,QAU5BxkB,EAAOG,GAAGsC,QAET+kB,GAAI,SAAUrF,EAAOliB,EAAUmb,EAAMjb,EAAiBsnB,GACrD,GAAIC,GAAQ3jB,CAGZ,IAAsB,gBAAVoe,GAAqB,CAEP,gBAAbliB,KAEXmb,EAAOA,GAAQnb,EACfA,EAAWoD,OAEZ,KAAMU,IAAQoe,GACbhjB,KAAKqoB,GAAIzjB,EAAM9D,EAAUmb,EAAM+G,EAAOpe,GAAQ0jB,EAE/C,OAAOtoB,MAmBR,GAhBa,MAARic,GAAsB,MAANjb,GAEpBA,EAAKF,EACLmb,EAAOnb,EAAWoD,QACD,MAANlD,IACc,gBAAbF,IAEXE,EAAKib,EACLA,EAAO/X,SAGPlD,EAAKib,EACLA,EAAOnb,EACPA,EAAWoD,SAGRlD,KAAO,EACXA,EAAK4hB,MACC,KAAM5hB,EACZ,MAAOhB,KAaR,OAVa,KAARsoB,IACJC,EAASvnB,EACTA,EAAK,SAAU+hB,GAGd,MADAliB,KAAS+d,IAAKmE,GACPwF,EAAO3lB,MAAO5C,KAAM6C,YAG5B7B,EAAGgG,KAAOuhB,EAAOvhB,OAAUuhB,EAAOvhB,KAAOnG,EAAOmG,SAE1ChH,KAAKsC,KAAM,WACjBzB,EAAOkiB,MAAMvI,IAAKxa,KAAMgjB,EAAOhiB,EAAIib,EAAMnb,MAG3CwnB,IAAK,SAAUtF,EAAOliB,EAAUmb,EAAMjb,GACrC,MAAOhB,MAAKqoB,GAAIrF,EAAOliB,EAAUmb,EAAMjb,EAAI,IAE5C4d,IAAK,SAAUoE,EAAOliB,EAAUE,GAC/B,GAAIqiB,GAAWze,CACf,IAAKoe,GAASA,EAAMkC,gBAAkBlC,EAAMK,UAQ3C,MANAA,GAAYL,EAAMK,UAClBxiB,EAAQmiB,EAAMuC,gBAAiB3G,IAC9ByE,EAAUW,UAAYX,EAAUI,SAAW,IAAMJ,EAAUW,UAAYX,EAAUI,SACjFJ,EAAUviB,SACVuiB,EAAUvV,SAEJ9N,IAER,IAAsB,gBAAVgjB,GAAqB,CAEhC,IAAMpe,IAAQoe,GACbhjB,KAAK4e,IAAKha,EAAM9D,EAAUkiB,EAAOpe,GAElC,OAAO5E,MAUR,OARKc,KAAa,GAA6B,kBAAbA,MAEjCE,EAAKF,EACLA,EAAWoD,QAEPlD,KAAO,IACXA,EAAK4hB,GAEC5iB,KAAKsC,KAAK,WAChBzB,EAAOkiB,MAAM3G,OAAQpc,KAAMgjB,EAAOhiB,EAAIF,MAIxCyjB,QAAS,SAAU3f,EAAMqX,GACxB,MAAOjc,MAAKsC,KAAK,WAChBzB,EAAOkiB,MAAMwB,QAAS3f,EAAMqX,EAAMjc,SAGpC2e,eAAgB,SAAU/Z,EAAMqX,GAC/B,GAAIvZ,GAAO1C,KAAK,EAChB,OAAK0C,GACG7B,EAAOkiB,MAAMwB,QAAS3f,EAAMqX,EAAMvZ,GAAM,GADhD,SAOF,IACC8lB,IAAY,0EACZC,GAAW,YACXC,GAAQ,YACRC,GAAe,0BAEfC,GAAW,oCACXC,GAAc,4BACdC,GAAoB,cACpBC,GAAe,2CAGfC,IAGCC,QAAU,EAAG,+BAAgC,aAE7CC,OAAS,EAAG,UAAW,YACvBC,KAAO,EAAG,oBAAqB,uBAC/BC,IAAM,EAAG,iBAAkB,oBAC3BC,IAAM,EAAG,qBAAsB,yBAE/BjE,UAAY,EAAG,GAAI,IAIrB4D,IAAQM,SAAWN,GAAQC,OAE3BD,GAAQO,MAAQP,GAAQQ,MAAQR,GAAQS,SAAWT,GAAQU,QAAUV,GAAQE,MAC7EF,GAAQW,GAAKX,GAAQK,EAIrB,SAASO,IAAoBlnB,EAAMmnB,GAClC,MAAOhpB,GAAOoF,SAAUvD,EAAM,UAC7B7B,EAAOoF,SAA+B,KAArB4jB,EAAQ5kB,SAAkB4kB,EAAUA,EAAQtY,WAAY,MAEzE7O,EAAK8J,qBAAqB,SAAS,IAClC9J,EAAKkD,YAAalD,EAAK0J,cAAc3G,cAAc,UACpD/C,EAIF,QAASonB,IAAepnB,GAEvB,MADAA,GAAKkC,MAAsC,OAA9BlC,EAAKkK,aAAa,SAAoB,IAAMlK,EAAKkC,KACvDlC,EAER,QAASqnB,IAAernB,GACvB,GAAImJ,GAAQid,GAAkBzc,KAAM3J,EAAKkC,KAQzC,OANKiH,GACJnJ,EAAKkC,KAAOiH,EAAO,GAEnBnJ,EAAKyK,gBAAgB,QAGfzK,EAIR,QAASsnB,IAAe9nB,EAAO+nB,GAI9B,IAHA,GAAItnB,GAAI,EACPwX,EAAIjY,EAAMN,OAECuY,EAAJxX,EAAOA,IACd0d,EAAUN,IACT7d,EAAOS,GAAK,cAAesnB,GAAe5J,EAAUte,IAAKkoB,EAAatnB,GAAK,eAK9E,QAASunB,IAAgBzmB,EAAK0mB,GAC7B,GAAIxnB,GAAGwX,EAAGvV,EAAMwlB,EAAUC,EAAUC,EAAUC,EAAUpH,CAExD,IAAuB,IAAlBgH,EAAKllB,SAAV,CAKA,GAAKob,EAAUF,QAAS1c,KACvB2mB,EAAW/J,EAAUpB,OAAQxb,GAC7B4mB,EAAWhK,EAAUN,IAAKoK,EAAMC,GAChCjH,EAASiH,EAASjH,QAEJ,OACNkH,GAAS1G,OAChB0G,EAASlH,SAET,KAAMve,IAAQue,GACb,IAAMxgB,EAAI,EAAGwX,EAAIgJ,EAAQve,GAAOhD,OAAYuY,EAAJxX,EAAOA,IAC9C9B,EAAOkiB,MAAMvI,IAAK2P,EAAMvlB,EAAMue,EAAQve,GAAQjC,IAO7C2d,EAAUH,QAAS1c,KACvB6mB,EAAWhK,EAAUrB,OAAQxb,GAC7B8mB,EAAW1pB,EAAOyC,UAAYgnB,GAE9BhK,EAAUP,IAAKoK,EAAMI,KAIvB,QAASC,IAAQzpB,EAAS4O,GACzB,GAAIxN,GAAMpB,EAAQyL,qBAAuBzL,EAAQyL,qBAAsBmD,GAAO,KAC5E5O,EAAQkM,iBAAmBlM,EAAQkM,iBAAkB0C,GAAO,OAG9D,OAAezL,UAARyL,GAAqBA,GAAO9O,EAAOoF,SAAUlF,EAAS4O,GAC5D9O,EAAOuB,OAASrB,GAAWoB,GAC3BA,EAIF,QAASsoB,IAAUhnB,EAAK0mB,GACvB,GAAIlkB,GAAWkkB,EAAKlkB,SAASC,aAGX,WAAbD,GAAwB8b,EAAepV,KAAMlJ,EAAImB,MACrDulB,EAAK3V,QAAU/Q,EAAI+Q,SAGK,UAAbvO,GAAqC,aAAbA,KACnCkkB,EAAKxR,aAAelV,EAAIkV,cAI1B9X,EAAOyC,QACNM,MAAO,SAAUlB,EAAMgoB,EAAeC,GACrC,GAAIhoB,GAAGwX,EAAGyQ,EAAaC,EACtBjnB,EAAQlB,EAAKyf,WAAW,GACxB2I,EAASjqB,EAAOwH,SAAU3F,EAAK0J,cAAe1J,EAG/C,MAAM/B,EAAQyhB,gBAAsC,IAAlB1f,EAAKuC,UAAoC,KAAlBvC,EAAKuC,UAC3DpE,EAAOgY,SAAUnW,IAMnB,IAHAmoB,EAAeL,GAAQ5mB,GACvBgnB,EAAcJ,GAAQ9nB,GAEhBC,EAAI,EAAGwX,EAAIyQ,EAAYhpB,OAAYuY,EAAJxX,EAAOA,IAC3C8nB,GAAUG,EAAajoB,GAAKkoB,EAAcloB,GAK5C,IAAK+nB,EACJ,GAAKC,EAIJ,IAHAC,EAAcA,GAAeJ,GAAQ9nB,GACrCmoB,EAAeA,GAAgBL,GAAQ5mB,GAEjCjB,EAAI,EAAGwX,EAAIyQ,EAAYhpB,OAAYuY,EAAJxX,EAAOA,IAC3CunB,GAAgBU,EAAajoB,GAAKkoB,EAAcloB,QAGjDunB,IAAgBxnB,EAAMkB,EAWxB,OANAinB,GAAeL,GAAQ5mB,EAAO,UACzBinB,EAAajpB,OAAS,GAC1BooB,GAAea,GAAeC,GAAUN,GAAQ9nB,EAAM,WAIhDkB,GAGRmnB,cAAe,SAAU7oB,EAAOnB,EAASiqB,EAASC,GAOjD,IANA,GAAIvoB,GAAMwE,EAAKyI,EAAKub,EAAM7iB,EAAUnF,EACnC8e,EAAWjhB,EAAQkhB,yBACnBkJ,KACAxoB,EAAI,EACJwX,EAAIjY,EAAMN,OAECuY,EAAJxX,EAAOA,IAGd,GAFAD,EAAOR,EAAOS,GAETD,GAAiB,IAATA,EAGZ,GAA6B,WAAxB7B,EAAO+D,KAAMlC,GAGjB7B,EAAOuB,MAAO+oB,EAAOzoB,EAAKuC,UAAavC,GAASA,OAG1C,IAAMgmB,GAAM/b,KAAMjK,GAIlB,CACNwE,EAAMA,GAAO8a,EAASpc,YAAa7E,EAAQ0E,cAAc,QAGzDkK,GAAQ8Y,GAASpc,KAAM3J,KAAY,GAAI,KAAQ,GAAIwD,cACnDglB,EAAOlC,GAASrZ,IAASqZ,GAAQ5D,SACjCle,EAAI0I,UAAYsb,EAAM,GAAMxoB,EAAK4B,QAASkkB,GAAW,aAAgB0C,EAAM,GAG3EhoB,EAAIgoB,EAAM,EACV,OAAQhoB,IACPgE,EAAMA,EAAIgM,SAKXrS,GAAOuB,MAAO+oB,EAAOjkB,EAAIuE,YAGzBvE,EAAM8a,EAASzQ,WAGfrK,EAAIoK,YAAc,OAzBlB6Z,GAAM9qB,KAAMU,EAAQqqB,eAAgB1oB,GA+BvCsf,GAAS1Q,YAAc,GAEvB3O,EAAI,CACJ,OAASD,EAAOyoB,EAAOxoB,KAItB,KAAKsoB,GAAmD,KAAtCpqB,EAAO2F,QAAS9D,EAAMuoB,MAIxC5iB,EAAWxH,EAAOwH,SAAU3F,EAAK0J,cAAe1J,GAGhDwE,EAAMsjB,GAAQxI,EAASpc,YAAalD,GAAQ,UAGvC2F,GACJ2hB,GAAe9iB,GAIX8jB,GAAU,CACd9nB,EAAI,CACJ,OAASR,EAAOwE,EAAKhE,KACf2lB,GAAYlc,KAAMjK,EAAKkC,MAAQ,KACnComB,EAAQ3qB,KAAMqC,GAMlB,MAAOsf,IAGRqJ,UAAW,SAAUnpB,GAKpB,IAJA,GAAI+Z,GAAMvZ,EAAMkC,EAAM0I,EACrBgW,EAAUziB,EAAOkiB,MAAMO,QACvB3gB,EAAI,EAE2BuB,UAAvBxB,EAAOR,EAAOS,IAAoBA,IAAM,CAChD,GAAK9B,EAAOye,WAAY5c,KACvB4K,EAAM5K,EAAM2d,EAAUlc,SAEjBmJ,IAAQ2O,EAAOoE,EAAUhT,MAAOC,KAAS,CAC7C,GAAK2O,EAAKkH,OACT,IAAMve,IAAQqX,GAAKkH,OACbG,EAAS1e,GACb/D,EAAOkiB,MAAM3G,OAAQ1Z,EAAMkC,GAI3B/D,EAAOyjB,YAAa5hB,EAAMkC,EAAMqX,EAAK0H,OAInCtD,GAAUhT,MAAOC,UAEd+S,GAAUhT,MAAOC,SAKpBgT,GAAUjT,MAAO3K,EAAM4d,EAAUnc,cAK3CtD,EAAOG,GAAGsC,QACToC,KAAM,SAAUS,GACf,MAAO8Y,GAAQjf,KAAM,SAAUmG,GAC9B,MAAiBjC,UAAViC,EACNtF,EAAO6E,KAAM1F,MACbA,KAAK2U,QAAQrS,KAAK,YACM,IAAlBtC,KAAKiF,UAAoC,KAAlBjF,KAAKiF,UAAqC,IAAlBjF,KAAKiF,YACxDjF,KAAKsR,YAAcnL,MAGpB,KAAMA,EAAOtD,UAAUjB,SAG3B0pB,OAAQ,WACP,MAAOtrB,MAAKurB,SAAU1oB,UAAW,SAAUH,GAC1C,GAAuB,IAAlB1C,KAAKiF,UAAoC,KAAlBjF,KAAKiF,UAAqC,IAAlBjF,KAAKiF,SAAiB,CACzE,GAAIpB,GAAS+lB,GAAoB5pB,KAAM0C,EACvCmB,GAAO+B,YAAalD,OAKvB8oB,QAAS,WACR,MAAOxrB,MAAKurB,SAAU1oB,UAAW,SAAUH,GAC1C,GAAuB,IAAlB1C,KAAKiF,UAAoC,KAAlBjF,KAAKiF,UAAqC,IAAlBjF,KAAKiF,SAAiB,CACzE,GAAIpB,GAAS+lB,GAAoB5pB,KAAM0C,EACvCmB,GAAO4nB,aAAc/oB,EAAMmB,EAAO0N,gBAKrCma,OAAQ,WACP,MAAO1rB,MAAKurB,SAAU1oB,UAAW,SAAUH,GACrC1C,KAAK6F,YACT7F,KAAK6F,WAAW4lB,aAAc/oB,EAAM1C,SAKvC2rB,MAAO,WACN,MAAO3rB,MAAKurB,SAAU1oB,UAAW,SAAUH,GACrC1C,KAAK6F,YACT7F,KAAK6F,WAAW4lB,aAAc/oB,EAAM1C,KAAKoO,gBAK5CgO,OAAQ,SAAUtb,EAAU8qB,GAK3B,IAJA,GAAIlpB,GACHR,EAAQpB,EAAWD,EAAO2O,OAAQ1O,EAAUd,MAASA,KACrD2C,EAAI,EAEwB,OAApBD,EAAOR,EAAMS,IAAaA,IAC5BipB,GAA8B,IAAlBlpB,EAAKuC,UACtBpE,EAAOwqB,UAAWb,GAAQ9nB,IAGtBA,EAAKmD,aACJ+lB,GAAY/qB,EAAOwH,SAAU3F,EAAK0J,cAAe1J,IACrDsnB,GAAeQ,GAAQ9nB,EAAM,WAE9BA,EAAKmD,WAAWC,YAAapD,GAI/B,OAAO1C,OAGR2U,MAAO,WAIN,IAHA,GAAIjS,GACHC,EAAI,EAEuB,OAAnBD,EAAO1C,KAAK2C,IAAaA,IACV,IAAlBD,EAAKuC,WAGTpE,EAAOwqB,UAAWb,GAAQ9nB,GAAM,IAGhCA,EAAK4O,YAAc,GAIrB,OAAOtR,OAGR4D,MAAO,SAAU8mB,EAAeC,GAI/B,MAHAD,GAAiC,MAAjBA,GAAwB,EAAQA,EAChDC,EAAyC,MAArBA,EAA4BD,EAAgBC,EAEzD3qB,KAAKyC,IAAI,WACf,MAAO5B,GAAO+C,MAAO5D,KAAM0qB,EAAeC,MAI5CkB,KAAM,SAAU1lB,GACf,MAAO8Y,GAAQjf,KAAM,SAAUmG,GAC9B,GAAIzD,GAAO1C,KAAM,OAChB2C,EAAI,EACJwX,EAAIna,KAAK4B,MAEV,IAAesC,SAAViC,GAAyC,IAAlBzD,EAAKuC,SAChC,MAAOvC,GAAKkN,SAIb,IAAsB,gBAAVzJ,KAAuBwiB,GAAahc,KAAMxG,KACpD6iB,IAAWP,GAASpc,KAAMlG,KAAa,GAAI,KAAQ,GAAID,eAAkB,CAE1EC,EAAQA,EAAM7B,QAASkkB,GAAW,YAElC,KACC,KAAYrO,EAAJxX,EAAOA,IACdD,EAAO1C,KAAM2C,OAGU,IAAlBD,EAAKuC,WACTpE,EAAOwqB,UAAWb,GAAQ9nB,GAAM,IAChCA,EAAKkN,UAAYzJ,EAInBzD,GAAO,EAGN,MAAOgJ,KAGLhJ,GACJ1C,KAAK2U,QAAQ2W,OAAQnlB,IAEpB,KAAMA,EAAOtD,UAAUjB,SAG3BkqB,YAAa,WACZ,GAAI/kB,GAAMlE,UAAW,EAcrB,OAXA7C,MAAKurB,SAAU1oB,UAAW,SAAUH,GACnCqE,EAAM/G,KAAK6F,WAEXhF,EAAOwqB,UAAWb,GAAQxqB,OAErB+G,GACJA,EAAIglB,aAAcrpB,EAAM1C,QAKnB+G,IAAQA,EAAInF,QAAUmF,EAAI9B,UAAYjF,KAAOA,KAAKoc,UAG1D4P,OAAQ,SAAUlrB,GACjB,MAAOd,MAAKoc,OAAQtb,GAAU,IAG/ByqB,SAAU,SAAU/oB,EAAMD,GAGzBC,EAAOpC,EAAOwC,SAAWJ,EAEzB,IAAIwf,GAAUlf,EAAOkoB,EAASiB,EAAYtd,EAAMG,EAC/CnM,EAAI,EACJwX,EAAIna,KAAK4B,OACTme,EAAM/f,KACNksB,EAAW/R,EAAI,EACfhU,EAAQ3D,EAAM,GACduB,EAAalD,EAAOkD,WAAYoC,EAGjC,IAAKpC,GACDoW,EAAI,GAAsB,gBAAVhU,KAChBxF,EAAQuhB,YAAc0G,GAASjc,KAAMxG,GACxC,MAAOnG,MAAKsC,KAAK,SAAUgY,GAC1B,GAAInB,GAAO4G,EAAIhd,GAAIuX,EACdvW,KACJvB,EAAM,GAAM2D,EAAMrE,KAAM9B,KAAMsa,EAAOnB,EAAK0S,SAE3C1S,EAAKoS,SAAU/oB,EAAMD,IAIvB,IAAK4X,IACJ6H,EAAWnhB,EAAOkqB,cAAevoB,EAAMxC,KAAM,GAAIoM,eAAe,EAAOpM,MACvE8C,EAAQkf,EAASzQ,WAEmB,IAA/ByQ,EAASvW,WAAW7J,SACxBogB,EAAWlf,GAGPA,GAAQ,CAMZ,IALAkoB,EAAUnqB,EAAO4B,IAAK+nB,GAAQxI,EAAU,UAAY8H,IACpDmC,EAAajB,EAAQppB,OAITuY,EAAJxX,EAAOA,IACdgM,EAAOqT,EAEFrf,IAAMupB,IACVvd,EAAO9N,EAAO+C,MAAO+K,GAAM,GAAM,GAG5Bsd,GAGJprB,EAAOuB,MAAO4oB,EAASR,GAAQ7b,EAAM,YAIvCpM,EAAST,KAAM9B,KAAM2C,GAAKgM,EAAMhM,EAGjC,IAAKspB,EAOJ,IANAnd,EAAMkc,EAASA,EAAQppB,OAAS,GAAIwK,cAGpCvL,EAAO4B,IAAKuoB,EAASjB,IAGfpnB,EAAI,EAAOspB,EAAJtpB,EAAgBA,IAC5BgM,EAAOqc,EAASroB,GACXkmB,GAAYlc,KAAMgC,EAAK/J,MAAQ,MAClCyb,EAAUpB,OAAQtQ,EAAM,eAAkB9N,EAAOwH,SAAUyG,EAAKH,KAE5DA,EAAKlL,IAEJ5C,EAAOsrB,UACXtrB,EAAOsrB,SAAUxd,EAAKlL,KAGvB5C,EAAOsE,WAAYwJ,EAAK2C,YAAYhN,QAASykB,GAAc,MAQjE,MAAO/oB,SAITa,EAAOyB,MACN8pB,SAAU,SACVC,UAAW,UACXZ,aAAc,SACda,YAAa,QACbC,WAAY,eACV,SAAU/oB,EAAMyiB,GAClBplB,EAAOG,GAAIwC,GAAS,SAAU1C,GAO7B,IANA,GAAIoB,GACHC,KACAqqB,EAAS3rB,EAAQC,GACjBkC,EAAOwpB,EAAO5qB,OAAS,EACvBe,EAAI,EAEQK,GAALL,EAAWA,IAClBT,EAAQS,IAAMK,EAAOhD,KAAOA,KAAK4D,OAAO,GACxC/C,EAAQ2rB,EAAQ7pB,IAAOsjB,GAAY/jB,GAInC7B,EAAKuC,MAAOT,EAAKD,EAAMH,MAGxB,OAAO/B,MAAKiC,UAAWE,KAKzB,IAAIsqB,IACHC,KAQD,SAASC,IAAenpB,EAAMsL,GAC7B,GAAI8d,GACHlqB,EAAO7B,EAAQiO,EAAIrJ,cAAejC,IAAS4oB,SAAUtd,EAAIyX,MAGzDsG,EAAU9sB,EAAO+sB,0BAA6BF,EAAQ7sB,EAAO+sB,wBAAyBpqB,EAAM,KAI3FkqB,EAAMC,QAAUhsB,EAAOihB,IAAKpf,EAAM,GAAK,UAMzC,OAFAA,GAAKspB,SAEEa,EAOR,QAASE,IAAgB9mB,GACxB,GAAI6I,GAAMlP,EACTitB,EAAUH,GAAazmB,EA0BxB,OAxBM4mB,KACLA,EAAUF,GAAe1mB,EAAU6I,GAGlB,SAAZ+d,GAAuBA,IAG3BJ,IAAUA,IAAU5rB,EAAQ,mDAAoDurB,SAAUtd,EAAIJ,iBAG9FI,EAAM2d,GAAQ,GAAIzR,gBAGlBlM,EAAIke,QACJle,EAAIme,QAEJJ,EAAUF,GAAe1mB,EAAU6I,GACnC2d,GAAOT,UAIRU,GAAazmB,GAAa4mB,GAGpBA,EAER,GAAIK,IAAU,UAEVC,GAAY,GAAIxjB,QAAQ,KAAO8X,EAAO,kBAAmB,KAEzD2L,GAAY,SAAU1qB,GAIxB,MAAKA,GAAK0J,cAAc2C,YAAYse,OAC5B3qB,EAAK0J,cAAc2C,YAAYue,iBAAkB5qB,EAAM,MAGxD3C,EAAOutB,iBAAkB5qB,EAAM,MAKxC,SAAS6qB,IAAQ7qB,EAAMc,EAAMgqB,GAC5B,GAAIC,GAAOC,EAAUC,EAAUxrB,EAC9ByqB,EAAQlqB,EAAKkqB,KAsCd,OApCAY,GAAWA,GAAYJ,GAAW1qB,GAI7B8qB,IACJrrB,EAAMqrB,EAASI,iBAAkBpqB,IAAUgqB,EAAUhqB,IAGjDgqB,IAES,KAARrrB,GAAetB,EAAOwH,SAAU3F,EAAK0J,cAAe1J,KACxDP,EAAMtB,EAAO+rB,MAAOlqB,EAAMc,IAOtB2pB,GAAUxgB,KAAMxK,IAAS+qB,GAAQvgB,KAAMnJ,KAG3CiqB,EAAQb,EAAMa,MACdC,EAAWd,EAAMc,SACjBC,EAAWf,EAAMe,SAGjBf,EAAMc,SAAWd,EAAMe,SAAWf,EAAMa,MAAQtrB,EAChDA,EAAMqrB,EAASC,MAGfb,EAAMa,MAAQA,EACdb,EAAMc,SAAWA,EACjBd,EAAMe,SAAWA,IAIJzpB,SAAR/B,EAGNA,EAAM,GACNA,EAIF,QAAS0rB,IAAcC,EAAaC,GAEnC,OACChsB,IAAK,WACJ,MAAK+rB,gBAGG9tB,MAAK+B,KAKL/B,KAAK+B,IAAMgsB,GAAQnrB,MAAO5C,KAAM6C,cAM3C,WACC,GAAImrB,GAAkBC,EACrBhmB,EAAUrI,EAAS8O,gBACnBwf,EAAYtuB,EAAS6F,cAAe,OACpCkI,EAAM/N,EAAS6F,cAAe,MAE/B,IAAMkI,EAAIif,MAAV,CAMAjf,EAAIif,MAAMuB,eAAiB,cAC3BxgB,EAAIwU,WAAW,GAAOyK,MAAMuB,eAAiB,GAC7CxtB,EAAQytB,gBAA+C,gBAA7BzgB,EAAIif,MAAMuB,eAEpCD,EAAUtB,MAAMyB,QAAU,gFAE1BH,EAAUtoB,YAAa+H,EAIvB,SAAS2gB,KACR3gB,EAAIif,MAAMyB,QAGT,uKAGD1gB,EAAIiC,UAAY,GAChB3H,EAAQrC,YAAasoB,EAErB,IAAIK,GAAWxuB,EAAOutB,iBAAkB3f,EAAK,KAC7CqgB,GAAoC,OAAjBO,EAASvf,IAC5Bif,EAA0C,QAAnBM,EAASd,MAEhCxlB,EAAQnC,YAAaooB,GAKjBnuB,EAAOutB,kBACXzsB,EAAOyC,OAAQ3C,GACd6tB,cAAe,WAMd,MADAF,KACON,GAERS,kBAAmB,WAIlB,MAH6B,OAAxBR,GACJK,IAEML,GAERS,oBAAqB,WAOpB,GAAIvsB,GACHwsB,EAAYhhB,EAAI/H,YAAahG,EAAS6F,cAAe,OAiBtD,OAdAkpB,GAAU/B,MAAMyB,QAAU1gB,EAAIif,MAAMyB,QAGnC,8HAEDM,EAAU/B,MAAMgC,YAAcD,EAAU/B,MAAMa,MAAQ,IACtD9f,EAAIif,MAAMa,MAAQ,MAClBxlB,EAAQrC,YAAasoB,GAErB/rB,GAAO6C,WAAYjF,EAAOutB,iBAAkBqB,EAAW,MAAOC,aAE9D3mB,EAAQnC,YAAaooB,GACrBvgB,EAAI7H,YAAa6oB,GAEVxsB,SAQXtB,EAAOguB,KAAO,SAAUnsB,EAAMa,EAAShB,EAAUC,GAChD,GAAIL,GAAKqB,EACRwI,IAGD,KAAMxI,IAAQD,GACbyI,EAAKxI,GAASd,EAAKkqB,MAAOppB,GAC1Bd,EAAKkqB,MAAOppB,GAASD,EAASC,EAG/BrB,GAAMI,EAASK,MAAOF,EAAMF,MAG5B,KAAMgB,IAAQD,GACbb,EAAKkqB,MAAOppB,GAASwI,EAAKxI,EAG3B,OAAOrB,GAIR,IAGC2sB,IAAe,4BACfC,GAAY,GAAIplB,QAAQ,KAAO8X,EAAO,SAAU,KAChDuN,GAAU,GAAIrlB,QAAQ,YAAc8X,EAAO,IAAK,KAEhDwN,IAAYC,SAAU,WAAYC,WAAY,SAAUtC,QAAS,SACjEuC,IACCC,cAAe,IACfC,WAAY,OAGbC,IAAgB,SAAU,IAAK,MAAO,KAGvC,SAASC,IAAgB5C,EAAOppB,GAG/B,GAAKA,IAAQopB,GACZ,MAAOppB,EAIR,IAAIisB,GAAUjsB,EAAK,GAAGhC,cAAgBgC,EAAKrD,MAAM,GAChDuvB,EAAWlsB,EACXb,EAAI4sB,GAAY3tB,MAEjB,OAAQe,IAEP,GADAa,EAAO+rB,GAAa5sB,GAAM8sB,EACrBjsB,IAAQopB,GACZ,MAAOppB,EAIT,OAAOksB,GAGR,QAASC,IAAmBjtB,EAAMyD,EAAOypB,GACxC,GAAI/oB,GAAUkoB,GAAU1iB,KAAMlG,EAC9B,OAAOU,GAENzC,KAAKyrB,IAAK,EAAGhpB,EAAS,IAAQ+oB,GAAY,KAAU/oB,EAAS,IAAO,MACpEV,EAGF,QAAS2pB,IAAsBptB,EAAMc,EAAMusB,EAAOC,EAAaC,GAS9D,IARA,GAAIttB,GAAIotB,KAAYC,EAAc,SAAW,WAE5C,EAES,UAATxsB,EAAmB,EAAI,EAEvBwN,EAAM,EAEK,EAAJrO,EAAOA,GAAK,EAEJ,WAAVotB,IACJ/e,GAAOnQ,EAAOihB,IAAKpf,EAAMqtB,EAAQpO,EAAWhf,IAAK,EAAMstB,IAGnDD,GAEW,YAAVD,IACJ/e,GAAOnQ,EAAOihB,IAAKpf,EAAM,UAAYif,EAAWhf,IAAK,EAAMstB,IAI7C,WAAVF,IACJ/e,GAAOnQ,EAAOihB,IAAKpf,EAAM,SAAWif,EAAWhf,GAAM,SAAS,EAAMstB,MAIrEjf,GAAOnQ,EAAOihB,IAAKpf,EAAM,UAAYif,EAAWhf,IAAK,EAAMstB,GAG5C,YAAVF,IACJ/e,GAAOnQ,EAAOihB,IAAKpf,EAAM,SAAWif,EAAWhf,GAAM,SAAS,EAAMstB,IAKvE,OAAOjf,GAGR,QAASkf,IAAkBxtB,EAAMc,EAAMusB,GAGtC,GAAII,IAAmB,EACtBnf,EAAe,UAATxN,EAAmBd,EAAK0tB,YAAc1tB,EAAK2tB,aACjDJ,EAAS7C,GAAW1qB,GACpBstB,EAAiE,eAAnDnvB,EAAOihB,IAAKpf,EAAM,aAAa,EAAOutB,EAKrD,IAAY,GAAPjf,GAAmB,MAAPA,EAAc,CAQ9B,GANAA,EAAMuc,GAAQ7qB,EAAMc,EAAMysB,IACf,EAANjf,GAAkB,MAAPA,KACfA,EAAMtO,EAAKkqB,MAAOppB,IAId2pB,GAAUxgB,KAAKqE,GACnB,MAAOA,EAKRmf,GAAmBH,IAChBrvB,EAAQ8tB,qBAAuBzd,IAAQtO,EAAKkqB,MAAOppB,IAGtDwN,EAAMhM,WAAYgM,IAAS,EAI5B,MAASA,GACR8e,GACCptB,EACAc,EACAusB,IAAWC,EAAc,SAAW,WACpCG,EACAF,GAEE,KAGL,QAASK,IAAUxf,EAAUyf,GAM5B,IALA,GAAI1D,GAASnqB,EAAM8tB,EAClBxS,KACA1D,EAAQ,EACR1Y,EAASkP,EAASlP,OAEHA,EAAR0Y,EAAgBA,IACvB5X,EAAOoO,EAAUwJ,GACX5X,EAAKkqB,QAIX5O,EAAQ1D,GAAU+F,EAAUte,IAAKW,EAAM,cACvCmqB,EAAUnqB,EAAKkqB,MAAMC,QAChB0D,GAGEvS,EAAQ1D,IAAuB,SAAZuS,IACxBnqB,EAAKkqB,MAAMC,QAAU,IAMM,KAAvBnqB,EAAKkqB,MAAMC,SAAkBjL,EAAUlf,KAC3Csb,EAAQ1D,GAAU+F,EAAUpB,OAAQvc,EAAM,aAAcqqB,GAAerqB,EAAKuD,cAG7EuqB,EAAS5O,EAAUlf,GAEF,SAAZmqB,GAAuB2D,GAC3BnQ,EAAUN,IAAKrd,EAAM,aAAc8tB,EAAS3D,EAAUhsB,EAAOihB,IAAKpf,EAAM,aAO3E,KAAM4X,EAAQ,EAAW1Y,EAAR0Y,EAAgBA,IAChC5X,EAAOoO,EAAUwJ,GACX5X,EAAKkqB,QAGL2D,GAA+B,SAAvB7tB,EAAKkqB,MAAMC,SAA6C,KAAvBnqB,EAAKkqB,MAAMC,UACzDnqB,EAAKkqB,MAAMC,QAAU0D,EAAOvS,EAAQ1D,IAAW,GAAK,QAItD,OAAOxJ,GAGRjQ,EAAOyC,QAINmtB,UACCC,SACC3uB,IAAK,SAAUW,EAAM8qB,GACpB,GAAKA,EAAW,CAGf,GAAIrrB,GAAMorB,GAAQ7qB,EAAM,UACxB,OAAe,KAARP,EAAa,IAAMA,MAO9BwuB,WACCC,aAAe,EACfC,aAAe,EACfC,UAAY,EACZC,YAAc,EACdzB,YAAc,EACd0B,YAAc,EACdN,SAAW,EACXO,OAAS,EACTC,SAAW,EACXC,QAAU,EACVC,QAAU,EACVC,MAAQ,GAKTC,UACCC,QAAS,YAIV3E,MAAO,SAAUlqB,EAAMc,EAAM2C,EAAO4pB,GAGnC,GAAMrtB,GAA0B,IAAlBA,EAAKuC,UAAoC,IAAlBvC,EAAKuC,UAAmBvC,EAAKkqB,MAAlE,CAKA,GAAIzqB,GAAKyC,EAAMsc,EACdwO,EAAW7uB,EAAOkF,UAAWvC,GAC7BopB,EAAQlqB,EAAKkqB,KAQd,OANAppB,GAAO3C,EAAOywB,SAAU5B,KAAgB7uB,EAAOywB,SAAU5B,GAAaF,GAAgB5C,EAAO8C,IAG7FxO,EAAQrgB,EAAO4vB,SAAUjtB,IAAU3C,EAAO4vB,SAAUf,GAGrCxrB,SAAViC,EAiCC+a,GAAS,OAASA,IAAqDhd,UAA3C/B,EAAM+e,EAAMnf,IAAKW,GAAM,EAAOqtB,IACvD5tB,EAIDyqB,EAAOppB,IArCdoB,QAAcuB,GAGA,WAATvB,IAAsBzC,EAAM6sB,GAAQ3iB,KAAMlG,MAC9CA,GAAUhE,EAAI,GAAK,GAAMA,EAAI,GAAK6C,WAAYnE,EAAOihB,IAAKpf,EAAMc,IAEhEoB,EAAO,UAIM,MAATuB,GAAiBA,IAAUA,IAKlB,WAATvB,GAAsB/D,EAAO8vB,UAAWjB,KAC5CvpB,GAAS,MAKJxF,EAAQytB,iBAA6B,KAAVjoB,GAAiD,IAAjC3C,EAAKlD,QAAS,gBAC9DssB,EAAOppB,GAAS,WAIX0d,GAAW,OAASA,IAAwDhd,UAA7CiC,EAAQ+a,EAAMnB,IAAKrd,EAAMyD,EAAO4pB,MACpEnD,EAAOppB,GAAS2C,IAjBjB,UA+BF2b,IAAK,SAAUpf,EAAMc,EAAMusB,EAAOE,GACjC,GAAIjf,GAAKhP,EAAKkf,EACbwO,EAAW7uB,EAAOkF,UAAWvC,EAwB9B,OArBAA,GAAO3C,EAAOywB,SAAU5B,KAAgB7uB,EAAOywB,SAAU5B,GAAaF,GAAgB9sB,EAAKkqB,MAAO8C,IAGlGxO,EAAQrgB,EAAO4vB,SAAUjtB,IAAU3C,EAAO4vB,SAAUf,GAG/CxO,GAAS,OAASA,KACtBlQ,EAAMkQ,EAAMnf,IAAKW,GAAM,EAAMqtB,IAIjB7rB,SAAR8M,IACJA,EAAMuc,GAAQ7qB,EAAMc,EAAMysB,IAId,WAARjf,GAAoBxN,IAAQ4rB,MAChCpe,EAAMoe,GAAoB5rB,IAIZ,KAAVusB,GAAgBA,GACpB/tB,EAAMgD,WAAYgM,GACX+e,KAAU,GAAQlvB,EAAOkE,UAAW/C,GAAQA,GAAO,EAAIgP,GAExDA,KAITnQ,EAAOyB,MAAO,SAAU,SAAW,SAAUK,EAAGa,GAC/C3C,EAAO4vB,SAAUjtB,IAChBzB,IAAK,SAAUW,EAAM8qB,EAAUuC,GAC9B,MAAKvC,GAIGsB,GAAaniB,KAAM9L,EAAOihB,IAAKpf,EAAM,aAAsC,IAArBA,EAAK0tB,YACjEvvB,EAAOguB,KAAMnsB,EAAMusB,GAAS,WAC3B,MAAOiB,IAAkBxtB,EAAMc,EAAMusB,KAEtCG,GAAkBxtB,EAAMc,EAAMusB,GARhC,QAYDhQ,IAAK,SAAUrd,EAAMyD,EAAO4pB,GAC3B,GAAIE,GAASF,GAAS3C,GAAW1qB,EACjC,OAAOitB,IAAmBjtB,EAAMyD,EAAO4pB,EACtCD,GACCptB,EACAc,EACAusB,EACmD,eAAnDlvB,EAAOihB,IAAKpf,EAAM,aAAa,EAAOutB,GACtCA,GACG,OAORpvB,EAAO4vB,SAAS7B,YAAcf,GAAcltB,EAAQ+tB,oBACnD,SAAUhsB,EAAM8qB,GACf,MAAKA,GACG3sB,EAAOguB,KAAMnsB,GAAQmqB,QAAW,gBACtCU,IAAU7qB,EAAM,gBAFlB,SAQF7B,EAAOyB,MACNkvB,OAAQ,GACRC,QAAS,GACTC,OAAQ,SACN,SAAUC,EAAQC,GACpB/wB,EAAO4vB,SAAUkB,EAASC,IACzBC,OAAQ,SAAU1rB,GAOjB,IANA,GAAIxD,GAAI,EACPmvB,KAGAC,EAAyB,gBAAV5rB,GAAqBA,EAAMkB,MAAM,MAASlB,GAE9C,EAAJxD,EAAOA,IACdmvB,EAAUH,EAAShQ,EAAWhf,GAAMivB,GACnCG,EAAOpvB,IAAOovB,EAAOpvB,EAAI,IAAOovB,EAAO,EAGzC,OAAOD,KAIH5E,GAAQvgB,KAAMglB,KACnB9wB,EAAO4vB,SAAUkB,EAASC,GAAS7R,IAAM4P,MAI3C9uB,EAAOG,GAAGsC,QACTwe,IAAK,SAAUte,EAAM2C,GACpB,MAAO8Y,GAAQjf,KAAM,SAAU0C,EAAMc,EAAM2C,GAC1C,GAAI8pB,GAAQhtB,EACXR,KACAE,EAAI,CAEL,IAAK9B,EAAOoD,QAAST,GAAS,CAI7B,IAHAysB,EAAS7C,GAAW1qB,GACpBO,EAAMO,EAAK5B,OAECqB,EAAJN,EAASA,IAChBF,EAAKe,EAAMb,IAAQ9B,EAAOihB,IAAKpf,EAAMc,EAAMb,IAAK,EAAOstB,EAGxD,OAAOxtB,GAGR,MAAiByB,UAAViC,EACNtF,EAAO+rB,MAAOlqB,EAAMc,EAAM2C,GAC1BtF,EAAOihB,IAAKpf,EAAMc,IACjBA,EAAM2C,EAAOtD,UAAUjB,OAAS,IAEpC2uB,KAAM,WACL,MAAOD,IAAUtwB,MAAM,IAExBgyB,KAAM,WACL,MAAO1B,IAAUtwB,OAElBiyB,OAAQ,SAAUtV,GACjB,MAAsB,iBAAVA,GACJA,EAAQ3c,KAAKuwB,OAASvwB,KAAKgyB,OAG5BhyB,KAAKsC,KAAK,WACXsf,EAAU5hB,MACda,EAAQb,MAAOuwB,OAEf1vB,EAAQb,MAAOgyB,WAOnB,SAASE,IAAOxvB,EAAMa,EAASyc,EAAM7c,EAAKgvB,GACzC,MAAO,IAAID,IAAMzwB,UAAUR,KAAMyB,EAAMa,EAASyc,EAAM7c,EAAKgvB,GAE5DtxB,EAAOqxB,MAAQA,GAEfA,GAAMzwB,WACLE,YAAauwB,GACbjxB,KAAM,SAAUyB,EAAMa,EAASyc,EAAM7c,EAAKgvB,EAAQC,GACjDpyB,KAAK0C,KAAOA,EACZ1C,KAAKggB,KAAOA,EACZhgB,KAAKmyB,OAASA,GAAU,QACxBnyB,KAAKuD,QAAUA,EACfvD,KAAKgT,MAAQhT,KAAKmH,IAAMnH,KAAKiO,MAC7BjO,KAAKmD,IAAMA,EACXnD,KAAKoyB,KAAOA,IAAUvxB,EAAO8vB,UAAW3Q,GAAS,GAAK,OAEvD/R,IAAK,WACJ,GAAIiT,GAAQgR,GAAMG,UAAWryB,KAAKggB,KAElC,OAAOkB,IAASA,EAAMnf,IACrBmf,EAAMnf,IAAK/B,MACXkyB,GAAMG,UAAUjN,SAASrjB,IAAK/B,OAEhCsyB,IAAK,SAAUC,GACd,GAAIC,GACHtR,EAAQgR,GAAMG,UAAWryB,KAAKggB,KAoB/B,OAlBKhgB,MAAKuD,QAAQkvB,SACjBzyB,KAAKqa,IAAMmY,EAAQ3xB,EAAOsxB,OAAQnyB,KAAKmyB,QACtCI,EAASvyB,KAAKuD,QAAQkvB,SAAWF,EAAS,EAAG,EAAGvyB,KAAKuD,QAAQkvB,UAG9DzyB,KAAKqa,IAAMmY,EAAQD,EAEpBvyB,KAAKmH,KAAQnH,KAAKmD,IAAMnD,KAAKgT,OAAUwf,EAAQxyB,KAAKgT,MAE/ChT,KAAKuD,QAAQmvB,MACjB1yB,KAAKuD,QAAQmvB,KAAK5wB,KAAM9B,KAAK0C,KAAM1C,KAAKmH,IAAKnH,MAGzCkhB,GAASA,EAAMnB,IACnBmB,EAAMnB,IAAK/f,MAEXkyB,GAAMG,UAAUjN,SAASrF,IAAK/f,MAExBA,OAITkyB,GAAMzwB,UAAUR,KAAKQ,UAAYywB,GAAMzwB,UAEvCywB,GAAMG,WACLjN,UACCrjB,IAAK,SAAU4wB,GACd,GAAIngB,EAEJ,OAAiC,OAA5BmgB,EAAMjwB,KAAMiwB,EAAM3S,OACpB2S,EAAMjwB,KAAKkqB,OAA2C,MAAlC+F,EAAMjwB,KAAKkqB,MAAO+F,EAAM3S,OAQ/CxN,EAAS3R,EAAOihB,IAAK6Q,EAAMjwB,KAAMiwB,EAAM3S,KAAM,IAErCxN,GAAqB,SAAXA,EAAwBA,EAAJ,GAT9BmgB,EAAMjwB,KAAMiwB,EAAM3S,OAW3BD,IAAK,SAAU4S,GAIT9xB,EAAO+xB,GAAGF,KAAMC,EAAM3S,MAC1Bnf,EAAO+xB,GAAGF,KAAMC,EAAM3S,MAAQ2S,GACnBA,EAAMjwB,KAAKkqB,QAAgE,MAArD+F,EAAMjwB,KAAKkqB,MAAO/rB,EAAOywB,SAAUqB,EAAM3S,QAAoBnf,EAAO4vB,SAAUkC,EAAM3S,OACrHnf,EAAO+rB,MAAO+F,EAAMjwB,KAAMiwB,EAAM3S,KAAM2S,EAAMxrB,IAAMwrB,EAAMP,MAExDO,EAAMjwB,KAAMiwB,EAAM3S,MAAS2S,EAAMxrB,OAQrC+qB,GAAMG,UAAUvL,UAAYoL,GAAMG,UAAU3L,YAC3C3G,IAAK,SAAU4S,GACTA,EAAMjwB,KAAKuC,UAAY0tB,EAAMjwB,KAAKmD,aACtC8sB,EAAMjwB,KAAMiwB,EAAM3S,MAAS2S,EAAMxrB,OAKpCtG,EAAOsxB,QACNU,OAAQ,SAAUC,GACjB,MAAOA,IAERC,MAAO,SAAUD,GAChB,MAAO,GAAM1uB,KAAK4uB,IAAKF,EAAI1uB,KAAK6uB,IAAO,IAIzCpyB,EAAO+xB,GAAKV,GAAMzwB,UAAUR,KAG5BJ,EAAO+xB,GAAGF,OAKV,IACCQ,IAAOC,GACPC,GAAW,yBACXC,GAAS,GAAI1pB,QAAQ,iBAAmB8X,EAAO,cAAe,KAC9D6R,GAAO,cACPC,IAAwBC,IACxBC,IACCC,KAAO,SAAU1T,EAAM7Z,GACtB,GAAIwsB,GAAQ3yB,KAAK2zB,YAAa3T,EAAM7Z,GACnCtC,EAAS8uB,EAAM1kB,MACf8jB,EAAQsB,GAAOhnB,KAAMlG,GACrBisB,EAAOL,GAASA,EAAO,KAASlxB,EAAO8vB,UAAW3Q,GAAS,GAAK,MAGhEhN,GAAUnS,EAAO8vB,UAAW3Q,IAAmB,OAAToS,IAAkBvuB,IACvDwvB,GAAOhnB,KAAMxL,EAAOihB,IAAK6Q,EAAMjwB,KAAMsd,IACtC4T,EAAQ,EACRC,EAAgB,EAEjB,IAAK7gB,GAASA,EAAO,KAAQof,EAAO,CAEnCA,EAAOA,GAAQpf,EAAO,GAGtB+e,EAAQA,MAGR/e,GAASnP,GAAU,CAEnB,GAGC+vB,GAAQA,GAAS,KAGjB5gB,GAAgB4gB,EAChB/yB,EAAO+rB,MAAO+F,EAAMjwB,KAAMsd,EAAMhN,EAAQof,SAI/BwB,KAAWA,EAAQjB,EAAM1kB,MAAQpK,IAAqB,IAAV+vB,KAAiBC,GAaxE,MATK9B,KACJ/e,EAAQ2f,EAAM3f,OAASA,IAAUnP,GAAU,EAC3C8uB,EAAMP,KAAOA,EAEbO,EAAMxvB,IAAM4uB,EAAO,GAClB/e,GAAU+e,EAAO,GAAM,GAAMA,EAAO,IACnCA,EAAO,IAGHY,IAKV,SAASmB,MAIR,MAHA9U,YAAW,WACVkU,GAAQhvB,SAEAgvB,GAAQryB,EAAOsG,MAIzB,QAAS4sB,IAAOnvB,EAAMovB,GACrB,GAAI9N,GACHvjB,EAAI,EACJkL,GAAUomB,OAAQrvB,EAKnB,KADAovB,EAAeA,EAAe,EAAI,EACtB,EAAJrxB,EAAQA,GAAK,EAAIqxB,EACxB9N,EAAQvE,EAAWhf,GACnBkL,EAAO,SAAWqY,GAAUrY,EAAO,UAAYqY,GAAUthB,CAO1D,OAJKovB,KACJnmB,EAAM6iB,QAAU7iB,EAAM4f,MAAQ7oB,GAGxBiJ,EAGR,QAAS8lB,IAAaxtB,EAAO6Z,EAAMkU,GAKlC,IAJA,GAAIvB,GACHwB,GAAeV,GAAUzT,QAAe5f,OAAQqzB,GAAU,MAC1DnZ,EAAQ,EACR1Y,EAASuyB,EAAWvyB,OACLA,EAAR0Y,EAAgBA,IACvB,GAAMqY,EAAQwB,EAAY7Z,GAAQxY,KAAMoyB,EAAWlU,EAAM7Z,GAGxD,MAAOwsB,GAKV,QAASa,IAAkB9wB,EAAMojB,EAAOsO,GAEvC,GAAIpU,GAAM7Z,EAAO8rB,EAAQU,EAAOzR,EAAOmT,EAASxH,EAASyH,EACxDC,EAAOv0B,KACPioB,KACA2E,EAAQlqB,EAAKkqB,MACb4D,EAAS9tB,EAAKuC,UAAY2c,EAAUlf,GACpC8xB,EAAWnU,EAAUte,IAAKW,EAAM,SAG3B0xB,GAAKrT,QACVG,EAAQrgB,EAAOsgB,YAAaze,EAAM,MACX,MAAlBwe,EAAMuT,WACVvT,EAAMuT,SAAW,EACjBJ,EAAUnT,EAAMvM,MAAMqH,KACtBkF,EAAMvM,MAAMqH,KAAO,WACZkF,EAAMuT,UACXJ,MAIHnT,EAAMuT,WAENF,EAAK1X,OAAO,WAEX0X,EAAK1X,OAAO,WACXqE,EAAMuT,WACA5zB,EAAOkgB,MAAOre,EAAM,MAAOd,QAChCsf,EAAMvM,MAAMqH,YAOO,IAAlBtZ,EAAKuC,WAAoB,UAAY6gB,IAAS,SAAWA,MAK7DsO,EAAKM,UAAa9H,EAAM8H,SAAU9H,EAAM+H,UAAW/H,EAAMgI,WAIzD/H,EAAUhsB,EAAOihB,IAAKpf,EAAM,WAG5B4xB,EAA2B,SAAZzH,EACdxM,EAAUte,IAAKW,EAAM,eAAkBqqB,GAAgBrqB,EAAKuD,UAAa4mB,EAEpD,WAAjByH,GAA6D,SAAhCzzB,EAAOihB,IAAKpf,EAAM,WACnDkqB,EAAMC,QAAU,iBAIbuH,EAAKM,WACT9H,EAAM8H,SAAW,SACjBH,EAAK1X,OAAO,WACX+P,EAAM8H,SAAWN,EAAKM,SAAU,GAChC9H,EAAM+H,UAAYP,EAAKM,SAAU,GACjC9H,EAAMgI,UAAYR,EAAKM,SAAU,KAKnC,KAAM1U,IAAQ8F,GAEb,GADA3f,EAAQ2f,EAAO9F,GACVoT,GAAS/mB,KAAMlG,GAAU,CAG7B,SAFO2f,GAAO9F,GACdiS,EAASA,GAAoB,WAAV9rB,EACdA,KAAYqqB,EAAS,OAAS,QAAW,CAG7C,GAAe,SAAVrqB,IAAoBquB,GAAiCtwB,SAArBswB,EAAUxU,GAG9C,QAFAwQ,IAAS,EAKXvI,EAAMjI,GAASwU,GAAYA,EAAUxU,IAAUnf,EAAO+rB,MAAOlqB,EAAMsd,OAInE6M,GAAU3oB,MAIZ,IAAMrD,EAAOqE,cAAe+iB,GAyCqD,YAAxD,SAAZ4E,EAAqBE,GAAgBrqB,EAAKuD,UAAa4mB,KACnED,EAAMC,QAAUA,OA1CoB,CAC/B2H,EACC,UAAYA,KAChBhE,EAASgE,EAAShE,QAGnBgE,EAAWnU,EAAUpB,OAAQvc,EAAM,aAI/BuvB,IACJuC,EAAShE,QAAUA,GAEfA,EACJ3vB,EAAQ6B,GAAO6tB,OAEfgE,EAAK/rB,KAAK,WACT3H,EAAQ6B,GAAOsvB,SAGjBuC,EAAK/rB,KAAK,WACT,GAAIwX,EAEJK,GAAUjE,OAAQ1Z,EAAM,SACxB,KAAMsd,IAAQiI,GACbpnB,EAAO+rB,MAAOlqB,EAAMsd,EAAMiI,EAAMjI,KAGlC,KAAMA,IAAQiI,GACb0K,EAAQgB,GAAanD,EAASgE,EAAUxU,GAAS,EAAGA,EAAMuU,GAElDvU,IAAQwU,KACfA,EAAUxU,GAAS2S,EAAM3f,MACpBwd,IACJmC,EAAMxvB,IAAMwvB,EAAM3f,MAClB2f,EAAM3f,MAAiB,UAATgN,GAA6B,WAATA,EAAoB,EAAI,KAW/D,QAAS6U,IAAY/O,EAAOgP,GAC3B,GAAIxa,GAAO9W,EAAM2uB,EAAQhsB,EAAO+a,CAGhC,KAAM5G,IAASwL,GAed,GAdAtiB,EAAO3C,EAAOkF,UAAWuU,GACzB6X,EAAS2C,EAAetxB,GACxB2C,EAAQ2f,EAAOxL,GACVzZ,EAAOoD,QAASkC,KACpBgsB,EAAShsB,EAAO,GAChBA,EAAQ2f,EAAOxL,GAAUnU,EAAO,IAG5BmU,IAAU9W,IACdsiB,EAAOtiB,GAAS2C,QACT2f,GAAOxL,IAGf4G,EAAQrgB,EAAO4vB,SAAUjtB,GACpB0d,GAAS,UAAYA,GAAQ,CACjC/a,EAAQ+a,EAAM2Q,OAAQ1rB,SACf2f,GAAOtiB,EAId,KAAM8W,IAASnU,GACNmU,IAASwL,KAChBA,EAAOxL,GAAUnU,EAAOmU,GACxBwa,EAAexa,GAAU6X,OAI3B2C,GAAetxB,GAAS2uB,EAK3B,QAAS4C,IAAWryB,EAAMsyB,EAAYzxB,GACrC,GAAIiP,GACHyiB,EACA3a,EAAQ,EACR1Y,EAAS2xB,GAAoB3xB,OAC7Bkb,EAAWjc,EAAO2b,WAAWK,OAAQ,iBAE7BqY,GAAKxyB,OAEbwyB,EAAO,WACN,GAAKD,EACJ,OAAO,CAWR,KATA,GAAIE,GAAcjC,IAASY,KAC1BhW,EAAY1Z,KAAKyrB,IAAK,EAAGqE,EAAUkB,UAAYlB,EAAUzB,SAAW0C,GAGpEle,EAAO6G,EAAYoW,EAAUzB,UAAY,EACzCF,EAAU,EAAItb,EACdqD,EAAQ,EACR1Y,EAASsyB,EAAUmB,OAAOzzB,OAEXA,EAAR0Y,EAAiBA,IACxB4Z,EAAUmB,OAAQ/a,GAAQgY,IAAKC,EAKhC,OAFAzV,GAASoB,WAAYxb,GAAQwxB,EAAW3B,EAASzU,IAElC,EAAVyU,GAAe3wB,EACZkc,GAEPhB,EAASqB,YAAazb,GAAQwxB,KACvB,IAGTA,EAAYpX,EAASF,SACpBla,KAAMA,EACNojB,MAAOjlB,EAAOyC,UAAY0xB,GAC1BZ,KAAMvzB,EAAOyC,QAAQ,GAAQwxB,kBAAqBvxB,GAClD+xB,mBAAoBN,EACpBO,gBAAiBhyB,EACjB6xB,UAAWlC,IAASY,KACpBrB,SAAUlvB,EAAQkvB,SAClB4C,UACA1B,YAAa,SAAU3T,EAAM7c,GAC5B,GAAIwvB,GAAQ9xB,EAAOqxB,MAAOxvB,EAAMwxB,EAAUE,KAAMpU,EAAM7c,EACpD+wB,EAAUE,KAAKU,cAAe9U,IAAUkU,EAAUE,KAAKjC,OAEzD,OADA+B,GAAUmB,OAAOh1B,KAAMsyB,GAChBA,GAERvR,KAAM,SAAUoU,GACf,GAAIlb,GAAQ,EAGX1Y,EAAS4zB,EAAUtB,EAAUmB,OAAOzzB,OAAS,CAC9C,IAAKqzB,EACJ,MAAOj1B,KAGR,KADAi1B,GAAU,EACMrzB,EAAR0Y,EAAiBA,IACxB4Z,EAAUmB,OAAQ/a,GAAQgY,IAAK,EAShC,OALKkD,GACJ1Y,EAASqB,YAAazb,GAAQwxB,EAAWsB,IAEzC1Y,EAAS2Y,WAAY/yB,GAAQwxB,EAAWsB,IAElCx1B,QAGT8lB,EAAQoO,EAAUpO,KAInB,KAFA+O,GAAY/O,EAAOoO,EAAUE,KAAKU,eAElBlzB,EAAR0Y,EAAiBA,IAExB,GADA9H,EAAS+gB,GAAqBjZ,GAAQxY,KAAMoyB,EAAWxxB,EAAMojB,EAAOoO,EAAUE,MAE7E,MAAO5hB,EAmBT,OAfA3R,GAAO4B,IAAKqjB,EAAO6N,GAAaO,GAE3BrzB,EAAOkD,WAAYmwB,EAAUE,KAAKphB,QACtCkhB,EAAUE,KAAKphB,MAAMlR,KAAMY,EAAMwxB,GAGlCrzB,EAAO+xB,GAAG8C,MACT70B,EAAOyC,OAAQ4xB,GACdxyB,KAAMA,EACN6xB,KAAML,EACNnT,MAAOmT,EAAUE,KAAKrT,SAKjBmT,EAAU3W,SAAU2W,EAAUE,KAAK7W,UACxC/U,KAAM0rB,EAAUE,KAAK5rB,KAAM0rB,EAAUE,KAAKuB,UAC1C5Y,KAAMmX,EAAUE,KAAKrX,MACrBF,OAAQqX,EAAUE,KAAKvX,QAG1Bhc,EAAOk0B,UAAYl0B,EAAOyC,OAAQyxB,IAEjCa,QAAS,SAAU9P,EAAOvjB,GACpB1B,EAAOkD,WAAY+hB,IACvBvjB,EAAWujB,EACXA,GAAU,MAEVA,EAAQA,EAAMze,MAAM,IAOrB,KAJA,GAAI2Y,GACH1F,EAAQ,EACR1Y,EAASkkB,EAAMlkB,OAEAA,EAAR0Y,EAAiBA,IACxB0F,EAAO8F,EAAOxL,GACdmZ,GAAUzT,GAASyT,GAAUzT,OAC7ByT,GAAUzT,GAAOpP,QAASrO,IAI5BszB,UAAW,SAAUtzB,EAAUipB,GACzBA,EACJ+H,GAAoB3iB,QAASrO,GAE7BgxB,GAAoBlzB,KAAMkC,MAK7B1B,EAAOi1B,MAAQ,SAAUA,EAAO3D,EAAQnxB,GACvC,GAAI+0B,GAAMD,GAA0B,gBAAVA,GAAqBj1B,EAAOyC,UAAYwyB,IACjEH,SAAU30B,IAAOA,GAAMmxB,GACtBtxB,EAAOkD,WAAY+xB,IAAWA,EAC/BrD,SAAUqD,EACV3D,OAAQnxB,GAAMmxB,GAAUA,IAAWtxB,EAAOkD,WAAYouB,IAAYA,EAwBnE,OArBA4D,GAAItD,SAAW5xB,EAAO+xB,GAAGhU,IAAM,EAA4B,gBAAjBmX,GAAItD,SAAwBsD,EAAItD,SACzEsD,EAAItD,WAAY5xB,GAAO+xB,GAAGoD,OAASn1B,EAAO+xB,GAAGoD,OAAQD,EAAItD,UAAa5xB,EAAO+xB,GAAGoD,OAAO5Q,UAGtE,MAAb2Q,EAAIhV,OAAiBgV,EAAIhV,SAAU,KACvCgV,EAAIhV,MAAQ,MAIbgV,EAAI/pB,IAAM+pB,EAAIJ,SAEdI,EAAIJ,SAAW,WACT90B,EAAOkD,WAAYgyB,EAAI/pB,MAC3B+pB,EAAI/pB,IAAIlK,KAAM9B,MAGV+1B,EAAIhV,OACRlgB,EAAOmgB,QAAShhB,KAAM+1B,EAAIhV,QAIrBgV,GAGRl1B,EAAOG,GAAGsC,QACT2yB,OAAQ,SAAUH,EAAOI,EAAI/D,EAAQ5vB,GAGpC,MAAOvC,MAAKwP,OAAQoS,GAAWE,IAAK,UAAW,GAAIyO,OAGjDptB,MAAMgzB,SAAUzF,QAASwF,GAAMJ,EAAO3D,EAAQ5vB,IAEjD4zB,QAAS,SAAUnW,EAAM8V,EAAO3D,EAAQ5vB,GACvC,GAAIoS,GAAQ9T,EAAOqE,cAAe8a,GACjCoW,EAASv1B,EAAOi1B,MAAOA,EAAO3D,EAAQ5vB,GACtC8zB,EAAc,WAEb,GAAI9B,GAAOQ,GAAW/0B,KAAMa,EAAOyC,UAAY0c,GAAQoW,IAGlDzhB,GAAS0L,EAAUte,IAAK/B,KAAM,YAClCu0B,EAAKnT,MAAM,GAKd,OAFCiV,GAAYC,OAASD,EAEf1hB,GAASyhB,EAAOrV,SAAU,EAChC/gB,KAAKsC,KAAM+zB,GACXr2B,KAAK+gB,MAAOqV,EAAOrV,MAAOsV,IAE5BjV,KAAM,SAAUxc,EAAM0c,EAAYkU,GACjC,GAAIe,GAAY,SAAUrV,GACzB,GAAIE,GAAOF,EAAME,WACVF,GAAME,KACbA,EAAMoU,GAYP,OATqB,gBAAT5wB,KACX4wB,EAAUlU,EACVA,EAAa1c,EACbA,EAAOV,QAEHod,GAAc1c,KAAS,GAC3B5E,KAAK+gB,MAAOnc,GAAQ,SAGd5E,KAAKsC,KAAK,WAChB,GAAI0e,IAAU,EACb1G,EAAgB,MAAR1V,GAAgBA,EAAO,aAC/B4xB,EAAS31B,EAAO21B,OAChBva,EAAOoE,EAAUte,IAAK/B,KAEvB,IAAKsa,EACC2B,EAAM3B,IAAW2B,EAAM3B,GAAQ8G,MACnCmV,EAAWta,EAAM3B,QAGlB,KAAMA,IAAS2B,GACTA,EAAM3B,IAAW2B,EAAM3B,GAAQ8G,MAAQkS,GAAK3mB,KAAM2N,IACtDic,EAAWta,EAAM3B,GAKpB,KAAMA,EAAQkc,EAAO50B,OAAQ0Y,KACvBkc,EAAQlc,GAAQ5X,OAAS1C,MAAiB,MAAR4E,GAAgB4xB,EAAQlc,GAAQyG,QAAUnc,IAChF4xB,EAAQlc,GAAQia,KAAKnT,KAAMoU,GAC3BxU,GAAU,EACVwV,EAAOnzB,OAAQiX,EAAO,KAOnB0G,IAAYwU,IAChB30B,EAAOmgB,QAAShhB,KAAM4E,MAIzB0xB,OAAQ,SAAU1xB,GAIjB,MAHKA,MAAS,IACbA,EAAOA,GAAQ,MAET5E,KAAKsC,KAAK,WAChB,GAAIgY,GACH2B,EAAOoE,EAAUte,IAAK/B,MACtB+gB,EAAQ9E,EAAMrX,EAAO,SACrBsc,EAAQjF,EAAMrX,EAAO,cACrB4xB,EAAS31B,EAAO21B,OAChB50B,EAASmf,EAAQA,EAAMnf,OAAS,CAajC,KAVAqa,EAAKqa,QAAS,EAGdz1B,EAAOkgB,MAAO/gB,KAAM4E,MAEfsc,GAASA,EAAME,MACnBF,EAAME,KAAKtf,KAAM9B,MAAM,GAIlBsa,EAAQkc,EAAO50B,OAAQ0Y,KACvBkc,EAAQlc,GAAQ5X,OAAS1C,MAAQw2B,EAAQlc,GAAQyG,QAAUnc,IAC/D4xB,EAAQlc,GAAQia,KAAKnT,MAAM,GAC3BoV,EAAOnzB,OAAQiX,EAAO,GAKxB,KAAMA,EAAQ,EAAW1Y,EAAR0Y,EAAgBA,IAC3ByG,EAAOzG,IAAWyG,EAAOzG,GAAQgc,QACrCvV,EAAOzG,GAAQgc,OAAOx0B,KAAM9B,YAKvBic,GAAKqa,YAKfz1B,EAAOyB,MAAO,SAAU,OAAQ,QAAU,SAAUK,EAAGa,GACtD,GAAIizB,GAAQ51B,EAAOG,GAAIwC,EACvB3C,GAAOG,GAAIwC,GAAS,SAAUsyB,EAAO3D,EAAQ5vB,GAC5C,MAAgB,OAATuzB,GAAkC,iBAAVA,GAC9BW,EAAM7zB,MAAO5C,KAAM6C,WACnB7C,KAAKm2B,QAASpC,GAAOvwB,GAAM,GAAQsyB,EAAO3D,EAAQ5vB,MAKrD1B,EAAOyB,MACNo0B,UAAW3C,GAAM,QACjB4C,QAAS5C,GAAM,QACf6C,YAAa7C,GAAM,UACnB8C,QAAUnG,QAAS,QACnBoG,SAAWpG,QAAS,QACpBqG,YAAcrG,QAAS,WACrB,SAAUltB,EAAMsiB,GAClBjlB,EAAOG,GAAIwC,GAAS,SAAUsyB,EAAO3D,EAAQ5vB,GAC5C,MAAOvC,MAAKm2B,QAASrQ,EAAOgQ,EAAO3D,EAAQ5vB,MAI7C1B,EAAO21B,UACP31B,EAAO+xB,GAAGsC,KAAO,WAChB,GAAIQ,GACH/yB,EAAI,EACJ6zB,EAAS31B,EAAO21B,MAIjB,KAFAtD,GAAQryB,EAAOsG,MAEPxE,EAAI6zB,EAAO50B,OAAQe,IAC1B+yB,EAAQc,EAAQ7zB,GAEV+yB,KAAWc,EAAQ7zB,KAAQ+yB,GAChCc,EAAOnzB,OAAQV,IAAK,EAIhB6zB,GAAO50B,QACZf,EAAO+xB,GAAGxR,OAEX8R,GAAQhvB,QAGTrD,EAAO+xB,GAAG8C,MAAQ,SAAUA,GAC3B70B,EAAO21B,OAAOn2B,KAAMq1B,GACfA,IACJ70B,EAAO+xB,GAAG5f,QAEVnS,EAAO21B,OAAOvtB,OAIhBpI,EAAO+xB,GAAGoE,SAAW,GAErBn2B,EAAO+xB,GAAG5f,MAAQ,WACXmgB,KACLA,GAAU8D,YAAap2B,EAAO+xB,GAAGsC,KAAMr0B,EAAO+xB,GAAGoE,YAInDn2B,EAAO+xB,GAAGxR,KAAO,WAChB8V,cAAe/D,IACfA,GAAU,MAGXtyB,EAAO+xB,GAAGoD,QACTmB,KAAM,IACNC,KAAM,IAENhS,SAAU,KAMXvkB,EAAOG,GAAGq2B,MAAQ,SAAUC,EAAM1yB,GAIjC,MAHA0yB,GAAOz2B,EAAO+xB,GAAK/xB,EAAO+xB,GAAGoD,OAAQsB,IAAUA,EAAOA,EACtD1yB,EAAOA,GAAQ,KAER5E,KAAK+gB,MAAOnc,EAAM,SAAUgV,EAAMsH,GACxC,GAAIqW,GAAUvY,WAAYpF,EAAM0d,EAChCpW,GAAME,KAAO,WACZoW,aAAcD,OAMjB,WACC,GAAI1nB,GAAQjQ,EAAS6F,cAAe,SACnCmC,EAAShI,EAAS6F,cAAe,UACjCswB,EAAMnuB,EAAOhC,YAAahG,EAAS6F,cAAe,UAEnDoK,GAAMjL,KAAO,WAIbjE,EAAQ82B,QAA0B,KAAhB5nB,EAAM1J,MAIxBxF,EAAQ+2B,YAAc3B,EAAIthB,SAI1B7M,EAAO2M,UAAW,EAClB5T,EAAQg3B,aAAe5B,EAAIxhB,SAI3B1E,EAAQjQ,EAAS6F,cAAe,SAChCoK,EAAM1J,MAAQ,IACd0J,EAAMjL,KAAO,QACbjE,EAAQi3B,WAA6B,MAAhB/nB,EAAM1J,QAI5B,IAAI0xB,IAAUC,GACb/pB,GAAalN,EAAOgQ,KAAK9C,UAE1BlN,GAAOG,GAAGsC,QACTyN,KAAM,SAAUvN,EAAM2C,GACrB,MAAO8Y,GAAQjf,KAAMa,EAAOkQ,KAAMvN,EAAM2C,EAAOtD,UAAUjB,OAAS,IAGnEm2B,WAAY,SAAUv0B,GACrB,MAAOxD,MAAKsC,KAAK,WAChBzB,EAAOk3B,WAAY/3B,KAAMwD,QAK5B3C,EAAOyC,QACNyN,KAAM,SAAUrO,EAAMc,EAAM2C,GAC3B,GAAI+a,GAAO/e,EACV61B,EAAQt1B,EAAKuC,QAGd,IAAMvC,GAAkB,IAAVs1B,GAAyB,IAAVA,GAAyB,IAAVA,EAK5C,aAAYt1B,GAAKkK,eAAiByV,EAC1BxhB,EAAOmf,KAAMtd,EAAMc,EAAM2C,IAKlB,IAAV6xB,GAAgBn3B,EAAOgY,SAAUnW,KACrCc,EAAOA,EAAK0C,cACZgb,EAAQrgB,EAAOo3B,UAAWz0B,KACvB3C,EAAOgQ,KAAKhF,MAAMrB,KAAKmC,KAAMnJ,GAASs0B,GAAWD;AAGtC3zB,SAAViC,EAaO+a,GAAS,OAASA,IAA6C,QAAnC/e,EAAM+e,EAAMnf,IAAKW,EAAMc,IACvDrB,GAGPA,EAAMtB,EAAO0O,KAAKwB,KAAMrO,EAAMc,GAGhB,MAAPrB,EACN+B,OACA/B,GApBc,OAAVgE,EAGO+a,GAAS,OAASA,IAAoDhd,UAA1C/B,EAAM+e,EAAMnB,IAAKrd,EAAMyD,EAAO3C,IAC9DrB,GAGPO,EAAKmK,aAAcrJ,EAAM2C,EAAQ,IAC1BA,OAPPtF,GAAOk3B,WAAYr1B,EAAMc,KAuB5Bu0B,WAAY,SAAUr1B,EAAMyD,GAC3B,GAAI3C,GAAM00B,EACTv1B,EAAI,EACJw1B,EAAYhyB,GAASA,EAAM0F,MAAOqP,EAEnC,IAAKid,GAA+B,IAAlBz1B,EAAKuC,SACtB,MAASzB,EAAO20B,EAAUx1B,KACzBu1B,EAAWr3B,EAAOu3B,QAAS50B,IAAUA,EAGhC3C,EAAOgQ,KAAKhF,MAAMrB,KAAKmC,KAAMnJ,KAEjCd,EAAMw1B,IAAa,GAGpBx1B,EAAKyK,gBAAiB3J,IAKzBy0B,WACCrzB,MACCmb,IAAK,SAAUrd,EAAMyD,GACpB,IAAMxF,EAAQi3B,YAAwB,UAAVzxB,GAC3BtF,EAAOoF,SAAUvD,EAAM,SAAY,CACnC,GAAIsO,GAAMtO,EAAKyD,KAKf,OAJAzD,GAAKmK,aAAc,OAAQ1G,GACtB6K,IACJtO,EAAKyD,MAAQ6K,GAEP7K,QAQZ2xB,IACC/X,IAAK,SAAUrd,EAAMyD,EAAO3C,GAO3B,MANK2C,MAAU,EAEdtF,EAAOk3B,WAAYr1B,EAAMc,GAEzBd,EAAKmK,aAAcrJ,EAAMA,GAEnBA,IAGT3C,EAAOyB,KAAMzB,EAAOgQ,KAAKhF,MAAMrB,KAAKkX,OAAO7V,MAAO,QAAU,SAAUlJ,EAAGa,GACxE,GAAI60B,GAAStqB,GAAYvK,IAAU3C,EAAO0O,KAAKwB,IAE/ChD,IAAYvK,GAAS,SAAUd,EAAMc,EAAMiE,GAC1C,GAAItF,GAAKwhB,CAUT,OATMlc,KAELkc,EAAS5V,GAAYvK,GACrBuK,GAAYvK,GAASrB,EACrBA,EAAqC,MAA/Bk2B,EAAQ31B,EAAMc,EAAMiE,GACzBjE,EAAK0C,cACL,KACD6H,GAAYvK,GAASmgB,GAEfxhB,IAOT,IAAIm2B,IAAa,qCAEjBz3B,GAAOG,GAAGsC,QACT0c,KAAM,SAAUxc,EAAM2C,GACrB,MAAO8Y,GAAQjf,KAAMa,EAAOmf,KAAMxc,EAAM2C,EAAOtD,UAAUjB,OAAS,IAGnE22B,WAAY,SAAU/0B,GACrB,MAAOxD,MAAKsC,KAAK,iBACTtC,MAAMa,EAAOu3B,QAAS50B,IAAUA,QAK1C3C,EAAOyC,QACN80B,SACCI,MAAO,UACPC,QAAS,aAGVzY,KAAM,SAAUtd,EAAMc,EAAM2C,GAC3B,GAAIhE,GAAK+e,EAAOwX,EACfV,EAAQt1B,EAAKuC,QAGd,IAAMvC,GAAkB,IAAVs1B,GAAyB,IAAVA,GAAyB,IAAVA,EAY5C,MARAU,GAAmB,IAAVV,IAAgBn3B,EAAOgY,SAAUnW,GAErCg2B,IAEJl1B,EAAO3C,EAAOu3B,QAAS50B,IAAUA,EACjC0d,EAAQrgB,EAAOwxB,UAAW7uB,IAGZU,SAAViC,EACG+a,GAAS,OAASA,IAAoDhd,UAA1C/B,EAAM+e,EAAMnB,IAAKrd,EAAMyD,EAAO3C,IAChErB,EACEO,EAAMc,GAAS2C,EAGX+a,GAAS,OAASA,IAA6C,QAAnC/e,EAAM+e,EAAMnf,IAAKW,EAAMc,IACzDrB,EACAO,EAAMc,IAIT6uB,WACChe,UACCtS,IAAK,SAAUW,GACd,MAAOA,GAAKi2B,aAAc,aAAgBL,GAAW3rB,KAAMjK,EAAKuD,WAAcvD,EAAK0R,KAClF1R,EAAK2R,SACL,QAMC1T,EAAQ+2B,cACb72B,EAAOwxB,UAAU5d,UAChB1S,IAAK,SAAUW,GACd,GAAImM,GAASnM,EAAKmD,UAIlB,OAHKgJ,IAAUA,EAAOhJ,YACrBgJ,EAAOhJ,WAAW6O,cAEZ,QAKV7T,EAAOyB,MACN,WACA,WACA,YACA,cACA,cACA,UACA,UACA,SACA,cACA,mBACE,WACFzB,EAAOu3B,QAASp4B,KAAKkG,eAAkBlG,MAMxC,IAAI44B,IAAS,aAEb/3B,GAAOG,GAAGsC,QACTu1B,SAAU,SAAU1yB,GACnB,GAAI2yB,GAASp2B,EAAMuL,EAAK8qB,EAAO71B,EAAG81B,EACjCC,EAA2B,gBAAV9yB,IAAsBA,EACvCxD,EAAI,EACJM,EAAMjD,KAAK4B,MAEZ,IAAKf,EAAOkD,WAAYoC,GACvB,MAAOnG,MAAKsC,KAAK,SAAUY,GAC1BrC,EAAQb,MAAO64B,SAAU1yB,EAAMrE,KAAM9B,KAAMkD,EAAGlD,KAAKmP,aAIrD,IAAK8pB,EAIJ,IAFAH,GAAY3yB,GAAS,IAAK0F,MAAOqP,OAErBjY,EAAJN,EAASA,IAOhB,GANAD,EAAO1C,KAAM2C,GACbsL,EAAwB,IAAlBvL,EAAKuC,WAAoBvC,EAAKyM,WACjC,IAAMzM,EAAKyM,UAAY,KAAM7K,QAASs0B,GAAQ,KAChD,KAGU,CACV11B,EAAI,CACJ,OAAS61B,EAAQD,EAAQ51B,KACnB+K,EAAI3N,QAAS,IAAMy4B,EAAQ,KAAQ,IACvC9qB,GAAO8qB,EAAQ,IAKjBC,GAAan4B,EAAO2E,KAAMyI,GACrBvL,EAAKyM,YAAc6pB,IACvBt2B,EAAKyM,UAAY6pB,GAMrB,MAAOh5B,OAGRk5B,YAAa,SAAU/yB,GACtB,GAAI2yB,GAASp2B,EAAMuL,EAAK8qB,EAAO71B,EAAG81B,EACjCC,EAA+B,IAArBp2B,UAAUjB,QAAiC,gBAAVuE,IAAsBA,EACjExD,EAAI,EACJM,EAAMjD,KAAK4B,MAEZ,IAAKf,EAAOkD,WAAYoC,GACvB,MAAOnG,MAAKsC,KAAK,SAAUY,GAC1BrC,EAAQb,MAAOk5B,YAAa/yB,EAAMrE,KAAM9B,KAAMkD,EAAGlD,KAAKmP,aAGxD,IAAK8pB,EAGJ,IAFAH,GAAY3yB,GAAS,IAAK0F,MAAOqP,OAErBjY,EAAJN,EAASA,IAQhB,GAPAD,EAAO1C,KAAM2C,GAEbsL,EAAwB,IAAlBvL,EAAKuC,WAAoBvC,EAAKyM,WACjC,IAAMzM,EAAKyM,UAAY,KAAM7K,QAASs0B,GAAQ,KAChD,IAGU,CACV11B,EAAI,CACJ,OAAS61B,EAAQD,EAAQ51B,KAExB,MAAQ+K,EAAI3N,QAAS,IAAMy4B,EAAQ,MAAS,EAC3C9qB,EAAMA,EAAI3J,QAAS,IAAMy0B,EAAQ,IAAK,IAKxCC,GAAa7yB,EAAQtF,EAAO2E,KAAMyI,GAAQ,GACrCvL,EAAKyM,YAAc6pB,IACvBt2B,EAAKyM,UAAY6pB,GAMrB,MAAOh5B,OAGRm5B,YAAa,SAAUhzB,EAAOizB,GAC7B,GAAIx0B,SAAcuB,EAElB,OAAyB,iBAAbizB,IAAmC,WAATx0B,EAC9Bw0B,EAAWp5B,KAAK64B,SAAU1yB,GAAUnG,KAAKk5B,YAAa/yB,GAItDnG,KAAKsC,KADRzB,EAAOkD,WAAYoC,GACN,SAAUxD,GAC1B9B,EAAQb,MAAOm5B,YAAahzB,EAAMrE,KAAK9B,KAAM2C,EAAG3C,KAAKmP,UAAWiqB,GAAWA,IAI5D,WAChB,GAAc,WAATx0B,EAAoB,CAExB,GAAIuK,GACHxM,EAAI,EACJwW,EAAOtY,EAAQb,MACfq5B,EAAalzB,EAAM0F,MAAOqP,MAE3B,OAAS/L,EAAYkqB,EAAY12B,KAE3BwW,EAAKmgB,SAAUnqB,GACnBgK,EAAK+f,YAAa/pB,GAElBgK,EAAK0f,SAAU1pB,QAKNvK,IAASyd,GAAyB,YAATzd,KAC/B5E,KAAKmP,WAETkR,EAAUN,IAAK/f,KAAM,gBAAiBA,KAAKmP,WAO5CnP,KAAKmP,UAAYnP,KAAKmP,WAAahJ,KAAU,EAAQ,GAAKka,EAAUte,IAAK/B,KAAM,kBAAqB,OAKvGs5B,SAAU,SAAUx4B,GAInB,IAHA,GAAIqO,GAAY,IAAMrO,EAAW,IAChC6B,EAAI,EACJwX,EAAIna,KAAK4B,OACEuY,EAAJxX,EAAOA,IACd,GAA0B,IAArB3C,KAAK2C,GAAGsC,WAAmB,IAAMjF,KAAK2C,GAAGwM,UAAY,KAAK7K,QAAQs0B,GAAQ,KAAKt4B,QAAS6O,IAAe,EAC3G,OAAO,CAIT,QAAO,IAOT,IAAIoqB,IAAU,KAEd14B,GAAOG,GAAGsC,QACT0N,IAAK,SAAU7K,GACd,GAAI+a,GAAO/e,EAAK4B,EACfrB,EAAO1C,KAAK,EAEb,EAAA,GAAM6C,UAAUjB,OAsBhB,MAFAmC,GAAalD,EAAOkD,WAAYoC,GAEzBnG,KAAKsC,KAAK,SAAUK,GAC1B,GAAIqO,EAEmB,KAAlBhR,KAAKiF,WAKT+L,EADIjN,EACEoC,EAAMrE,KAAM9B,KAAM2C,EAAG9B,EAAQb,MAAOgR,OAEpC7K,EAIK,MAAP6K,EACJA,EAAM,GAEoB,gBAARA,GAClBA,GAAO,GAEInQ,EAAOoD,QAAS+M,KAC3BA,EAAMnQ,EAAO4B,IAAKuO,EAAK,SAAU7K,GAChC,MAAgB,OAATA,EAAgB,GAAKA,EAAQ,MAItC+a,EAAQrgB,EAAO24B,SAAUx5B,KAAK4E,OAAU/D,EAAO24B,SAAUx5B,KAAKiG,SAASC,eAGjEgb,GAAW,OAASA,IAA8Chd,SAApCgd,EAAMnB,IAAK/f,KAAMgR,EAAK,WACzDhR,KAAKmG,MAAQ6K,KAnDd,IAAKtO,EAGJ,MAFAwe,GAAQrgB,EAAO24B,SAAU92B,EAAKkC,OAAU/D,EAAO24B,SAAU92B,EAAKuD,SAASC,eAElEgb,GAAS,OAASA,IAAgDhd,UAAtC/B,EAAM+e,EAAMnf,IAAKW,EAAM,UAChDP,GAGRA,EAAMO,EAAKyD,MAEW,gBAARhE,GAEbA,EAAImC,QAAQi1B,GAAS,IAEd,MAAPp3B,EAAc,GAAKA,OA4CxBtB,EAAOyC,QACNk2B,UACCvQ,QACClnB,IAAK,SAAUW,GACd,GAAIsO,GAAMnQ,EAAO0O,KAAKwB,KAAMrO,EAAM,QAClC,OAAc,OAAPsO,EACNA,EAGAnQ,EAAO2E,KAAM3E,EAAO6E,KAAMhD,MAG7BkF,QACC7F,IAAK,SAAUW,GAYd,IAXA,GAAIyD,GAAO8iB,EACV1lB,EAAUb,EAAKa,QACf+W,EAAQ5X,EAAKgS,cACb4T,EAAoB,eAAd5lB,EAAKkC,MAAiC,EAAR0V,EACpC0D,EAASsK,EAAM,QACfuH,EAAMvH,EAAMhO,EAAQ,EAAI/W,EAAQ3B,OAChCe,EAAY,EAAR2X,EACHuV,EACAvH,EAAMhO,EAAQ,EAGJuV,EAAJltB,EAASA,IAIhB,GAHAsmB,EAAS1lB,EAASZ,MAGXsmB,EAAOxU,UAAY9R,IAAM2X,IAE5B3Z,EAAQg3B,YAAe1O,EAAO1U,SAAiD,OAAtC0U,EAAOrc,aAAc,cAC7Dqc,EAAOpjB,WAAW0O,UAAa1T,EAAOoF,SAAUgjB,EAAOpjB,WAAY,aAAiB,CAMxF,GAHAM,EAAQtF,EAAQooB,GAASjY,MAGpBsX,EACJ,MAAOniB,EAIR6X,GAAO3d,KAAM8F,GAIf,MAAO6X,IAGR+B,IAAK,SAAUrd,EAAMyD,GACpB,GAAIszB,GAAWxQ,EACd1lB,EAAUb,EAAKa,QACfya,EAASnd,EAAOwF,UAAWF,GAC3BxD,EAAIY,EAAQ3B,MAEb,OAAQe,IACPsmB,EAAS1lB,EAASZ,IACZsmB,EAAOxU,SAAW5T,EAAO2F,QAASyiB,EAAO9iB,MAAO6X,IAAY,KACjEyb,GAAY,EAQd,OAHMA,KACL/2B,EAAKgS,cAAgB,IAEfsJ,OAOXnd,EAAOyB,MAAO,QAAS,YAAc,WACpCzB,EAAO24B,SAAUx5B,OAChB+f,IAAK,SAAUrd,EAAMyD,GACpB,MAAKtF,GAAOoD,QAASkC,GACXzD,EAAK8R,QAAU3T,EAAO2F,QAAS3F,EAAO6B,GAAMsO,MAAO7K,IAAW,EADxE,SAKIxF,EAAQ82B,UACb52B,EAAO24B,SAAUx5B,MAAO+B,IAAM,SAAUW,GACvC,MAAsC,QAA/BA,EAAKkK,aAAa,SAAoB,KAAOlK,EAAKyD,UAW5DtF,EAAOyB,KAAM,0MAEqD+E,MAAM,KAAM,SAAU1E,EAAGa,GAG1F3C,EAAOG,GAAIwC,GAAS,SAAUyY,EAAMjb,GACnC,MAAO6B,WAAUjB,OAAS,EACzB5B,KAAKqoB,GAAI7kB,EAAM,KAAMyY,EAAMjb,GAC3BhB,KAAKukB,QAAS/gB,MAIjB3C,EAAOG,GAAGsC,QACTo2B,MAAO,SAAUC,EAAQC,GACxB,MAAO55B,MAAK6nB,WAAY8R,GAAS7R,WAAY8R,GAASD,IAGvDE,KAAM,SAAU7W,EAAO/G,EAAMjb,GAC5B,MAAOhB,MAAKqoB,GAAIrF,EAAO,KAAM/G,EAAMjb,IAEpC84B,OAAQ,SAAU9W,EAAOhiB,GACxB,MAAOhB,MAAK4e,IAAKoE,EAAO,KAAMhiB,IAG/B+4B,SAAU,SAAUj5B,EAAUkiB,EAAO/G,EAAMjb,GAC1C,MAAOhB,MAAKqoB,GAAIrF,EAAOliB,EAAUmb,EAAMjb,IAExCg5B,WAAY,SAAUl5B,EAAUkiB,EAAOhiB,GAEtC,MAA4B,KAArB6B,UAAUjB,OAAe5B,KAAK4e,IAAK9d,EAAU,MAASd,KAAK4e,IAAKoE,EAAOliB,GAAY,KAAME,KAKlG,IAAIi5B,IAAQp5B,EAAOsG,MAEf+yB,GAAS,IAMbr5B,GAAO6f,UAAY,SAAUzE,GAC5B,MAAOke,MAAKC,MAAOne,EAAO,KAK3Bpb,EAAOw5B,SAAW,SAAUpe,GAC3B,GAAIpJ,GAAK3L,CACT,KAAM+U,GAAwB,gBAATA,GACpB,MAAO,KAIR,KACC/U,EAAM,GAAIozB,WACVznB,EAAM3L,EAAIqzB,gBAAiBte,EAAM,YAChC,MAAQvQ,GACTmH,EAAM3O,OAMP,QAHM2O,GAAOA,EAAIrG,qBAAsB,eAAgB5K,SACtDf,EAAO2D,MAAO,gBAAkByX,GAE1BpJ,EAIR,IACC2nB,IAAQ,OACRC,GAAM,gBACNC,GAAW,6BAEXC,GAAiB,4DACjBC,GAAa,iBACbC,GAAY,QACZC,GAAO,4DAWPC,MAOAC,MAGAC,GAAW,KAAK76B,OAAQ,KAGxB86B,GAAen7B,EAAOgU,SAASK,KAG/B+mB,GAAeL,GAAKzuB,KAAM6uB,GAAah1B,kBAGxC,SAASk1B,IAA6BC,GAGrC,MAAO,UAAUC,EAAoB7e,GAED,gBAAvB6e,KACX7e,EAAO6e,EACPA,EAAqB,IAGtB,IAAIC,GACH54B,EAAI,EACJ64B,EAAYF,EAAmBp1B,cAAc2F,MAAOqP,MAErD,IAAKra,EAAOkD,WAAY0Y,GAEvB,MAAS8e,EAAWC,EAAU74B,KAER,MAAhB44B,EAAS,IACbA,EAAWA,EAASp7B,MAAO,IAAO,KACjCk7B,EAAWE,GAAaF,EAAWE,QAAkB3qB,QAAS6L,KAI9D4e,EAAWE,GAAaF,EAAWE,QAAkBl7B,KAAMoc,IAQjE,QAASgf,IAA+BJ,EAAW93B,EAASgyB,EAAiBmG,GAE5E,GAAIC,MACHC,EAAqBP,IAAcL,EAEpC,SAASa,GAASN,GACjB,GAAI9mB,EAYJ,OAXAknB,GAAWJ,IAAa,EACxB16B,EAAOyB,KAAM+4B,EAAWE,OAAkB,SAAUrwB,EAAG4wB,GACtD,GAAIC,GAAsBD,EAAoBv4B,EAASgyB,EAAiBmG,EACxE,OAAoC,gBAAxBK,IAAqCH,GAAqBD,EAAWI,GAIrEH,IACDnnB,EAAWsnB,GADf,QAHNx4B,EAAQi4B,UAAU5qB,QAASmrB,GAC3BF,EAASE,IACF,KAKFtnB,EAGR,MAAOonB,GAASt4B,EAAQi4B,UAAW,MAAUG,EAAW,MAASE,EAAS,KAM3E,QAASG,IAAYn4B,EAAQJ,GAC5B,GAAI6J,GAAKxJ,EACRm4B,EAAcp7B,EAAOq7B,aAAaD,eAEnC,KAAM3uB,IAAO7J,GACQS,SAAfT,EAAK6J,MACP2uB,EAAa3uB,GAAQzJ,EAAWC,IAASA,OAAgBwJ,GAAQ7J,EAAK6J,GAO1E,OAJKxJ,IACJjD,EAAOyC,QAAQ,EAAMO,EAAQC,GAGvBD,EAOR,QAASs4B,IAAqBC,EAAGV,EAAOW,GAEvC,GAAIC,GAAI13B,EAAM23B,EAAeC,EAC5B7iB,EAAWyiB,EAAEziB,SACb6hB,EAAYY,EAAEZ,SAGf,OAA2B,MAAnBA,EAAW,GAClBA,EAAUhuB,QACEtJ,SAAPo4B,IACJA,EAAKF,EAAEK,UAAYf,EAAMgB,kBAAkB,gBAK7C,IAAKJ,EACJ,IAAM13B,IAAQ+U,GACb,GAAKA,EAAU/U,IAAU+U,EAAU/U,GAAO+H,KAAM2vB,GAAO,CACtDd,EAAU5qB,QAAShM,EACnB,OAMH,GAAK42B,EAAW,IAAOa,GACtBE,EAAgBf,EAAW,OACrB,CAEN,IAAM52B,IAAQy3B,GAAY,CACzB,IAAMb,EAAW,IAAOY,EAAEO,WAAY/3B,EAAO,IAAM42B,EAAU,IAAO,CACnEe,EAAgB33B,CAChB,OAEK43B,IACLA,EAAgB53B,GAIlB23B,EAAgBA,GAAiBC,EAMlC,MAAKD,IACCA,IAAkBf,EAAW,IACjCA,EAAU5qB,QAAS2rB,GAEbF,EAAWE,IAJnB,OAWD,QAASK,IAAaR,EAAGS,EAAUnB,EAAOoB,GACzC,GAAIC,GAAOC,EAASC,EAAM/1B,EAAK2S,EAC9B8iB,KAEAnB,EAAYY,EAAEZ,UAAUr7B,OAGzB,IAAKq7B,EAAW,GACf,IAAMyB,IAAQb,GAAEO,WACfA,EAAYM,EAAK/2B,eAAkBk2B,EAAEO,WAAYM,EAInDD,GAAUxB,EAAUhuB,OAGpB,OAAQwvB,EAcP,GAZKZ,EAAEc,eAAgBF,KACtBtB,EAAOU,EAAEc,eAAgBF,IAAcH,IAIlChjB,GAAQijB,GAAaV,EAAEe,aAC5BN,EAAWT,EAAEe,WAAYN,EAAUT,EAAEb,WAGtC1hB,EAAOmjB,EACPA,EAAUxB,EAAUhuB,QAKnB,GAAiB,MAAZwvB,EAEJA,EAAUnjB,MAGJ,IAAc,MAATA,GAAgBA,IAASmjB,EAAU,CAM9C,GAHAC,EAAON,EAAY9iB,EAAO,IAAMmjB,IAAaL,EAAY,KAAOK,IAG1DC,EACL,IAAMF,IAASJ,GAId,GADAz1B,EAAM61B,EAAM11B,MAAO,KACdH,EAAK,KAAQ81B,IAGjBC,EAAON,EAAY9iB,EAAO,IAAM3S,EAAK,KACpCy1B,EAAY,KAAOz1B,EAAK,KACb,CAEN+1B,KAAS,EACbA,EAAON,EAAYI,GAGRJ,EAAYI,MAAY,IACnCC,EAAU91B,EAAK,GACfs0B,EAAU5qB,QAAS1J,EAAK,IAEzB,OAOJ,GAAK+1B,KAAS,EAGb,GAAKA,GAAQb,EAAG,UACfS,EAAWI,EAAMJ,OAEjB,KACCA,EAAWI,EAAMJ,GAChB,MAAQnxB,GACT,OAASiR,MAAO,cAAenY,MAAOy4B,EAAOvxB,EAAI,sBAAwBmO,EAAO,OAASmjB,IAQ/F,OAASrgB,MAAO,UAAWV,KAAM4gB,GAGlCh8B,EAAOyC,QAGN85B,OAAQ,EAGRC,gBACAC,QAEApB,cACCqB,IAAKrC,GACLt2B,KAAM,MACN44B,QAAS7C,GAAehuB,KAAMwuB,GAAc,IAC5C37B,QAAQ,EACRi+B,aAAa,EACbC,OAAO,EACPC,YAAa,mDAabhe,SACC+T,IAAKuH,GACLv1B,KAAM,aACNmmB,KAAM,YACNhZ,IAAK,4BACL+qB,KAAM,qCAGPjkB,UACC9G,IAAK,MACLgZ,KAAM,OACN+R,KAAM,QAGPV,gBACCrqB,IAAK,cACLnN,KAAM,eACNk4B,KAAM,gBAKPjB,YAGCkB,SAAUvyB,OAGVwyB,aAAa,EAGbC,YAAal9B,EAAO6f,UAGpBsd,WAAYn9B,EAAOw5B,UAOpB4B,aACCsB,KAAK,EACLx8B,SAAS,IAOXk9B,UAAW,SAAUp6B,EAAQq6B,GAC5B,MAAOA,GAGNlC,GAAYA,GAAYn4B,EAAQhD,EAAOq7B,cAAgBgC,GAGvDlC,GAAYn7B,EAAOq7B,aAAcr4B,IAGnCs6B,cAAe/C,GAA6BL,IAC5CqD,cAAehD,GAA6BJ,IAG5CqD,KAAM,SAAUd,EAAKh6B,GAGA,gBAARg6B,KACXh6B,EAAUg6B,EACVA,EAAMr5B,QAIPX,EAAUA,KAEV,IAAI+6B,GAEHC,EAEAC,EACAC,EAEAC,EAEA3M,EAEA4M,EAEAh8B,EAEAy5B,EAAIv7B,EAAOo9B,aAAe16B,GAE1Bq7B,EAAkBxC,EAAEr7B,SAAWq7B,EAE/ByC,EAAqBzC,EAAEr7B,UAAa69B,EAAgB35B,UAAY25B,EAAgBl9B,QAC/Eb,EAAQ+9B,GACR/9B,EAAOkiB,MAERjG,EAAWjc,EAAO2b,WAClBsiB,EAAmBj+B,EAAO0a,UAAU,eAEpCwjB,EAAa3C,EAAE2C,eAEfC,KACAC,KAEAtiB,EAAQ,EAERuiB,EAAW,WAEXxD,GACC3c,WAAY,EAGZ2d,kBAAmB,SAAUpvB,GAC5B,GAAIzB,EACJ,IAAe,IAAV8Q,EAAc,CAClB,IAAM8hB,EAAkB,CACvBA,IACA,OAAS5yB,EAAQ6uB,GAASruB,KAAMmyB,GAC/BC,EAAiB5yB,EAAM,GAAG3F,eAAkB2F,EAAO,GAGrDA,EAAQ4yB,EAAiBnxB,EAAIpH,eAE9B,MAAgB,OAAT2F,EAAgB,KAAOA,GAI/BszB,sBAAuB,WACtB,MAAiB,KAAVxiB,EAAc6hB,EAAwB,MAI9CY,iBAAkB,SAAU57B,EAAM2C,GACjC,GAAIk5B,GAAQ77B,EAAK0C,aAKjB,OAJMyW,KACLnZ,EAAOy7B,EAAqBI,GAAUJ,EAAqBI,IAAW77B,EACtEw7B,EAAgBx7B,GAAS2C,GAEnBnG,MAIRs/B,iBAAkB,SAAU16B,GAI3B,MAHM+X,KACLyf,EAAEK,SAAW73B,GAEP5E,MAIR++B,WAAY,SAAUt8B,GACrB,GAAI2C,EACJ,IAAK3C,EACJ,GAAa,EAARka,EACJ,IAAMvX,IAAQ3C,GAEbs8B,EAAY35B,IAAW25B,EAAY35B,GAAQ3C,EAAK2C,QAIjDs2B,GAAM7e,OAAQpa,EAAKi5B,EAAM6D,QAG3B,OAAOv/B,OAIRw/B,MAAO,SAAUC,GAChB,GAAIC,GAAYD,GAAcP,CAK9B,OAJKZ,IACJA,EAAUkB,MAAOE,GAElBl3B,EAAM,EAAGk3B,GACF1/B,MAyCV,IApCA8c,EAASF,QAAS8e,GAAQ/F,SAAWmJ,EAAiBtkB,IACtDkhB,EAAMiE,QAAUjE,EAAMlzB,KACtBkzB,EAAMl3B,MAAQk3B,EAAM3e,KAMpBqf,EAAEmB,MAAUA,GAAOnB,EAAEmB,KAAOrC,IAAiB,IAAK52B,QAASk2B,GAAO,IAChEl2B,QAASu2B,GAAWM,GAAc,GAAM,MAG1CiB,EAAEx3B,KAAOrB,EAAQq8B,QAAUr8B,EAAQqB,MAAQw3B,EAAEwD,QAAUxD,EAAEx3B,KAGzDw3B,EAAEZ,UAAY36B,EAAO2E,KAAM42B,EAAEb,UAAY,KAAMr1B,cAAc2F,MAAOqP,KAAiB,IAG/D,MAAjBkhB,EAAEyD,cACN9N,EAAQ+I,GAAKzuB,KAAM+vB,EAAEmB,IAAIr3B,eACzBk2B,EAAEyD,eAAkB9N,GACjBA,EAAO,KAAQoJ,GAAc,IAAOpJ,EAAO,KAAQoJ,GAAc,KAChEpJ,EAAO,KAAwB,UAAfA,EAAO,GAAkB,KAAO,WAC/CoJ,GAAc,KAA+B,UAAtBA,GAAc,GAAkB,KAAO,UAK/DiB,EAAEngB,MAAQmgB,EAAEqB,aAAiC,gBAAXrB,GAAEngB,OACxCmgB,EAAEngB,KAAOpb,EAAOi/B,MAAO1D,EAAEngB,KAAMmgB,EAAE2D,cAIlCtE,GAA+BV,GAAYqB,EAAG74B,EAASm4B,GAGxC,IAAV/e,EACJ,MAAO+e,EAKRiD,GAAc99B,EAAOkiB,OAASqZ,EAAE58B,OAG3Bm/B,GAAmC,IAApB99B,EAAOu8B,UAC1Bv8B,EAAOkiB,MAAMwB,QAAQ,aAItB6X,EAAEx3B,KAAOw3B,EAAEx3B,KAAKpD,cAGhB46B,EAAE4D,YAAcpF,GAAWjuB,KAAMyvB,EAAEx3B,MAInC25B,EAAWnC,EAAEmB,IAGPnB,EAAE4D,aAGF5D,EAAEngB,OACNsiB,EAAanC,EAAEmB,MAASrD,GAAOvtB,KAAM4xB,GAAa,IAAM,KAAQnC,EAAEngB,WAE3DmgB,GAAEngB,MAILmgB,EAAE/uB,SAAU,IAChB+uB,EAAEmB,IAAM9C,GAAI9tB,KAAM4xB,GAGjBA,EAASj6B,QAASm2B,GAAK,OAASR,MAGhCsE,GAAarE,GAAOvtB,KAAM4xB,GAAa,IAAM,KAAQ,KAAOtE,OAK1DmC,EAAE6D,aACDp/B,EAAOw8B,aAAckB,IACzB7C,EAAM0D,iBAAkB,oBAAqBv+B,EAAOw8B,aAAckB,IAE9D19B,EAAOy8B,KAAMiB,IACjB7C,EAAM0D,iBAAkB,gBAAiBv+B,EAAOy8B,KAAMiB,MAKnDnC,EAAEngB,MAAQmgB,EAAE4D,YAAc5D,EAAEuB,eAAgB,GAASp6B,EAAQo6B,cACjEjC,EAAM0D,iBAAkB,eAAgBhD,EAAEuB,aAI3CjC,EAAM0D,iBACL,SACAhD,EAAEZ,UAAW,IAAOY,EAAEzc,QAASyc,EAAEZ,UAAU,IAC1CY,EAAEzc,QAASyc,EAAEZ,UAAU,KAA8B,MAArBY,EAAEZ,UAAW,GAAc,KAAOP,GAAW,WAAa,IAC1FmB,EAAEzc,QAAS,KAIb,KAAMhd,IAAKy5B,GAAE8D,QACZxE,EAAM0D,iBAAkBz8B,EAAGy5B,EAAE8D,QAASv9B,GAIvC,IAAKy5B,EAAE+D,aAAgB/D,EAAE+D,WAAWr+B,KAAM88B,EAAiBlD,EAAOU,MAAQ,GAAmB,IAAVzf,GAElF,MAAO+e,GAAM8D,OAIdN,GAAW,OAGX,KAAMv8B,KAAOg9B,QAAS,EAAGn7B,MAAO,EAAGmxB,SAAU,GAC5C+F,EAAO/4B,GAAKy5B,EAAGz5B,GAOhB,IAHA27B,EAAY7C,GAA+BT,GAAYoB,EAAG74B,EAASm4B,GAK5D,CACNA,EAAM3c,WAAa,EAGd4f,GACJE,EAAmBta,QAAS,YAAcmX,EAAOU,IAG7CA,EAAEsB,OAAStB,EAAE7E,QAAU,IAC3BmH,EAAe1f,WAAW,WACzB0c,EAAM8D,MAAM,YACVpD,EAAE7E,SAGN,KACC5a,EAAQ,EACR2hB,EAAU8B,KAAMpB,EAAgBx2B,GAC/B,MAAQkD,GAET,KAAa,EAARiR,GAIJ,KAAMjR,EAHNlD,GAAM,GAAIkD,QArBZlD,GAAM,GAAI,eA8BX,SAASA,GAAM+2B,EAAQc,EAAkBhE,EAAW6D,GACnD,GAAIpD,GAAW6C,EAASn7B,EAAOq4B,EAAUyD,EACxCb,EAAaY,CAGC,KAAV1jB,IAKLA,EAAQ,EAGH+hB,GACJlH,aAAckH,GAKfJ,EAAYp6B,OAGZs6B,EAAwB0B,GAAW,GAGnCxE,EAAM3c,WAAawgB,EAAS,EAAI,EAAI,EAGpCzC,EAAYyC,GAAU,KAAgB,IAATA,GAA2B,MAAXA,EAGxClD,IACJQ,EAAWV,GAAqBC,EAAGV,EAAOW,IAI3CQ,EAAWD,GAAaR,EAAGS,EAAUnB,EAAOoB,GAGvCA,GAGCV,EAAE6D,aACNK,EAAW5E,EAAMgB,kBAAkB,iBAC9B4D,IACJz/B,EAAOw8B,aAAckB,GAAa+B,GAEnCA,EAAW5E,EAAMgB,kBAAkB,QAC9B4D,IACJz/B,EAAOy8B,KAAMiB,GAAa+B,IAKZ,MAAXf,GAA6B,SAAXnD,EAAEx3B,KACxB66B,EAAa,YAGS,MAAXF,EACXE,EAAa,eAIbA,EAAa5C,EAASlgB,MACtBgjB,EAAU9C,EAAS5gB,KACnBzX,EAAQq4B,EAASr4B,MACjBs4B,GAAat4B,KAIdA,EAAQi7B,GACHF,IAAWE,KACfA,EAAa,QACC,EAATF,IACJA,EAAS,KAMZ7D,EAAM6D,OAASA,EACf7D,EAAM+D,YAAeY,GAAoBZ,GAAe,GAGnD3C,EACJhgB,EAASqB,YAAaygB,GAAmBe,EAASF,EAAY/D,IAE9D5e,EAAS2Y,WAAYmJ,GAAmBlD,EAAO+D,EAAYj7B,IAI5Dk3B,EAAMqD,WAAYA,GAClBA,EAAa76B,OAERy6B,GACJE,EAAmBta,QAASuY,EAAY,cAAgB,aACrDpB,EAAOU,EAAGU,EAAY6C,EAAUn7B,IAIpCs6B,EAAiBviB,SAAUqiB,GAAmBlD,EAAO+D,IAEhDd,IACJE,EAAmBta,QAAS,gBAAkBmX,EAAOU,MAE3Cv7B,EAAOu8B,QAChBv8B,EAAOkiB,MAAMwB,QAAQ,cAKxB,MAAOmX,IAGR6E,QAAS,SAAUhD,EAAKthB,EAAM1Z,GAC7B,MAAO1B,GAAOkB,IAAKw7B,EAAKthB,EAAM1Z,EAAU,SAGzCi+B,UAAW,SAAUjD,EAAKh7B,GACzB,MAAO1B,GAAOkB,IAAKw7B,EAAKr5B,OAAW3B,EAAU,aAI/C1B,EAAOyB,MAAQ,MAAO,QAAU,SAAUK,EAAGi9B,GAC5C/+B,EAAQ++B,GAAW,SAAUrC,EAAKthB,EAAM1Z,EAAUqC,GAQjD,MANK/D,GAAOkD,WAAYkY,KACvBrX,EAAOA,GAAQrC,EACfA,EAAW0Z,EACXA,EAAO/X,QAGDrD,EAAOw9B,MACbd,IAAKA,EACL34B,KAAMg7B,EACNrE,SAAU32B,EACVqX,KAAMA,EACN0jB,QAASp9B,OAMZ1B,EAAOsrB,SAAW,SAAUoR,GAC3B,MAAO18B,GAAOw9B,MACbd,IAAKA,EACL34B,KAAM,MACN22B,SAAU,SACVmC,OAAO,EACPl+B,QAAQ,EACRihC,UAAU,KAKZ5/B,EAAOG,GAAGsC,QACTo9B,QAAS,SAAU7U,GAClB,GAAIX,EAEJ,OAAKrqB,GAAOkD,WAAY8nB,GAChB7rB,KAAKsC,KAAK,SAAUK,GAC1B9B,EAAQb,MAAO0gC,QAAS7U,EAAK/pB,KAAK9B,KAAM2C,OAIrC3C,KAAM,KAGVkrB,EAAOrqB,EAAQgrB,EAAM7rB,KAAM,GAAIoM,eAAgBrJ,GAAI,GAAIa,OAAO,GAEzD5D,KAAM,GAAI6F,YACdqlB,EAAKO,aAAczrB,KAAM,IAG1BkrB,EAAKzoB,IAAI,WACR,GAAIC,GAAO1C,IAEX,OAAQ0C,EAAKi+B,kBACZj+B,EAAOA,EAAKi+B,iBAGb,OAAOj+B,KACL4oB,OAAQtrB,OAGLA,OAGR4gC,UAAW,SAAU/U,GACpB,MACQ7rB,MAAKsC,KADRzB,EAAOkD,WAAY8nB,GACN,SAAUlpB,GAC1B9B,EAAQb,MAAO4gC,UAAW/U,EAAK/pB,KAAK9B,KAAM2C,KAI3B,WAChB,GAAIwW,GAAOtY,EAAQb,MAClB2Z,EAAWR,EAAKQ,UAEZA,GAAS/X,OACb+X,EAAS+mB,QAAS7U,GAGlB1S,EAAKmS,OAAQO,MAKhBX,KAAM,SAAUW,GACf,GAAI9nB,GAAalD,EAAOkD,WAAY8nB,EAEpC,OAAO7rB,MAAKsC,KAAK,SAAUK,GAC1B9B,EAAQb,MAAO0gC,QAAS38B,EAAa8nB,EAAK/pB,KAAK9B,KAAM2C,GAAKkpB,MAI5DgV,OAAQ,WACP,MAAO7gC,MAAK6O,SAASvM,KAAK,WACnBzB,EAAOoF,SAAUjG,KAAM,SAC5Ba,EAAQb,MAAO8rB,YAAa9rB,KAAKyL,cAEhCtI,SAKLtC,EAAOgQ,KAAK4E,QAAQ+a,OAAS,SAAU9tB,GAGtC,MAAOA,GAAK0tB,aAAe,GAAK1tB,EAAK2tB,cAAgB,GAEtDxvB,EAAOgQ,KAAK4E,QAAQqrB,QAAU,SAAUp+B,GACvC,OAAQ7B,EAAOgQ,KAAK4E,QAAQ+a,OAAQ9tB,GAMrC,IAAIq+B,IAAM,OACTC,GAAW,QACXC,GAAQ,SACRC,GAAkB,wCAClBC,GAAe,oCAEhB,SAASC,IAAazP,EAAQhtB,EAAKo7B,EAAavlB,GAC/C,GAAIhX,EAEJ,IAAK3C,EAAOoD,QAASU,GAEpB9D,EAAOyB,KAAMqC,EAAK,SAAUhC,EAAG0+B,GACzBtB,GAAeiB,GAASr0B,KAAMglB,GAElCnX,EAAKmX,EAAQ0P,GAIbD,GAAazP,EAAS,KAAqB,gBAAN0P,GAAiB1+B,EAAI,IAAO,IAAK0+B,EAAGtB,EAAavlB,SAIlF,IAAMulB,GAAsC,WAAvBl/B,EAAO+D,KAAMD,GAQxC6V,EAAKmX,EAAQhtB,OANb,KAAMnB,IAAQmB,GACby8B,GAAazP,EAAS,IAAMnuB,EAAO,IAAKmB,EAAKnB,GAAQu8B,EAAavlB,GAWrE3Z,EAAOi/B,MAAQ,SAAUh3B,EAAGi3B,GAC3B,GAAIpO,GACHyK,KACA5hB,EAAM,SAAUlN,EAAKnH,GAEpBA,EAAQtF,EAAOkD,WAAYoC,GAAUA,IAAqB,MAATA,EAAgB,GAAKA,EACtEi2B,EAAGA,EAAEx6B,QAAW0/B,mBAAoBh0B,GAAQ,IAAMg0B,mBAAoBn7B,GASxE,IALqBjC,SAAhB67B,IACJA,EAAcl/B,EAAOq7B,cAAgBr7B,EAAOq7B,aAAa6D,aAIrDl/B,EAAOoD,QAAS6E,IAASA,EAAEpH,SAAWb,EAAOmD,cAAe8E,GAEhEjI,EAAOyB,KAAMwG,EAAG,WACf0R,EAAKxa,KAAKwD,KAAMxD,KAAKmG,aAMtB,KAAMwrB,IAAU7oB,GACfs4B,GAAazP,EAAQ7oB,EAAG6oB,GAAUoO,EAAavlB,EAKjD,OAAO4hB,GAAEpvB,KAAM,KAAM1I,QAASy8B,GAAK,MAGpClgC,EAAOG,GAAGsC,QACTi+B,UAAW,WACV,MAAO1gC,GAAOi/B,MAAO9/B,KAAKwhC,mBAE3BA,eAAgB,WACf,MAAOxhC,MAAKyC,IAAI,WAEf,GAAIqO,GAAWjQ,EAAOmf,KAAMhgB,KAAM,WAClC,OAAO8Q,GAAWjQ,EAAOwF,UAAWyK,GAAa9Q,OAEjDwP,OAAO,WACP,GAAI5K,GAAO5E,KAAK4E,IAGhB,OAAO5E,MAAKwD,OAAS3C,EAAQb,MAAOoZ,GAAI,cACvC+nB,GAAax0B,KAAM3M,KAAKiG,YAAei7B,GAAgBv0B,KAAM/H,KAC3D5E,KAAKwU,UAAYuN,EAAepV,KAAM/H,MAEzCnC,IAAI,SAAUE,EAAGD,GACjB,GAAIsO,GAAMnQ,EAAQb,MAAOgR,KAEzB,OAAc,OAAPA,EACN,KACAnQ,EAAOoD,QAAS+M,GACfnQ,EAAO4B,IAAKuO,EAAK,SAAUA,GAC1B,OAASxN,KAAMd,EAAKc,KAAM2C,MAAO6K,EAAI1M,QAAS28B,GAAO,YAEpDz9B,KAAMd,EAAKc,KAAM2C,MAAO6K,EAAI1M,QAAS28B,GAAO,WAC9Cl/B,SAKLlB,EAAOq7B,aAAauF,IAAM,WACzB,IACC,MAAO,IAAIC,gBACV,MAAOh2B,KAGV,IAAIi2B,IAAQ,EACXC,MACAC,IAEC,EAAG,IAGHC,KAAM,KAEPC,GAAelhC,EAAOq7B,aAAauF,KAK/B1hC,GAAOmP,aACXnP,EAAOmP,YAAa,WAAY,WAC/B,IAAM,GAAI5B,KAAOs0B,IAChBA,GAAct0B,OAKjB3M,EAAQqhC,OAASD,IAAkB,mBAAqBA,IACxDphC,EAAQ09B,KAAO0D,KAAiBA,GAEhClhC,EAAOu9B,cAAc,SAAU76B,GAC9B,GAAIhB,EAGJ,OAAK5B,GAAQqhC,MAAQD,KAAiBx+B,EAAQs8B,aAE5CO,KAAM,SAAUF,EAASvK,GACxB,GAAIhzB,GACH8+B,EAAMl+B,EAAQk+B,MACdl1B,IAAOo1B,EAKR,IAHAF,EAAIQ,KAAM1+B,EAAQqB,KAAMrB,EAAQg6B,IAAKh6B,EAAQm6B,MAAOn6B,EAAQ2+B,SAAU3+B,EAAQ8R,UAGzE9R,EAAQ4+B,UACZ,IAAMx/B,IAAKY,GAAQ4+B,UAClBV,EAAK9+B,GAAMY,EAAQ4+B,UAAWx/B,EAK3BY,GAAQk5B,UAAYgF,EAAInC,kBAC5BmC,EAAInC,iBAAkB/7B,EAAQk5B,UAQzBl5B,EAAQs8B,aAAgBK,EAAQ,sBACrCA,EAAQ,oBAAsB,iBAI/B,KAAMv9B,IAAKu9B,GACVuB,EAAIrC,iBAAkBz8B,EAAGu9B,EAASv9B,GAInCJ,GAAW,SAAUqC,GACpB,MAAO,YACDrC,UACGq/B,IAAcr1B,GACrBhK,EAAWk/B,EAAIW,OAASX,EAAIY,QAAU,KAExB,UAATz9B,EACJ68B,EAAIjC,QACgB,UAAT56B,EACX+wB,EAEC8L,EAAIlC,OACJkC,EAAIhC,YAGL9J,EACCkM,GAAkBJ,EAAIlC,SAAYkC,EAAIlC,OACtCkC,EAAIhC,WAIwB,gBAArBgC,GAAIa,cACV58B,KAAM+7B,EAAIa,cACPp+B,OACJu9B,EAAItC,4BAQTsC,EAAIW,OAAS7/B,IACbk/B,EAAIY,QAAU9/B,EAAS,SAGvBA,EAAWq/B,GAAcr1B,GAAOhK,EAAS,QAEzC,KAECk/B,EAAIrB,KAAM78B,EAAQy8B,YAAcz8B,EAAQ0Y,MAAQ,MAC/C,MAAQvQ,GAET,GAAKnJ,EACJ,KAAMmJ,KAKT8zB,MAAO,WACDj9B,GACJA,MAvFJ,SAkGD1B,EAAOo9B,WACNte,SACCta,OAAQ,6FAETsU,UACCtU,OAAQ,uBAETs3B,YACC4F,cAAe,SAAU78B,GAExB,MADA7E,GAAOsE,WAAYO,GACZA,MAMV7E,EAAOs9B,cAAe,SAAU,SAAU/B,GACxBl4B,SAAZk4B,EAAE/uB,QACN+uB,EAAE/uB,OAAQ,GAEN+uB,EAAEyD,cACNzD,EAAEx3B,KAAO,SAKX/D,EAAOu9B,cAAe,SAAU,SAAUhC,GAEzC,GAAKA,EAAEyD,YAAc,CACpB,GAAIx6B,GAAQ9C,CACZ,QACC69B,KAAM,SAAUl1B,EAAGyqB,GAClBtwB,EAASxE,EAAO,YAAYmf,MAC3B0d,OAAO,EACP8E,QAASpG,EAAEqG,cACXh/B,IAAK24B,EAAEmB,MACLlV,GACF,aACA9lB,EAAW,SAAUmgC,GACpBr9B,EAAO+W,SACP7Z,EAAW,KACNmgC,GACJ/M,EAAuB,UAAb+M,EAAI99B,KAAmB,IAAM,IAAK89B,EAAI99B,QAInDhF,EAAS+F,KAAKC,YAAaP,EAAQ,KAEpCm6B,MAAO,WACDj9B,GACJA,QAUL,IAAIogC,OACHC,GAAS,mBAGV/hC,GAAOo9B,WACN4E,MAAO,WACPC,cAAe,WACd,GAAIvgC,GAAWogC,GAAa15B,OAAWpI,EAAOsD,QAAU,IAAQ81B,IAEhE,OADAj6B,MAAMuC,IAAa,EACZA,KAKT1B,EAAOs9B,cAAe,aAAc,SAAU/B,EAAG2G,EAAkBrH,GAElE,GAAIsH,GAAcC,EAAaC,EAC9BC,EAAW/G,EAAEyG,SAAU,IAAWD,GAAOj2B,KAAMyvB,EAAEmB,KAChD,MACkB,gBAAXnB,GAAEngB,QAAwBmgB,EAAEuB,aAAe,IAAKr9B,QAAQ,sCAAwCsiC,GAAOj2B,KAAMyvB,EAAEngB,OAAU,OAIlI,OAAKknB,IAAiC,UAArB/G,EAAEZ,UAAW,IAG7BwH,EAAe5G,EAAE0G,cAAgBjiC,EAAOkD,WAAYq4B,EAAE0G,eACrD1G,EAAE0G,gBACF1G,EAAE0G,cAGEK,EACJ/G,EAAG+G,GAAa/G,EAAG+G,GAAW7+B,QAASs+B,GAAQ,KAAOI,GAC3C5G,EAAEyG,SAAU,IACvBzG,EAAEmB,MAASrD,GAAOvtB,KAAMyvB,EAAEmB,KAAQ,IAAM,KAAQnB,EAAEyG,MAAQ,IAAMG,GAIjE5G,EAAEO,WAAW,eAAiB,WAI7B,MAHMuG,IACLriC,EAAO2D,MAAOw+B,EAAe,mBAEvBE,EAAmB,IAI3B9G,EAAEZ,UAAW,GAAM,OAGnByH,EAAcljC,EAAQijC,GACtBjjC,EAAQijC,GAAiB,WACxBE,EAAoBrgC,WAIrB64B,EAAM7e,OAAO,WAEZ9c,EAAQijC,GAAiBC,EAGpB7G,EAAG4G,KAEP5G,EAAE0G,cAAgBC,EAAiBD,cAGnCH,GAAatiC,KAAM2iC,IAIfE,GAAqBriC,EAAOkD,WAAYk/B,IAC5CA,EAAaC,EAAmB,IAGjCA,EAAoBD,EAAc/+B,SAI5B,UAtDR,SAgEDrD,EAAOyY,UAAY,SAAU2C,EAAMlb,EAASqiC,GAC3C,IAAMnnB,GAAwB,gBAATA,GACpB,MAAO,KAEgB,kBAAZlb,KACXqiC,EAAcriC,EACdA,GAAU,GAEXA,EAAUA,GAAWnB,CAErB,IAAIyjC,GAAStqB,EAAW1M,KAAM4P,GAC7B+O,GAAWoY,KAGZ,OAAKC,IACKtiC,EAAQ0E,cAAe49B,EAAO,MAGxCA,EAASxiC,EAAOkqB,eAAiB9O,GAAQlb,EAASiqB,GAE7CA,GAAWA,EAAQppB,QACvBf,EAAQmqB,GAAU5O,SAGZvb,EAAOuB,SAAWihC,EAAO53B,aAKjC,IAAI63B,IAAQziC,EAAOG,GAAGkmB,IAKtBrmB,GAAOG,GAAGkmB,KAAO,SAAUqW,EAAKgG,EAAQhhC,GACvC,GAAoB,gBAARg7B,IAAoB+F,GAC/B,MAAOA,IAAM1gC,MAAO5C,KAAM6C,UAG3B,IAAI/B,GAAU8D,EAAMi4B,EACnB1jB,EAAOnZ,KACP4e,EAAM2e,EAAIj9B,QAAQ,IA+CnB,OA7CKse,IAAO,IACX9d,EAAWD,EAAO2E,KAAM+3B,EAAIp9B,MAAOye,IACnC2e,EAAMA,EAAIp9B,MAAO,EAAGye,IAIhB/d,EAAOkD,WAAYw/B,IAGvBhhC,EAAWghC,EACXA,EAASr/B,QAGEq/B,GAA4B,gBAAXA,KAC5B3+B,EAAO,QAIHuU,EAAKvX,OAAS,GAClBf,EAAOw9B,MACNd,IAAKA,EAGL34B,KAAMA,EACN22B,SAAU,OACVtf,KAAMsnB,IACJ/6B,KAAK,SAAU85B,GAGjBzF,EAAWh6B,UAEXsW,EAAK0S,KAAM/qB,EAIVD,EAAO,SAASyqB,OAAQzqB,EAAOyY,UAAWgpB,IAAiB/yB,KAAMzO,GAGjEwhC,KAEC3M,SAAUpzB,GAAY,SAAUm5B,EAAO6D,GACzCpmB,EAAK7W,KAAMC,EAAUs6B,IAAcnB,EAAM4G,aAAc/C,EAAQ7D,MAI1D17B,MAORa,EAAOyB,MAAQ,YAAa,WAAY,eAAgB,YAAa,cAAe,YAAc,SAAUK,EAAGiC,GAC9G/D,EAAOG,GAAI4D,GAAS,SAAU5D,GAC7B,MAAOhB,MAAKqoB,GAAIzjB,EAAM5D,MAOxBH,EAAOgQ,KAAK4E,QAAQ+tB,SAAW,SAAU9gC,GACxC,MAAO7B,GAAO6F,KAAK7F,EAAO21B,OAAQ,SAAUx1B,GAC3C,MAAO0B,KAAS1B,EAAG0B,OACjBd,OAMJ,IAAIqG,IAAUlI,EAAOH,SAAS8O,eAK9B,SAAS+0B,IAAW/gC,GACnB,MAAO7B,GAAOiE,SAAUpC,GAASA,EAAyB,IAAlBA,EAAKuC,UAAkBvC,EAAKqM,YAGrElO,EAAO6iC,QACNC,UAAW,SAAUjhC,EAAMa,EAASZ,GACnC,GAAIihC,GAAaC,EAASC,EAAWC,EAAQC,EAAWC,EAAYC,EACnEhV,EAAWruB,EAAOihB,IAAKpf,EAAM,YAC7ByhC,EAAUtjC,EAAQ6B,GAClBojB,IAGiB,YAAboJ,IACJxsB,EAAKkqB,MAAMsC,SAAW,YAGvB8U,EAAYG,EAAQT,SACpBI,EAAYjjC,EAAOihB,IAAKpf,EAAM,OAC9BuhC,EAAapjC,EAAOihB,IAAKpf,EAAM,QAC/BwhC,GAAmC,aAAbhV,GAAwC,UAAbA,KAC9C4U,EAAYG,GAAa3jC,QAAQ,QAAU,GAIzC4jC,GACJN,EAAcO,EAAQjV,WACtB6U,EAASH,EAAY50B,IACrB60B,EAAUD,EAAYQ,OAGtBL,EAAS/+B,WAAY8+B,IAAe,EACpCD,EAAU7+B,WAAYi/B,IAAgB,GAGlCpjC,EAAOkD,WAAYR,KACvBA,EAAUA,EAAQzB,KAAMY,EAAMC,EAAGqhC,IAGd,MAAfzgC,EAAQyL,MACZ8W,EAAM9W,IAAQzL,EAAQyL,IAAMg1B,EAAUh1B,IAAQ+0B,GAE1B,MAAhBxgC,EAAQ6gC,OACZte,EAAMse,KAAS7gC,EAAQ6gC,KAAOJ,EAAUI,KAASP,GAG7C,SAAWtgC,GACfA,EAAQ8gC,MAAMviC,KAAMY,EAAMojB,GAG1Bqe,EAAQriB,IAAKgE,KAKhBjlB,EAAOG,GAAGsC,QACTogC,OAAQ,SAAUngC,GACjB,GAAKV,UAAUjB,OACd,MAAmBsC,UAAZX,EACNvD,KACAA,KAAKsC,KAAK,SAAUK,GACnB9B,EAAO6iC,OAAOC,UAAW3jC,KAAMuD,EAASZ,IAI3C,IAAIsF,GAASq8B,EACZ5hC,EAAO1C,KAAM,GACbukC,GAAQv1B,IAAK,EAAGo1B,KAAM,GACtBt1B,EAAMpM,GAAQA,EAAK0J,aAEpB,IAAM0C,EAON,MAHA7G,GAAU6G,EAAIJ,gBAGR7N,EAAOwH,SAAUJ,EAASvF,UAMpBA,GAAK8hC,wBAA0BniB,IAC1CkiB,EAAM7hC,EAAK8hC,yBAEZF,EAAMb,GAAW30B,IAEhBE,IAAKu1B,EAAIv1B,IAAMs1B,EAAIG,YAAcx8B,EAAQ8e,UACzCqd,KAAMG,EAAIH,KAAOE,EAAII,YAAcz8B,EAAQ0e,aAXpC4d,GAeTrV,SAAU,WACT,GAAMlvB,KAAM,GAAZ,CAIA,GAAI2kC,GAAcjB,EACjBhhC,EAAO1C,KAAM,GACb4kC,GAAiB51B,IAAK,EAAGo1B,KAAM,EAuBhC,OApBwC,UAAnCvjC,EAAOihB,IAAKpf,EAAM,YAEtBghC,EAAShhC,EAAK8hC,yBAIdG,EAAe3kC,KAAK2kC,eAGpBjB,EAAS1jC,KAAK0jC,SACR7iC,EAAOoF,SAAU0+B,EAAc,GAAK,UACzCC,EAAeD,EAAajB,UAI7BkB,EAAa51B,KAAOnO,EAAOihB,IAAK6iB,EAAc,GAAK,kBAAkB,GACrEC,EAAaR,MAAQvjC,EAAOihB,IAAK6iB,EAAc,GAAK,mBAAmB,KAKvE31B,IAAK00B,EAAO10B,IAAM41B,EAAa51B,IAAMnO,EAAOihB,IAAKpf,EAAM,aAAa,GACpE0hC,KAAMV,EAAOU,KAAOQ,EAAaR,KAAOvjC,EAAOihB,IAAKpf,EAAM,cAAc,MAI1EiiC,aAAc,WACb,MAAO3kC,MAAKyC,IAAI,WACf,GAAIkiC,GAAe3kC,KAAK2kC,cAAgB18B,EAExC,OAAQ08B,IAAmB9jC,EAAOoF,SAAU0+B,EAAc,SAAuD,WAA3C9jC,EAAOihB,IAAK6iB,EAAc,YAC/FA,EAAeA,EAAaA,YAG7B,OAAOA,IAAgB18B,QAM1BpH,EAAOyB,MAAQokB,WAAY,cAAeI,UAAW,eAAiB,SAAU8Y,EAAQ5f,GACvF,GAAIhR,GAAM,gBAAkBgR,CAE5Bnf,GAAOG,GAAI4+B,GAAW,SAAU5uB,GAC/B,MAAOiO,GAAQjf,KAAM,SAAU0C,EAAMk9B,EAAQ5uB,GAC5C,GAAIszB,GAAMb,GAAW/gC,EAErB,OAAawB,UAAR8M,EACGszB,EAAMA,EAAKtkB,GAAStd,EAAMk9B,QAG7B0E,EACJA,EAAIO,SACF71B,EAAYjP,EAAO2kC,YAAb1zB,EACPhC,EAAMgC,EAAMjR,EAAO0kC,aAIpB/hC,EAAMk9B,GAAW5uB,IAEhB4uB,EAAQ5uB,EAAKnO,UAAUjB,OAAQ,SAUpCf,EAAOyB,MAAQ,MAAO,QAAU,SAAUK,EAAGqd,GAC5Cnf,EAAO4vB,SAAUzQ,GAAS6N,GAAcltB,EAAQ6tB,cAC/C,SAAU9rB,EAAM8qB,GACf,MAAKA,IACJA,EAAWD,GAAQ7qB,EAAMsd,GAElBmN,GAAUxgB,KAAM6gB,GACtB3sB,EAAQ6B,GAAOwsB,WAAYlP,GAAS,KACpCwN,GALF,WAaH3sB,EAAOyB,MAAQwiC,OAAQ,SAAUC,MAAO,SAAW,SAAUvhC,EAAMoB,GAClE/D,EAAOyB,MAAQmvB,QAAS,QAAUjuB,EAAMqmB,QAASjlB,EAAM,GAAI,QAAUpB,GAAQ,SAAUwhC,EAAcC,GAEpGpkC,EAAOG,GAAIikC,GAAa,SAAUzT,EAAQrrB,GACzC,GAAI+Y,GAAYrc,UAAUjB,SAAYojC,GAAkC,iBAAXxT,IAC5DzB,EAAQiV,IAAkBxT,KAAW,GAAQrrB,KAAU,EAAO,SAAW,SAE1E,OAAO8Y,GAAQjf,KAAM,SAAU0C,EAAMkC,EAAMuB,GAC1C,GAAI2I,EAEJ,OAAKjO,GAAOiE,SAAUpC,GAIdA,EAAK9C,SAAS8O,gBAAiB,SAAWlL,GAI3B,IAAlBd,EAAKuC,UACT6J,EAAMpM,EAAKgM,gBAIJtK,KAAKyrB,IACXntB,EAAK6jB,KAAM,SAAW/iB,GAAQsL,EAAK,SAAWtL,GAC9Cd,EAAK6jB,KAAM,SAAW/iB,GAAQsL,EAAK,SAAWtL,GAC9CsL,EAAK,SAAWtL,KAIDU,SAAViC,EAENtF,EAAOihB,IAAKpf,EAAMkC,EAAMmrB,GAGxBlvB,EAAO+rB,MAAOlqB,EAAMkC,EAAMuB,EAAO4pB,IAChCnrB,EAAMsa,EAAYsS,EAASttB,OAAWgb,EAAW,WAOvDre,EAAOG,GAAGkkC,KAAO,WAChB,MAAOllC,MAAK4B,QAGbf,EAAOG,GAAGmkC,QAAUtkC,EAAOG,GAAGyZ,QAkBP,kBAAX2qB,SAAyBA,OAAOC,KAC3CD,OAAQ,YAAc,WACrB,MAAOvkC,IAOT,IAECykC,IAAUvlC,EAAOc,OAGjB0kC,GAAKxlC,EAAOylC,CAwBb,OAtBA3kC,GAAO4kC,WAAa,SAAU3hC,GAS7B,MARK/D,GAAOylC,IAAM3kC,IACjBd,EAAOylC,EAAID,IAGPzhC,GAAQ/D,EAAOc,SAAWA,IAC9Bd,EAAOc,OAASykC,IAGVzkC,SAMIZ,KAAaoiB,IACxBtiB,EAAOc,OAASd,EAAOylC,EAAI3kC,GAMrBA"} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js new file mode 100644 index 0000000..606b062 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js @@ -0,0 +1,7 @@ +/* +* bootstrap-table - v1.11.1 - 2017-02-22 +* https://github.com/wenzhixin/bootstrap-table +* Copyright (c) 2017 zhixin wen +* Licensed MIT License +*/ +!function(a){"use strict";var b=function(b,c){b.options.columnsHidden.length>0&&a.each(b.columns,function(d,e){-1!==b.options.columnsHidden.indexOf(e.field)&&e.visible!==c&&b.toggleColumn(a.fn.bootstrapTable.utils.getFieldIndex(b.columns,e.field),c,!0)})},c=function(a){(a.options.height||a.options.showFooter)&&setTimeout(function(){a.resetView.call(a)},1)},d=function(a,b,d){a.options.minHeight?b<=a.options.minWidth&&d<=a.options.minHeight?e(a):b>a.options.minWidth&&d>a.options.minHeight&&f(a):b<=a.options.minWidth?e(a):b>a.options.minWidth&&f(a),c(a)},e=function(a){g(a,!1),b(a,!1)},f=function(a){g(a,!0),b(a,!0)},g=function(a,b){a.options.cardView=b,a.toggleView()},h=function(a,b){var c;return function(){var d=this,e=arguments,f=function(){c=null,a.apply(d,e)};clearTimeout(c),c=setTimeout(f,b)}};a.extend(a.fn.bootstrapTable.defaults,{mobileResponsive:!1,minWidth:562,minHeight:void 0,heightThreshold:100,checkOnInit:!0,columnsHidden:[]});var i=a.fn.bootstrapTable.Constructor,j=i.prototype.init;i.prototype.init=function(){if(j.apply(this,Array.prototype.slice.apply(arguments)),this.options.mobileResponsive&&this.options.minWidth){this.options.minWidth<100&&this.options.resizable&&(console.log("The minWidth when the resizable extension is active should be greater or equal than 100"),this.options.minWidth=100);var b=this,c={width:a(window).width(),height:a(window).height()};if(a(window).on("resize orientationchange",h(function(){var e=a(this).height(),f=a(this).width();(Math.abs(c.height-e)>b.options.heightThreshold||c.width!=f)&&(d(b,f,e),c={width:f,height:e})},200)),this.options.checkOnInit){var e=a(window).height(),f=a(window).width();d(this,f,e),c={width:f,height:e}}}}}(jQuery); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table.min.js new file mode 100644 index 0000000..d15db75 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table.min.js @@ -0,0 +1,8 @@ +/* +* bootstrap-table - v1.11.1 - 2017-02-22 +* https://github.com/wenzhixin/bootstrap-table +* Copyright (c) 2017 zhixin wen +* Licensed MIT License +*/ +!function(a){"use strict";var b=null,c=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},d=function(b,c,d,e){var f="";return a.each(b,function(a,b){return b[c]===e?(f=b[d],!1):!0}),f},e=function(b,c){var d=-1;return a.each(b,function(a,b){return b.field===c?(d=a,!1):!0}),d},f=function(b){var c,d,e,f=0,g=[];for(c=0;c<b[0].length;c++)f+=b[0][c].colspan||1;for(c=0;c<b.length;c++)for(g[c]=[],d=0;f>d;d++)g[c][d]=!1;for(c=0;c<b.length;c++)for(d=0;d<b[c].length;d++){var h=b[c][d],i=h.rowspan||1,j=h.colspan||1,k=a.inArray(!1,g[c]);for(1===j&&(h.fieldIndex=k,"undefined"==typeof h.field&&(h.field=k)),e=0;i>e;e++)g[c+e][k]=!0;for(e=0;j>e;e++)g[c][k+e]=!0}},g=function(){if(null===b){var c,d,e=a("<p/>").addClass("fixed-table-scroll-inner"),f=a("<div/>").addClass("fixed-table-scroll-outer");f.append(e),a("body").append(f),c=e[0].offsetWidth,f.css("overflow","scroll"),d=e[0].offsetWidth,c===d&&(d=f[0].clientWidth),f.remove(),b=c-d}return b},h=function(b,d,e,f){var g=d;if("string"==typeof d){var h=d.split(".");h.length>1?(g=window,a.each(h,function(a,b){g=g[b]})):g=window[d]}return"object"==typeof g?g:"function"==typeof g?g.apply(b,e||[]):!g&&"string"==typeof d&&c.apply(this,[d].concat(e))?c.apply(this,[d].concat(e)):f},i=function(b,c,d){var e=Object.getOwnPropertyNames(b),f=Object.getOwnPropertyNames(c),g="";if(d&&e.length!==f.length)return!1;for(var h=0;h<e.length;h++)if(g=e[h],a.inArray(g,f)>-1&&b[g]!==c[g])return!1;return!0},j=function(a){return"string"==typeof a?a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/`/g,"`"):a},k=function(a){for(var b in a){var c=b.split(/(?=[A-Z])/).join("-").toLowerCase();c!==b&&(a[c]=a[b],delete a[b])}return a},l=function(a,b,c){var d=a;if("string"!=typeof b||a.hasOwnProperty(b))return c?j(a[b]):a[b];var e=b.split(".");for(var f in e)e.hasOwnProperty(f)&&(d=d&&d[e[f]]);return c?j(d):d},m=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},n=function(){Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}())},o=function(b,c){this.options=c,this.$el=a(b),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};o.DEFAULTS={classes:"table table-hover",sortClass:void 0,locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",sortStable:!1,striped:!1,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:void 0,ajax:void 0,cache:!0,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(a){return a},queryParamsType:"limit",responseHandler:function(a){return a},pagination:!1,onlyInfoPagination:!1,paginationLoop:!0,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"‹",paginationNextText:"›",search:!1,searchOnEnterKey:!1,strictSearch:!1,searchAlign:"right",selectItemName:"btSelectItem",showHeader:!0,showFooter:!1,showColumns:!1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,buttonsAlign:"right",smartDisplay:!0,escape:!1,minimumCountColumns:1,idField:void 0,uniqueId:void 0,cardView:!1,detailView:!1,detailFormatter:function(){return""},trimOnSearch:!0,clickToSelect:!1,singleSelect:!1,toolbar:void 0,toolbarAlign:"left",checkboxHeader:!0,sortable:!0,silentSort:!0,maintainSelected:!1,searchTimeOut:500,searchText:"",iconSize:void 0,buttonsClass:"default",iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},customSearch:a.noop,customSort:a.noop,rowStyle:function(){return{}},rowAttributes:function(){return{}},footerStyle:function(){return{}},onAll:function(){return!1},onClickCell:function(){return!1},onDblClickCell:function(){return!1},onClickRow:function(){return!1},onDblClickRow:function(){return!1},onSort:function(){return!1},onCheck:function(){return!1},onUncheck:function(){return!1},onCheckAll:function(){return!1},onUncheckAll:function(){return!1},onCheckSome:function(){return!1},onUncheckSome:function(){return!1},onLoadSuccess:function(){return!1},onLoadError:function(){return!1},onColumnSwitch:function(){return!1},onPageChange:function(){return!1},onSearch:function(){return!1},onToggle:function(){return!1},onPreBody:function(){return!1},onPostBody:function(){return!1},onPostHeader:function(){return!1},onExpandRow:function(){return!1},onCollapseRow:function(){return!1},onRefreshOptions:function(){return!1},onRefresh:function(){return!1},onResetView:function(){return!1}},o.LOCALES={},o.LOCALES["en-US"]=o.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(a){return c("%s rows per page",a)},formatShowingRows:function(a,b,d){return c("Showing %s to %s of %s rows",a,b,d)},formatDetailPagination:function(a){return c("Showing %s rows",a)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}},a.extend(o.DEFAULTS,o.LOCALES["en-US"]),o.COLUMN_DEFAULTS={radio:!1,checkbox:!1,checkboxEnabled:!0,field:void 0,title:void 0,titleTooltip:void 0,"class":void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,width:void 0,sortable:!1,order:"asc",visible:!0,switchable:!0,clickToSelect:!0,formatter:void 0,footerFormatter:void 0,events:void 0,sorter:void 0,sortName:void 0,cellStyle:void 0,searchable:!0,searchFormatter:!0,cardVisible:!0,escape:!1},o.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh"},o.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initHiddenRows(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},o.prototype.initLocale=function(){if(this.options.locale){var b=this.options.locale.split(/-|_/);b[0].toLowerCase(),b[1]&&b[1].toUpperCase(),a.fn.bootstrapTable.locales[this.options.locale]?a.extend(this.options,a.fn.bootstrapTable.locales[this.options.locale]):a.fn.bootstrapTable.locales[b.join("-")]?a.extend(this.options,a.fn.bootstrapTable.locales[b.join("-")]):a.fn.bootstrapTable.locales[b[0]]&&a.extend(this.options,a.fn.bootstrapTable.locales[b[0]])}},o.prototype.initContainer=function(){this.$container=a(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination" style="clear: both;"></div>':"",'<div class="fixed-table-container">','<div class="fixed-table-header"><table></table></div>','<div class="fixed-table-body">','<div class="fixed-table-loading">',this.options.formatLoadingMessage(),"</div>","</div>",'<div class="fixed-table-footer"><table><tr></tr></table></div>',"bottom"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination"></div>':"","</div>","</div>"].join("")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$container.find(".fixed-table-footer"),this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('<div class="clearfix"></div>'),this.$el.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),-1!==a.inArray("table-no-bordered",this.options.classes.split(" "))&&this.$tableContainer.addClass("table-no-bordered")},o.prototype.initTable=function(){var b=this,c=[],d=[];if(this.$header=this.$el.find(">thead"),this.$header.length||(this.$header=a("<thead></thead>").appendTo(this.$el)),this.$header.find("tr").each(function(){var b=[];a(this).find("th").each(function(){"undefined"!=typeof a(this).data("field")&&a(this).data("field",a(this).data("field")+""),b.push(a.extend({},{title:a(this).html(),"class":a(this).attr("class"),titleTooltip:a(this).attr("title"),rowspan:a(this).attr("rowspan")?+a(this).attr("rowspan"):void 0,colspan:a(this).attr("colspan")?+a(this).attr("colspan"):void 0},a(this).data()))}),c.push(b)}),a.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=a.extend(!0,[],c,this.options.columns),this.columns=[],f(this.options.columns),a.each(this.options.columns,function(c,d){a.each(d,function(d,e){e=a.extend({},o.COLUMN_DEFAULTS,e),"undefined"!=typeof e.fieldIndex&&(b.columns[e.fieldIndex]=e),b.options.columns[c][d]=e})}),!this.options.data.length){var e=[];this.$el.find(">tbody>tr").each(function(c){var f={};f._id=a(this).attr("id"),f._class=a(this).attr("class"),f._data=k(a(this).data()),a(this).find(">td").each(function(d){for(var g,h,i=a(this),j=+i.attr("colspan")||1,l=+i.attr("rowspan")||1;e[c]&&e[c][d];d++);for(g=d;d+j>g;g++)for(h=c;c+l>h;h++)e[h]||(e[h]=[]),e[h][g]=!0;var m=b.columns[d].field;f[m]=a(this).html(),f["_"+m+"_id"]=a(this).attr("id"),f["_"+m+"_class"]=a(this).attr("class"),f["_"+m+"_rowspan"]=a(this).attr("rowspan"),f["_"+m+"_colspan"]=a(this).attr("colspan"),f["_"+m+"_title"]=a(this).attr("title"),f["_"+m+"_data"]=k(a(this).data())}),d.push(f)}),this.options.data=d,d.length&&(this.fromHtml=!0)}},o.prototype.initHeader=function(){var b=this,d={},e=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]},a.each(this.options.columns,function(f,g){e.push("<tr>"),0===f&&!b.options.cardView&&b.options.detailView&&e.push(c('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',b.options.columns.length)),a.each(g,function(a,f){var g="",h="",i="",k="",l=c(' class="%s"',f["class"]),m=(b.options.sortOrder||f.order,"px"),n=f.width;if(void 0===f.width||b.options.cardView||"string"==typeof f.width&&-1!==f.width.indexOf("%")&&(m="%"),f.width&&"string"==typeof f.width&&(n=f.width.replace("%","").replace("px","")),h=c("text-align: %s; ",f.halign?f.halign:f.align),i=c("text-align: %s; ",f.align),k=c("vertical-align: %s; ",f.valign),k+=c("width: %s; ",!f.checkbox&&!f.radio||n?n?n+m:void 0:"36px"),"undefined"!=typeof f.fieldIndex){if(b.header.fields[f.fieldIndex]=f.field,b.header.styles[f.fieldIndex]=i+k,b.header.classes[f.fieldIndex]=l,b.header.formatters[f.fieldIndex]=f.formatter,b.header.events[f.fieldIndex]=f.events,b.header.sorters[f.fieldIndex]=f.sorter,b.header.sortNames[f.fieldIndex]=f.sortName,b.header.cellStyles[f.fieldIndex]=f.cellStyle,b.header.searchables[f.fieldIndex]=f.searchable,!f.visible)return;if(b.options.cardView&&!f.cardVisible)return;d[f.field]=f}e.push("<th"+c(' title="%s"',f.titleTooltip),f.checkbox||f.radio?c(' class="bs-checkbox %s"',f["class"]||""):l,c(' style="%s"',h+k),c(' rowspan="%s"',f.rowspan),c(' colspan="%s"',f.colspan),c(' data-field="%s"',f.field),">"),e.push(c('<div class="th-inner %s">',b.options.sortable&&f.sortable?"sortable both":"")),g=b.options.escape?j(f.title):f.title,f.checkbox&&(!b.options.singleSelect&&b.options.checkboxHeader&&(g='<input name="btSelectAll" type="checkbox" />'),b.header.stateField=f.field),f.radio&&(g="",b.header.stateField=f.field,b.options.singleSelect=!0),e.push(g),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</th>")}),e.push("</tr>")}),this.$header.html(e.join("")),this.$header.find("th[data-field]").each(function(){a(this).data(d[a(this).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(c){var d=a(this);return b.options.detailView&&d.closest(".bootstrap-table")[0]!==b.$container[0]?!1:void(b.options.sortable&&d.parent().data().sortable&&b.onSort(c))}),this.$header.children().children().off("keypress").on("keypress",function(c){if(b.options.sortable&&a(this).data().sortable){var d=c.keyCode||c.which;13==d&&b.onSort(c)}}),a(window).off("resize.bootstrap-table"),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret(),a(window).on("resize.bootstrap-table",a.proxy(this.resetWidth,this))),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(){var c=a(this).prop("checked");b[c?"checkAll":"uncheckAll"](),b.updateSelected()})},o.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},o.prototype.initData=function(a,b){this.data="append"===b?this.data.concat(a):"prepend"===b?[].concat(a).concat(this.data):a||this.options.data,this.options.data="append"===b?this.options.data.concat(a):"prepend"===b?[].concat(a).concat(this.options.data):this.data,"server"!==this.options.sidePagination&&this.initSort()},o.prototype.initSort=function(){var b=this,d=this.options.sortName,e="desc"===this.options.sortOrder?-1:1,f=a.inArray(this.options.sortName,this.header.fields),g=0;return this.options.customSort!==a.noop?void this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]):void(-1!==f&&(this.options.sortStable&&a.each(this.data,function(a,b){b.hasOwnProperty("_position")||(b._position=a)}),this.data.sort(function(c,g){b.header.sortNames[f]&&(d=b.header.sortNames[f]);var i=l(c,d,b.options.escape),j=l(g,d,b.options.escape),k=h(b.header,b.header.sorters[f],[i,j]);return void 0!==k?e*k:((void 0===i||null===i)&&(i=""),(void 0===j||null===j)&&(j=""),b.options.sortStable&&i===j&&(i=c._position,j=g._position),a.isNumeric(i)&&a.isNumeric(j)?(i=parseFloat(i),j=parseFloat(j),j>i?-1*e:e):i===j?0:("string"!=typeof i&&(i=i.toString()),-1===i.localeCompare(j)?-1*e:e))}),void 0!==this.options.sortClass&&(clearTimeout(g),g=setTimeout(function(){b.$el.removeClass(b.options.sortClass);var a=b.$header.find(c('[data-field="%s"]',b.options.sortName).index()+1);b.$el.find(c("tr td:nth-child(%s)",a)).addClass(b.options.sortClass)},250))))},o.prototype.onSort=function(b){var c="keypress"===b.type?a(b.currentTarget):a(b.currentTarget).parent(),d=this.$header.find("th").eq(c.index());return this.$header.add(this.$header_).find("span.order").remove(),this.options.sortName===c.data("field")?this.options.sortOrder="asc"===this.options.sortOrder?"desc":"asc":(this.options.sortName=c.data("field"),this.options.sortOrder="asc"===c.data("order")?"desc":"asc"),this.trigger("sort",this.options.sortName,this.options.sortOrder),c.add(d).data("order",this.options.sortOrder),this.getCaret(),"server"===this.options.sidePagination?void this.initServer(this.options.silentSort):(this.initSort(),void this.initBody())},o.prototype.initToolbar=function(){var b,d,e=this,f=[],g=0,i=0;this.$toolbar.find(".bs-bars").children().length&&a("body").append(a(this.options.toolbar)),this.$toolbar.html(""),("string"==typeof this.options.toolbar||"object"==typeof this.options.toolbar)&&a(c('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append(a(this.options.toolbar)),f=[c('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)],"string"==typeof this.options.icons&&(this.options.icons=h(null,this.options.icons)),this.options.showPaginationSwitch&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',this.options.formatPaginationSwitch()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>"),this.options.showRefresh&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" aria-label="refresh" title="%s">',this.options.formatRefresh()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>"),this.options.showToggle&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" aria-label="toggle" title="%s">',this.options.formatToggle()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>"),this.options.showColumns&&(f.push(c('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" aria-label="columns" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'),a.each(this.columns,function(a,b){if(!(b.radio||b.checkbox||e.options.cardView&&!b.cardVisible)){var d=b.visible?' checked="checked"':"";b.switchable&&(f.push(c('<li role="menuitem"><label><input type="checkbox" data-field="%s" value="%s"%s> %s</label></li>',b.field,a,d,b.title)),i++)}}),f.push("</ul>","</div>")),f.push("</div>"),(this.showToolbar||f.length>2)&&this.$toolbar.append(f.join("")),this.options.showPaginationSwitch&&this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",a.proxy(this.togglePagination,this)),this.options.showRefresh&&this.$toolbar.find('button[name="refresh"]').off("click").on("click",a.proxy(this.refresh,this)),this.options.showToggle&&this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){e.toggleView()}),this.options.showColumns&&(b=this.$toolbar.find(".keep-open"),i<=this.options.minimumCountColumns&&b.find("input").prop("disabled",!0),b.find("li").off("click").on("click",function(a){a.stopImmediatePropagation()}),b.find("input").off("click").on("click",function(){var b=a(this);e.toggleColumn(a(this).val(),b.prop("checked"),!1),e.trigger("column-switch",a(this).data("field"),b.prop("checked"))})),this.options.search&&(f=[],f.push('<div class="pull-'+this.options.searchAlign+' search">',c('<input class="form-control'+c(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>"),this.$toolbar.append(f.join("")),d=this.$toolbar.find(".search input"),d.off("keyup drop blur").on("keyup drop blur",function(b){e.options.searchOnEnterKey&&13!==b.keyCode||a.inArray(b.keyCode,[37,38,39,40])>-1||(clearTimeout(g),g=setTimeout(function(){e.onSearch(b)},e.options.searchTimeOut))}),m()&&d.off("mouseup").on("mouseup",function(a){clearTimeout(g),g=setTimeout(function(){e.onSearch(a)},e.options.searchTimeOut)}))},o.prototype.onSearch=function(b){var c=a.trim(a(b.currentTarget).val());this.options.trimOnSearch&&a(b.currentTarget).val()!==c&&a(b.currentTarget).val(c),c!==this.searchText&&(this.searchText=c,this.options.searchText=c,this.options.pageNumber=1,this.initSearch(),this.updatePagination(),this.trigger("search",c))},o.prototype.initSearch=function(){var b=this;if("server"!==this.options.sidePagination){if(this.options.customSearch!==a.noop)return void this.options.customSearch.apply(this,[this.searchText]);var c=this.searchText&&(this.options.escape?j(this.searchText):this.searchText).toLowerCase(),d=a.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=d?a.grep(this.options.data,function(b){for(var c in d)if(a.isArray(d[c])&&-1===a.inArray(b[c],d[c])||!a.isArray(d[c])&&b[c]!==d[c])return!1;return!0}):this.options.data,this.data=c?a.grep(this.data,function(d,f){for(var g=0;g<b.header.fields.length;g++)if(b.header.searchables[g]){var i,j=a.isNumeric(b.header.fields[g])?parseInt(b.header.fields[g],10):b.header.fields[g],k=b.columns[e(b.columns,j)];if("string"==typeof j){i=d;for(var l=j.split("."),m=0;m<l.length;m++)i=i[l[m]];k&&k.searchFormatter&&(i=h(k,b.header.formatters[g],[i,d,f],i))}else i=d[j];if("string"==typeof i||"number"==typeof i)if(b.options.strictSearch){if((i+"").toLowerCase()===c)return!0}else if(-1!==(i+"").toLowerCase().indexOf(c))return!0}return!1}):this.data}},o.prototype.initPagination=function(){if(!this.options.pagination)return void this.$pagination.hide();this.$pagination.show();var b,d,e,f,g,h,i,j,k,l=this,m=[],n=!1,o=this.getData(),p=this.options.pageList;if("server"!==this.options.sidePagination&&(this.options.totalRows=o.length),this.totalPages=0,this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows())this.options.pageSize=this.options.totalRows,n=!0;else if(this.options.pageSize===this.options.totalRows){var q="string"==typeof this.options.pageList?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;a.inArray(this.options.formatAllRows().toLowerCase(),q)>-1&&(n=!0)}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1,this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages&&(this.options.pageNumber=this.totalPages),this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1,this.pageTo=this.options.pageNumber*this.options.pageSize,this.pageTo>this.options.totalRows&&(this.pageTo=this.options.totalRows),m.push('<div class="pull-'+this.options.paginationDetailHAlign+' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"</span>"),!this.options.onlyInfoPagination){m.push('<span class="page-list">');var r=[c('<span class="btn-group %s">',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?"dropdown":"dropup"),'<button type="button" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',n?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if("string"==typeof this.options.pageList){var s=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");p=[],a.each(s,function(a,b){p.push(b.toUpperCase()===l.options.formatAllRows().toUpperCase()?l.options.formatAllRows():+b)})}for(a.each(p,function(a,b){if(!l.options.smartDisplay||0===a||p[a-1]<l.options.totalRows){var d;d=n?b===l.options.formatAllRows()?' class="active"':"":b===l.options.pageSize?' class="active"':"",r.push(c('<li role="menuitem"%s><a href="#">%s</a></li>',d,b))}}),r.push("</ul></span>"),m.push(this.options.formatRecordsPerPage(r.join(""))),m.push("</span>"),m.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+c(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="#">'+this.options.paginationPreText+"</a></li>"),this.totalPages<5?(d=1,e=this.totalPages):(d=this.options.pageNumber-2,e=d+4,1>d&&(d=1,e=5),e>this.totalPages&&(e=this.totalPages,d=e-4)),this.totalPages>=6&&(this.options.pageNumber>=3&&(m.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="#">',1,"</a>","</li>"),d++),this.options.pageNumber>=4&&(4==this.options.pageNumber||6==this.totalPages||7==this.totalPages?d--:m.push('<li class="page-first-separator disabled">','<a href="#">...</a>',"</li>"),e--)),this.totalPages>=7&&this.options.pageNumber>=this.totalPages-2&&d--,6==this.totalPages?this.options.pageNumber>=this.totalPages-2&&e++:this.totalPages>=7&&(7==this.totalPages||this.options.pageNumber>=this.totalPages-3)&&e++,b=d;e>=b;b++)m.push('<li class="page-number'+(b===this.options.pageNumber?" active":"")+'">','<a href="#">',b,"</a>","</li>");this.totalPages>=8&&this.options.pageNumber<=this.totalPages-4&&m.push('<li class="page-last-separator disabled">','<a href="#">...</a>',"</li>"),this.totalPages>=6&&this.options.pageNumber<=this.totalPages-3&&m.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="#">',this.totalPages,"</a>","</li>"),m.push('<li class="page-next"><a href="#">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(m.join("")),this.options.onlyInfoPagination||(f=this.$pagination.find(".page-list a"),g=this.$pagination.find(".page-first"),h=this.$pagination.find(".page-pre"),i=this.$pagination.find(".page-next"),j=this.$pagination.find(".page-last"),k=this.$pagination.find(".page-number"),this.options.smartDisplay&&(this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),(p.length<2||this.options.totalRows<=p[0])&&this.$pagination.find("span.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"]()),this.options.paginationLoop||(1===this.options.pageNumber&&h.addClass("disabled"),this.options.pageNumber===this.totalPages&&i.addClass("disabled")),n&&(this.options.pageSize=this.options.formatAllRows()),f.off("click").on("click",a.proxy(this.onPageListChange,this)),g.off("click").on("click",a.proxy(this.onPageFirst,this)),h.off("click").on("click",a.proxy(this.onPagePre,this)),i.off("click").on("click",a.proxy(this.onPageNext,this)),j.off("click").on("click",a.proxy(this.onPageLast,this)),k.off("click").on("click",a.proxy(this.onPageNumber,this)))},o.prototype.updatePagination=function(b){b&&a(b.currentTarget).hasClass("disabled")||(this.options.maintainSelected||this.resetRows(),this.initPagination(),"server"===this.options.sidePagination?this.initServer():this.initBody(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize))},o.prototype.onPageListChange=function(b){var c=a(b.currentTarget);return c.parent().addClass("active").siblings().removeClass("active"),this.options.pageSize=c.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+c.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(b),!1},o.prototype.onPageFirst=function(a){return this.options.pageNumber=1,this.updatePagination(a),!1},o.prototype.onPagePre=function(a){return this.options.pageNumber-1===0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(a),!1},o.prototype.onPageNext=function(a){return this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(a),!1},o.prototype.onPageLast=function(a){return this.options.pageNumber=this.totalPages,this.updatePagination(a),!1},o.prototype.onPageNumber=function(b){return this.options.pageNumber!==+a(b.currentTarget).text()?(this.options.pageNumber=+a(b.currentTarget).text(),this.updatePagination(b),!1):void 0},o.prototype.initRow=function(b,e){var f,g=this,i=[],k={},m=[],n="",o={},p=[];if(!(a.inArray(b,this.hiddenRows)>-1)){if(k=h(this.options,this.options.rowStyle,[b,e],k),k&&k.css)for(f in k.css)m.push(f+": "+k.css[f]);if(o=h(this.options,this.options.rowAttributes,[b,e],o))for(f in o)p.push(c('%s="%s"',f,j(o[f])));return b._data&&!a.isEmptyObject(b._data)&&a.each(b._data,function(a,b){"index"!==a&&(n+=c(' data-%s="%s"',a,b))}),i.push("<tr",c(" %s",p.join(" ")),c(' id="%s"',a.isArray(b)?void 0:b._id),c(' class="%s"',k.classes||(a.isArray(b)?void 0:b._class)),c(' data-index="%s"',e),c(' data-uniqueid="%s"',b[this.options.uniqueId]),c("%s",n),">"),this.options.cardView&&i.push(c('<td colspan="%s"><div class="card-views">',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&i.push("<td>",'<a class="detail-icon" href="#">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>"),a.each(this.header.fields,function(f,n){var o="",p=l(b,n,g.options.escape),q="",r="",s={},t="",u=g.header.classes[f],v="",w="",x="",y="",z=g.columns[f];if(!(g.fromHtml&&"undefined"==typeof p||!z.visible||g.options.cardView&&!z.cardVisible)){if(z.escape&&(p=j(p)),k=c('style="%s"',m.concat(g.header.styles[f]).join("; ")),b["_"+n+"_id"]&&(t=c(' id="%s"',b["_"+n+"_id"])),b["_"+n+"_class"]&&(u=c(' class="%s"',b["_"+n+"_class"])),b["_"+n+"_rowspan"]&&(w=c(' rowspan="%s"',b["_"+n+"_rowspan"])),b["_"+n+"_colspan"]&&(x=c(' colspan="%s"',b["_"+n+"_colspan"])),b["_"+n+"_title"]&&(y=c(' title="%s"',b["_"+n+"_title"])),s=h(g.header,g.header.cellStyles[f],[p,b,e,n],s),s.classes&&(u=c(' class="%s"',s.classes)),s.css){var A=[];for(var B in s.css)A.push(B+": "+s.css[B]);k=c('style="%s"',A.concat(g.header.styles[f]).join("; "))}q=h(z,g.header.formatters[f],[p,b,e],p),b["_"+n+"_data"]&&!a.isEmptyObject(b["_"+n+"_data"])&&a.each(b["_"+n+"_data"],function(a,b){"index"!==a&&(v+=c(' data-%s="%s"',a,b))}),z.checkbox||z.radio?(r=z.checkbox?"checkbox":r,r=z.radio?"radio":r,o=[c(g.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',z["class"]||""),"<input"+c(' data-index="%s"',e)+c(' name="%s"',g.options.selectItemName)+c(' type="%s"',r)+c(' value="%s"',b[g.options.idField])+c(' checked="%s"',q===!0||p||q&&q.checked?"checked":void 0)+c(' disabled="%s"',!z.checkboxEnabled||q&&q.disabled?"disabled":void 0)+" />",g.header.formatters[f]&&"string"==typeof q?q:"",g.options.cardView?"</div>":"</td>"].join(""),b[g.header.stateField]=q===!0||q&&q.checked):(q="undefined"==typeof q||null===q?g.options.undefinedText:q,o=g.options.cardView?['<div class="card-view">',g.options.showHeader?c('<span class="title" %s>%s</span>',k,d(g.columns,"field","title",n)):"",c('<span class="value">%s</span>',q),"</div>"].join(""):[c("<td%s %s %s %s %s %s %s>",t,u,k,v,w,x,y),q,"</td>"].join(""),g.options.cardView&&g.options.smartDisplay&&""===q&&(o='<div class="card-view"></div>')),i.push(o)}}),this.options.cardView&&i.push("</div></td>"),i.push("</tr>"),i.join(" ")}},o.prototype.initBody=function(b){var d=this,f=this.getData();this.trigger("pre-body",f),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=a("<tbody></tbody>").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=f.length);for(var g,i=a(document.createDocumentFragment()),j=this.pageFrom-1;j<this.pageTo;j++){ +var k=f[j],m=this.initRow(k,j,f,i);g=g||!!m,m&&m!==!0&&i.append(m)}g||i.append('<tr class="no-records-found">'+c('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches())+"</tr>"),this.$body.html(i),b||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(b){var f=a(this),g=f.parent(),h=d.data[g.data("index")],i=f[0].cellIndex,j=d.getVisibleFields(),k=j[d.options.detailView&&!d.options.cardView?i-1:i],m=d.columns[e(d.columns,k)],n=l(h,k,d.options.escape);if(!f.find(".detail-icon").length&&(d.trigger("click"===b.type?"click-cell":"dbl-click-cell",k,n,h,f),d.trigger("click"===b.type?"click-row":"dbl-click-row",h,g,k),"click"===b.type&&d.options.clickToSelect&&m.clickToSelect)){var o=g.find(c('[name="%s"]',d.options.selectItemName));o.length&&o[0].click()}}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var b=a(this),e=b.parent().parent(),g=e.data("index"),i=f[g];if(e.next().is("tr.detail-view"))b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailOpen)),d.trigger("collapse-row",g,i),e.next().remove();else{b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailClose)),e.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>',e.find("td").length));var j=e.next().find("td"),k=h(d.options,d.options.detailFormatter,[g,i,j],"");1===j.length&&j.append(k),d.trigger("expand-row",g,i,j)}return d.resetView(),!1}),this.$selectItem=this.$body.find(c('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(b){b.stopImmediatePropagation();var c=a(this),e=c.prop("checked"),f=d.data[c.data("index")];d.options.maintainSelected&&a(this).is(":radio")&&a.each(d.options.data,function(a,b){b[d.header.stateField]=!1}),f[d.header.stateField]=e,d.options.singleSelect&&(d.$selectItem.not(this).each(function(){d.data[a(this).data("index")][d.header.stateField]=!1}),d.$selectItem.filter(":checked").not(this).prop("checked",!1)),d.updateSelected(),d.trigger(e?"check":"uncheck",f,c)}),a.each(this.header.events,function(b,c){if(c){"string"==typeof c&&(c=h(null,c));var e=d.header.fields[b],f=a.inArray(e,d.getVisibleFields());d.options.detailView&&!d.options.cardView&&(f+=1);for(var g in c)d.$body.find(">tr:not(.no-records-found)").each(function(){var b=a(this),h=b.find(d.options.cardView?".card-view":"td").eq(f),i=g.indexOf(" "),j=g.substring(0,i),k=g.substring(i+1),l=c[g];h.find(k).off(j).on(j,function(a){var c=b.data("index"),f=d.data[c],g=f[e];l.apply(this,[a,g,f,c])})})}}),this.updateSelected(),this.resetView(),this.trigger("post-body",f)},o.prototype.initServer=function(b,c,d){var e,f=this,g={},i={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};this.options.pagination&&(i.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,i.pageNumber=this.options.pageNumber),(d||this.options.url||this.options.ajax)&&("limit"===this.options.queryParamsType&&(i={search:i.searchText,sort:i.sortName,order:i.sortOrder},this.options.pagination&&(i.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1),i.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)),a.isEmptyObject(this.filterColumnsPartial)||(i.filter=JSON.stringify(this.filterColumnsPartial,null)),g=h(this.options,this.options.queryParams,[i],g),a.extend(g,c||{}),g!==!1&&(b||this.$tableLoading.show(),e=a.extend({},h(null,this.options.ajaxOptions),{type:this.options.method,url:d||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(g):g,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(a){a=h(f.options,f.options.responseHandler,[a],a),f.load(a),f.trigger("load-success",a),b||f.$tableLoading.hide()},error:function(a){f.trigger("load-error",a.status,a),b||f.$tableLoading.hide()}}),this.options.ajax?h(this,this.options.ajax,[e],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=a.ajax(e))))},o.prototype.initSearchText=function(){if(this.options.search&&""!==this.options.searchText){var a=this.$toolbar.find(".search input");a.val(this.options.searchText),this.onSearch({currentTarget:a})}},o.prototype.getCaret=function(){var b=this;a.each(this.$header.find("th"),function(c,d){a(d).find(".sortable").removeClass("desc asc").addClass(a(d).data("field")===b.options.sortName?b.options.sortOrder:"both")})},o.prototype.updateSelected=function(){var b=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",b),this.$selectItem.each(function(){a(this).closest("tr")[a(this).prop("checked")?"addClass":"removeClass"]("selected")})},o.prototype.updateRows=function(){var b=this;this.$selectItem.each(function(){b.data[a(this).data("index")][b.header.stateField]=a(this).prop("checked")})},o.prototype.resetRows=function(){var b=this;a.each(this.data,function(a,c){b.$selectAll.prop("checked",!1),b.$selectItem.prop("checked",!1),b.header.stateField&&(c[b.header.stateField]=!1)}),this.initHiddenRows()},o.prototype.trigger=function(b){var c=Array.prototype.slice.call(arguments,1);b+=".bs.table",this.options[o.EVENTS[b]].apply(this.options,c),this.$el.trigger(a.Event(b),c),this.options.onAll(b,c),this.$el.trigger(a.Event("all.bs.table"),[b,c])},o.prototype.resetHeader=function(){clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(a.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)},o.prototype.fitHeader=function(){var b,d,e,f,h=this;if(h.$el.is(":hidden"))return void(h.timeoutId_=setTimeout(a.proxy(h.fitHeader,h),100));if(b=this.$tableBody.get(0),d=b.scrollWidth>b.clientWidth&&b.scrollHeight>b.clientHeight+this.$header.outerHeight()?g():0,this.$el.css("margin-top",-this.$header.outerHeight()),e=a(":focus"),e.length>0){var i=e.parents("th");if(i.length>0){var j=i.attr("data-field");if(void 0!==j){var k=this.$header.find("[data-field='"+j+"']");k.length>0&&k.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css({"margin-right":d}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),f=a(".focus-temp:visible:eq(0)"),f.length>0&&(f.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(){h.$header_.find(c('th[data-field="%s"]',a(this).data("field"))).data(a(this).data())});var l=this.getVisibleFields(),m=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(b){var d=a(this),e=b;h.options.detailView&&!h.options.cardView&&(0===b&&h.$header_.find("th.detail").find(".fht-cell").width(d.innerWidth()),e=b-1);var f=h.$header_.find(c('th[data-field="%s"]',l[e]));f.length>1&&(f=a(m[d[0].cellIndex])),f.find(".fht-cell").width(d.innerWidth())}),this.$tableBody.off("scroll").on("scroll",function(){h.$tableHeader.scrollLeft(a(this).scrollLeft()),h.options.showFooter&&!h.options.cardView&&h.$tableFooter.scrollLeft(a(this).scrollLeft())}),h.trigger("post-header")},o.prototype.resetFooter=function(){var b=this,d=b.getData(),e=[];this.options.showFooter&&!this.options.cardView&&(!this.options.cardView&&this.options.detailView&&e.push('<td><div class="th-inner"> </div><div class="fht-cell"></div></td>'),a.each(this.columns,function(a,f){var g,i="",j="",k=[],l={},m=c(' class="%s"',f["class"]);if(f.visible&&(!b.options.cardView||f.cardVisible)){if(i=c("text-align: %s; ",f.falign?f.falign:f.align),j=c("vertical-align: %s; ",f.valign),l=h(null,b.options.footerStyle),l&&l.css)for(g in l.css)k.push(g+": "+l.css[g]);e.push("<td",m,c(' style="%s"',i+j+k.concat().join("; ")),">"),e.push('<div class="th-inner">'),e.push(h(f,f.footerFormatter,[d]," ")||" "),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</td>")}}),this.$tableFooter.find("tr").html(e.join("")),this.$tableFooter.show(),clearTimeout(this.timeoutFooter_),this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0))},o.prototype.fitFooter=function(){var b,c,d;return clearTimeout(this.timeoutFooter_),this.$el.is(":hidden")?void(this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),100)):(c=this.$el.css("width"),d=c>this.$tableBody.width()?g():0,this.$tableFooter.css({"margin-right":d}).find("table").css("width",c).attr("class",this.$el.attr("class")),b=this.$tableFooter.find("td"),void this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(c){var d=a(this);b.eq(c).find(".fht-cell").width(d.innerWidth())}))},o.prototype.toggleColumn=function(a,b,d){if(-1!==a&&(this.columns[a].visible=b,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var e=this.$toolbar.find(".keep-open input").prop("disabled",!1);d&&e.filter(c('[value="%s"]',a)).prop("checked",b),e.filter(":checked").length<=this.options.minimumCountColumns&&e.filter(":checked").prop("disabled",!0)}},o.prototype.getVisibleFields=function(){var b=this,c=[];return a.each(this.header.fields,function(a,d){var f=b.columns[e(b.columns,d)];f.visible&&c.push(d)}),c},o.prototype.resetView=function(a){var b=0;if(a&&a.height&&(this.options.height=a.height),this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length),this.options.height){var c=this.$toolbar.outerHeight(!0),d=this.$pagination.outerHeight(!0),e=this.options.height-c-d;this.$tableContainer.css("height",e+"px")}return this.options.cardView?(this.$el.css("margin-top","0"),this.$tableContainer.css("padding-bottom","0"),void this.$tableFooter.hide()):(this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),b+=this.$header.outerHeight()):(this.$tableHeader.hide(),this.trigger("post-header")),this.options.showFooter&&(this.resetFooter(),this.options.height&&(b+=this.$tableFooter.outerHeight()+1)),this.getCaret(),this.$tableContainer.css("padding-bottom",b+"px"),void this.trigger("reset-view"))},o.prototype.getData=function(b){return!this.searchText&&a.isEmptyObject(this.filterColumns)&&a.isEmptyObject(this.filterColumnsPartial)?b?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data:b?this.data.slice(this.pageFrom-1,this.pageTo):this.data},o.prototype.load=function(b){var c=!1;"server"===this.options.sidePagination?(this.options.totalRows=b[this.options.totalField],c=b.fixedScroll,b=b[this.options.dataField]):a.isArray(b)||(c=b.fixedScroll,b=b.data),this.initData(b),this.initSearch(),this.initPagination(),this.initBody(c)},o.prototype.append=function(a){this.initData(a,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.prepend=function(a){this.initData(a,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.remove=function(b){var c,d,e=this.options.data.length;if(b.hasOwnProperty("field")&&b.hasOwnProperty("values")){for(c=e-1;c>=0;c--)d=this.options.data[c],d.hasOwnProperty(b.field)&&-1!==a.inArray(d[b.field],b.values)&&(this.options.data.splice(c,1),"server"===this.options.sidePagination&&(this.options.totalRows-=1));e!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},o.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.getRowByUniqueId=function(a){var b,c,d,e=this.options.uniqueId,f=this.options.data.length,g=null;for(b=f-1;b>=0;b--){if(c=this.options.data[b],c.hasOwnProperty(e))d=c[e];else{if(!c._data.hasOwnProperty(e))continue;d=c._data[e]}if("string"==typeof d?a=a.toString():"number"==typeof d&&(Number(d)===d&&d%1===0?a=parseInt(a):d===Number(d)&&0!==d&&(a=parseFloat(a))),d===a){g=c;break}}return g},o.prototype.removeByUniqueId=function(a){var b=this.options.data.length,c=this.getRowByUniqueId(a);c&&this.options.data.splice(this.options.data.indexOf(c),1),b!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.updateByUniqueId=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){var e;d.hasOwnProperty("id")&&d.hasOwnProperty("row")&&(e=a.inArray(c.getRowByUniqueId(d.id),c.options.data),-1!==e&&a.extend(c.options.data[e],d.row))}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.insertRow=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("row")&&(this.data.splice(a.index,0,a.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))},o.prototype.updateRow=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){d.hasOwnProperty("index")&&d.hasOwnProperty("row")&&a.extend(c.options.data[d.index],d.row)}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.initHiddenRows=function(){this.hiddenRows=[]},o.prototype.showRow=function(a){this.toggleRow(a,!0)},o.prototype.hideRow=function(a){this.toggleRow(a,!1)},o.prototype.toggleRow=function(b,c){var d,e;b.hasOwnProperty("index")?d=this.getData()[b.index]:b.hasOwnProperty("uniqueId")&&(d=this.getRowByUniqueId(b.uniqueId)),d&&(e=a.inArray(d,this.hiddenRows),c||-1!==e?c&&e>-1&&this.hiddenRows.splice(e,1):this.hiddenRows.push(d),this.initBody(!0))},o.prototype.getHiddenRows=function(){var b=this,c=this.getData(),d=[];return a.each(c,function(c,e){a.inArray(e,b.hiddenRows)>-1&&d.push(e)}),this.hiddenRows=d,d},o.prototype.mergeCells=function(b){var c,d,e,f=b.index,g=a.inArray(b.field,this.getVisibleFields()),h=b.rowspan||1,i=b.colspan||1,j=this.$body.find(">tr");if(this.options.detailView&&!this.options.cardView&&(g+=1),e=j.eq(f).find(">td").eq(g),!(0>f||0>g||f>=this.data.length)){for(c=f;f+h>c;c++)for(d=g;g+i>d;d++)j.eq(c).find(">td").eq(d).hide();e.attr("rowspan",h).attr("colspan",i).show()}},o.prototype.updateCell=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("field")&&a.hasOwnProperty("value")&&(this.data[a.index][a.field]=a.value,a.reinit!==!1&&(this.initSort(),this.initBody(!0)))},o.prototype.getOptions=function(){return this.options},o.prototype.getSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]===!0})},o.prototype.getAllSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},o.prototype.checkAll=function(){this.checkAll_(!0)},o.prototype.uncheckAll=function(){this.checkAll_(!1)},o.prototype.checkInvert=function(){var b=this,c=b.$selectItem.filter(":enabled"),d=c.filter(":checked");c.each(function(){a(this).prop("checked",!a(this).prop("checked"))}),b.updateRows(),b.updateSelected(),b.trigger("uncheck-some",d),d=b.getSelections(),b.trigger("check-some",d)},o.prototype.checkAll_=function(a){var b;a||(b=this.getSelections()),this.$selectAll.add(this.$selectAll_).prop("checked",a),this.$selectItem.filter(":enabled").prop("checked",a),this.updateRows(),a&&(b=this.getSelections()),this.trigger(a?"check-all":"uncheck-all",b)},o.prototype.check=function(a){this.check_(!0,a)},o.prototype.uncheck=function(a){this.check_(!1,a)},o.prototype.check_=function(a,b){var d=this.$selectItem.filter(c('[data-index="%s"]',b)).prop("checked",a);this.data[b][this.header.stateField]=a,this.updateSelected(),this.trigger(a?"check":"uncheck",this.data[b],d)},o.prototype.checkBy=function(a){this.checkBy_(!0,a)},o.prototype.uncheckBy=function(a){this.checkBy_(!1,a)},o.prototype.checkBy_=function(b,d){if(d.hasOwnProperty("field")&&d.hasOwnProperty("values")){var e=this,f=[];a.each(this.options.data,function(g,h){if(!h.hasOwnProperty(d.field))return!1;if(-1!==a.inArray(h[d.field],d.values)){var i=e.$selectItem.filter(":enabled").filter(c('[data-index="%s"]',g)).prop("checked",b);h[e.header.stateField]=b,f.push(h),e.trigger(b?"check":"uncheck",h,i)}}),this.updateSelected(),this.trigger(b?"check-some":"uncheck-some",f)}},o.prototype.destroy=function(){this.$el.insertBefore(this.$container),a(this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")},o.prototype.showLoading=function(){this.$tableLoading.show()},o.prototype.hideLoading=function(){this.$tableLoading.hide()},o.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var a=this.$toolbar.find('button[name="paginationSwitch"] i');this.options.pagination?a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown):a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp),this.updatePagination()},o.prototype.refresh=function(a){a&&a.url&&(this.options.url=a.url),a&&a.pageNumber&&(this.options.pageNumber=a.pageNumber),a&&a.pageSize&&(this.options.pageSize=a.pageSize),this.initServer(a&&a.silent,a&&a.query,a&&a.url),this.trigger("refresh",a)},o.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},o.prototype.showColumn=function(a){this.toggleColumn(e(this.columns,a),!0,!0)},o.prototype.hideColumn=function(a){this.toggleColumn(e(this.columns,a),!1,!0)},o.prototype.getHiddenColumns=function(){return a.grep(this.columns,function(a){return!a.visible})},o.prototype.getVisibleColumns=function(){return a.grep(this.columns,function(a){return a.visible})},o.prototype.toggleAllColumns=function(b){if(a.each(this.columns,function(a){this.columns[a].visible=b}),this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns){var c=this.$toolbar.find(".keep-open input").prop("disabled",!1);c.filter(":checked").length<=this.options.minimumCountColumns&&c.filter(":checked").prop("disabled",!0)}},o.prototype.showAllColumns=function(){this.toggleAllColumns(!0)},o.prototype.hideAllColumns=function(){this.toggleAllColumns(!1)},o.prototype.filterBy=function(b){this.filterColumns=a.isEmptyObject(b)?{}:b,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},o.prototype.scrollTo=function(a){return"string"==typeof a&&(a="bottom"===a?this.$tableBody[0].scrollHeight:0),"number"==typeof a&&this.$tableBody.scrollTop(a),"undefined"==typeof a?this.$tableBody.scrollTop():void 0},o.prototype.getScrollPosition=function(){return this.scrollTo()},o.prototype.selectPage=function(a){a>0&&a<=this.options.totalPages&&(this.options.pageNumber=a,this.updatePagination())},o.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},o.prototype.nextPage=function(){this.options.pageNumber<this.options.totalPages&&(this.options.pageNumber++,this.updatePagination())},o.prototype.toggleView=function(){this.options.cardView=!this.options.cardView,this.initHeader(),this.initBody(),this.trigger("toggle",this.options.cardView)},o.prototype.refreshOptions=function(b){i(this.options,b,!0)||(this.options=a.extend(this.options,b),this.trigger("refresh-options",this.options),this.destroy(),this.init())},o.prototype.resetSearch=function(a){var b=this.$toolbar.find(".search input");b.val(a||""),this.onSearch({currentTarget:b})},o.prototype.expandRow_=function(a,b){var d=this.$body.find(c('> tr[data-index="%s"]',b));d.next().is("tr.detail-view")===(a?!1:!0)&&d.find("> td > .detail-icon").click()},o.prototype.expandRow=function(a){this.expandRow_(!0,a)},o.prototype.collapseRow=function(a){this.expandRow_(!1,a)},o.prototype.expandAllRows=function(b){if(b){var d=this.$body.find(c('> tr[data-index="%s"]',0)),e=this,f=null,g=!1,h=-1;if(d.next().is("tr.detail-view")?d.next().next().is("tr.detail-view")||(d.next().find(".detail-icon").click(),g=!0):(d.find("> td > .detail-icon").click(),g=!0),g)try{h=setInterval(function(){f=e.$body.find("tr.detail-view").last().find(".detail-icon"),f.length>0?f.click():clearInterval(h)},1)}catch(i){clearInterval(h)}}else for(var j=this.$body.children(),k=0;k<j.length;k++)this.expandRow_(!0,a(j[k]).data("index"))},o.prototype.collapseAllRows=function(b){if(b)this.expandRow_(!1,0);else for(var c=this.$body.children(),d=0;d<c.length;d++)this.expandRow_(!1,a(c[d]).data("index"))},o.prototype.updateFormatText=function(a,b){this.options[c("format%s",a)]&&("string"==typeof b?this.options[c("format%s",a)]=function(){return b}:"function"==typeof b&&(this.options[c("format%s",a)]=b)),this.initToolbar(),this.initPagination(),this.initBody()};var p=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getHiddenRows","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","getVisibleColumns","showAllColumns","hideAllColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];a.fn.bootstrapTable=function(b){var c,d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("bootstrap.table"),g=a.extend({},o.DEFAULTS,e.data(),"object"==typeof b&&b);if("string"==typeof b){if(a.inArray(b,p)<0)throw new Error("Unknown method: "+b);if(!f)return;c=f[b].apply(f,d),"destroy"===b&&e.removeData("bootstrap.table")}f||e.data("bootstrap.table",f=new o(this,g))}),"undefined"==typeof c?this:c},a.fn.bootstrapTable.Constructor=o,a.fn.bootstrapTable.defaults=o.DEFAULTS,a.fn.bootstrapTable.columnDefaults=o.COLUMN_DEFAULTS,a.fn.bootstrapTable.locales=o.LOCALES,a.fn.bootstrapTable.methods=p,a.fn.bootstrapTable.utils={sprintf:c,getFieldIndex:e,compareObjects:i,calculateObjectValue:h,getItemField:l,objectKeys:n,isIEBrowser:m},a(function(){a('[data-toggle="table"]').bootstrapTable()})}(jQuery); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js new file mode 100644 index 0000000..874f340 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js @@ -0,0 +1,46 @@ +/** + * Bootstrap Table Chinese translation + * Author: Zhixin Wen<wenzhixin2010@gmail.com> + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['zh-CN'] = { + formatLoadingMessage: function () { + return '正在努力地加载数据中,请稍候……'; + }, + formatRecordsPerPage: function (pageNumber) { + return '每页显示 ' + pageNumber + ' 条记录'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录'; + }, + formatSearch: function () { + return '搜索'; + }, + formatNoMatches: function () { + return '没有找到匹配的记录'; + }, + formatPaginationSwitch: function () { + return '隐藏/显示分页'; + }, + formatRefresh: function () { + return '刷新'; + }, + formatToggle: function () { + return '切换'; + }, + formatColumns: function () { + return '列'; + }, + formatExport: function () { + return '导出数据'; + }, + formatClearFilters: function () { + return '清空过滤'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']); + +})(jQuery); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js new file mode 100644 index 0000000..2fcd8d4 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js @@ -0,0 +1,7 @@ +/* +* bootstrap-table - v1.11.1 - 2017-02-22 +* https://github.com/wenzhixin/bootstrap-table +* Copyright (c) 2017 zhixin wen +* Licensed MIT License +*/ +!function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-treetable/bootstrap-treetable.js b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-treetable/bootstrap-treetable.js new file mode 100644 index 0000000..2daffe7 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-treetable/bootstrap-treetable.js @@ -0,0 +1,308 @@ +(function($) { + "use strict"; + + $.fn.bootstrapTreeTable = function(options, param) { + var allData = null;//用于存放格式化后的数据 + // 如果是调用方法 + if (typeof options == 'string') { + return $.fn.bootstrapTreeTable.methods[options](this, param); + } + // 如果是初始化组件 + options = $.extend({}, $.fn.bootstrapTreeTable.defaults, options || {}); + // 是否有radio或checkbox + var hasSelectItem = false; + var target = $(this); + // 在外层包装一下div,样式用的bootstrap-table的 + var _main_div = $("<div class='bootstrap-tree-table fixed-table-container'></div>"); + target.before(_main_div); + _main_div.append(target); + target.addClass("table table-hover treetable-table table-bordered"); + if (options.striped) { + target.addClass('table-striped'); + } + // 工具条在外层包装一下div,样式用的bootstrap-table的 + if(options.toolbar){ + var _tool_div = $("<div class='fixed-table-toolbar'></div>"); + var _tool_left_div = $("<div class='bs-bars pull-left'></div>"); + _tool_left_div.append($(options.toolbar)); + _tool_div.append(_tool_left_div); + _main_div.before(_tool_div); + } + // 格式化数据,优化性能 + target.formatData=function(data){ + var _root = options.rootCodeValue?options.rootCodeValue:null + $.each(data, function(index, item) { + // 添加一个默认属性,用来判断当前节点有没有被显示 + item.isShow = false; + // 这里兼容几种常见Root节点写法 + // 默认的几种判断 + var _defaultRootFlag = item[options.parentCode] == '0' + || item[options.parentCode] == 0 + || item[options.parentCode] == null + || item[options.parentCode] == ''; + if (!item[options.parentCode] || (_root?(item[options.parentCode] == options.rootCodeValue):_defaultRootFlag)){ + if(!allData["_root_"]){allData["_root_"]=[];} + allData["_root_"].push(item); + }else{ + if(!allData["_n_"+item[options.parentCode]]){allData["_n_"+item[options.parentCode]]=[];} + allData["_n_"+item[options.parentCode]].push(item); + } + }); + } + // 得到根节点 + target.getRootNodes = function() { + return allData["_root_"]; + }; + // 递归获取子节点并且设置子节点 + target.handleNode = function(parentNode, lv, tbody) { + var _ls = allData["_n_"+parentNode[options.code]]; + var tr = target.renderRow(parentNode,_ls?true:false,lv); + tbody.append(tr); + if(_ls){ + $.each(_ls, function(i, item) { + target.handleNode(item, (lv + 1), tbody) + }); + } + }; + // 绘制行 + target.renderRow = function(item,isP,lv){ + // 标记已显示 + item.isShow = true; + var tr = $('<tr class="tg-'+item[options.parentCode]+'"></tr>'); + var _icon = options.expanderCollapsedClass; + if(options.expandAll){ + tr.css("display","table"); + _icon = options.expanderExpandedClass; + }else if(options.expandFirst&&lv<=2){ + tr.css("display","table"); + _icon=(lv==1)?options.expanderExpandedClass:options.expanderCollapsedClass; + }else{ + tr.css("display","none"); + _icon = options.expanderCollapsedClass; + } + $.each(options.columns, function(index, column) { + // 判断有没有选择列 + if(index==0&&column.field=='selectItem'){ + hasSelectItem = true; + var td = $('<td style="text-align:center;width:36px"></td>'); + if(column.radio){ + var _ipt = $('<input name="select_item" type="radio" value="'+item[options.id]+'"></input>'); + td.append(_ipt); + } + if(column.checkbox){ + var _ipt = $('<input name="select_item" type="checkbox" value="'+item[options.id]+'"></input>'); + td.append(_ipt); + } + tr.append(td); + }else{ + var td = $('<td title="'+item[column.field]+'" name="'+column.field+'" style="'+((column.width)?('width:'+column.width):'')+'"></td>'); + // 增加formatter渲染 + if (column.formatter) { + td.html(column.formatter.call(this, item[column.field], item, index)); + } else { + td.text(item[column.field]); + } + if(options.expandColumn==index){ + if(!isP){ + td.prepend('<span class="treetable-expander"></span>') + }else{ + td.prepend('<span class="treetable-expander '+_icon+'"></span>') + } + for (var int = 0; int < (lv-1); int++) { + td.prepend('<span class="treetable-indent"></span>') + } + } + tr.append(td); + } + }); + return tr; + } + // 加载数据 + target.load = function(parms){ + // 加载数据前先清空 + allData = {}; + // 加载数据前先清空 + target.html(""); + // 构造表头 + var thr = $('<tr></tr>'); + $.each(options.columns, function(i, item) { + var th = null; + // 判断有没有选择列 + if(i==0&&item.field=='selectItem'){ + hasSelectItem = true; + th = $('<th style="width:36px"></th>'); + }else{ + th = $('<th style="'+((item.width)?('width:'+item.width):'')+'"></th>'); + } + th.text(item.title); + thr.append(th); + }); + var thead = $('<thead class="treetable-thead"></thead>'); + thead.append(thr); + target.append(thead); + // 构造表体 + var tbody = $('<tbody class="treetable-tbody"></tbody>'); + target.append(tbody); + // 添加加载loading + var _loading = '<tr><td colspan="'+options.columns.length+'"><div style="display: block;text-align: center;">正在努力地加载数据中,请稍候……</div></td></tr>' + tbody.html(_loading); + // 默认高度 + if(options.height){ + tbody.css("height",options.height); + } + $.ajax({ + type : options.type, + url : options.url, + data : parms?parms:options.ajaxParams, + dataType : "JSON", + success : function(data, textStatus, jqXHR) { + // 加载完数据先清空 + tbody.html(""); + if(!data||data.length<=0){ + var _empty = '<tr><td colspan="'+options.columns.length+'"><div style="display: block;text-align: center;">没有找到匹配的记录</div></td></tr>' + tbody.html(_empty); + return; + } + // 格式化数据 + target.formatData(data); + // 开始绘制 + var rootNode = target.getRootNodes(); + if(rootNode){ + $.each(rootNode, function(i, item) { + target.handleNode(item, 1, tbody); + }); + } + // 下边的操作主要是为了查询时让一些没有根节点的节点显示 + $.each(data, function(i, item) { + if(!item.isShow){ + var tr = target.renderRow(item,false,1); + tbody.append(tr); + } + }); + target.append(tbody); + //动态设置表头宽度 + thead.css("width", tbody.children(":first").css("width")); + // 行点击选中事件 + target.find("tbody").find("tr").click(function(){ + if(hasSelectItem){ + var _ipt = $(this).find("input[name='select_item']"); + if(_ipt.attr("type")=="radio"){ + _ipt.prop('checked',true); + target.find("tbody").find("tr").removeClass("treetable-selected"); + $(this).addClass("treetable-selected"); + }else{ + if(_ipt.prop('checked')){ + _ipt.prop('checked',false); + $(this).removeClass("treetable-selected"); + }else{ + _ipt.prop('checked',true); + $(this).addClass("treetable-selected"); + } + } + } + }); + // 小图标点击事件--展开缩起 + target.find("tbody").find("tr").find(".treetable-expander").click(function(){ + var tr = $(this).parent().parent(); + var _code = tr.find("input[name='select_item']").val(); + if(options.id==options.code){ + _code = tr.find("input[name='select_item']").val(); + }else{ + _code = tr.find("td[name='"+options.code+"']").text(); + } + var _ls = target.find("tbody").find(".tg-"+_code);//下一级 + if(_ls&&_ls.length>0){ + var _flag = $(this).hasClass(options.expanderExpandedClass); + $.each(_ls, function(index, item) { + $(item).css("display",_flag?"none":"table"); + }); + if(_flag){ + $(this).removeClass(options.expanderExpandedClass) + $(this).addClass(options.expanderCollapsedClass) + }else{ + $(this).removeClass(options.expanderCollapsedClass) + $(this).addClass(options.expanderExpandedClass) + } + } + }); + }, + error:function(xhr,textStatus){ + var _errorMsg = '<tr><td colspan="'+options.columns.length+'"><div style="display: block;text-align: center;">'+xhr.responseText+'</div></td></tr>' + tbody.html(_errorMsg); + debugger; + }, + }); + } + if (options.url) { + target.load(); + } else { + // 也可以通过defaults里面的data属性通过传递一个数据集合进来对组件进行初始化....有兴趣可以自己实现,思路和上述类似 + } + + return target; + }; + + // 组件方法封装........ + $.fn.bootstrapTreeTable.methods = { + // 返回选中记录的id(返回的id由配置中的id属性指定) + // 为了兼容bootstrap-table的写法,统一返回数组,这里只返回了指定的id + getSelections : function(target, data) { + // 所有被选中的记录input + var _ipt = target.find("tbody").find("tr").find("input[name='select_item']:checked"); + var chk_value =[]; + // 如果是radio + if(_ipt.attr("type")=="radio"){ + var _data = {id:_ipt.val()}; + var _tds = _ipt.parent().parent().find("td"); + _tds.each(function(_i,_item){ + if(_i!=0){ + _data[$(_item).attr("name")]=$(_item).text(); + } + }); + chk_value.push(_data); + }else{ + _ipt.each(function(_i,_item){ + var _data = {id:$(_item).val()}; + var _tds = $(_item).parent().parent().find("td"); + _tds.each(function(_ii,_iitem){ + if(_ii!=0){ + _data[$(_iitem).attr("name")]=$(_iitem).text(); + } + }); + chk_value.push(_data); + }); + } + return chk_value; + }, + // 刷新记录 + refresh : function(target, parms) { + if(parms){ + target.load(parms); + }else{ + target.load(); + } + }, + // 组件的其他方法也可以进行类似封装........ + }; + + $.fn.bootstrapTreeTable.defaults = { + id : 'id',// 选取记录返回的值 + code : 'id',// 用于设置父子关系 + parentCode : 'parentId',// 用于设置父子关系 + rootCodeValue: null,//设置根节点code值----可指定根节点,默认为null,"",0,"0" + data : [], // 构造table的数据集合 + type : "GET", // 请求数据的ajax类型 + url : null, // 请求数据的ajax的url + ajaxParams : {}, // 请求数据的ajax的data属性 + expandColumn : null,// 在哪一列上面显示展开按钮 + expandAll : true, // 是否全部展开 + expandFirst : false, // 是否默认第一级展开--expandAll为false时生效 + striped : false, // 是否各行渐变色 + columns : [], + toolbar: null,//顶部工具条 + height: 0, + expanderExpandedClass : 'glyphicon glyphicon-chevron-down',// 展开的按钮的图标 + expanderCollapsedClass : 'glyphicon glyphicon-chevron-right'// 缩起的按钮的图标 + + }; +})(jQuery); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/chosen/chosen.jquery.js b/user/guns-admin/src/main/webapp/static/js/plugins/chosen/chosen.jquery.js new file mode 100644 index 0000000..e7181e9 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/chosen/chosen.jquery.js @@ -0,0 +1,1211 @@ +/*! + Chosen, a Select Box Enhancer for jQuery and Prototype + by Patrick Filler for Harvest, http://getharvest.com + + Version 1.1.0 + Full source at https://github.com/harvesthq/chosen + Copyright (c) 2011 Harvest http://getharvest.com + + MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md + This file is generated by `grunt build`, do not edit it by hand. + */ + +(function() { + var $, AbstractChosen, Chosen, SelectParser, _ref, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + SelectParser = (function() { + function SelectParser() { + this.options_index = 0; + this.parsed = []; + } + + SelectParser.prototype.add_node = function(child) { + if (child.nodeName.toUpperCase() === "OPTGROUP") { + return this.add_group(child); + } else { + return this.add_option(child); + } + }; + + SelectParser.prototype.add_group = function(group) { + var group_position, option, _i, _len, _ref, _results; + group_position = this.parsed.length; + this.parsed.push({ + array_index: group_position, + group: true, + label: this.escapeExpression(group.label), + children: 0, + disabled: group.disabled + }); + _ref = group.childNodes; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + option = _ref[_i]; + _results.push(this.add_option(option, group_position, group.disabled)); + } + return _results; + }; + + SelectParser.prototype.add_option = function(option, group_position, group_disabled) { + if (option.nodeName.toUpperCase() === "OPTION") { + if (option.text !== "") { + if (group_position != null) { + this.parsed[group_position].children += 1; + } + this.parsed.push({ + array_index: this.parsed.length, + options_index: this.options_index, + value: option.value, + text: option.text, + html: option.innerHTML, + selected: option.selected, + disabled: group_disabled === true ? group_disabled : option.disabled, + group_array_index: group_position, + classes: option.className, + style: option.style.cssText + }); + } else { + this.parsed.push({ + array_index: this.parsed.length, + options_index: this.options_index, + empty: true + }); + } + return this.options_index += 1; + } + }; + + SelectParser.prototype.escapeExpression = function(text) { + var map, unsafe_chars; + if ((text == null) || text === false) { + return ""; + } + if (!/[\&\<\>\"\'\`]/.test(text)) { + return text; + } + map = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g; + return text.replace(unsafe_chars, function(chr) { + return map[chr] || "&"; + }); + }; + + return SelectParser; + + })(); + + SelectParser.select_to_array = function(select) { + var child, parser, _i, _len, _ref; + parser = new SelectParser(); + _ref = select.childNodes; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + parser.add_node(child); + } + return parser.parsed; + }; + + AbstractChosen = (function() { + function AbstractChosen(form_field, options) { + this.form_field = form_field; + this.options = options != null ? options : {}; + if (!AbstractChosen.browser_is_supported()) { + return; + } + this.is_multiple = this.form_field.multiple; + this.set_default_text(); + this.set_default_values(); + this.setup(); + this.set_up_html(); + this.register_observers(); + } + + AbstractChosen.prototype.set_default_values = function() { + var _this = this; + this.click_test_action = function(evt) { + return _this.test_active_click(evt); + }; + this.activate_action = function(evt) { + return _this.activate_field(evt); + }; + this.active_field = false; + this.mouse_on_container = false; + this.results_showing = false; + this.result_highlighted = null; + this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false; + this.disable_search_threshold = this.options.disable_search_threshold || 0; + this.disable_search = this.options.disable_search || false; + this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true; + this.group_search = this.options.group_search != null ? this.options.group_search : true; + this.search_contains = this.options.search_contains || false; + this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true; + this.max_selected_options = this.options.max_selected_options || Infinity; + this.inherit_select_classes = this.options.inherit_select_classes || false; + this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true; + return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true; + }; + + AbstractChosen.prototype.set_default_text = function() { + if (this.form_field.getAttribute("data-placeholder")) { + this.default_text = this.form_field.getAttribute("data-placeholder"); + } else if (this.is_multiple) { + this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text; + } else { + this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text; + } + return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text; + }; + + AbstractChosen.prototype.mouse_enter = function() { + return this.mouse_on_container = true; + }; + + AbstractChosen.prototype.mouse_leave = function() { + return this.mouse_on_container = false; + }; + + AbstractChosen.prototype.input_focus = function(evt) { + var _this = this; + if (this.is_multiple) { + if (!this.active_field) { + return setTimeout((function() { + return _this.container_mousedown(); + }), 50); + } + } else { + if (!this.active_field) { + return this.activate_field(); + } + } + }; + + AbstractChosen.prototype.input_blur = function(evt) { + var _this = this; + if (!this.mouse_on_container) { + this.active_field = false; + return setTimeout((function() { + return _this.blur_test(); + }), 100); + } + }; + + AbstractChosen.prototype.results_option_build = function(options) { + var content, data, _i, _len, _ref; + content = ''; + _ref = this.results_data; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + data = _ref[_i]; + if (data.group) { + content += this.result_add_group(data); + } else { + content += this.result_add_option(data); + } + if (options != null ? options.first : void 0) { + if (data.selected && this.is_multiple) { + this.choice_build(data); + } else if (data.selected && !this.is_multiple) { + this.single_set_selected_text(data.text); + } + } + } + return content; + }; + + AbstractChosen.prototype.result_add_option = function(option) { + var classes, option_el; + if (!option.search_match) { + return ''; + } + if (!this.include_option_in_results(option)) { + return ''; + } + classes = []; + if (!option.disabled && !(option.selected && this.is_multiple)) { + classes.push("active-result"); + } + if (option.disabled && !(option.selected && this.is_multiple)) { + classes.push("disabled-result"); + } + if (option.selected) { + classes.push("result-selected"); + } + if (option.group_array_index != null) { + classes.push("group-option"); + } + if (option.classes !== "") { + classes.push(option.classes); + } + option_el = document.createElement("li"); + option_el.className = classes.join(" "); + option_el.style.cssText = option.style; + option_el.setAttribute("data-option-array-index", option.array_index); + option_el.innerHTML = option.search_text; + return this.outerHTML(option_el); + }; + + AbstractChosen.prototype.result_add_group = function(group) { + var group_el; + if (!(group.search_match || group.group_match)) { + return ''; + } + if (!(group.active_options > 0)) { + return ''; + } + group_el = document.createElement("li"); + group_el.className = "group-result"; + group_el.innerHTML = group.search_text; + return this.outerHTML(group_el); + }; + + AbstractChosen.prototype.results_update_field = function() { + this.set_default_text(); + if (!this.is_multiple) { + this.results_reset_cleanup(); + } + this.result_clear_highlight(); + this.results_build(); + if (this.results_showing) { + return this.winnow_results(); + } + }; + + AbstractChosen.prototype.reset_single_select_options = function() { + var result, _i, _len, _ref, _results; + _ref = this.results_data; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + result = _ref[_i]; + if (result.selected) { + _results.push(result.selected = false); + } else { + _results.push(void 0); + } + } + return _results; + }; + + AbstractChosen.prototype.results_toggle = function() { + if (this.results_showing) { + return this.results_hide(); + } else { + return this.results_show(); + } + }; + + AbstractChosen.prototype.results_search = function(evt) { + if (this.results_showing) { + return this.winnow_results(); + } else { + return this.results_show(); + } + }; + + AbstractChosen.prototype.winnow_results = function() { + var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref; + this.no_results_clear(); + results = 0; + searchText = this.get_search_text(); + escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + regexAnchor = this.search_contains ? "" : "^"; + regex = new RegExp(regexAnchor + escapedSearchText, 'i'); + zregex = new RegExp(escapedSearchText, 'i'); + _ref = this.results_data; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + option = _ref[_i]; + option.search_match = false; + results_group = null; + if (this.include_option_in_results(option)) { + if (option.group) { + option.group_match = false; + option.active_options = 0; + } + if ((option.group_array_index != null) && this.results_data[option.group_array_index]) { + results_group = this.results_data[option.group_array_index]; + if (results_group.active_options === 0 && results_group.search_match) { + results += 1; + } + results_group.active_options += 1; + } + if (!(option.group && !this.group_search)) { + option.search_text = option.group ? option.label : option.html; + option.search_match = this.search_string_match(option.search_text, regex); + if (option.search_match && !option.group) { + results += 1; + } + if (option.search_match) { + if (searchText.length) { + startpos = option.search_text.search(zregex); + text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length); + option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos); + } + if (results_group != null) { + results_group.group_match = true; + } + } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) { + option.search_match = true; + } + } + } + } + this.result_clear_highlight(); + if (results < 1 && searchText.length) { + this.update_results_content(""); + return this.no_results(searchText); + } else { + this.update_results_content(this.results_option_build()); + return this.winnow_results_set_highlight(); + } + }; + + AbstractChosen.prototype.search_string_match = function(search_string, regex) { + var part, parts, _i, _len; + if (regex.test(search_string)) { + return true; + } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) { + parts = search_string.replace(/\[|\]/g, "").split(" "); + if (parts.length) { + for (_i = 0, _len = parts.length; _i < _len; _i++) { + part = parts[_i]; + if (regex.test(part)) { + return true; + } + } + } + } + }; + + AbstractChosen.prototype.choices_count = function() { + var option, _i, _len, _ref; + if (this.selected_option_count != null) { + return this.selected_option_count; + } + this.selected_option_count = 0; + _ref = this.form_field.options; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + option = _ref[_i]; + if (option.selected) { + this.selected_option_count += 1; + } + } + return this.selected_option_count; + }; + + AbstractChosen.prototype.choices_click = function(evt) { + evt.preventDefault(); + if (!(this.results_showing || this.is_disabled)) { + return this.results_show(); + } + }; + + AbstractChosen.prototype.keyup_checker = function(evt) { + var stroke, _ref; + stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; + this.search_field_scale(); + switch (stroke) { + case 8: + if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) { + return this.keydown_backstroke(); + } else if (!this.pending_backstroke) { + this.result_clear_highlight(); + return this.results_search(); + } + break; + case 13: + evt.preventDefault(); + if (this.results_showing) { + return this.result_select(evt); + } + break; + case 27: + if (this.results_showing) { + this.results_hide(); + } + return true; + case 9: + case 38: + case 40: + case 16: + case 91: + case 17: + break; + default: + return this.results_search(); + } + }; + + AbstractChosen.prototype.clipboard_event_checker = function(evt) { + var _this = this; + return setTimeout((function() { + return _this.results_search(); + }), 50); + }; + + AbstractChosen.prototype.container_width = function() { + if (this.options.width != null) { + return this.options.width; + } else { + return "" + this.form_field.offsetWidth + "px"; + } + }; + + AbstractChosen.prototype.include_option_in_results = function(option) { + if (this.is_multiple && (!this.display_selected_options && option.selected)) { + return false; + } + if (!this.display_disabled_options && option.disabled) { + return false; + } + if (option.empty) { + return false; + } + return true; + }; + + AbstractChosen.prototype.search_results_touchstart = function(evt) { + this.touch_started = true; + return this.search_results_mouseover(evt); + }; + + AbstractChosen.prototype.search_results_touchmove = function(evt) { + this.touch_started = false; + return this.search_results_mouseout(evt); + }; + + AbstractChosen.prototype.search_results_touchend = function(evt) { + if (this.touch_started) { + return this.search_results_mouseup(evt); + } + }; + + AbstractChosen.prototype.outerHTML = function(element) { + var tmp; + if (element.outerHTML) { + return element.outerHTML; + } + tmp = document.createElement("div"); + tmp.appendChild(element); + return tmp.innerHTML; + }; + + AbstractChosen.browser_is_supported = function() { + if (window.navigator.appName === "Microsoft Internet Explorer") { + return document.documentMode >= 8; + } + if (/iP(od|hone)/i.test(window.navigator.userAgent)) { + return false; + } + if (/Android/i.test(window.navigator.userAgent)) { + if (/Mobile/i.test(window.navigator.userAgent)) { + return false; + } + } + return true; + }; + + AbstractChosen.default_multiple_text = "Select Some Options"; + + AbstractChosen.default_single_text = "Select an Option"; + + AbstractChosen.default_no_result_text = "No results match"; + + return AbstractChosen; + + })(); + + $ = jQuery; + + $.fn.extend({ + chosen: function(options) { + if (!AbstractChosen.browser_is_supported()) { + return this; + } + return this.each(function(input_field) { + var $this, chosen; + $this = $(this); + chosen = $this.data('chosen'); + if (options === 'destroy' && chosen) { + chosen.destroy(); + } else if (!chosen) { + $this.data('chosen', new Chosen(this, options)); + } + }); + } + }); + + Chosen = (function(_super) { + __extends(Chosen, _super); + + function Chosen() { + _ref = Chosen.__super__.constructor.apply(this, arguments); + return _ref; + } + + Chosen.prototype.setup = function() { + this.form_field_jq = $(this.form_field); + this.current_selectedIndex = this.form_field.selectedIndex; + return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl"); + }; + + Chosen.prototype.set_up_html = function() { + var container_classes, container_props; + container_classes = ["chosen-container"]; + container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single")); + if (this.inherit_select_classes && this.form_field.className) { + container_classes.push(this.form_field.className); + } + if (this.is_rtl) { + container_classes.push("chosen-rtl"); + } + container_props = { + 'class': container_classes.join(' '), + 'style': "width: " + (this.container_width()) + ";", + 'title': this.form_field.title + }; + if (this.form_field.id.length) { + container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen"; + } + this.container = $("<div />", container_props); + if (this.is_multiple) { + this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'); + } else { + this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'); + } + this.form_field_jq.hide().after(this.container); + this.dropdown = this.container.find('div.chosen-drop').first(); + this.search_field = this.container.find('input').first(); + this.search_results = this.container.find('ul.chosen-results').first(); + this.search_field_scale(); + this.search_no_results = this.container.find('li.no-results').first(); + if (this.is_multiple) { + this.search_choices = this.container.find('ul.chosen-choices').first(); + this.search_container = this.container.find('li.search-field').first(); + } else { + this.search_container = this.container.find('div.chosen-search').first(); + this.selected_item = this.container.find('.chosen-single').first(); + } + this.results_build(); + this.set_tab_index(); + this.set_label_behavior(); + return this.form_field_jq.trigger("chosen:ready", { + chosen: this + }); + }; + + Chosen.prototype.register_observers = function() { + var _this = this; + this.container.bind('mousedown.chosen', function(evt) { + _this.container_mousedown(evt); + }); + this.container.bind('mouseup.chosen', function(evt) { + _this.container_mouseup(evt); + }); + this.container.bind('mouseenter.chosen', function(evt) { + _this.mouse_enter(evt); + }); + this.container.bind('mouseleave.chosen', function(evt) { + _this.mouse_leave(evt); + }); + this.search_results.bind('mouseup.chosen', function(evt) { + _this.search_results_mouseup(evt); + }); + this.search_results.bind('mouseover.chosen', function(evt) { + _this.search_results_mouseover(evt); + }); + this.search_results.bind('mouseout.chosen', function(evt) { + _this.search_results_mouseout(evt); + }); + this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) { + _this.search_results_mousewheel(evt); + }); + this.search_results.bind('touchstart.chosen', function(evt) { + _this.search_results_touchstart(evt); + }); + this.search_results.bind('touchmove.chosen', function(evt) { + _this.search_results_touchmove(evt); + }); + this.search_results.bind('touchend.chosen', function(evt) { + _this.search_results_touchend(evt); + }); + this.form_field_jq.bind("chosen:updated.chosen", function(evt) { + _this.results_update_field(evt); + }); + this.form_field_jq.bind("chosen:activate.chosen", function(evt) { + _this.activate_field(evt); + }); + this.form_field_jq.bind("chosen:open.chosen", function(evt) { + _this.container_mousedown(evt); + }); + this.form_field_jq.bind("chosen:close.chosen", function(evt) { + _this.input_blur(evt); + }); + this.search_field.bind('blur.chosen', function(evt) { + _this.input_blur(evt); + }); + this.search_field.bind('keyup.chosen', function(evt) { + _this.keyup_checker(evt); + }); + this.search_field.bind('keydown.chosen', function(evt) { + _this.keydown_checker(evt); + }); + this.search_field.bind('focus.chosen', function(evt) { + _this.input_focus(evt); + }); + this.search_field.bind('cut.chosen', function(evt) { + _this.clipboard_event_checker(evt); + }); + this.search_field.bind('paste.chosen', function(evt) { + _this.clipboard_event_checker(evt); + }); + if (this.is_multiple) { + return this.search_choices.bind('click.chosen', function(evt) { + _this.choices_click(evt); + }); + } else { + return this.container.bind('click.chosen', function(evt) { + evt.preventDefault(); + }); + } + }; + + Chosen.prototype.destroy = function() { + $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action); + if (this.search_field[0].tabIndex) { + this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex; + } + this.container.remove(); + this.form_field_jq.removeData('chosen'); + return this.form_field_jq.show(); + }; + + Chosen.prototype.search_field_disabled = function() { + this.is_disabled = this.form_field_jq[0].disabled; + if (this.is_disabled) { + this.container.addClass('chosen-disabled'); + this.search_field[0].disabled = true; + if (!this.is_multiple) { + this.selected_item.unbind("focus.chosen", this.activate_action); + } + return this.close_field(); + } else { + this.container.removeClass('chosen-disabled'); + this.search_field[0].disabled = false; + if (!this.is_multiple) { + return this.selected_item.bind("focus.chosen", this.activate_action); + } + } + }; + + Chosen.prototype.container_mousedown = function(evt) { + if (!this.is_disabled) { + if (evt && evt.type === "mousedown" && !this.results_showing) { + evt.preventDefault(); + } + if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) { + if (!this.active_field) { + if (this.is_multiple) { + this.search_field.val(""); + } + $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action); + this.results_show(); + } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) { + evt.preventDefault(); + this.results_toggle(); + } + return this.activate_field(); + } + } + }; + + Chosen.prototype.container_mouseup = function(evt) { + if (evt.target.nodeName === "ABBR" && !this.is_disabled) { + return this.results_reset(evt); + } + }; + + Chosen.prototype.search_results_mousewheel = function(evt) { + var delta; + if (evt.originalEvent) { + delta = -evt.originalEvent.wheelDelta || evt.originalEvent.detail; + } + if (delta != null) { + evt.preventDefault(); + if (evt.type === 'DOMMouseScroll') { + delta = delta * 40; + } + return this.search_results.scrollTop(delta + this.search_results.scrollTop()); + } + }; + + Chosen.prototype.blur_test = function(evt) { + if (!this.active_field && this.container.hasClass("chosen-container-active")) { + return this.close_field(); + } + }; + + Chosen.prototype.close_field = function() { + $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action); + this.active_field = false; + this.results_hide(); + this.container.removeClass("chosen-container-active"); + this.clear_backstroke(); + this.show_search_field_default(); + return this.search_field_scale(); + }; + + Chosen.prototype.activate_field = function() { + this.container.addClass("chosen-container-active"); + this.active_field = true; + this.search_field.val(this.search_field.val()); + return this.search_field.focus(); + }; + + Chosen.prototype.test_active_click = function(evt) { + var active_container; + active_container = $(evt.target).closest('.chosen-container'); + if (active_container.length && this.container[0] === active_container[0]) { + return this.active_field = true; + } else { + return this.close_field(); + } + }; + + Chosen.prototype.results_build = function() { + this.parsing = true; + this.selected_option_count = null; + this.results_data = SelectParser.select_to_array(this.form_field); + if (this.is_multiple) { + this.search_choices.find("li.search-choice").remove(); + } else if (!this.is_multiple) { + this.single_set_selected_text(); + if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) { + this.search_field[0].readOnly = true; + this.container.addClass("chosen-container-single-nosearch"); + } else { + this.search_field[0].readOnly = false; + this.container.removeClass("chosen-container-single-nosearch"); + } + } + this.update_results_content(this.results_option_build({ + first: true + })); + this.search_field_disabled(); + this.show_search_field_default(); + this.search_field_scale(); + return this.parsing = false; + }; + + Chosen.prototype.result_do_highlight = function(el) { + var high_bottom, high_top, maxHeight, visible_bottom, visible_top; + if (el.length) { + this.result_clear_highlight(); + this.result_highlight = el; + this.result_highlight.addClass("highlighted"); + maxHeight = parseInt(this.search_results.css("maxHeight"), 10); + visible_top = this.search_results.scrollTop(); + visible_bottom = maxHeight + visible_top; + high_top = this.result_highlight.position().top + this.search_results.scrollTop(); + high_bottom = high_top + this.result_highlight.outerHeight(); + if (high_bottom >= visible_bottom) { + return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0); + } else if (high_top < visible_top) { + return this.search_results.scrollTop(high_top); + } + } + }; + + Chosen.prototype.result_clear_highlight = function() { + if (this.result_highlight) { + this.result_highlight.removeClass("highlighted"); + } + return this.result_highlight = null; + }; + + Chosen.prototype.results_show = function() { + if (this.is_multiple && this.max_selected_options <= this.choices_count()) { + this.form_field_jq.trigger("chosen:maxselected", { + chosen: this + }); + return false; + } + this.container.addClass("chosen-with-drop"); + this.results_showing = true; + this.search_field.focus(); + this.search_field.val(this.search_field.val()); + this.winnow_results(); + return this.form_field_jq.trigger("chosen:showing_dropdown", { + chosen: this + }); + }; + + Chosen.prototype.update_results_content = function(content) { + return this.search_results.html(content); + }; + + Chosen.prototype.results_hide = function() { + if (this.results_showing) { + this.result_clear_highlight(); + this.container.removeClass("chosen-with-drop"); + this.form_field_jq.trigger("chosen:hiding_dropdown", { + chosen: this + }); + } + return this.results_showing = false; + }; + + Chosen.prototype.set_tab_index = function(el) { + var ti; + if (this.form_field.tabIndex) { + ti = this.form_field.tabIndex; + this.form_field.tabIndex = -1; + return this.search_field[0].tabIndex = ti; + } + }; + + Chosen.prototype.set_label_behavior = function() { + var _this = this; + this.form_field_label = this.form_field_jq.parents("label"); + if (!this.form_field_label.length && this.form_field.id.length) { + this.form_field_label = $("label[for='" + this.form_field.id + "']"); + } + if (this.form_field_label.length > 0) { + return this.form_field_label.bind('click.chosen', function(evt) { + if (_this.is_multiple) { + return _this.container_mousedown(evt); + } else { + return _this.activate_field(); + } + }); + } + }; + + Chosen.prototype.show_search_field_default = function() { + if (this.is_multiple && this.choices_count() < 1 && !this.active_field) { + this.search_field.val(this.default_text); + return this.search_field.addClass("default"); + } else { + this.search_field.val(""); + return this.search_field.removeClass("default"); + } + }; + + Chosen.prototype.search_results_mouseup = function(evt) { + var target; + target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); + if (target.length) { + this.result_highlight = target; + this.result_select(evt); + return this.search_field.focus(); + } + }; + + Chosen.prototype.search_results_mouseover = function(evt) { + var target; + target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); + if (target) { + return this.result_do_highlight(target); + } + }; + + Chosen.prototype.search_results_mouseout = function(evt) { + if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) { + return this.result_clear_highlight(); + } + }; + + Chosen.prototype.choice_build = function(item) { + var choice, close_link, + _this = this; + choice = $('<li />', { + "class": "search-choice" + }).html("<span>" + item.html + "</span>"); + if (item.disabled) { + choice.addClass('search-choice-disabled'); + } else { + close_link = $('<a />', { + "class": 'search-choice-close', + 'data-option-array-index': item.array_index + }); + close_link.bind('click.chosen', function(evt) { + return _this.choice_destroy_link_click(evt); + }); + choice.append(close_link); + } + return this.search_container.before(choice); + }; + + Chosen.prototype.choice_destroy_link_click = function(evt) { + evt.preventDefault(); + evt.stopPropagation(); + if (!this.is_disabled) { + return this.choice_destroy($(evt.target)); + } + }; + + Chosen.prototype.choice_destroy = function(link) { + if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) { + this.show_search_field_default(); + if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) { + this.results_hide(); + } + link.parents('li').first().remove(); + return this.search_field_scale(); + } + }; + + Chosen.prototype.results_reset = function() { + this.reset_single_select_options(); + this.form_field.options[0].selected = true; + this.single_set_selected_text(); + this.show_search_field_default(); + this.results_reset_cleanup(); + this.form_field_jq.trigger("change"); + if (this.active_field) { + return this.results_hide(); + } + }; + + Chosen.prototype.results_reset_cleanup = function() { + this.current_selectedIndex = this.form_field.selectedIndex; + return this.selected_item.find("abbr").remove(); + }; + + Chosen.prototype.result_select = function(evt) { + var high, item; + if (this.result_highlight) { + high = this.result_highlight; + this.result_clear_highlight(); + if (this.is_multiple && this.max_selected_options <= this.choices_count()) { + this.form_field_jq.trigger("chosen:maxselected", { + chosen: this + }); + return false; + } + if (this.is_multiple) { + high.removeClass("active-result"); + } else { + this.reset_single_select_options(); + } + item = this.results_data[high[0].getAttribute("data-option-array-index")]; + item.selected = true; + this.form_field.options[item.options_index].selected = true; + this.selected_option_count = null; + if (this.is_multiple) { + this.choice_build(item); + } else { + this.single_set_selected_text(item.text); + } + if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) { + this.results_hide(); + } + this.search_field.val(""); + if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) { + this.form_field_jq.trigger("change", { + 'selected': this.form_field.options[item.options_index].value + }); + } + this.current_selectedIndex = this.form_field.selectedIndex; + return this.search_field_scale(); + } + }; + + Chosen.prototype.single_set_selected_text = function(text) { + if (text == null) { + text = this.default_text; + } + if (text === this.default_text) { + this.selected_item.addClass("chosen-default"); + } else { + this.single_deselect_control_build(); + this.selected_item.removeClass("chosen-default"); + } + return this.selected_item.find("span").text(text); + }; + + Chosen.prototype.result_deselect = function(pos) { + var result_data; + result_data = this.results_data[pos]; + if (!this.form_field.options[result_data.options_index].disabled) { + result_data.selected = false; + this.form_field.options[result_data.options_index].selected = false; + this.selected_option_count = null; + this.result_clear_highlight(); + if (this.results_showing) { + this.winnow_results(); + } + this.form_field_jq.trigger("change", { + deselected: this.form_field.options[result_data.options_index].value + }); + this.search_field_scale(); + return true; + } else { + return false; + } + }; + + Chosen.prototype.single_deselect_control_build = function() { + if (!this.allow_single_deselect) { + return; + } + if (!this.selected_item.find("abbr").length) { + this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>"); + } + return this.selected_item.addClass("chosen-single-with-deselect"); + }; + + Chosen.prototype.get_search_text = function() { + if (this.search_field.val() === this.default_text) { + return ""; + } else { + return $('<div/>').text($.trim(this.search_field.val())).html(); + } + }; + + Chosen.prototype.winnow_results_set_highlight = function() { + var do_high, selected_results; + selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : []; + do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first(); + if (do_high != null) { + return this.result_do_highlight(do_high); + } + }; + + Chosen.prototype.no_results = function(terms) { + var no_results_html; + no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>'); + no_results_html.find("span").first().html(terms); + this.search_results.append(no_results_html); + return this.form_field_jq.trigger("chosen:no_results", { + chosen: this + }); + }; + + Chosen.prototype.no_results_clear = function() { + return this.search_results.find(".no-results").remove(); + }; + + Chosen.prototype.keydown_arrow = function() { + var next_sib; + if (this.results_showing && this.result_highlight) { + next_sib = this.result_highlight.nextAll("li.active-result").first(); + if (next_sib) { + return this.result_do_highlight(next_sib); + } + } else { + return this.results_show(); + } + }; + + Chosen.prototype.keyup_arrow = function() { + var prev_sibs; + if (!this.results_showing && !this.is_multiple) { + return this.results_show(); + } else if (this.result_highlight) { + prev_sibs = this.result_highlight.prevAll("li.active-result"); + if (prev_sibs.length) { + return this.result_do_highlight(prev_sibs.first()); + } else { + if (this.choices_count() > 0) { + this.results_hide(); + } + return this.result_clear_highlight(); + } + } + }; + + Chosen.prototype.keydown_backstroke = function() { + var next_available_destroy; + if (this.pending_backstroke) { + this.choice_destroy(this.pending_backstroke.find("a").first()); + return this.clear_backstroke(); + } else { + next_available_destroy = this.search_container.siblings("li.search-choice").last(); + if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) { + this.pending_backstroke = next_available_destroy; + if (this.single_backstroke_delete) { + return this.keydown_backstroke(); + } else { + return this.pending_backstroke.addClass("search-choice-focus"); + } + } + } + }; + + Chosen.prototype.clear_backstroke = function() { + if (this.pending_backstroke) { + this.pending_backstroke.removeClass("search-choice-focus"); + } + return this.pending_backstroke = null; + }; + + Chosen.prototype.keydown_checker = function(evt) { + var stroke, _ref1; + stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode; + this.search_field_scale(); + if (stroke !== 8 && this.pending_backstroke) { + this.clear_backstroke(); + } + switch (stroke) { + case 8: + this.backstroke_length = this.search_field.val().length; + break; + case 9: + if (this.results_showing && !this.is_multiple) { + this.result_select(evt); + } + this.mouse_on_container = false; + break; + case 13: + evt.preventDefault(); + break; + case 38: + evt.preventDefault(); + this.keyup_arrow(); + break; + case 40: + evt.preventDefault(); + this.keydown_arrow(); + break; + } + }; + + Chosen.prototype.search_field_scale = function() { + var div, f_width, h, style, style_block, styles, w, _i, _len; + if (this.is_multiple) { + h = 0; + w = 0; + style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"; + styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing']; + for (_i = 0, _len = styles.length; _i < _len; _i++) { + style = styles[_i]; + style_block += style + ":" + this.search_field.css(style) + ";"; + } + div = $('<div />', { + 'style': style_block + }); + div.text(this.search_field.val()); + $('body').append(div); + w = div.width() + 25; + div.remove(); + f_width = this.container.outerWidth(); + if (w > f_width - 10) { + w = f_width - 10; + } + return this.search_field.css({ + 'width': w + 'px' + }); + } + }; + + return Chosen; + + })(AbstractChosen); + +}).call(this); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/iCheck/icheck.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/iCheck/icheck.min.js new file mode 100644 index 0000000..9b826fb --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/iCheck/icheck.min.js @@ -0,0 +1,11 @@ +/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */ +(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate, + v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true"); + g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap(); + f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i"; + _add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c= + f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this, + b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+= + 'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return; + A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d= + b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/laydate/laydate.js b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/laydate.js new file mode 100644 index 0000000..83a12cb --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/laydate.js @@ -0,0 +1,2 @@ +/*! laydate-v5.0.9 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ + ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,n=t.length-1,a=n;a>0;a--)if("interactive"===t[a].readyState){e=t[a].src;break}return e||t[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.9",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var t=this;return t.config=w.extend({},t.config,e),t},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期<br>建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t<n.length;t++)this.push(n[t])};C.prototype=[],C.prototype.constructor=C,w.extend=function(){var e=1,t=arguments,n=function(e,t){e=e||(t.constructor===Array?[]:{});for(var a in t)e[a]=t[a]&&t[a].constructor===Object?n(e[a],t[a]):t[a];return e};for(t[0]="object"==typeof t[0]?t[0]:{};e<t.length;e++)"object"==typeof t[e]&&n(t[0],t[e]);return t[0]},w.ie=function(){var e=navigator.userAgent.toLowerCase();return!!(window.ActiveXObject||"ActiveXObject"in window)&&((e.match(/msie\s(\d+)/)||[])[1]||"11")}(),w.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},w.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n<e.length&&!t.call(e[n],n,e[n]);n++);return a},w.digit=function(e,t,n){var a="";e=String(e),t=t||2;for(var i=e.length;i<t;i++)a+="0";return e<Math.pow(10,t)?a+(0|e):e},w.elem=function(e,t){var n=document.createElement(e);return w.each(t||{},function(e,t){n.setAttribute(e,t)}),n},C.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),w.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},C.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),w.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},C.prototype.find=function(e){var t=this,n=0,a=[],i="object"==typeof e;return this.each(function(r,o){for(var s=i?[e]:o.querySelectorAll(e||null);n<s.length;n++)a.push(s[n]);t.shift()}),i||(t.selector=(t.selector?t.selector+" ":"")+e),w.each(a,function(e,n){t.push(n)}),t},C.prototype.each=function(e){return w.each.call(this,this,e)},C.prototype.addClass=function(e,t){return this.each(function(n,a){a.className=C[t?"removeStr":"addStr"](a.className,e)})},C.prototype.removeClass=function(e){return this.addClass(e,!0)},C.prototype.hasClass=function(e){var t=!1;return this.each(function(n,a){new RegExp("\\b"+e+"\\b").test(a.className)&&(t=!0)}),t},C.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r<s?o+r*s:r:o);a=[l.getFullYear(),l.getMonth()+1,l.getDate()],r<s||(i=[l.getHours(),l.getMinutes(),l.getSeconds()])}else a=(t[n].match(/\d+-\d+-\d+/)||[""])[0].split("-"),i=(t[n].match(/\d+:\d+:\d+/)||[""])[0].split(":");t[n]={year:0|a[0]||(new Date).getFullYear(),month:a[1]?(0|a[1])-1:(new Date).getMonth(),date:0|a[2]||(new Date).getDate(),hours:0|i[0],minutes:0|i[1],seconds:0|i[2]}}),e.elemID="layui-laydate"+t.elem.attr("lay-key"),(t.show||a)&&e.render(),a||e.events(),t.value&&(t.value.constructor===Date?e.setValue(e.parse(0,e.systemDate(t.value))):e.setValue(t.value)))},T.prototype.render=function(){var e=this,t=e.config,n=e.lang(),a="static"===t.position,i=e.elem=w.elem("div",{id:e.elemID,"class":["layui-laydate",t.range?" layui-laydate-range":"",a?" "+c:"",t.theme&&"default"!==t.theme&&!/^#/.test(t.theme)?" laydate-theme-"+t.theme:""].join("")}),r=e.elemMain=[],o=e.elemHeader=[],s=e.elemCont=[],l=e.table=[],d=e.footer=w.elem("div",{"class":p});if(t.zIndex&&(i.style.zIndex=t.zIndex),w.each(new Array(2),function(e){if(!t.range&&e>0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push('<span lay-type="datetime" class="laydate-btns-time">'+n.timeTips+"</span>"),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push('<span lay-type="'+r+'" class="laydate-btns-'+r+'">'+o+"</span>"))}),e.push('<div class="laydate-footer-btns">'+i.join("")+"</div>"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length<l.length&&(a=!0),/yyyy|y/.test(l)?(c<d[0]&&(c=d[0],a=!0),e.year=c):/MM|M/.test(l)?(c<1&&(c=1,a=!0),e.month=c-1):/dd|d/.test(l)?(c<1&&(c=1,a=!0),e.date=c):/HH|H/.test(l)?(c<1&&(c=0,a=!0),e.hours=c,r.range&&(i[o[n]].hours=c)):/mm|m/.test(l)?(c<1&&(c=0,a=!0),e.minutes=c,r.range&&(i[o[n]].minutes=c)):/ss|s/.test(l)&&(c<1&&(c=0,a=!0),e.seconds=c,r.range&&(i[o[n]].seconds=c))}),c(e)};return"limit"===e?(c(o),i):(l=l||r.value,"string"==typeof l&&(l=l.replace(/\s+/g," ").replace(/^\s|\s$/g,"")),i.startState&&!i.endState&&(delete i.startState,i.endState=!0),"string"==typeof l&&l?i.EXP_IF.test(l)?r.range?(l=l.split(" "+r.range+" "),i.startDate=i.startDate||i.systemDate(),i.endDate=i.endDate||i.systemDate(),r.dateTime=w.extend({},i.startDate),w.each([i.startDate,i.endDate],function(e,t){m(t,l[e],e)})):m(o,l):(i.hint("日期格式不合法<br>必须遵循下述格式:<br>"+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"<br>已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html('<span class="laydate-day-mark">'+n+"</span>"),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.now<l.min||l.now>l.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.year<d[0]&&(l.year=d[0],r.hint("最低只能支持到公元"+d[0]+"年")),l.year>d[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e<t?(c=a-t+e,n.addClass("laydate-day-prev"),d=r.getAsYM(l.year,l.month,"sub")):e>=t&&e<i+t?(c=e-t,s.range||c+1===l.date&&n.addClass(o)):(c=e-i-t,n.addClass("laydate-day-next"),d=r.getAsYM(l.year,l.month)),d[1]++,d[2]=c+1,n.attr("lay-ymd",d.join("-")).html(d[2]),r.mark(n,d).limit(n,{year:d[0],month:d[1]-1,date:d[2]},e)}),w(f[0]).attr("lay-ym",l.year+"-"+(l.month+1)),w(f[1]).attr("lay-ym",l.year+"-"+(l.month+1)),"cn"===s.lang?(w(f[0]).attr("lay-type","year").html(l.year+"年"),w(f[1]).attr("lay-type","month").html(l.month+1+"月")):(w(f[0]).attr("lay-type","month").html(m.month[l.month]),w(f[1]).attr("lay-type","year").html(l.year)),u&&(s.range&&(e?r.endDate=r.endDate||{year:l.year+("year"===s.type?1:0),month:l.month+("month"===s.type?0:-1)}:r.startDate=r.startDate||{year:l.year,month:l.month},e&&(r.listYM=[[r.startDate.year,r.startDate.month+1],[r.endDate.year,r.endDate.month+1]],r.list(s.type,0).list(s.type,1),"time"===s.type?r.setBtnStatus("时间",w.extend({},r.systemDate(),r.startTime),w.extend({},r.systemDate(),r.endTime)):r.setBtnStatus(!0))),s.range||(r.listYM=[[l.year,l.month+1]],r.list(s.type,0))),s.range&&!e){var p=r.getAsYM(l.year,l.month);r.calendar(w.extend({},l,{year:p[0],month:p[1]}))}return s.range||r.limit(w(r.footer).find(g),null,0,["hours","minutes","seconds"]),s.range&&e&&!u&&r.stampRange(),r},T.prototype.list=function(e,t){var n=this,a=n.config,i=a.dateTime,r=n.lang(),l=a.range&&"date"!==a.type&&"datetime"!==a.type,d=w.elem("ul",{"class":m+" "+{year:"laydate-year-list",month:"laydate-month-list",time:"laydate-time-list"}[e]}),c=n.elemHeader[t],u=w(c[2]).find("span"),h=n.elemCont[t||0],y=w(h).find("."+m)[0],f="cn"===a.lang,p=f?"年":"",T=n.listYM[t]||{},C=["hours","minutes","seconds"],x=["startTime","endTime"][t];if(T[0]<1&&(T[0]=1),"year"===e){var M,b=M=T[0]-7;b<1&&(b=M=1),w.each(new Array(15),function(e){var i=w.elem("li",{"lay-ym":M}),r={year:M};M==T[0]&&w(i).addClass(o),i.innerHTML=M+p,d.appendChild(i),M<n.firstDate.year?(r.month=a.min.month,r.date=a.min.date):M>=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]<n.firstDate.year?s.date=a.min.date:T[0]>=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["<p>"+r.time[e]+"</p><ol>"];w.each(new Array(t),function(t){i.push("<li"+(n[x][C[e]]===t?' class="'+o+'"':"")+">"+w.digit(t,2)+"</li>")}),a.innerHTML=i.join("")+"</ol>",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s<t&&w(i).addClass(u)})},T.prototype.done=function(e,t){var n=this,a=n.config,i=w.extend({},n.startDate?w.extend(n.startDate,n.startTime):a.dateTime),r=w.extend({},w.extend(n.endDate,n.endTime));return w.each([i,r],function(e,t){"month"in t&&w.extend(t,{month:t.month+1})}),e=e||[n.parse(),i,r],"function"==typeof a[t||"done"]&&a[t||"done"].apply(a,e),n},T.prototype.choose=function(e){var t=this,n=t.config,a=n.dateTime,i=w(t.elem).find("td"),r=e.attr("lay-ymd").split("-"),l=function(e){new Date;e&&w.extend(a,r),n.range&&(t.startDate?w.extend(t.startDate,r):t.startDate=w.extend({},r,t.startTime),t.startYMD=r)};if(r={year:0|r[0],month:(0|r[1])-1,date:0|r[2]},!e.hasClass(s))if(n.range){if(w.each(["startTime","endTime"],function(e,n){t[n]=t[n]||{hours:0,minutes:0,seconds:0}}),t.endState)l(),delete t.endState,delete t.endDate,t.startState=!0,i.removeClass(o+" "+u),e.addClass(o);else if(t.startState){if(e.addClass(o),t.endDate?w.extend(t.endDate,r):t.endDate=w.extend({},r,t.endTime),t.newDate(r).getTime()<t.newDate(t.startYMD).getTime()){var d=w.extend({},t.endDate,{hours:t.startDate.hours,minutes:t.startDate.minutes,seconds:t.startDate.seconds});w.extend(t.endDate,t.startDate,{hours:t.endDate.hours,minutes:t.endDate.minutes,seconds:t.endDate.seconds}),t.startDate=d}n.showBottom||t.done(),t.stampRange(),t.endState=!0,t.done(null,"change")}else e.addClass(o),l(),t.startState=!0;w(t.footer).find(g)[t.endDate?"removeClass":"addClass"](s)}else"static"===n.position?(l(!0),t.calendar().done().done(null,"change")):"date"===n.type?(l(!0),t.setValue(t.parse()).remove().done()):"datetime"===n.type&&(l(!0),t.calendar().done(null,"change"))},T.prototype.tool=function(e,t){var n=this,a=n.config,i=a.dateTime,r="static"===a.position,o={datetime:function(){w(e).hasClass(s)||(n.list("time",0),a.range&&n.list("time",1),w(e).attr("lay-type","date").html(n.lang().dateTips))},date:function(){n.closeList(),w(e).attr("lay-type","datetime").html(n.lang().timeTips)},clear:function(){n.setValue("").remove(),r&&(w.extend(i,n.firstDate),n.calendar()),a.range&&(delete n.startState,delete n.endState,delete n.endDate,delete n.startTime,delete n.endTime),n.done(["",{},{}])},now:function(){var e=new Date;w.extend(i,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),r&&n.calendar(),n.done()},confirm:function(){if(a.range){if(!n.endDate)return n.hint("请先选择日期范围");if(w(e).hasClass(s))return n.hint("time"===a.type?l.replace(/日期/g,"时间"):l)}else if(w(e).hasClass(s))return n.hint("不在有效日期或时间范围内");n.done(),n.setValue(n.parse()).remove()}};o[t]&&o[t]()},T.prototype.change=function(e){var t=this,n=t.config,a=n.dateTime,i=n.range&&("year"===n.type||"month"===n.type),r=t.elemCont[e||0],o=t.listYM[e],s=function(s){var l=["startDate","endDate"][e],d=w(r).find(".laydate-year-list")[0],c=w(r).find(".laydate-month-list")[0];return d&&(o[0]=s?o[0]-15:o[0]+15,t.list("year",e)),c&&(s?o[0]--:o[0]++,t.list("month",e)),(d||c)&&(w.extend(a,{year:o[0]}),i&&(t[l].year=o[0]),n.range||t.done(null,"change"),t.setBtnStatus(),n.range||t.limit(w(t.footer).find(g),{year:o[0]})),d||c};return{prevYear:function(){s("sub")||(a.year--,t.checkDate("limit").calendar(),n.range||t.done(null,"change"))},prevMonth:function(){var e=t.getAsYM(a.year,a.month,"sub");w.extend(a,{year:e[0],month:e[1]}),t.checkDate("limit").calendar(),n.range||t.done(null,"change")},nextMonth:function(){var e=t.getAsYM(a.year,a.month);w.extend(a,{year:e[0],month:e[1]}),t.checkDate("limit").calendar(),n.range||t.done(null,"change")},nextYear:function(){s()||(a.year++,t.checkDate("limit").calendar(),n.range||t.done(null,"change"))}}},T.prototype.changeEvent=function(){var e=this;e.config;w(e.elem).on("click",function(e){w.stope(e)}),w.each(e.elemHeader,function(t,n){w(n[0]).on("click",function(n){e.change(t).prevYear()}),w(n[1]).on("click",function(n){e.change(t).prevMonth()}),w(n[2]).find("span").on("click",function(n){var a=w(this),i=a.attr("lay-ym"),r=a.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(r,t),w(e.footer).find(D).addClass(s))}),w(n[3]).on("click",function(n){e.change(t).nextMonth()}),w(n[4]).on("click",function(n){e.change(t).nextYear()})}),w.each(e.table,function(t,n){var a=w(n).find("td");a.on("click",function(){e.choose(w(this))})}),w(e.footer).find("span").on("click",function(){var t=w(this).attr("lay-type");e.tool(this,t)})},T.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},T.prototype.events=function(){var e=this,t=e.config,n=function(n,a){n.on(t.trigger,function(){a&&(e.bindElem=this),e.render()})};t.elem[0]&&!t.elem[0].eventHandler&&(n(t.elem,"bind"),n(t.eventElem),w(document).on("click",function(n){n.target!==t.elem[0]&&n.target!==t.eventElem[0]&&n.target!==w(t.closeStop)[0]&&e.remove()}).on("keydown",function(t){13===t.keyCode&&w("#"+e.elemID)[0]&&e.elemID===T.thisElem&&(t.preventDefault(),w(e.footer).find(g)[0].click())}),w(window).on("resize",function(){return!(!e.elem||!w(r)[0])&&void e.position()}),t.elem[0].eventHandler=!0)},n.render=function(e){var t=new T(e);return a.call(t)},n.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},window.lay=window.lay||w,e?(n.ready(),layui.define(function(e){n.path=layui.cache.dir,e(i,n)})):"function"==typeof define&&define.amd?define(function(){return n}):function(){n.ready(),window.laydate=n}()}(); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.eot b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.eot new file mode 100644 index 0000000..c861caa --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.eot Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.svg b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.svg new file mode 100644 index 0000000..1e04218 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.svg @@ -0,0 +1,45 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > +<!-- +2013-9-30: Created. +--> +<svg> +<metadata> +Created by iconfont +</metadata> +<defs> + +<font id="laydate-icon" horiz-adv-x="1024" > + <font-face + font-family="laydate-icon" + font-weight="500" + font-stretch="normal" + units-per-em="1024" + ascent="896" + descent="-128" + /> + <missing-glyph /> + + <glyph glyph-name="x" unicode="x" horiz-adv-x="1001" +d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5 +t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5 +t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" /> + + + + <glyph glyph-name="youyou" unicode="" d="M283.648 721.918976 340.873216 780.926976 740.352 383.997952 340.876288-12.925952 283.648 46.077952 619.52 383.997952Z" horiz-adv-x="1024" /> + + + <glyph glyph-name="zuozuo" unicode="" d="M740.352 721.918976 683.126784 780.926976 283.648 383.997952 683.123712-12.925952 740.352 46.077952 404.48 383.997952Z" horiz-adv-x="1024" /> + + + <glyph glyph-name="xiayiye" unicode="" d="M62.573 384.103l423.401 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.751-18.976-68.727 0l-39.753 39.753 0.269 0.246-385.655 385.661zM451.365 384.103l423.407 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.757-18.977-68.727 0l-39.762 39.754 0.273 0.249-385.662 385.661zM451.365 384.103z" horiz-adv-x="1024" /> + + + <glyph glyph-name="xiayiye1" unicode="" d="M948.066926 382.958838l-411.990051-412.24426c-18.47333-18.47333-48.417689-18.47333-66.875207 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L814.691135 383.088983 467.512212 730.269123c-18.466032 18.458735-18.466032 48.405526 0 66.873991 18.468465 18.464816 48.410391 18.464816 66.872774 0l38.682336-38.682336-0.261507-0.239614 375.259894-375.265975v0.003649m-378.312834 0L157.756743-29.285422c-18.47333-18.47333-48.415256-18.47333-66.872775 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L436.369787 383.088983 89.19208 730.269123c-18.4636 18.458735-18.4636 48.405526 0 66.873991 18.470898 18.464816 48.415256 18.464816 66.872774 0l38.692067-38.682336-0.266372-0.239614 375.267191-375.265975-0.004865 0.003649m0 0z" horiz-adv-x="1024" /> + + + + + </font> +</defs></svg> diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.ttf b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.ttf new file mode 100644 index 0000000..0bd6c4a --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.ttf Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.woff b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.woff new file mode 100644 index 0000000..bfe5599 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.woff Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/laydate.css b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/laydate.css new file mode 100644 index 0000000..c7e1508 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/laydate.css @@ -0,0 +1,2 @@ +/*! laydate-v5.0.9 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/layer.js b/user/guns-admin/src/main/webapp/static/js/plugins/layer/layer.js new file mode 100644 index 0000000..12cb6b5 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/layer.js @@ -0,0 +1,2 @@ +/*! layer-v3.1.1 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */ + ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+(r.fixed?"":";position:absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="layui-layer-move"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+">"+(e.value||"")+"</textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input" value="'+(e.value||"")+'">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'"><div class="layui-layer-imgsee">'+(u.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+"/"+u.length+"</em></span></div></div></div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/layer.js b/user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/layer.js new file mode 100644 index 0000000..f9cf693 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/layer.js @@ -0,0 +1,2 @@ +/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */ + ;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/need/layer.css b/user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/need/layer.css new file mode 100644 index 0000000..b9dbf20 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/need/layer.css @@ -0,0 +1 @@ +.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon-ext.png b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon-ext.png new file mode 100644 index 0000000..bbbb669 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon-ext.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon.png b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon.png new file mode 100644 index 0000000..3e17da8 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon.png Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/layer.css b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/layer.css new file mode 100644 index 0000000..820b4a9 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/layer.css @@ -0,0 +1 @@ +.layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap}html #layuicss-layer{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch;top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;border-radius:2px;box-shadow:1px 1px 50px rgba(0,0,0,.3)}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #B2B2B2;border:1px solid rgba(0,0,0,.1);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-load{background:url(loading-1.gif) center center no-repeat #eee}.layui-layer-ico{background:url(icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;width:100%;height:100%;cursor:move;opacity:0;filter:alpha(opacity=0);background-color:#fff;z-index:2147483647}.layui-layer-resize{position:absolute;width:15px;height:15px;right:0;bottom:0;cursor:se-resize}.layer-anim{-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}@-webkit-keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-00{-webkit-animation-name:layer-bounceIn;animation-name:layer-bounceIn}@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-layer-title{padding:0 80px 0 20px;height:42px;line-height:42px;border-bottom:1px solid #eee;font-size:14px;color:#333;overflow:hidden;background-color:#F8F8F8;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:15px;font-size:0;line-height:initial}.layui-layer-setwin a{position:relative;width:16px;height:16px;margin-left:10px;font-size:12px;_overflow:hidden}.layui-layer-setwin .layui-layer-min cite{position:absolute;width:14px;height:2px;left:0;top:50%;margin-top:-1px;background-color:#2E2D3C;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA}.layui-layer-setwin .layui-layer-max{background-position:-32px -40px}.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px}.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px}.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px}.layui-layer-setwin .layui-layer-close1{background-position:1px -40px;cursor:pointer}.layui-layer-setwin .layui-layer-close1:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;width:30px;height:30px;margin-left:0;background-position:-149px -31px;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{background-position:-180px -31px}.layui-layer-btn{text-align:right;padding:0 15px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:28px;line-height:28px;margin:5px 5px 0;padding:0 15px;border:1px solid #dedede;background-color:#fff;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:#1E9FFF;background-color:#1E9FFF;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:260px}.layui-layer-dialog .layui-layer-content{position:relative;padding:20px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute;top:16px;left:15px;_left:-40px;width:30px;height:30px}.layui-layer-ico1{background-position:-30px 0}.layui-layer-ico2{background-position:-60px 0}.layui-layer-ico3{background-position:-90px 0}.layui-layer-ico4{background-position:-120px 0}.layui-layer-ico5{background-position:-150px 0}.layui-layer-ico6{background-position:-180px 0}.layui-layer-rim{border:6px solid #8D8D8D;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #D3D4D3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-content{padding:12px 25px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:20px 20px 20px 55px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:60px;height:24px;background:url(loading-0.gif) no-repeat}.layui-layer-loading .layui-layer-loading1{width:37px;height:37px;background:url(loading-1.gif) no-repeat}.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:8px 15px;font-size:12px;_float:left;border-radius:2px;box-shadow:1px 1px 3px rgba(0,0,0,.2);background-color:#000;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#000}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:5px;border-bottom-style:solid;border-bottom-color:#000}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan[type=dialog]{min-width:280px}.layui-layer-lan .layui-layer-title{background:#4476A7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:5px 10px 10px;text-align:right;border-top:1px solid #E9E7E7}.layui-layer-lan .layui-layer-btn a{background:#fff;border-color:#E9E7E7;color:#333}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95;border-color:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1}.layui-layer-iconext{background:url(icon-ext.png) no-repeat}.layui-layer-prompt .layui-layer-input{display:block;width:230px;height:36px;margin:0 auto;line-height:30px;padding-left:10px;border:1px solid #e6e6e6;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px;padding:6px 10px}.layui-layer-prompt .layui-layer-content{padding:20px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;overflow:hidden;cursor:pointer}.layui-layer-tab .layui-layer-title span.layui-this{height:43px;border-left:1px solid #eee;border-right:1px solid #eee;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.layui-this{display:block}.layui-layer-photos{-webkit-animation-duration:.8s;animation-duration:.8s}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal}@-webkit-keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:layer-bounceOut;animation-name:layer-bounceOut;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-0.gif b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-0.gif new file mode 100644 index 0000000..6f3c953 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-0.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-1.gif b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-1.gif new file mode 100644 index 0000000..db3a483 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-1.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-2.gif b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-2.gif new file mode 100644 index 0000000..5bb90fd --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-2.gif Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/metisMenu/jquery.metisMenu.js b/user/guns-admin/src/main/webapp/static/js/plugins/metisMenu/jquery.metisMenu.js new file mode 100644 index 0000000..a04cdb0 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/metisMenu/jquery.metisMenu.js @@ -0,0 +1,120 @@ +/* + * metismenu - v1.1.3 + * Easy menu jQuery plugin for Twitter Bootstrap 3 + * https://github.com/onokumus/metisMenu + * + * Made by Osman Nuri Okumus + * Under MIT License + */ +;(function($, window, document, undefined) { + + var pluginName = "metisMenu", + defaults = { + toggle: true, + doubleTapToGo: false + }; + + function Plugin(element, options) { + this.element = $(element); + this.settings = $.extend({}, defaults, options); + this._defaults = defaults; + this._name = pluginName; + this.init(); + } + + Plugin.prototype = { + init: function() { + + var $this = this.element, + $toggle = this.settings.toggle, + obj = this; + + if (this.isIE() <= 9) { + $this.find("li.active").has("ul").children("ul").collapse("show"); + $this.find("li").not(".active").has("ul").children("ul").collapse("hide"); + } else { + $this.find("li.active").has("ul").children("ul").addClass("collapse in"); + $this.find("li").not(".active").has("ul").children("ul").addClass("collapse"); + } + + //add the "doubleTapToGo" class to active items if needed + if (obj.settings.doubleTapToGo) { + $this.find("li.active").has("ul").children("a").addClass("doubleTapToGo"); + } + + $this.find("li").has("ul").children("a").on("click" + "." + pluginName, function(e) { + e.preventDefault(); + + //Do we need to enable the double tap + if (obj.settings.doubleTapToGo) { + + //if we hit a second time on the link and the href is valid, navigate to that url + if (obj.doubleTapToGo($(this)) && $(this).attr("href") !== "#" && $(this).attr("href") !== "") { + e.stopPropagation(); + document.location = $(this).attr("href"); + return; + } + } + + $(this).parent("li").toggleClass("active").children("ul").collapse("toggle"); + + if ($toggle) { + $(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide"); + } + + }); + }, + + isIE: function() { //https://gist.github.com/padolsey/527683 + var undef, + v = 3, + div = document.createElement("div"), + all = div.getElementsByTagName("i"); + + while ( + div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->", + all[0] + ) { + return v > 4 ? v : undef; + } + }, + + //Enable the link on the second click. + doubleTapToGo: function(elem) { + var $this = this.element; + + //if the class "doubleTapToGo" exists, remove it and return + if (elem.hasClass("doubleTapToGo")) { + elem.removeClass("doubleTapToGo"); + return true; + } + + //does not exists, add a new class and return false + if (elem.parent().children("ul").length) { + //first remove all other class + $this.find(".doubleTapToGo").removeClass("doubleTapToGo"); + //add the class on the current element + elem.addClass("doubleTapToGo"); + return false; + } + }, + + remove: function() { + this.element.off("." + pluginName); + this.element.removeData(pluginName); + } + + }; + + $.fn[pluginName] = function(options) { + this.each(function () { + var el = $(this); + if (el.data(pluginName)) { + el.data(pluginName).remove(); + } + el.data(pluginName, new Plugin(this, options)); + }); + return this; + }; + +})(jQuery, window, document); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/pace/pace.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/pace/pace.min.js new file mode 100644 index 0000000..134dcac --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/pace/pace.min.js @@ -0,0 +1,2 @@ +/*! pace 0.5.1 */ +(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W=[].slice,X={}.hasOwnProperty,Y=function(a,b){function c(){this.constructor=a}for(var d in b)X.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},Z=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};for(t={catchupTime:500,initialRate:.03,minTime:500,ghostTime:500,maxProgressPerFrame:10,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:!0,ignoreURLs:[]}},B=function(){var a;return null!=(a="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?a:+new Date},D=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,s=window.cancelAnimationFrame||window.mozCancelAnimationFrame,null==D&&(D=function(a){return setTimeout(a,50)},s=function(a){return clearTimeout(a)}),F=function(a){var b,c;return b=B(),(c=function(){var d;return d=B()-b,d>=33?(b=B(),a(d,function(){return D(c)})):setTimeout(c,33-d)})()},E=function(){var a,b,c;return c=arguments[0],b=arguments[1],a=3<=arguments.length?W.call(arguments,2):[],"function"==typeof c[b]?c[b].apply(c,a):c[b]},u=function(){var a,b,c,d,e,f,g;for(b=arguments[0],d=2<=arguments.length?W.call(arguments,1):[],f=0,g=d.length;g>f;f++)if(c=d[f])for(a in c)X.call(c,a)&&(e=c[a],null!=b[a]&&"object"==typeof b[a]&&null!=e&&"object"==typeof e?u(b[a],e):b[a]=e);return b},p=function(a){var b,c,d,e,f;for(c=b=0,e=0,f=a.length;f>e;e++)d=a[e],c+=Math.abs(d),b++;return c/b},w=function(a,b){var c,d,e;if(null==a&&(a="options"),null==b&&(b=!0),e=document.querySelector("[data-pace-"+a+"]")){if(c=e.getAttribute("data-pace-"+a),!b)return c;try{return JSON.parse(c)}catch(f){return d=f,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",d):void 0}}},g=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];c<this.bindings[a].length;)this.bindings[a][c].handler===b?e.push(this.bindings[a].splice(c,1)):e.push(c++);return e}},a.prototype.trigger=function(){var a,b,c,d,e,f,g,h,i;if(c=arguments[0],a=2<=arguments.length?W.call(arguments,1):[],null!=(g=this.bindings)?g[c]:void 0){for(e=0,i=[];e<this.bindings[c].length;)h=this.bindings[c][e],d=h.handler,b=h.ctx,f=h.once,d.apply(null!=b?b:this,a),f?i.push(this.bindings[c].splice(e,1)):i.push(e++);return i}},a}(),null==window.Pace&&(window.Pace={}),u(Pace,g.prototype),C=Pace.options=u({},t,window.paceOptions,w()),T=["ajax","document","eventLag","elements"],P=0,R=T.length;R>P;P++)J=T[P],C[J]===!0&&(C[J]=t[J]);i=function(a){function b(){return U=b.__super__.constructor.apply(this,arguments)}return Y(b,a),b}(Error),b=function(){function a(){this.progress=0}return a.prototype.getElement=function(){var a;if(null==this.el){if(a=document.querySelector(C.target),!a)throw new i;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace(/pace-done/g,""),document.body.className+=" pace-running",this.el.innerHTML='<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>',null!=a.firstChild?a.insertBefore(this.el,a.firstChild):a.appendChild(this.el)}return this.el},a.prototype.finish=function(){var a;return a=this.getElement(),a.className=a.className.replace("pace-active",""),a.className+=" pace-inactive",document.body.className=document.body.className.replace("pace-running",""),document.body.className+=" pace-done"},a.prototype.update=function(a){return this.progress=a,this.render()},a.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(a){i=a}return this.el=void 0},a.prototype.render=function(){var a,b;return null==document.querySelector(C.target)?!1:(a=this.getElement(),a.children[0].style.width=""+this.progress+"%",(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(a.children[0].setAttribute("data-progress-text",""+(0|this.progress)+"%"),this.progress>=100?b="99":(b=this.progress<10?"0":"",b+=0|this.progress),a.children[0].setAttribute("data-progress",""+b)),this.lastRenderedProgress=this.progress)},a.prototype.done=function(){return this.progress>=100},a}(),h=function(){function a(){this.bindings={}}return a.prototype.trigger=function(a,b){var c,d,e,f,g;if(null!=this.bindings[a]){for(f=this.bindings[a],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.call(this,b));return g}},a.prototype.on=function(a,b){var c;return null==(c=this.bindings)[a]&&(c[a]=[]),this.bindings[a].push(b)},a}(),O=window.XMLHttpRequest,N=window.XDomainRequest,M=window.WebSocket,v=function(a,b){var c,d,e,f;f=[];for(d in b.prototype)try{e=b.prototype[d],null==a[d]&&"function"!=typeof e?f.push(a[d]=e):f.push(void 0)}catch(g){c=g}return f},z=[],Pace.ignore=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?W.call(arguments,1):[],z.unshift("ignore"),c=b.apply(null,a),z.shift(),c},Pace.track=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?W.call(arguments,1):[],z.unshift("track"),c=b.apply(null,a),z.shift(),c},I=function(a){var b;if(null==a&&(a="GET"),"track"===z[0])return"force";if(!z.length&&C.ajax){if("socket"===a&&C.ajax.trackWebSockets)return!0;if(b=a.toUpperCase(),Z.call(C.ajax.trackMethods,b)>=0)return!0}return!1},j=function(a){function b(){var a,c=this;b.__super__.constructor.apply(this,arguments),a=function(a){var b;return b=a.open,a.open=function(d,e){return I(d)&&c.trigger("request",{type:d,url:e,request:a}),b.apply(a,arguments)}},window.XMLHttpRequest=function(b){var c;return c=new O(b),a(c),c},v(window.XMLHttpRequest,O),null!=N&&(window.XDomainRequest=function(){var b;return b=new N,a(b),b},v(window.XDomainRequest,N)),null!=M&&C.ajax.trackWebSockets&&(window.WebSocket=function(a,b){var d;return d=null!=b?new M(a,b):new M(a),I("socket")&&c.trigger("request",{type:"socket",url:a,protocols:b,request:d}),d},v(window.WebSocket,M))}return Y(b,a),b}(h),Q=null,x=function(){return null==Q&&(Q=new j),Q},H=function(a){var b,c,d,e;for(e=C.ajax.ignoreURLs,c=0,d=e.length;d>c;c++)if(b=e[c],"string"==typeof b){if(-1!==a.indexOf(b))return!0}else if(b.test(a))return!0;return!1},x().on("request",function(b){var c,d,e,f,g;return f=b.type,e=b.request,g=b.url,H(g)?void 0:Pace.running||C.restartOnRequestAfter===!1&&"force"!==I(f)?void 0:(d=arguments,c=C.restartOnRequestAfter||0,"boolean"==typeof c&&(c=0),setTimeout(function(){var b,c,g,h,i,j;if(b="socket"===f?e.readyState<2:0<(h=e.readyState)&&4>h){for(Pace.restart(),i=Pace.sources,j=[],c=0,g=i.length;g>c;c++){if(J=i[c],J instanceof a){J.watch.apply(J,d);break}j.push(void 0)}return j}},c))}),a=function(){function a(){var a=this;this.elements=[],x().on("request",function(){return a.watch.apply(a,arguments)})}return a.prototype.watch=function(a){var b,c,d,e;return d=a.type,b=a.request,e=a.url,H(e)?void 0:(c="socket"===d?new m(b):new n(b),this.elements.push(c))},a}(),n=function(){function a(a){var b,c,d,e,f,g,h=this;if(this.progress=0,null!=window.ProgressEvent)for(c=null,a.addEventListener("progress",function(a){return h.progress=a.lengthComputable?100*a.loaded/a.total:h.progress+(100-h.progress)/2}),g=["load","abort","timeout","error"],d=0,e=g.length;e>d;d++)b=g[d],a.addEventListener(b,function(){return h.progress=100});else f=a.onreadystatechange,a.onreadystatechange=function(){var b;return 0===(b=a.readyState)||4===b?h.progress=100:3===a.readyState&&(h.progress=50),"function"==typeof f?f.apply(null,arguments):void 0}}return a}(),m=function(){function a(a){var b,c,d,e,f=this;for(this.progress=0,e=["error","open"],c=0,d=e.length;d>c;c++)b=e[c],a.addEventListener(b,function(){return f.progress=100})}return a}(),d=function(){function a(a){var b,c,d,f;for(null==a&&(a={}),this.elements=[],null==a.selectors&&(a.selectors=[]),f=a.selectors,c=0,d=f.length;d>c;c++)b=f[c],this.elements.push(new e(b))}return a}(),e=function(){function a(a){this.selector=a,this.progress=0,this.check()}return a.prototype.check=function(){var a=this;return document.querySelector(this.selector)?this.done():setTimeout(function(){return a.check()},C.elements.checkInterval)},a.prototype.done=function(){return this.progress=100},a}(),c=function(){function a(){var a,b,c=this;this.progress=null!=(b=this.states[document.readyState])?b:100,a=document.onreadystatechange,document.onreadystatechange=function(){return null!=c.states[document.readyState]&&(c.progress=c.states[document.readyState]),"function"==typeof a?a.apply(null,arguments):void 0}}return a.prototype.states={loading:0,interactive:50,complete:100},a}(),f=function(){function a(){var a,b,c,d,e,f=this;this.progress=0,a=0,e=[],d=0,c=B(),b=setInterval(function(){var g;return g=B()-c-50,c=B(),e.push(g),e.length>C.eventLag.sampleCount&&e.shift(),a=p(e),++d>=C.eventLag.minSamples&&a<C.eventLag.lagThreshold?(f.progress=100,clearInterval(b)):f.progress=100*(3/(a+3))},50)}return a}(),l=function(){function a(a){this.source=a,this.last=this.sinceLastUpdate=0,this.rate=C.initialRate,this.catchup=0,this.progress=this.lastProgress=0,null!=this.source&&(this.progress=E(this.source,"progress"))}return a.prototype.tick=function(a,b){var c;return null==b&&(b=E(this.source,"progress")),b>=100&&(this.done=!0),b===this.last?this.sinceLastUpdate+=a:(this.sinceLastUpdate&&(this.rate=(b-this.last)/this.sinceLastUpdate),this.catchup=(b-this.progress)/C.catchupTime,this.sinceLastUpdate=0,this.last=b),b>this.progress&&(this.progress+=this.catchup*a),c=1-Math.pow(this.progress/100,C.easeFactor),this.progress+=c*this.rate*a,this.progress=Math.min(this.lastProgress+C.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},a}(),K=null,G=null,q=null,L=null,o=null,r=null,Pace.running=!1,y=function(){return C.restartOnPushState?Pace.restart():void 0},null!=window.history.pushState&&(S=window.history.pushState,window.history.pushState=function(){return y(),S.apply(window.history,arguments)}),null!=window.history.replaceState&&(V=window.history.replaceState,window.history.replaceState=function(){return y(),V.apply(window.history,arguments)}),k={ajax:a,elements:d,document:c,eventLag:f},(A=function(){var a,c,d,e,f,g,h,i;for(Pace.sources=K=[],g=["ajax","elements","document","eventLag"],c=0,e=g.length;e>c;c++)a=g[c],C[a]!==!1&&K.push(new k[a](C[a]));for(i=null!=(h=C.extraSources)?h:[],d=0,f=i.length;f>d;d++)J=i[d],K.push(new J(C));return Pace.bar=q=new b,G=[],L=new l})(),Pace.stop=function(){return Pace.trigger("stop"),Pace.running=!1,q.destroy(),r=!0,null!=o&&("function"==typeof s&&s(o),o=null),A()},Pace.restart=function(){return Pace.trigger("restart"),Pace.stop(),Pace.start()},Pace.go=function(){var a;return Pace.running=!0,q.render(),a=B(),r=!1,o=F(function(b,c){var d,e,f,g,h,i,j,k,m,n,o,p,s,t,u,v;for(k=100-q.progress,e=o=0,f=!0,i=p=0,t=K.length;t>p;i=++p)for(J=K[i],n=null!=G[i]?G[i]:G[i]=[],h=null!=(v=J.elements)?v:[J],j=s=0,u=h.length;u>s;j=++s)g=h[j],m=null!=n[j]?n[j]:n[j]=new l(g),f&=m.done,m.done||(e++,o+=m.tick(b));return d=o/e,q.update(L.tick(b,d)),q.done()||f||r?(q.update(100),Pace.trigger("done"),setTimeout(function(){return q.finish(),Pace.running=!1,Pace.trigger("hide")},Math.max(C.ghostTime,Math.max(C.minTime-(B()-a),0)))):c()})},Pace.start=function(a){u(C,a),Pace.running=!0;try{q.render()}catch(b){i=b}return document.querySelector(".pace")?(Pace.trigger("start"),Pace.go()):setTimeout(Pace.start,50)},"function"==typeof define&&define.amd?define(function(){return Pace}):"object"==typeof exports?module.exports=Pace:C.startOnPageLoad&&Pace.start()}).call(this); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/slimscroll/jquery.slimscroll.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/slimscroll/jquery.slimscroll.min.js new file mode 100644 index 0000000..97f60c5 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/slimscroll/jquery.slimscroll.min.js @@ -0,0 +1,15 @@ +/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * + * Version: 1.3.0 + * + */ +(function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"4px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d|| +window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,h){k=!1;var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0<d?Math.ceil(e):Math.floor(e),c.css({top:e+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight()); +e=l*(b[0].scrollHeight-b.outerHeight());h&&(e=d,d=e/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),g),c.css({top:d+"px"}));b.scrollTop(e);b.trigger("slimscrolling",~~e);v();p()}function C(){window.addEventListener?(this.addEventListener("DOMMouseScroll",r,!1),this.addEventListener("mousewheel",r,!1),this.addEventListener("MozMousePixelScroll",r,!1)):document.attachEvent("onmousewheel",r)}function w(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),D);c.css({height:u+"px"}); +var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function v(){w();clearTimeout(A);l==~~l?(k=a.allowPageScroll,B!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;B=l;u>=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&s||(x||y)||(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var s,x,y,A,z,u,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(), +c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);w();if(f.isPlainObject(h)){if("height"in h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in h)n=parseInt(a.scrollTo);else if("scrollBy"in h)n+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;n=f("<div></div>").addClass(a.wrapperClass).css({position:"relative",width:a.width,height:a.height});b.css({width:a.width,height:a.height});var g=f("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible? +"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};g.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(g);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)}); +b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});g.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){s=!0;v();p()},function(){s=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&& +(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/validate/additional-methods.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/validate/additional-methods.min.js new file mode 100644 index 0000000..2d8735b --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/validate/additional-methods.min.js @@ -0,0 +1,4 @@ +/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014 + * http://jqueryvalidation.org/ + * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */ +!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):a(jQuery)}(function(a){!function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(b,c,d){var e,f,g="string"==typeof d?d.replace(/\s/g,"").replace(/,/g,"|"):"image/*",h=this.optional(c);if(h)return h;if("file"===a(c).attr("type")&&(g=g.replace(/\*/g,".*"),c.files&&c.files.length))for(e=0;e<c.files.length;e++)if(f=c.files[e],!f.type.match(new RegExp(".?("+g+")$","i")))return!1;return!0},a.validator.format("Please enter a value with a valid mimetype.")),a.validator.addMethod("alphanumeric",function(a,b){return this.optional(b)||/^\w+$/i.test(a)},"Letters, numbers, and underscores only please"),a.validator.addMethod("bankaccountNL",function(a,b){if(this.optional(b))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(a))return!1;var c,d,e,f=a.replace(/ /g,""),g=0,h=f.length;for(c=0;h>c;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number"),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number"),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a)},"Please specify a valid BIC code"),a.validator.addMethod("cifES",function(a){"use strict";var b,c,d,e,f,g,h=[];if(a=a.toUpperCase(),!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)"))return!1;for(d=0;9>d;d++)h[d]=parseInt(a.charAt(d),10);for(c=h[2]+h[4]+h[6],e=1;8>e;e+=2)f=(2*h[e]).toString(),g=f.charAt(1),c+=parseInt(f.charAt(0),10)+(""===g?0:parseInt(g,10));return/^[ABCDEFGHJNPQRSUVW]{1}/.test(a)?(c+="",b=10-parseInt(c.charAt(c.length-1),10),a+=b,h[8].toString()===String.fromCharCode(64+b)||h[8].toString()===a.charAt(a.length-1)):!1},"Please specify a valid CIF number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&/^(5[12345])/.test(a)?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:128&d?!0:!1},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=e?!0:c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},"Please enter a correct date"),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(f,e-1,d,12,0,0,0),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d?!0:!1):h=!1,this.optional(b)||h},"Please enter a correct date"),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},"Please enter a correct date"),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp(".("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="";if(!/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(l))return!1;if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j<d.length;j++)e=d.charAt(j),"0"!==e&&(n=!1),n||(m+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(e));for(k=0;k<m.length;k++)f=m.charAt(k),p=""+o+f,o=p%97;return 1===o},"Please specify a valid IBAN"),a.validator.addMethod("integer",function(a,b){return this.optional(b)||/^-?\d+$/.test(a)},"A positive or negative non-decimal number please"),a.validator.addMethod("ipv4",function(a,b){return this.optional(b)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(a)},"Please enter a valid IP v4 address."),a.validator.addMethod("ipv6",function(a,b){return this.optional(b)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(a)},"Please enter a valid IP v6 address."),a.validator.addMethod("lettersonly",function(a,b){return this.optional(b)||/^[a-z]+$/i.test(a)},"Letters only please"),a.validator.addMethod("letterswithbasicpunc",function(a,b){return this.optional(b)||/^[a-z\-.,()'"\s]+$/i.test(a)},"Letters or punctuation only please"),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number"),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("nieES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[T]{1}/.test(a)?a[8]===/^[T]{1}[A-Z0-9]{8}$/.test(a):/^[XYZ]{1}/.test(a)?a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.replace("X","0").replace("Y","1").replace("Z","2").substring(0,8)%23):!1:!1},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):/^[KLM]{1}/.test(a)?a[8]===String.fromCharCode(64):!1:!1},"Please specify a valid NIF number."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return this.optional(b)?!0:("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),jQuery.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=e||"undefined"==typeof c.caseSensitive?!1:c.caseSensitive,g=e||"undefined"==typeof c.includeTerritories?!1:c.includeTerritories,h=e||"undefined"==typeof c.includeMilitary?!1:c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;17>b;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c<h.length;c++)if(d.toUpperCase()===h[c]){d=i[c],d*=e,isNaN(g)&&8===c&&(g=h[c]);break}}else d*=e;k+=d}return f=k%11,10===f&&(f="X"),f===g?!0:!1},"The specified vehicle identification number (VIN) is invalid."),a.validator.addMethod("zipcodeUS",function(a,b){return this.optional(b)||/^\d{5}(-\d{4})?$/.test(a)},"The specified US ZIP Code is invalid"),a.validator.addMethod("ziprange",function(a,b){return this.optional(b)||/^90[2-5]\d\{2\}-\d{4}$/.test(a)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx")}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/validate/bootstrapValidator.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/validate/bootstrapValidator.min.js new file mode 100644 index 0000000..06282df --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/validate/bootstrapValidator.min.js @@ -0,0 +1,14 @@ +/*! + * BootstrapValidator (http://bootstrapvalidator.com) + * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3 + * + * @version v0.5.3, built on 2014-11-05 9:14:18 PM + * @author https://twitter.com/nghuuphuoc + * @copyright (c) 2013 - 2014 Nguyen Huu Phuoc + * @license Commercial: http://bootstrapvalidator.com/license/ + * Non-commercial: http://creativecommons.org/licenses/by-nc-nd/3.0/ + */ +if("undefined"==typeof jQuery)throw new Error("BootstrapValidator requires jQuery");!function(a){var b=a.fn.jquery.split(" ")[0].split(".");if(+b[0]<2&&+b[1]<9||1===+b[0]&&9===+b[1]&&+b[2]<1)throw new Error("BootstrapValidator requires jQuery version 1.9.1 or higher")}(window.jQuery),function(a){var b=function(b,c){this.$form=a(b),this.options=a.extend({},a.fn.bootstrapValidator.DEFAULT_OPTIONS,c),this.$invalidFields=a([]),this.$submitButton=null,this.$hiddenButton=null,this.STATUS_NOT_VALIDATED="NOT_VALIDATED",this.STATUS_VALIDATING="VALIDATING",this.STATUS_INVALID="INVALID",this.STATUS_VALID="VALID";var d=function(){for(var a=3,b=document.createElement("div"),c=b.all||[];b.innerHTML="<!--[if gt IE "+ ++a+"]><br><![endif]-->",c[0];);return a>4?a:!a}(),e=document.createElement("div");this._changeEvent=9!==d&&"oninput"in e?"input":"keyup",this._submitIfValid=null,this._cacheFields={},this._init()};b.prototype={constructor:b,_init:function(){var b=this,c={autoFocus:this.$form.attr("data-bv-autofocus"),container:this.$form.attr("data-bv-container"),events:{formInit:this.$form.attr("data-bv-events-form-init"),formError:this.$form.attr("data-bv-events-form-error"),formSuccess:this.$form.attr("data-bv-events-form-success"),fieldAdded:this.$form.attr("data-bv-events-field-added"),fieldRemoved:this.$form.attr("data-bv-events-field-removed"),fieldInit:this.$form.attr("data-bv-events-field-init"),fieldError:this.$form.attr("data-bv-events-field-error"),fieldSuccess:this.$form.attr("data-bv-events-field-success"),fieldStatus:this.$form.attr("data-bv-events-field-status"),validatorError:this.$form.attr("data-bv-events-validator-error"),validatorSuccess:this.$form.attr("data-bv-events-validator-success")},excluded:this.$form.attr("data-bv-excluded"),feedbackIcons:{valid:this.$form.attr("data-bv-feedbackicons-valid"),invalid:this.$form.attr("data-bv-feedbackicons-invalid"),validating:this.$form.attr("data-bv-feedbackicons-validating")},group:this.$form.attr("data-bv-group"),live:this.$form.attr("data-bv-live"),message:this.$form.attr("data-bv-message"),onError:this.$form.attr("data-bv-onerror"),onSuccess:this.$form.attr("data-bv-onsuccess"),submitButtons:this.$form.attr("data-bv-submitbuttons"),threshold:this.$form.attr("data-bv-threshold"),trigger:this.$form.attr("data-bv-trigger"),verbose:this.$form.attr("data-bv-verbose"),fields:{}};this.$form.attr("novalidate","novalidate").addClass(this.options.elementClass).on("submit.bv",function(a){a.preventDefault(),b.validate()}).on("click.bv",this.options.submitButtons,function(){b.$submitButton=a(this),b._submitIfValid=!0}).find("[name], [data-bv-field]").each(function(){var d=a(this),e=d.attr("name")||d.attr("data-bv-field"),f=b._parseOptions(d);f&&(d.attr("data-bv-field",e),c.fields[e]=a.extend({},f,c.fields[e]))}),this.options=a.extend(!0,this.options,c),this.$hiddenButton=a("<button/>").attr("type","submit").prependTo(this.$form).addClass("bv-hidden-submit").css({display:"none",width:0,height:0}),this.$form.on("click.bv",'[type="submit"]',function(c){if(!c.isDefaultPrevented()){var d=a(c.target),e=d.is('[type="submit"]')?d.eq(0):d.parent('[type="submit"]').eq(0);!b.options.submitButtons||e.is(b.options.submitButtons)||e.is(b.$hiddenButton)||b.$form.off("submit.bv").submit()}});for(var d in this.options.fields)this._initField(d);this.$form.trigger(a.Event(this.options.events.formInit),{bv:this,options:this.options}),this.options.onSuccess&&this.$form.on(this.options.events.formSuccess,function(c){a.fn.bootstrapValidator.helpers.call(b.options.onSuccess,[c])}),this.options.onError&&this.$form.on(this.options.events.formError,function(c){a.fn.bootstrapValidator.helpers.call(b.options.onError,[c])})},_parseOptions:function(b){var c,d,e,f,g,h,i,j,k,l=b.attr("name")||b.attr("data-bv-field"),m={};for(d in a.fn.bootstrapValidator.validators)if(c=a.fn.bootstrapValidator.validators[d],e="data-bv-"+d.toLowerCase(),f=b.attr(e)+"",k="function"==typeof c.enableByHtml5?c.enableByHtml5(b):null,k&&"false"!==f||k!==!0&&(""===f||"true"===f||e===f.toLowerCase())){c.html5Attributes=a.extend({},{message:"message",onerror:"onError",onsuccess:"onSuccess"},c.html5Attributes),m[d]=a.extend({},k===!0?{}:k,m[d]);for(j in c.html5Attributes)g=c.html5Attributes[j],h="data-bv-"+d.toLowerCase()+"-"+j,i=b.attr(h),i&&("true"===i||h===i.toLowerCase()?i=!0:"false"===i&&(i=!1),m[d][g]=i)}var n={autoFocus:b.attr("data-bv-autofocus"),container:b.attr("data-bv-container"),excluded:b.attr("data-bv-excluded"),feedbackIcons:b.attr("data-bv-feedbackicons"),group:b.attr("data-bv-group"),message:b.attr("data-bv-message"),onError:b.attr("data-bv-onerror"),onStatus:b.attr("data-bv-onstatus"),onSuccess:b.attr("data-bv-onsuccess"),selector:b.attr("data-bv-selector"),threshold:b.attr("data-bv-threshold"),trigger:b.attr("data-bv-trigger"),verbose:b.attr("data-bv-verbose"),validators:m},o=a.isEmptyObject(n),p=a.isEmptyObject(m);return!p||!o&&this.options.fields&&this.options.fields[l]?(n.validators=m,n):null},_initField:function(b){var c=a([]);switch(typeof b){case"object":c=b,b=b.attr("data-bv-field");break;case"string":c=this.getFieldElements(b),c.attr("data-bv-field",b)}if(0!==c.length&&null!==this.options.fields[b]&&null!==this.options.fields[b].validators){var d;for(d in this.options.fields[b].validators)a.fn.bootstrapValidator.validators[d]||delete this.options.fields[b].validators[d];null===this.options.fields[b].enabled&&(this.options.fields[b].enabled=!0);for(var e=this,f=c.length,g=c.attr("type"),h=1===f||"radio"===g||"checkbox"===g,i="radio"===g||"checkbox"===g||"file"===g||"SELECT"===c.eq(0).get(0).tagName?"change":this._changeEvent,j=(this.options.fields[b].trigger||this.options.trigger||i).split(" "),k=a.map(j,function(a){return a+".update.bv"}).join(" "),l=0;f>l;l++){var m=c.eq(l),n=this.options.fields[b].group||this.options.group,o=m.parents(n),p="function"==typeof(this.options.fields[b].container||this.options.container)?(this.options.fields[b].container||this.options.container).call(this,m,this):this.options.fields[b].container||this.options.container,q=p&&"tooltip"!==p&&"popover"!==p?a(p):this._getMessageContainer(m,n);p&&"tooltip"!==p&&"popover"!==p&&q.addClass("has-error"),q.find('.help-block[data-bv-validator][data-bv-for="'+b+'"]').remove(),o.find('i[data-bv-icon-for="'+b+'"]').remove(),m.off(k).on(k,function(){e.updateStatus(a(this),e.STATUS_NOT_VALIDATED)}),m.data("bv.messages",q);for(d in this.options.fields[b].validators)m.data("bv.result."+d,this.STATUS_NOT_VALIDATED),h&&l!==f-1||a("<small/>").css("display","none").addClass("help-block").attr("data-bv-validator",d).attr("data-bv-for",b).attr("data-bv-result",this.STATUS_NOT_VALIDATED).html(this._getMessage(b,d)).appendTo(q),"function"==typeof a.fn.bootstrapValidator.validators[d].init&&a.fn.bootstrapValidator.validators[d].init(this,m,this.options.fields[b].validators[d]);if(this.options.fields[b].feedbackIcons!==!1&&"false"!==this.options.fields[b].feedbackIcons&&this.options.feedbackIcons&&this.options.feedbackIcons.validating&&this.options.feedbackIcons.invalid&&this.options.feedbackIcons.valid&&(!h||l===f-1)){o.addClass("has-feedback");var r=a("<i/>").css("display","none").addClass("form-control-feedback").attr("data-bv-icon-for",b).insertAfter(m);if("checkbox"===g||"radio"===g){var s=m.parent();s.hasClass(g)?r.insertAfter(s):s.parent().hasClass(g)&&r.insertAfter(s.parent())}0===o.find("label").length&&r.addClass("bv-no-label"),0!==o.find(".input-group").length&&r.addClass("bv-icon-input-group").insertAfter(o.find(".input-group").eq(0)),h?l===f-1&&c.data("bv.icon",r):m.data("bv.icon",r),p&&m.off("focus.container.bv").on("focus.container.bv",function(){switch(p){case"tooltip":a(this).data("bv.icon").tooltip("show");break;case"popover":a(this).data("bv.icon").popover("show")}}).off("blur.container.bv").on("blur.container.bv",function(){switch(p){case"tooltip":a(this).data("bv.icon").tooltip("hide");break;case"popover":a(this).data("bv.icon").popover("hide")}})}}switch(c.on(this.options.events.fieldSuccess,function(b,c){var d=e.getOptions(c.field,null,"onSuccess");d&&a.fn.bootstrapValidator.helpers.call(d,[b,c])}).on(this.options.events.fieldError,function(b,c){var d=e.getOptions(c.field,null,"onError");d&&a.fn.bootstrapValidator.helpers.call(d,[b,c])}).on(this.options.events.fieldStatus,function(b,c){var d=e.getOptions(c.field,null,"onStatus");d&&a.fn.bootstrapValidator.helpers.call(d,[b,c])}).on(this.options.events.validatorError,function(b,c){var d=e.getOptions(c.field,c.validator,"onError");d&&a.fn.bootstrapValidator.helpers.call(d,[b,c])}).on(this.options.events.validatorSuccess,function(b,c){var d=e.getOptions(c.field,c.validator,"onSuccess");d&&a.fn.bootstrapValidator.helpers.call(d,[b,c])}),k=a.map(j,function(a){return a+".live.bv"}).join(" "),this.options.live){case"submitted":break;case"disabled":c.off(k);break;case"enabled":default:c.off(k).on(k,function(){e._exceedThreshold(a(this))&&e.validateField(a(this))})}c.trigger(a.Event(this.options.events.fieldInit),{bv:this,field:b,element:c})}},_getMessage:function(b,c){if(!(this.options.fields[b]&&a.fn.bootstrapValidator.validators[c]&&this.options.fields[b].validators&&this.options.fields[b].validators[c]))return"";var d=this.options.fields[b].validators[c];switch(!0){case!!d.message:return d.message;case!!this.options.fields[b].message:return this.options.fields[b].message;case!!a.fn.bootstrapValidator.i18n[c]:return a.fn.bootstrapValidator.i18n[c]["default"];default:return this.options.message}},_getMessageContainer:function(a,b){var c=a.parent();if(c.is(b))return c;var d=c.attr("class");if(!d)return this._getMessageContainer(c,b);d=d.split(" ");for(var e=d.length,f=0;e>f;f++)if(/^col-(xs|sm|md|lg)-\d+$/.test(d[f])||/^col-(xs|sm|md|lg)-offset-\d+$/.test(d[f]))return c;return this._getMessageContainer(c,b)},_submit:function(){var b=this.isValid(),c=b?this.options.events.formSuccess:this.options.events.formError,d=a.Event(c);this.$form.trigger(d),this.$submitButton&&(b?this._onSuccess(d):this._onError(d))},_isExcluded:function(b){var c=b.attr("data-bv-excluded"),d=b.attr("data-bv-field")||b.attr("name");switch(!0){case!!d&&this.options.fields&&this.options.fields[d]&&("true"===this.options.fields[d].excluded||this.options.fields[d].excluded===!0):case"true"===c:case""===c:return!0;case!!d&&this.options.fields&&this.options.fields[d]&&("false"===this.options.fields[d].excluded||this.options.fields[d].excluded===!1):case"false"===c:return!1;default:if(this.options.excluded){"string"==typeof this.options.excluded&&(this.options.excluded=a.map(this.options.excluded.split(","),function(b){return a.trim(b)}));for(var e=this.options.excluded.length,f=0;e>f;f++)if("string"==typeof this.options.excluded[f]&&b.is(this.options.excluded[f])||"function"==typeof this.options.excluded[f]&&this.options.excluded[f].call(this,b,this)===!0)return!0}return!1}},_exceedThreshold:function(b){var c=b.attr("data-bv-field"),d=this.options.fields[c].threshold||this.options.threshold;if(!d)return!0;var e=-1!==a.inArray(b.attr("type"),["button","checkbox","file","hidden","image","radio","reset","submit"]);return e||b.val().length>=d},_onError:function(b){if(!b.isDefaultPrevented()){if("submitted"===this.options.live){this.options.live="enabled";var c=this;for(var d in this.options.fields)!function(b){var e=c.getFieldElements(b);if(e.length){var f=a(e[0]).attr("type"),g="radio"===f||"checkbox"===f||"file"===f||"SELECT"===a(e[0]).get(0).tagName?"change":c._changeEvent,h=c.options.fields[d].trigger||c.options.trigger||g,i=a.map(h.split(" "),function(a){return a+".live.bv"}).join(" ");e.off(i).on(i,function(){c._exceedThreshold(a(this))&&c.validateField(a(this))})}}(d)}for(var e=0;e<this.$invalidFields.length;e++){var f=this.$invalidFields.eq(e),g=this._isOptionEnabled(f.attr("data-bv-field"),"autoFocus");if(g){var h,i=f.parents(".tab-pane");i&&(h=i.attr("id"))&&a('a[href="#'+h+'"][data-toggle="tab"]').tab("show"),f.focus();break}}}},_onSuccess:function(a){a.isDefaultPrevented()||this.disableSubmitButtons(!0).defaultSubmit()},_onFieldValidated:function(b,c){var d=b.attr("data-bv-field"),e=this.options.fields[d].validators,f={},g=0,h={bv:this,field:d,element:b,validator:c,result:b.data("bv.response."+c)};if(c)switch(b.data("bv.result."+c)){case this.STATUS_INVALID:b.trigger(a.Event(this.options.events.validatorError),h);break;case this.STATUS_VALID:b.trigger(a.Event(this.options.events.validatorSuccess),h)}f[this.STATUS_NOT_VALIDATED]=0,f[this.STATUS_VALIDATING]=0,f[this.STATUS_INVALID]=0,f[this.STATUS_VALID]=0;for(var i in e)if(e[i].enabled!==!1){g++;var j=b.data("bv.result."+i);j&&f[j]++}f[this.STATUS_VALID]===g?(this.$invalidFields=this.$invalidFields.not(b),b.trigger(a.Event(this.options.events.fieldSuccess),h)):(0===f[this.STATUS_NOT_VALIDATED]||!this._isOptionEnabled(d,"verbose"))&&0===f[this.STATUS_VALIDATING]&&f[this.STATUS_INVALID]>0&&(this.$invalidFields=this.$invalidFields.add(b),b.trigger(a.Event(this.options.events.fieldError),h))},_isOptionEnabled:function(a,b){return!this.options.fields[a]||"true"!==this.options.fields[a][b]&&this.options.fields[a][b]!==!0?!this.options.fields[a]||"false"!==this.options.fields[a][b]&&this.options.fields[a][b]!==!1?"true"===this.options[b]||this.options[b]===!0:!1:!0},getFieldElements:function(b){return this._cacheFields[b]||(this._cacheFields[b]=this.options.fields[b]&&this.options.fields[b].selector?a(this.options.fields[b].selector):this.$form.find('[name="'+b+'"]')),this._cacheFields[b]},getOptions:function(a,b,c){if(!a)return c?this.options[c]:this.options;if("object"==typeof a&&(a=a.attr("data-bv-field")),!this.options.fields[a])return null;var d=this.options.fields[a];return b?d.validators&&d.validators[b]?c?d.validators[b][c]:d.validators[b]:null:c?d[c]:d},disableSubmitButtons:function(a){return a?"disabled"!==this.options.live&&this.$form.find(this.options.submitButtons).attr("disabled","disabled"):this.$form.find(this.options.submitButtons).removeAttr("disabled"),this},validate:function(){if(!this.options.fields)return this;this.disableSubmitButtons(!0),this._submitIfValid=!1;for(var a in this.options.fields)this.validateField(a);return this._submit(),this._submitIfValid=!0,this},validateField:function(b){var c=a([]);switch(typeof b){case"object":c=b,b=b.attr("data-bv-field");break;case"string":c=this.getFieldElements(b)}if(0===c.length||!this.options.fields[b]||this.options.fields[b].enabled===!1)return this;for(var d,e,f=this,g=c.attr("type"),h="radio"===g||"checkbox"===g?1:c.length,i="radio"===g||"checkbox"===g,j=this.options.fields[b].validators,k=this._isOptionEnabled(b,"verbose"),l=0;h>l;l++){var m=c.eq(l);if(!this._isExcluded(m)){var n=!1;for(d in j){if(m.data("bv.dfs."+d)&&m.data("bv.dfs."+d).reject(),n)break;var o=m.data("bv.result."+d);if(o!==this.STATUS_VALID&&o!==this.STATUS_INVALID)if(j[d].enabled!==!1){if(m.data("bv.result."+d,this.STATUS_VALIDATING),e=a.fn.bootstrapValidator.validators[d].validate(this,m,j[d]),"object"==typeof e&&e.resolve)this.updateStatus(i?b:m,this.STATUS_VALIDATING,d),m.data("bv.dfs."+d,e),e.done(function(a,b,c){a.removeData("bv.dfs."+b).data("bv.response."+b,c),c.message&&f.updateMessage(a,b,c.message),f.updateStatus(i?a.attr("data-bv-field"):a,c.valid?f.STATUS_VALID:f.STATUS_INVALID,b),c.valid&&f._submitIfValid===!0?f._submit():c.valid||k||(n=!0)});else if("object"==typeof e&&void 0!==e.valid&&void 0!==e.message){if(m.data("bv.response."+d,e),this.updateMessage(i?b:m,d,e.message),this.updateStatus(i?b:m,e.valid?this.STATUS_VALID:this.STATUS_INVALID,d),!e.valid&&!k)break}else if("boolean"==typeof e&&(m.data("bv.response."+d,e),this.updateStatus(i?b:m,e?this.STATUS_VALID:this.STATUS_INVALID,d),!e&&!k))break}else this.updateStatus(i?b:m,this.STATUS_VALID,d);else this._onFieldValidated(m,d)}}}return this},updateMessage:function(b,c,d){var e=a([]);switch(typeof b){case"object":e=b,b=b.attr("data-bv-field");break;case"string":e=this.getFieldElements(b)}e.each(function(){a(this).data("bv.messages").find('.help-block[data-bv-validator="'+c+'"][data-bv-for="'+b+'"]').html(d)})},updateStatus:function(b,c,d){var e=a([]);switch(typeof b){case"object":e=b,b=b.attr("data-bv-field");break;case"string":e=this.getFieldElements(b)}c===this.STATUS_NOT_VALIDATED&&(this._submitIfValid=!1);for(var f=this,g=e.attr("type"),h=this.options.fields[b].group||this.options.group,i="radio"===g||"checkbox"===g?1:e.length,j=0;i>j;j++){var k=e.eq(j);if(!this._isExcluded(k)){var l=k.parents(h),m=k.data("bv.messages"),n=m.find('.help-block[data-bv-validator][data-bv-for="'+b+'"]'),o=d?n.filter('[data-bv-validator="'+d+'"]'):n,p=k.data("bv.icon"),q="function"==typeof(this.options.fields[b].container||this.options.container)?(this.options.fields[b].container||this.options.container).call(this,k,this):this.options.fields[b].container||this.options.container,r=null;if(d)k.data("bv.result."+d,c);else for(var s in this.options.fields[b].validators)k.data("bv.result."+s,c);o.attr("data-bv-result",c);var t,u,v=k.parents(".tab-pane");switch(v&&(t=v.attr("id"))&&(u=a('a[href="#'+t+'"][data-toggle="tab"]').parent()),c){case this.STATUS_VALIDATING:r=null,this.disableSubmitButtons(!0),l.removeClass("has-success").removeClass("has-error"),p&&p.removeClass(this.options.feedbackIcons.valid).removeClass(this.options.feedbackIcons.invalid).addClass(this.options.feedbackIcons.validating).show(),u&&u.removeClass("bv-tab-success").removeClass("bv-tab-error");break;case this.STATUS_INVALID:r=!1,this.disableSubmitButtons(!0),l.removeClass("has-success").addClass("has-error"),p&&p.removeClass(this.options.feedbackIcons.valid).removeClass(this.options.feedbackIcons.validating).addClass(this.options.feedbackIcons.invalid).show(),u&&u.removeClass("bv-tab-success").addClass("bv-tab-error");break;case this.STATUS_VALID:r=0===n.filter('[data-bv-result="'+this.STATUS_NOT_VALIDATED+'"]').length?n.filter('[data-bv-result="'+this.STATUS_VALID+'"]').length===n.length:null,null!==r&&(this.disableSubmitButtons(this.$submitButton?!this.isValid():!r),p&&p.removeClass(this.options.feedbackIcons.invalid).removeClass(this.options.feedbackIcons.validating).removeClass(this.options.feedbackIcons.valid).addClass(r?this.options.feedbackIcons.valid:this.options.feedbackIcons.invalid).show()),l.removeClass("has-error has-success").addClass(this.isValidContainer(l)?"has-success":"has-error"),u&&u.removeClass("bv-tab-success").removeClass("bv-tab-error").addClass(this.isValidContainer(v)?"bv-tab-success":"bv-tab-error");break;case this.STATUS_NOT_VALIDATED:default:r=null,this.disableSubmitButtons(!1),l.removeClass("has-success").removeClass("has-error"),p&&p.removeClass(this.options.feedbackIcons.valid).removeClass(this.options.feedbackIcons.invalid).removeClass(this.options.feedbackIcons.validating).hide(),u&&u.removeClass("bv-tab-success").removeClass("bv-tab-error")}switch(!0){case p&&"tooltip"===q:r===!1?p.css("cursor","pointer").tooltip("destroy").tooltip({container:"body",html:!0,placement:"auto top",title:n.filter('[data-bv-result="'+f.STATUS_INVALID+'"]').eq(0).html()}):p.css("cursor","").tooltip("destroy");break;case p&&"popover"===q:r===!1?p.css("cursor","pointer").popover("destroy").popover({container:"body",content:n.filter('[data-bv-result="'+f.STATUS_INVALID+'"]').eq(0).html(),html:!0,placement:"auto top",trigger:"hover click"}):p.css("cursor","").popover("destroy");break;default:c===this.STATUS_INVALID?o.show():o.hide()}k.trigger(a.Event(this.options.events.fieldStatus),{bv:this,field:b,element:k,status:c}),this._onFieldValidated(k,d)}}return this},isValid:function(){for(var a in this.options.fields)if(!this.isValidField(a))return!1;return!0},isValidField:function(b){var c=a([]);switch(typeof b){case"object":c=b,b=b.attr("data-bv-field");break;case"string":c=this.getFieldElements(b)}if(0===c.length||!this.options.fields[b]||this.options.fields[b].enabled===!1)return!0;for(var d,e,f,g=c.attr("type"),h="radio"===g||"checkbox"===g?1:c.length,i=0;h>i;i++)if(d=c.eq(i),!this._isExcluded(d))for(e in this.options.fields[b].validators)if(this.options.fields[b].validators[e].enabled!==!1&&(f=d.data("bv.result."+e),f!==this.STATUS_VALID))return!1;return!0},isValidContainer:function(b){var c=this,d={},e="string"==typeof b?a(b):b;if(0===e.length)return!0;e.find("[data-bv-field]").each(function(){var b=a(this),e=b.attr("data-bv-field");c._isExcluded(b)||d[e]||(d[e]=b)});for(var f in d){var g=d[f];if(g.data("bv.messages").find('.help-block[data-bv-validator][data-bv-for="'+f+'"]').filter('[data-bv-result="'+this.STATUS_INVALID+'"]').length>0)return!1}return!0},defaultSubmit:function(){this.$submitButton&&a("<input/>").attr("type","hidden").attr("data-bv-submit-hidden","").attr("name",this.$submitButton.attr("name")).val(this.$submitButton.val()).appendTo(this.$form),this.$form.off("submit.bv").submit()},getInvalidFields:function(){return this.$invalidFields},getSubmitButton:function(){return this.$submitButton},getMessages:function(b,c){var d=this,e=[],f=a([]);switch(!0){case b&&"object"==typeof b:f=b;break;case b&&"string"==typeof b:var g=this.getFieldElements(b);if(g.length>0){var h=g.attr("type");f="radio"===h||"checkbox"===h?g.eq(0):g}break;default:f=this.$invalidFields}var i=c?'[data-bv-validator="'+c+'"]':"";return f.each(function(){e=e.concat(a(this).data("bv.messages").find('.help-block[data-bv-for="'+a(this).attr("data-bv-field")+'"][data-bv-result="'+d.STATUS_INVALID+'"]'+i).map(function(){var b=a(this).attr("data-bv-validator"),c=a(this).attr("data-bv-for");return d.options.fields[c].validators[b].enabled===!1?"":a(this).html()}).get())}),e},updateOption:function(a,b,c,d){return"object"==typeof a&&(a=a.attr("data-bv-field")),this.options.fields[a]&&this.options.fields[a].validators[b]&&(this.options.fields[a].validators[b][c]=d,this.updateStatus(a,this.STATUS_NOT_VALIDATED,b)),this},addField:function(b,c){var d=a([]);switch(typeof b){case"object":d=b,b=b.attr("data-bv-field")||b.attr("name");break;case"string":delete this._cacheFields[b],d=this.getFieldElements(b)}d.attr("data-bv-field",b);for(var e=d.attr("type"),f="radio"===e||"checkbox"===e?1:d.length,g=0;f>g;g++){var h=d.eq(g),i=this._parseOptions(h);i=null===i?c:a.extend(!0,c,i),this.options.fields[b]=a.extend(!0,this.options.fields[b],i),this._cacheFields[b]=this._cacheFields[b]?this._cacheFields[b].add(h):h,this._initField("checkbox"===e||"radio"===e?b:h)}return this.disableSubmitButtons(!1),this.$form.trigger(a.Event(this.options.events.fieldAdded),{field:b,element:d,options:this.options.fields[b]}),this},removeField:function(b){var c=a([]);switch(typeof b){case"object":c=b,b=b.attr("data-bv-field")||b.attr("name"),c.attr("data-bv-field",b);break;case"string":c=this.getFieldElements(b)}if(0===c.length)return this;for(var d=c.attr("type"),e="radio"===d||"checkbox"===d?1:c.length,f=0;e>f;f++){var g=c.eq(f);this.$invalidFields=this.$invalidFields.not(g),this._cacheFields[b]=this._cacheFields[b].not(g)}return this._cacheFields[b]&&0!==this._cacheFields[b].length||delete this.options.fields[b],("checkbox"===d||"radio"===d)&&this._initField(b),this.disableSubmitButtons(!1),this.$form.trigger(a.Event(this.options.events.fieldRemoved),{field:b,element:c}),this},resetField:function(b,c){var d=a([]);switch(typeof b){case"object":d=b,b=b.attr("data-bv-field");break;case"string":d=this.getFieldElements(b)}var e=d.length;if(this.options.fields[b])for(var f=0;e>f;f++)for(var g in this.options.fields[b].validators)d.eq(f).removeData("bv.dfs."+g);if(this.updateStatus(b,this.STATUS_NOT_VALIDATED),c){var h=d.attr("type");"radio"===h||"checkbox"===h?d.removeAttr("checked").removeAttr("selected"):d.val("")}return this},resetForm:function(b){for(var c in this.options.fields)this.resetField(c,b);return this.$invalidFields=a([]),this.$submitButton=null,this.disableSubmitButtons(!1),this},revalidateField:function(a){return this.updateStatus(a,this.STATUS_NOT_VALIDATED).validateField(a),this},enableFieldValidators:function(a,b,c){var d=this.options.fields[a].validators;if(c&&d&&d[c]&&d[c].enabled!==b)this.options.fields[a].validators[c].enabled=b,this.updateStatus(a,this.STATUS_NOT_VALIDATED,c);else if(!c&&this.options.fields[a].enabled!==b){this.options.fields[a].enabled=b;for(var e in d)this.enableFieldValidators(a,b,e)}return this},getDynamicOption:function(b,c){var d="string"==typeof b?this.getFieldElements(b):b,e=d.val();if("function"==typeof c)return a.fn.bootstrapValidator.helpers.call(c,[e,this,d]);if("string"==typeof c){var f=this.getFieldElements(c);return f.length?f.val():a.fn.bootstrapValidator.helpers.call(c,[e,this,d])||c}return null},destroy:function(){var b,c,d,e,f,g;for(b in this.options.fields){c=this.getFieldElements(b),g=this.options.fields[b].group||this.options.group;for(var h=0;h<c.length;h++){if(d=c.eq(h),d.data("bv.messages").find('.help-block[data-bv-validator][data-bv-for="'+b+'"]').remove().end().end().removeData("bv.messages").parents(g).removeClass("has-feedback has-error has-success").end().off(".bv").removeAttr("data-bv-field"),f=d.data("bv.icon")){var i="function"==typeof(this.options.fields[b].container||this.options.container)?(this.options.fields[b].container||this.options.container).call(this,d,this):this.options.fields[b].container||this.options.container;switch(i){case"tooltip":f.tooltip("destroy").remove();break;case"popover":f.popover("destroy").remove();break;default:f.remove()}}d.removeData("bv.icon");for(e in this.options.fields[b].validators)d.data("bv.dfs."+e)&&d.data("bv.dfs."+e).reject(),d.removeData("bv.result."+e).removeData("bv.response."+e).removeData("bv.dfs."+e),"function"==typeof a.fn.bootstrapValidator.validators[e].destroy&&a.fn.bootstrapValidator.validators[e].destroy(this,d,this.options.fields[b].validators[e])}}this.disableSubmitButtons(!1),this.$hiddenButton.remove(),this.$form.removeClass(this.options.elementClass).off(".bv").removeData("bootstrapValidator").find("[data-bv-submit-hidden]").remove().end().find('[type="submit"]').off("click.bv")}},a.fn.bootstrapValidator=function(c){var d=arguments;return this.each(function(){var e=a(this),f=e.data("bootstrapValidator"),g="object"==typeof c&&c;f||(f=new b(this,g),e.data("bootstrapValidator",f)),"string"==typeof c&&f[c].apply(f,Array.prototype.slice.call(d,1))})},a.fn.bootstrapValidator.DEFAULT_OPTIONS={autoFocus:!0,container:null,elementClass:"bv-form",events:{formInit:"init.form.bv",formError:"error.form.bv",formSuccess:"success.form.bv",fieldAdded:"added.field.bv",fieldRemoved:"removed.field.bv",fieldInit:"init.field.bv",fieldError:"error.field.bv",fieldSuccess:"success.field.bv",fieldStatus:"status.field.bv",validatorError:"error.validator.bv",validatorSuccess:"success.validator.bv"},excluded:[":disabled",":hidden",":not(:visible)"],feedbackIcons:{valid:null,invalid:null,validating:null},fields:null,group:".form-group",live:"enabled",message:"This value is not valid",submitButtons:'[type="submit"]',threshold:null,verbose:!0},a.fn.bootstrapValidator.validators={},a.fn.bootstrapValidator.i18n={},a.fn.bootstrapValidator.Constructor=b,a.fn.bootstrapValidator.helpers={call:function(a,b){if("function"==typeof a)return a.apply(this,b);if("string"==typeof a){"()"===a.substring(a.length-2)&&(a=a.substring(0,a.length-2));for(var c=a.split("."),d=c.pop(),e=window,f=0;f<c.length;f++)e=e[c[f]];return"undefined"==typeof e[d]?null:e[d].apply(this,b)}},format:function(b,c){a.isArray(c)||(c=[c]);for(var d in c)b=b.replace("%s",c[d]);return b},date:function(a,b,c,d){if(isNaN(a)||isNaN(b)||isNaN(c))return!1;if(c.length>2||b.length>2||a.length>4)return!1;if(c=parseInt(c,10),b=parseInt(b,10),a=parseInt(a,10),1e3>a||a>9999||0>=b||b>12)return!1;var e=[31,28,31,30,31,30,31,31,30,31,30,31];if((a%400===0||a%100!==0&&a%4===0)&&(e[1]=29),0>=c||c>e[b-1])return!1;if(d===!0){var f=new Date,g=f.getFullYear(),h=f.getMonth(),i=f.getDate();return g>a||a===g&&h>b-1||a===g&&b-1===h&&i>c}return!0},luhn:function(a){for(var b=a.length,c=0,d=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],e=0;b--;)e+=d[c][parseInt(a.charAt(b),10)],c^=1;return e%10===0&&e>0},mod11And10:function(a){for(var b=5,c=a.length,d=0;c>d;d++)b=(2*(b||10)%11+parseInt(a.charAt(d),10))%10;return 1===b},mod37And36:function(a,b){b=b||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(var c=b.length,d=a.length,e=Math.floor(c/2),f=0;d>f;f++)e=(2*(e||c)%(c+1)+b.indexOf(a.charAt(f)))%c;return 1===e}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.base64=a.extend(a.fn.bootstrapValidator.i18n.base64||{},{"default":"Please enter a valid base 64 encoded"}),a.fn.bootstrapValidator.validators.base64={validate:function(a,b){var c=b.val();return""===c?!0:/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.between=a.extend(a.fn.bootstrapValidator.i18n.between||{},{"default":"Please enter a value between %s and %s",notInclusive:"Please enter a value between %s and %s strictly"}),a.fn.bootstrapValidator.validators.between={html5Attributes:{message:"message",min:"min",max:"max",inclusive:"inclusive"},enableByHtml5:function(a){return"range"===a.attr("type")?{min:a.attr("min"),max:a.attr("max")}:!1},validate:function(b,c,d){var e=c.val();if(""===e)return!0;if(e=this._format(e),!a.isNumeric(e))return!1;var f=a.isNumeric(d.min)?d.min:b.getDynamicOption(c,d.min),g=a.isNumeric(d.max)?d.max:b.getDynamicOption(c,d.max),h=this._format(f),i=this._format(g);return e=parseFloat(e),d.inclusive===!0||void 0===d.inclusive?{valid:e>=h&&i>=e,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.between["default"],[f,g])}:{valid:e>h&&i>e,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.between.notInclusive,[f,g])}},_format:function(a){return(a+"").replace(",",".")}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.blank={validate:function(){return!0}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.callback=a.extend(a.fn.bootstrapValidator.i18n.callback||{},{"default":"Please enter a valid value"}),a.fn.bootstrapValidator.validators.callback={html5Attributes:{message:"message",callback:"callback"},validate:function(b,c,d){var e=c.val(),f=new a.Deferred,g={valid:!0};if(d.callback){var h=a.fn.bootstrapValidator.helpers.call(d.callback,[e,b,c]);g="boolean"==typeof h?{valid:h}:h}return f.resolve(c,"callback",g),f}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.choice=a.extend(a.fn.bootstrapValidator.i18n.choice||{},{"default":"Please enter a valid value",less:"Please choose %s options at minimum",more:"Please choose %s options at maximum",between:"Please choose %s - %s options"}),a.fn.bootstrapValidator.validators.choice={html5Attributes:{message:"message",min:"min",max:"max"},validate:function(b,c,d){var e=c.is("select")?b.getFieldElements(c.attr("data-bv-field")).find("option").filter(":selected").length:b.getFieldElements(c.attr("data-bv-field")).filter(":checked").length,f=d.min?a.isNumeric(d.min)?d.min:b.getDynamicOption(c,d.min):null,g=d.max?a.isNumeric(d.max)?d.max:b.getDynamicOption(c,d.max):null,h=!0,i=d.message||a.fn.bootstrapValidator.i18n.choice["default"];switch((f&&e<parseInt(f,10)||g&&e>parseInt(g,10))&&(h=!1),!0){case!!f&&!!g:i=a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.choice.between,[parseInt(f,10),parseInt(g,10)]);break;case!!f:i=a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.choice.less,parseInt(f,10));break;case!!g:i=a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.choice.more,parseInt(g,10))}return{valid:h,message:i}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.color=a.extend(a.fn.bootstrapValidator.i18n.color||{},{"default":"Please enter a valid color"}),a.fn.bootstrapValidator.validators.color={SUPPORTED_TYPES:["hex","rgb","rgba","hsl","hsla","keyword"],KEYWORD_COLORS:["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],validate:function(b,c,d){var e=c.val(); +if(""===e)return!0;var f=d.type||this.SUPPORTED_TYPES;a.isArray(f)||(f=f.replace(/s/g,"").split(","));for(var g,h,i=!1,j=0;j<f.length;j++)if(h=f[j],g="_"+h.toLowerCase(),i=i||this[g](e))return!0;return!1},_hex:function(a){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)},_hsl:function(a){return/^hsl\((\s*(-?\d+)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*)\)$/.test(a)},_hsla:function(a){return/^hsla\((\s*(-?\d+)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*,){2}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/.test(a)},_keyword:function(b){return a.inArray(b,this.KEYWORD_COLORS)>=0},_rgb:function(a){var b=/^rgb\((\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*,){2}(\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*)\)$/,c=/^rgb\((\s*(\b(0?\d{1,2}|100)\b%)\s*,){2}(\s*(\b(0?\d{1,2}|100)\b%)\s*)\)$/;return b.test(a)||c.test(a)},_rgba:function(a){var b=/^rgba\((\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*,){3}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/,c=/^rgba\((\s*(\b(0?\d{1,2}|100)\b%)\s*,){3}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/;return b.test(a)||c.test(a)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.creditCard=a.extend(a.fn.bootstrapValidator.i18n.creditCard||{},{"default":"Please enter a valid credit card number"}),a.fn.bootstrapValidator.validators.creditCard={validate:function(b,c){var d=c.val();if(""===d)return!0;if(/[^0-9-\s]+/.test(d))return!1;if(d=d.replace(/\D/g,""),!a.fn.bootstrapValidator.helpers.luhn(d))return!1;var e,f,g={AMERICAN_EXPRESS:{length:[15],prefix:["34","37"]},DINERS_CLUB:{length:[14],prefix:["300","301","302","303","304","305","36"]},DINERS_CLUB_US:{length:[16],prefix:["54","55"]},DISCOVER:{length:[16],prefix:["6011","622126","622127","622128","622129","62213","62214","62215","62216","62217","62218","62219","6222","6223","6224","6225","6226","6227","6228","62290","62291","622920","622921","622922","622923","622924","622925","644","645","646","647","648","649","65"]},JCB:{length:[16],prefix:["3528","3529","353","354","355","356","357","358"]},LASER:{length:[16,17,18,19],prefix:["6304","6706","6771","6709"]},MAESTRO:{length:[12,13,14,15,16,17,18,19],prefix:["5018","5020","5038","6304","6759","6761","6762","6763","6764","6765","6766"]},MASTERCARD:{length:[16],prefix:["51","52","53","54","55"]},SOLO:{length:[16,18,19],prefix:["6334","6767"]},UNIONPAY:{length:[16,17,18,19],prefix:["622126","622127","622128","622129","62213","62214","62215","62216","62217","62218","62219","6222","6223","6224","6225","6226","6227","6228","62290","62291","622920","622921","622922","622923","622924","622925"]},VISA:{length:[16],prefix:["4"]}};for(e in g)for(f in g[e].prefix)if(d.substr(0,g[e].prefix[f].length)===g[e].prefix[f]&&-1!==a.inArray(d.length,g[e].length))return!0;return!1}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.cusip=a.extend(a.fn.bootstrapValidator.i18n.cusip||{},{"default":"Please enter a valid CUSIP number"}),a.fn.bootstrapValidator.validators.cusip={validate:function(b,c){var d=c.val();if(""===d)return!0;if(d=d.toUpperCase(),!/^[0-9A-Z]{9}$/.test(d))return!1;for(var e=a.map(d.split(""),function(a){var b=a.charCodeAt(0);return b>="A".charCodeAt(0)&&b<="Z".charCodeAt(0)?b-"A".charCodeAt(0)+10:a}),f=e.length,g=0,h=0;f-1>h;h++){var i=parseInt(e[h],10);h%2!==0&&(i*=2),i>9&&(i-=9),g+=i}return g=(10-g%10)%10,g===e[f-1]}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.cvv=a.extend(a.fn.bootstrapValidator.i18n.cvv||{},{"default":"Please enter a valid CVV number"}),a.fn.bootstrapValidator.validators.cvv={html5Attributes:{message:"message",ccfield:"creditCardField"},validate:function(b,c,d){var e=c.val();if(""===e)return!0;if(!/^[0-9]{3,4}$/.test(e))return!1;if(!d.creditCardField)return!0;var f=b.getFieldElements(d.creditCardField).val();if(""===f)return!0;f=f.replace(/\D/g,"");var g,h,i={AMERICAN_EXPRESS:{length:[15],prefix:["34","37"]},DINERS_CLUB:{length:[14],prefix:["300","301","302","303","304","305","36"]},DINERS_CLUB_US:{length:[16],prefix:["54","55"]},DISCOVER:{length:[16],prefix:["6011","622126","622127","622128","622129","62213","62214","62215","62216","62217","62218","62219","6222","6223","6224","6225","6226","6227","6228","62290","62291","622920","622921","622922","622923","622924","622925","644","645","646","647","648","649","65"]},JCB:{length:[16],prefix:["3528","3529","353","354","355","356","357","358"]},LASER:{length:[16,17,18,19],prefix:["6304","6706","6771","6709"]},MAESTRO:{length:[12,13,14,15,16,17,18,19],prefix:["5018","5020","5038","6304","6759","6761","6762","6763","6764","6765","6766"]},MASTERCARD:{length:[16],prefix:["51","52","53","54","55"]},SOLO:{length:[16,18,19],prefix:["6334","6767"]},UNIONPAY:{length:[16,17,18,19],prefix:["622126","622127","622128","622129","62213","62214","62215","62216","62217","62218","62219","6222","6223","6224","6225","6226","6227","6228","62290","62291","622920","622921","622922","622923","622924","622925"]},VISA:{length:[16],prefix:["4"]}},j=null;for(g in i)for(h in i[g].prefix)if(f.substr(0,i[g].prefix[h].length)===i[g].prefix[h]&&-1!==a.inArray(f.length,i[g].length)){j=g;break}return null===j?!1:"AMERICAN_EXPRESS"===j?4===e.length:3===e.length}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.date=a.extend(a.fn.bootstrapValidator.i18n.date||{},{"default":"Please enter a valid date",min:"Please enter a date after %s",max:"Please enter a date before %s",range:"Please enter a date in the range %s - %s"}),a.fn.bootstrapValidator.validators.date={html5Attributes:{message:"message",format:"format",min:"min",max:"max",separator:"separator"},validate:function(b,c,d){var e=c.val();if(""===e)return!0;d.format=d.format||"MM/DD/YYYY","date"===c.attr("type")&&(d.format="YYYY-MM-DD");var f=d.format.split(" "),g=f[0],h=f.length>1?f[1]:null,i=f.length>2?f[2]:null,j=e.split(" "),k=j[0],l=j.length>1?j[1]:null;if(f.length!==j.length)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]};var m=d.separator;if(m||(m=-1!==k.indexOf("/")?"/":-1!==k.indexOf("-")?"-":null),null===m||-1===k.indexOf(m))return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]};if(k=k.split(m),g=g.split(m),k.length!==g.length)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]};var n=k[a.inArray("YYYY",g)],o=k[a.inArray("MM",g)],p=k[a.inArray("DD",g)];if(!n||!o||!p||4!==n.length)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]};var q=null,r=null,s=null;if(h){if(h=h.split(":"),l=l.split(":"),h.length!==l.length)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]};if(r=l.length>0?l[0]:null,q=l.length>1?l[1]:null,s=l.length>2?l[2]:null){if(isNaN(s)||s.length>2)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]};if(s=parseInt(s,10),0>s||s>60)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]}}if(r){if(isNaN(r)||r.length>2)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]};if(r=parseInt(r,10),0>r||r>=24||i&&r>12)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]}}if(q){if(isNaN(q)||q.length>2)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]};if(q=parseInt(q,10),0>q||q>59)return{valid:!1,message:d.message||a.fn.bootstrapValidator.i18n.date["default"]}}}var t=a.fn.bootstrapValidator.helpers.date(n,o,p),u=d.message||a.fn.bootstrapValidator.i18n.date["default"],v=null,w=null,x=d.min,y=d.max;switch(x&&(isNaN(Date.parse(x))&&(x=b.getDynamicOption(c,x)),v=this._parseDate(x,g,m)),y&&(isNaN(Date.parse(y))&&(y=b.getDynamicOption(c,y)),w=this._parseDate(y,g,m)),k=new Date(n,o,p,r,q,s),!0){case x&&!y&&t:t=k.getTime()>=v.getTime(),u=d.message||a.fn.bootstrapValidator.helpers.format(a.fn.bootstrapValidator.i18n.date.min,x);break;case y&&!x&&t:t=k.getTime()<=w.getTime(),u=d.message||a.fn.bootstrapValidator.helpers.format(a.fn.bootstrapValidator.i18n.date.max,y);break;case y&&x&&t:t=k.getTime()<=w.getTime()&&k.getTime()>=v.getTime(),u=d.message||a.fn.bootstrapValidator.helpers.format(a.fn.bootstrapValidator.i18n.date.range,[x,y])}return{valid:t,message:u}},_parseDate:function(b,c,d){var e=0,f=0,g=0,h=b.split(" "),i=h[0],j=h.length>1?h[1]:null;i=i.split(d);var k=i[a.inArray("YYYY",c)],l=i[a.inArray("MM",c)],m=i[a.inArray("DD",c)];return j&&(j=j.split(":"),f=j.length>0?j[0]:null,e=j.length>1?j[1]:null,g=j.length>2?j[2]:null),new Date(k,l,m,f,e,g)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.different=a.extend(a.fn.bootstrapValidator.i18n.different||{},{"default":"Please enter a different value"}),a.fn.bootstrapValidator.validators.different={html5Attributes:{message:"message",field:"field"},validate:function(a,b,c){var d=b.val();if(""===d)return!0;for(var e=c.field.split(","),f=!0,g=0;g<e.length;g++){var h=a.getFieldElements(e[g]);if(null!=h&&0!==h.length){var i=h.val();d===i?f=!1:""!==i&&a.updateStatus(h,a.STATUS_VALID,"different")}}return f}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.digits=a.extend(a.fn.bootstrapValidator.i18n.digits||{},{"default":"Please enter only digits"}),a.fn.bootstrapValidator.validators.digits={validate:function(a,b){var c=b.val();return""===c?!0:/^\d+$/.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.ean=a.extend(a.fn.bootstrapValidator.i18n.ean||{},{"default":"Please enter a valid EAN number"}),a.fn.bootstrapValidator.validators.ean={validate:function(a,b){var c=b.val();if(""===c)return!0;if(!/^(\d{8}|\d{12}|\d{13})$/.test(c))return!1;for(var d=c.length,e=0,f=8===d?[3,1]:[1,3],g=0;d-1>g;g++)e+=parseInt(c.charAt(g),10)*f[g%2];return e=(10-e%10)%10,e+""===c.charAt(d-1)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.emailAddress=a.extend(a.fn.bootstrapValidator.i18n.emailAddress||{},{"default":"Please enter a valid email address"}),a.fn.bootstrapValidator.validators.emailAddress={html5Attributes:{message:"message",multiple:"multiple",separator:"separator"},enableByHtml5:function(a){return"email"===a.attr("type")},validate:function(a,b,c){var d=b.val();if(""===d)return!0;var e=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,f=c.multiple===!0||"true"===c.multiple;if(f){for(var g=c.separator||/[,;]/,h=this._splitEmailAddresses(d,g),i=0;i<h.length;i++)if(!e.test(h[i]))return!1;return!0}return e.test(d)},_splitEmailAddresses:function(a,b){for(var c=a.split(/"/),d=c.length,e=[],f="",g=0;d>g;g++)if(g%2===0){var h=c[g].split(b),i=h.length;if(1===i)f+=h[0];else{e.push(f+h[0]);for(var j=1;i-1>j;j++)e.push(h[j]);f=h[i-1]}}else f+='"'+c[g],d-1>g&&(f+='"');return e.push(f),e}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.file=a.extend(a.fn.bootstrapValidator.i18n.file||{},{"default":"Please choose a valid file"}),a.fn.bootstrapValidator.validators.file={html5Attributes:{extension:"extension",maxfiles:"maxFiles",minfiles:"minFiles",maxsize:"maxSize",minsize:"minSize",maxtotalsize:"maxTotalSize",mintotalsize:"minTotalSize",message:"message",type:"type"},validate:function(b,c,d){var e=c.val();if(""===e)return!0;var f,g=d.extension?d.extension.toLowerCase().split(","):null,h=d.type?d.type.toLowerCase().split(","):null,i=window.File&&window.FileList&&window.FileReader;if(i){var j=c.get(0).files,k=j.length,l=0;if(d.maxFiles&&k>parseInt(d.maxFiles,10)||d.minFiles&&k<parseInt(d.minFiles,10))return!1;for(var m=0;k>m;m++)if(l+=j[m].size,f=j[m].name.substr(j[m].name.lastIndexOf(".")+1),d.minSize&&j[m].size<parseInt(d.minSize,10)||d.maxSize&&j[m].size>parseInt(d.maxSize,10)||g&&-1===a.inArray(f.toLowerCase(),g)||j[m].type&&h&&-1===a.inArray(j[m].type.toLowerCase(),h))return!1;if(d.maxTotalSize&&l>parseInt(d.maxTotalSize,10)||d.minTotalSize&&l<parseInt(d.minTotalSize,10))return!1}else if(f=e.substr(e.lastIndexOf(".")+1),g&&-1===a.inArray(f.toLowerCase(),g))return!1;return!0}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.greaterThan=a.extend(a.fn.bootstrapValidator.i18n.greaterThan||{},{"default":"Please enter a value greater than or equal to %s",notInclusive:"Please enter a value greater than %s"}),a.fn.bootstrapValidator.validators.greaterThan={html5Attributes:{message:"message",value:"value",inclusive:"inclusive"},enableByHtml5:function(a){var b=a.attr("type"),c=a.attr("min");return c&&"date"!==b?{value:c}:!1},validate:function(b,c,d){var e=c.val();if(""===e)return!0;if(e=this._format(e),!a.isNumeric(e))return!1;var f=a.isNumeric(d.value)?d.value:b.getDynamicOption(c,d.value),g=this._format(f);return e=parseFloat(e),d.inclusive===!0||void 0===d.inclusive?{valid:e>=g,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.greaterThan["default"],f)}:{valid:e>g,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.greaterThan.notInclusive,f)}},_format:function(a){return(a+"").replace(",",".")}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.grid=a.extend(a.fn.bootstrapValidator.i18n.grid||{},{"default":"Please enter a valid GRId number"}),a.fn.bootstrapValidator.validators.grid={validate:function(b,c){var d=c.val();return""===d?!0:(d=d.toUpperCase(),/^[GRID:]*([0-9A-Z]{2})[-\s]*([0-9A-Z]{5})[-\s]*([0-9A-Z]{10})[-\s]*([0-9A-Z]{1})$/g.test(d)?(d=d.replace(/\s/g,"").replace(/-/g,""),"GRID:"===d.substr(0,5)&&(d=d.substr(5)),a.fn.bootstrapValidator.helpers.mod37And36(d)):!1)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.hex=a.extend(a.fn.bootstrapValidator.i18n.hex||{},{"default":"Please enter a valid hexadecimal number"}),a.fn.bootstrapValidator.validators.hex={validate:function(a,b){var c=b.val();return""===c?!0:/^[0-9a-fA-F]+$/.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.hexColor=a.extend(a.fn.bootstrapValidator.i18n.hexColor||{},{"default":"Please enter a valid hex color"}),a.fn.bootstrapValidator.validators.hexColor={enableByHtml5:function(a){return"color"===a.attr("type")},validate:function(a,b){var c=b.val();return""===c?!0:"color"===b.attr("type")?/^#[0-9A-F]{6}$/i.test(c):/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.iban=a.extend(a.fn.bootstrapValidator.i18n.iban||{},{"default":"Please enter a valid IBAN number",countryNotSupported:"The country code %s is not supported",country:"Please enter a valid IBAN number in %s",countries:{AD:"Andorra",AE:"United Arab Emirates",AL:"Albania",AO:"Angola",AT:"Austria",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BR:"Brazil",CH:"Switzerland",CI:"Ivory Coast",CM:"Cameroon",CR:"Costa Rica",CV:"Cape Verde",CY:"Cyprus",CZ:"Czech Republic",DE:"Germany",DK:"Denmark",DO:"Dominican Republic",DZ:"Algeria",EE:"Estonia",ES:"Spain",FI:"Finland",FO:"Faroe Islands",FR:"France",GB:"United Kingdom",GE:"Georgia",GI:"Gibraltar",GL:"Greenland",GR:"Greece",GT:"Guatemala",HR:"Croatia",HU:"Hungary",IE:"Ireland",IL:"Israel",IR:"Iran",IS:"Iceland",IT:"Italy",JO:"Jordan",KW:"Kuwait",KZ:"Kazakhstan",LB:"Lebanon",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"Macedonia",ML:"Mali",MR:"Mauritania",MT:"Malta",MU:"Mauritius",MZ:"Mozambique",NL:"Netherlands",NO:"Norway",PK:"Pakistan",PL:"Poland",PS:"Palestine",PT:"Portugal",QA:"Qatar",RO:"Romania",RS:"Serbia",SA:"Saudi Arabia",SE:"Sweden",SI:"Slovenia",SK:"Slovakia",SM:"San Marino",SN:"Senegal",TN:"Tunisia",TR:"Turkey",VG:"Virgin Islands, British"}}),a.fn.bootstrapValidator.validators.iban={html5Attributes:{message:"message",country:"country"},REGEX:{AD:"AD[0-9]{2}[0-9]{4}[0-9]{4}[A-Z0-9]{12}",AE:"AE[0-9]{2}[0-9]{3}[0-9]{16}",AL:"AL[0-9]{2}[0-9]{8}[A-Z0-9]{16}",AO:"AO[0-9]{2}[0-9]{21}",AT:"AT[0-9]{2}[0-9]{5}[0-9]{11}",AZ:"AZ[0-9]{2}[A-Z]{4}[A-Z0-9]{20}",BA:"BA[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{8}[0-9]{2}",BE:"BE[0-9]{2}[0-9]{3}[0-9]{7}[0-9]{2}",BF:"BF[0-9]{2}[0-9]{23}",BG:"BG[0-9]{2}[A-Z]{4}[0-9]{4}[0-9]{2}[A-Z0-9]{8}",BH:"BH[0-9]{2}[A-Z]{4}[A-Z0-9]{14}",BI:"BI[0-9]{2}[0-9]{12}",BJ:"BJ[0-9]{2}[A-Z]{1}[0-9]{23}",BR:"BR[0-9]{2}[0-9]{8}[0-9]{5}[0-9]{10}[A-Z][A-Z0-9]",CH:"CH[0-9]{2}[0-9]{5}[A-Z0-9]{12}",CI:"CI[0-9]{2}[A-Z]{1}[0-9]{23}",CM:"CM[0-9]{2}[0-9]{23}",CR:"CR[0-9]{2}[0-9]{3}[0-9]{14}",CV:"CV[0-9]{2}[0-9]{21}",CY:"CY[0-9]{2}[0-9]{3}[0-9]{5}[A-Z0-9]{16}",CZ:"CZ[0-9]{2}[0-9]{20}",DE:"DE[0-9]{2}[0-9]{8}[0-9]{10}",DK:"DK[0-9]{2}[0-9]{14}",DO:"DO[0-9]{2}[A-Z0-9]{4}[0-9]{20}",DZ:"DZ[0-9]{2}[0-9]{20}",EE:"EE[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{11}[0-9]{1}",ES:"ES[0-9]{2}[0-9]{4}[0-9]{4}[0-9]{1}[0-9]{1}[0-9]{10}",FI:"FI[0-9]{2}[0-9]{6}[0-9]{7}[0-9]{1}",FO:"FO[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}",FR:"FR[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}",GB:"GB[0-9]{2}[A-Z]{4}[0-9]{6}[0-9]{8}",GE:"GE[0-9]{2}[A-Z]{2}[0-9]{16}",GI:"GI[0-9]{2}[A-Z]{4}[A-Z0-9]{15}",GL:"GL[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}",GR:"GR[0-9]{2}[0-9]{3}[0-9]{4}[A-Z0-9]{16}",GT:"GT[0-9]{2}[A-Z0-9]{4}[A-Z0-9]{20}",HR:"HR[0-9]{2}[0-9]{7}[0-9]{10}",HU:"HU[0-9]{2}[0-9]{3}[0-9]{4}[0-9]{1}[0-9]{15}[0-9]{1}",IE:"IE[0-9]{2}[A-Z]{4}[0-9]{6}[0-9]{8}",IL:"IL[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{13}",IR:"IR[0-9]{2}[0-9]{22}",IS:"IS[0-9]{2}[0-9]{4}[0-9]{2}[0-9]{6}[0-9]{10}",IT:"IT[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}",JO:"JO[0-9]{2}[A-Z]{4}[0-9]{4}[0]{8}[A-Z0-9]{10}",KW:"KW[0-9]{2}[A-Z]{4}[0-9]{22}",KZ:"KZ[0-9]{2}[0-9]{3}[A-Z0-9]{13}",LB:"LB[0-9]{2}[0-9]{4}[A-Z0-9]{20}",LI:"LI[0-9]{2}[0-9]{5}[A-Z0-9]{12}",LT:"LT[0-9]{2}[0-9]{5}[0-9]{11}",LU:"LU[0-9]{2}[0-9]{3}[A-Z0-9]{13}",LV:"LV[0-9]{2}[A-Z]{4}[A-Z0-9]{13}",MC:"MC[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}",MD:"MD[0-9]{2}[A-Z0-9]{20}",ME:"ME[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}",MG:"MG[0-9]{2}[0-9]{23}",MK:"MK[0-9]{2}[0-9]{3}[A-Z0-9]{10}[0-9]{2}",ML:"ML[0-9]{2}[A-Z]{1}[0-9]{23}",MR:"MR13[0-9]{5}[0-9]{5}[0-9]{11}[0-9]{2}",MT:"MT[0-9]{2}[A-Z]{4}[0-9]{5}[A-Z0-9]{18}",MU:"MU[0-9]{2}[A-Z]{4}[0-9]{2}[0-9]{2}[0-9]{12}[0-9]{3}[A-Z]{3}",MZ:"MZ[0-9]{2}[0-9]{21}",NL:"NL[0-9]{2}[A-Z]{4}[0-9]{10}",NO:"NO[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{1}",PK:"PK[0-9]{2}[A-Z]{4}[A-Z0-9]{16}",PL:"PL[0-9]{2}[0-9]{8}[0-9]{16}",PS:"PS[0-9]{2}[A-Z]{4}[A-Z0-9]{21}",PT:"PT[0-9]{2}[0-9]{4}[0-9]{4}[0-9]{11}[0-9]{2}",QA:"QA[0-9]{2}[A-Z]{4}[A-Z0-9]{21}",RO:"RO[0-9]{2}[A-Z]{4}[A-Z0-9]{16}",RS:"RS[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}",SA:"SA[0-9]{2}[0-9]{2}[A-Z0-9]{18}",SE:"SE[0-9]{2}[0-9]{3}[0-9]{16}[0-9]{1}",SI:"SI[0-9]{2}[0-9]{5}[0-9]{8}[0-9]{2}",SK:"SK[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{10}",SM:"SM[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}",SN:"SN[0-9]{2}[A-Z]{1}[0-9]{23}",TN:"TN59[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}",TR:"TR[0-9]{2}[0-9]{5}[A-Z0-9]{1}[A-Z0-9]{16}",VG:"VG[0-9]{2}[A-Z]{4}[0-9]{16}"},validate:function(b,c,d){var e=c.val();if(""===e)return!0;e=e.replace(/[^a-zA-Z0-9]/g,"").toUpperCase();var f=d.country;if(f?"string"==typeof f&&this.REGEX[f]||(f=b.getDynamicOption(c,f)):f=e.substr(0,2),!this.REGEX[f])return{valid:!1,message:a.fn.bootstrapValidator.helpers.format(a.fn.bootstrapValidator.i18n.iban.countryNotSupported,f)};if(!new RegExp("^"+this.REGEX[f]+"$").test(e))return{valid:!1,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.iban.country,a.fn.bootstrapValidator.i18n.iban.countries[f])};e=e.substr(4)+e.substr(0,4),e=a.map(e.split(""),function(a){var b=a.charCodeAt(0);return b>="A".charCodeAt(0)&&b<="Z".charCodeAt(0)?b-"A".charCodeAt(0)+10:a}),e=e.join("");for(var g=parseInt(e.substr(0,1),10),h=e.length,i=1;h>i;++i)g=(10*g+parseInt(e.substr(i,1),10))%97;return{valid:1===g,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.iban.country,a.fn.bootstrapValidator.i18n.iban.countries[f])}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.id=a.extend(a.fn.bootstrapValidator.i18n.id||{},{"default":"Please enter a valid identification number",countryNotSupported:"The country code %s is not supported",country:"Please enter a valid identification number in %s",countries:{BA:"Bosnia and Herzegovina",BG:"Bulgaria",BR:"Brazil",CH:"Switzerland",CL:"Chile",CN:"China",CZ:"Czech Republic",DK:"Denmark",EE:"Estonia",ES:"Spain",FI:"Finland",HR:"Croatia",IE:"Ireland",IS:"Iceland",LT:"Lithuania",LV:"Latvia",ME:"Montenegro",MK:"Macedonia",NL:"Netherlands",RO:"Romania",RS:"Serbia",SE:"Sweden",SI:"Slovenia",SK:"Slovakia",SM:"San Marino",TH:"Thailand",ZA:"South Africa"}}),a.fn.bootstrapValidator.validators.id={html5Attributes:{message:"message",country:"country"},COUNTRY_CODES:["BA","BG","BR","CH","CL","CN","CZ","DK","EE","ES","FI","HR","IE","IS","LT","LV","ME","MK","NL","RO","RS","SE","SI","SK","SM","TH","ZA"],validate:function(b,c,d){var e=c.val();if(""===e)return!0;var f=d.country;if(f?("string"!=typeof f||-1===a.inArray(f.toUpperCase(),this.COUNTRY_CODES))&&(f=b.getDynamicOption(c,f)):f=e.substr(0,2),-1===a.inArray(f,this.COUNTRY_CODES))return{valid:!1,message:a.fn.bootstrapValidator.helpers.format(a.fn.bootstrapValidator.i18n.id.countryNotSupported,f)};var g=["_",f.toLowerCase()].join("");return this[g](e)?!0:{valid:!1,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.id.country,a.fn.bootstrapValidator.i18n.id.countries[f.toUpperCase()])}},_validateJMBG:function(a,b){if(!/^\d{13}$/.test(a))return!1;var c=parseInt(a.substr(0,2),10),d=parseInt(a.substr(2,2),10),e=(parseInt(a.substr(4,3),10),parseInt(a.substr(7,2),10)),f=parseInt(a.substr(12,1),10);if(c>31||d>12)return!1;for(var g=0,h=0;6>h;h++)g+=(7-h)*(parseInt(a.charAt(h),10)+parseInt(a.charAt(h+6),10));if(g=11-g%11,(10===g||11===g)&&(g=0),g!==f)return!1;switch(b.toUpperCase()){case"BA":return e>=10&&19>=e;case"MK":return e>=41&&49>=e;case"ME":return e>=20&&29>=e;case"RS":return e>=70&&99>=e;case"SI":return e>=50&&59>=e;default:return!0}},_ba:function(a){return this._validateJMBG(a,"BA")},_mk:function(a){return this._validateJMBG(a,"MK")},_me:function(a){return this._validateJMBG(a,"ME")},_rs:function(a){return this._validateJMBG(a,"RS")},_si:function(a){return this._validateJMBG(a,"SI")},_bg:function(b){if(!/^\d{10}$/.test(b)&&!/^\d{6}\s\d{3}\s\d{1}$/.test(b))return!1;b=b.replace(/\s/g,"");var c=parseInt(b.substr(0,2),10)+1900,d=parseInt(b.substr(2,2),10),e=parseInt(b.substr(4,2),10);if(d>40?(c+=100,d-=40):d>20&&(c-=100,d-=20),!a.fn.bootstrapValidator.helpers.date(c,d,e))return!1;for(var f=0,g=[2,4,8,5,10,9,7,3,6],h=0;9>h;h++)f+=parseInt(b.charAt(h),10)*g[h];return f=f%11%10,f+""===b.substr(9,1)},_br:function(a){if(/^1{11}|2{11}|3{11}|4{11}|5{11}|6{11}|7{11}|8{11}|9{11}|0{11}$/.test(a))return!1;if(!/^\d{11}$/.test(a)&&!/^\d{3}\.\d{3}\.\d{3}-\d{2}$/.test(a))return!1;a=a.replace(/\./g,"").replace(/-/g,"");for(var b=0,c=0;9>c;c++)b+=(10-c)*parseInt(a.charAt(c),10);if(b=11-b%11,(10===b||11===b)&&(b=0),b+""!==a.charAt(9))return!1;var d=0;for(c=0;10>c;c++)d+=(11-c)*parseInt(a.charAt(c),10);return d=11-d%11,(10===d||11===d)&&(d=0),d+""===a.charAt(10)},_ch:function(a){if(!/^756[\.]{0,1}[0-9]{4}[\.]{0,1}[0-9]{4}[\.]{0,1}[0-9]{2}$/.test(a))return!1;a=a.replace(/\D/g,"").substr(3);for(var b=a.length,c=0,d=8===b?[3,1]:[1,3],e=0;b-1>e;e++)c+=parseInt(a.charAt(e),10)*d[e%2];return c=10-c%10,c+""===a.charAt(b-1)},_cl:function(a){if(!/^\d{7,8}[-]{0,1}[0-9K]$/i.test(a))return!1;for(a=a.replace(/\-/g,"");a.length<9;)a="0"+a;for(var b=0,c=[3,2,7,6,5,4,3,2],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b=11-b%11,11===b?b=0:10===b&&(b="K"),b+""===a.charAt(8).toUpperCase()},_cn:function(b){if(b=b.trim(),!/^\d{15}$/.test(b)&&!/^\d{17}[\dXx]{1}$/.test(b))return!1;var c={11:{0:[0],1:[[0,9],[11,17]],2:[0,28,29]},12:{0:[0],1:[[0,16]],2:[0,21,23,25]},13:{0:[0],1:[[0,5],7,8,21,[23,33],[81,85]],2:[[0,5],[7,9],[23,25],27,29,30,81,83],3:[[0,4],[21,24]],4:[[0,4],6,21,[23,35],81],5:[[0,3],[21,35],81,82],6:[[0,4],[21,38],[81,84]],7:[[0,3],5,6,[21,33]],8:[[0,4],[21,28]],9:[[0,3],[21,30],[81,84]],10:[[0,3],[22,26],28,81,82],11:[[0,2],[21,28],81,82]},14:{0:[0],1:[0,1,[5,10],[21,23],81],2:[[0,3],11,12,[21,27]],3:[[0,3],11,21,22],4:[[0,2],11,21,[23,31],81],5:[[0,2],21,22,24,25,81],6:[[0,3],[21,24]],7:[[0,2],[21,29],81],8:[[0,2],[21,30],81,82],9:[[0,2],[21,32],81],10:[[0,2],[21,34],81,82],11:[[0,2],[21,30],81,82],23:[[0,3],22,23,[25,30],32,33]},15:{0:[0],1:[[0,5],[21,25]],2:[[0,7],[21,23]],3:[[0,4]],4:[[0,4],[21,26],[28,30]],5:[[0,2],[21,26],81],6:[[0,2],[21,27]],7:[[0,3],[21,27],[81,85]],8:[[0,2],[21,26]],9:[[0,2],[21,29],81],22:[[0,2],[21,24]],25:[[0,2],[22,31]],26:[[0,2],[24,27],[29,32],34],28:[0,1,[22,27]],29:[0,[21,23]]},21:{0:[0],1:[[0,6],[11,14],[22,24],81],2:[[0,4],[11,13],24,[81,83]],3:[[0,4],11,21,23,81],4:[[0,4],11,[21,23]],5:[[0,5],21,22],6:[[0,4],24,81,82],7:[[0,3],11,26,27,81,82],8:[[0,4],11,81,82],9:[[0,5],11,21,22],10:[[0,5],11,21,81],11:[[0,3],21,22],12:[[0,2],4,21,23,24,81,82],13:[[0,3],21,22,24,81,82],14:[[0,4],21,22,81]},22:{0:[0],1:[[0,6],12,22,[81,83]],2:[[0,4],11,21,[81,84]],3:[[0,3],22,23,81,82],4:[[0,3],21,22],5:[[0,3],21,23,24,81,82],6:[[0,2],4,5,[21,23],25,81],7:[[0,2],[21,24],81],8:[[0,2],21,22,81,82],24:[[0,6],24,26]},23:{0:[0],1:[[0,12],21,[23,29],[81,84]],2:[[0,8],21,[23,25],27,[29,31],81],3:[[0,7],21,81,82],4:[[0,7],21,22],5:[[0,3],5,6,[21,24]],6:[[0,6],[21,24]],7:[[0,16],22,81],8:[[0,5],11,22,26,28,33,81,82],9:[[0,4],21],10:[[0,5],24,25,81,[83,85]],11:[[0,2],21,23,24,81,82],12:[[0,2],[21,26],[81,83]],27:[[0,4],[21,23]]},31:{0:[0],1:[0,1,[3,10],[12,20]],2:[0,30]},32:{0:[0],1:[[0,7],11,[13,18],24,25],2:[[0,6],11,81,82],3:[[0,5],11,12,[21,24],81,82],4:[[0,2],4,5,11,12,81,82],5:[[0,9],[81,85]],6:[[0,2],11,12,21,23,[81,84]],7:[0,1,3,5,6,[21,24]],8:[[0,4],11,26,[29,31]],9:[[0,3],[21,25],28,81,82],10:[[0,3],11,12,23,81,84,88],11:[[0,2],11,12,[81,83]],12:[[0,4],[81,84]],13:[[0,2],11,[21,24]]},33:{0:[0],1:[[0,6],[8,10],22,27,82,83,85],2:[0,1,[3,6],11,12,25,26,[81,83]],3:[[0,4],22,24,[26,29],81,82],4:[[0,2],11,21,24,[81,83]],5:[[0,3],[21,23]],6:[[0,2],21,24,[81,83]],7:[[0,3],23,26,27,[81,84]],8:[[0,3],22,24,25,81],9:[[0,3],21,22],10:[[0,4],[21,24],81,82],11:[[0,2],[21,27],81]},34:{0:[0],1:[[0,4],11,[21,24],81],2:[[0,4],7,8,[21,23],25],3:[[0,4],11,[21,23]],4:[[0,6],21],5:[[0,4],6,[21,23]],6:[[0,4],21],7:[[0,3],11,21],8:[[0,3],11,[22,28],81],10:[[0,4],[21,24]],11:[[0,3],22,[24,26],81,82],12:[[0,4],21,22,25,26,82],13:[[0,2],[21,24]],14:[[0,2],[21,24]],15:[[0,3],[21,25]],16:[[0,2],[21,23]],17:[[0,2],[21,23]],18:[[0,2],[21,25],81]},35:{0:[0],1:[[0,5],11,[21,25],28,81,82],2:[[0,6],[11,13]],3:[[0,5],22],4:[[0,3],21,[23,30],81],5:[[0,5],21,[24,27],[81,83]],6:[[0,3],[22,29],81],7:[[0,2],[21,25],[81,84]],8:[[0,2],[21,25],81],9:[[0,2],[21,26],81,82]},36:{0:[0],1:[[0,5],11,[21,24]],2:[[0,3],22,81],3:[[0,2],13,[21,23]],4:[[0,3],21,[23,30],81,82],5:[[0,2],21],6:[[0,2],22,81],7:[[0,2],[21,35],81,82],8:[[0,3],[21,30],81],9:[[0,2],[21,26],[81,83]],10:[[0,2],[21,30]],11:[[0,2],[21,30],81]},37:{0:[0],1:[[0,5],12,13,[24,26],81],2:[[0,3],5,[11,14],[81,85]],3:[[0,6],[21,23]],4:[[0,6],81],5:[[0,3],[21,23]],6:[[0,2],[11,13],34,[81,87]],7:[[0,5],24,25,[81,86]],8:[[0,2],11,[26,32],[81,83]],9:[[0,3],11,21,23,82,83],10:[[0,2],[81,83]],11:[[0,3],21,22],12:[[0,3]],13:[[0,2],11,12,[21,29]],14:[[0,2],[21,28],81,82],15:[[0,2],[21,26],81],16:[[0,2],[21,26]],17:[[0,2],[21,28]]},41:{0:[0],1:[[0,6],8,22,[81,85]],2:[[0,5],11,[21,25]],3:[[0,7],11,[22,29],81],4:[[0,4],11,[21,23],25,81,82],5:[[0,3],5,6,22,23,26,27,81],6:[[0,3],11,21,22],7:[[0,4],11,21,[24,28],81,82],8:[[0,4],11,[21,23],25,[81,83]],9:[[0,2],22,23,[26,28]],10:[[0,2],[23,25],81,82],11:[[0,4],[21,23]],12:[[0,2],21,22,24,81,82],13:[[0,3],[21,30],81],14:[[0,3],[21,26],81],15:[[0,3],[21,28]],16:[[0,2],[21,28],81],17:[[0,2],[21,29]],90:[0,1]},42:{0:[0],1:[[0,7],[11,17]],2:[[0,5],22,81],3:[[0,3],[21,25],81],5:[[0,6],[25,29],[81,83]],6:[[0,2],6,7,[24,26],[82,84]],7:[[0,4]],8:[[0,2],4,21,22,81],9:[[0,2],[21,23],81,82,84],10:[[0,3],[22,24],81,83,87],11:[[0,2],[21,27],81,82],12:[[0,2],[21,24],81],13:[[0,3],21,81],28:[[0,2],22,23,[25,28]],90:[0,[4,6],21]},43:{0:[0],1:[[0,5],11,12,21,22,24,81],2:[[0,4],11,21,[23,25],81],3:[[0,2],4,21,81,82],4:[0,1,[5,8],12,[21,24],26,81,82],5:[[0,3],11,[21,25],[27,29],81],6:[[0,3],11,21,23,24,26,81,82],7:[[0,3],[21,26],81],8:[[0,2],11,21,22],9:[[0,3],[21,23],81],10:[[0,3],[21,28],81],11:[[0,3],[21,29]],12:[[0,2],[21,30],81],13:[[0,2],21,22,81,82],31:[0,1,[22,27],30]},44:{0:[0],1:[[0,7],[11,16],83,84],2:[[0,5],21,22,24,29,32,33,81,82],3:[0,1,[3,8]],4:[[0,4]],5:[0,1,[6,15],23,82,83],6:[0,1,[4,8]],7:[0,1,[3,5],81,[83,85]],8:[[0,4],11,23,25,[81,83]],9:[[0,3],23,[81,83]],12:[[0,3],[23,26],83,84],13:[[0,3],[22,24],81],14:[[0,2],[21,24],26,27,81],15:[[0,2],21,23,81],16:[[0,2],[21,25]],17:[[0,2],21,23,81],18:[[0,3],21,23,[25,27],81,82],19:[0],20:[0],51:[[0,3],21,22],52:[[0,3],21,22,24,81],53:[[0,2],[21,23],81]},45:{0:[0],1:[[0,9],[21,27]],2:[[0,5],[21,26]],3:[[0,5],11,12,[21,32]],4:[0,1,[3,6],11,[21,23],81],5:[[0,3],12,21],6:[[0,3],21,81],7:[[0,3],21,22],8:[[0,4],21,81],9:[[0,3],[21,24],81],10:[[0,2],[21,31]],11:[[0,2],[21,23]],12:[[0,2],[21,29],81],13:[[0,2],[21,24],81],14:[[0,2],[21,25],81]},46:{0:[0],1:[0,1,[5,8]],2:[0,1],3:[0,[21,23]],90:[[0,3],[5,7],[21,39]]},50:{0:[0],1:[[0,19]],2:[0,[22,38],[40,43]],3:[0,[81,84]]},51:{0:[0],1:[0,1,[4,8],[12,15],[21,24],29,31,32,[81,84]],3:[[0,4],11,21,22],4:[[0,3],11,21,22],5:[[0,4],21,22,24,25],6:[0,1,3,23,26,[81,83]],7:[0,1,3,4,[22,27],81],8:[[0,2],11,12,[21,24]],9:[[0,4],[21,23]],10:[[0,2],11,24,25,28],11:[[0,2],[11,13],23,24,26,29,32,33,81],13:[[0,4],[21,25],81],14:[[0,2],[21,25]],15:[[0,3],[21,29]],16:[[0,3],[21,23],81],17:[[0,3],[21,25],81],18:[[0,3],[21,27]],19:[[0,3],[21,23]],20:[[0,2],21,22,81],32:[0,[21,33]],33:[0,[21,38]],34:[0,1,[22,37]]},52:{0:[0],1:[[0,3],[11,15],[21,23],81],2:[0,1,3,21,22],3:[[0,3],[21,30],81,82],4:[[0,2],[21,25]],5:[[0,2],[21,27]],6:[[0,3],[21,28]],22:[0,1,[22,30]],23:[0,1,[22,28]],24:[0,1,[22,28]],26:[0,1,[22,36]],27:[[0,2],22,23,[25,32]]},53:{0:[0],1:[[0,3],[11,14],21,22,[24,29],81],3:[[0,2],[21,26],28,81],4:[[0,2],[21,28]],5:[[0,2],[21,24]],6:[[0,2],[21,30]],7:[[0,2],[21,24]],8:[[0,2],[21,29]],9:[[0,2],[21,27]],23:[0,1,[22,29],31],25:[[0,4],[22,32]],26:[0,1,[21,28]],27:[0,1,[22,30]],28:[0,1,22,23],29:[0,1,[22,32]],31:[0,2,3,[22,24]],34:[0,[21,23]],33:[0,21,[23,25]],35:[0,[21,28]]},54:{0:[0],1:[[0,2],[21,27]],21:[0,[21,29],32,33],22:[0,[21,29],[31,33]],23:[0,1,[22,38]],24:[0,[21,31]],25:[0,[21,27]],26:[0,[21,27]]},61:{0:[0],1:[[0,4],[11,16],22,[24,26]],2:[[0,4],22],3:[[0,4],[21,24],[26,31]],4:[[0,4],[22,31],81],5:[[0,2],[21,28],81,82],6:[[0,2],[21,32]],7:[[0,2],[21,30]],8:[[0,2],[21,31]],9:[[0,2],[21,29]],10:[[0,2],[21,26]]},62:{0:[0],1:[[0,5],11,[21,23]],2:[0,1],3:[[0,2],21],4:[[0,3],[21,23]],5:[[0,3],[21,25]],6:[[0,2],[21,23]],7:[[0,2],[21,25]],8:[[0,2],[21,26]],9:[[0,2],[21,24],81,82],10:[[0,2],[21,27]],11:[[0,2],[21,26]],12:[[0,2],[21,28]],24:[0,21,[24,29]],26:[0,21,[23,30]],29:[0,1,[21,27]],30:[0,1,[21,27]]},63:{0:[0],1:[[0,5],[21,23]],2:[0,2,[21,25]],21:[0,[21,23],[26,28]],22:[0,[21,24]],23:[0,[21,24]],25:[0,[21,25]],26:[0,[21,26]],27:[0,1,[21,26]],28:[[0,2],[21,23]]},64:{0:[0],1:[0,1,[4,6],21,22,81],2:[[0,3],5,[21,23]],3:[[0,3],[21,24],81],4:[[0,2],[21,25]],5:[[0,2],21,22]},65:{0:[0],1:[[0,9],21],2:[[0,5]],21:[0,1,22,23],22:[0,1,22,23],23:[[0,3],[23,25],27,28],28:[0,1,[22,29]],29:[0,1,[22,29]],30:[0,1,[22,24]],31:[0,1,[21,31]],32:[0,1,[21,27]],40:[0,2,3,[21,28]],42:[[0,2],21,[23,26]],43:[0,1,[21,26]],90:[[0,4]],27:[[0,2],22,23]},71:{0:[0]},81:{0:[0]},82:{0:[0]}},d=parseInt(b.substr(0,2),10),e=parseInt(b.substr(2,2),10),f=parseInt(b.substr(4,2),10);if(!c[d]||!c[d][e])return!1;for(var g=!1,h=c[d][e],i=0;i<h.length;i++)if(a.isArray(h[i])&&h[i][0]<=f&&f<=h[i][1]||!a.isArray(h[i])&&f===h[i]){g=!0;break}if(!g)return!1;var j;j=18===b.length?b.substr(6,8):"19"+b.substr(6,6);var k=parseInt(j.substr(0,4),10),l=parseInt(j.substr(4,2),10),m=parseInt(j.substr(6,2),10);if(!a.fn.bootstrapValidator.helpers.date(k,l,m))return!1;if(18===b.length){var n=0,o=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];for(i=0;17>i;i++)n+=parseInt(b.charAt(i),10)*o[i];n=(12-n%11)%11;var p="X"!==b.charAt(17).toUpperCase()?parseInt(b.charAt(17),10):10;return p===n}return!0 +},_cz:function(b){if(!/^\d{9,10}$/.test(b))return!1;var c=1900+parseInt(b.substr(0,2),10),d=parseInt(b.substr(2,2),10)%50%20,e=parseInt(b.substr(4,2),10);if(9===b.length){if(c>=1980&&(c-=100),c>1953)return!1}else 1954>c&&(c+=100);if(!a.fn.bootstrapValidator.helpers.date(c,d,e))return!1;if(10===b.length){var f=parseInt(b.substr(0,9),10)%11;return 1985>c&&(f%=10),f+""===b.substr(9,1)}return!0},_dk:function(b){if(!/^[0-9]{6}[-]{0,1}[0-9]{4}$/.test(b))return!1;b=b.replace(/-/g,"");var c=parseInt(b.substr(0,2),10),d=parseInt(b.substr(2,2),10),e=parseInt(b.substr(4,2),10);switch(!0){case-1!=="5678".indexOf(b.charAt(6))&&e>=58:e+=1800;break;case-1!=="0123".indexOf(b.charAt(6)):case-1!=="49".indexOf(b.charAt(6))&&e>=37:e+=1900;break;default:e+=2e3}return a.fn.bootstrapValidator.helpers.date(e,d,c)},_ee:function(a){return this._lt(a)},_es:function(a){if(!/^[0-9A-Z]{8}[-]{0,1}[0-9A-Z]$/.test(a)&&!/^[XYZ][-]{0,1}[0-9]{7}[-]{0,1}[0-9A-Z]$/.test(a))return!1;a=a.replace(/-/g,"");var b="XYZ".indexOf(a.charAt(0));-1!==b&&(a=b+a.substr(1)+"");var c=parseInt(a.substr(0,8),10);return c="TRWAGMYFPDXBNJZSQVHLCKE"[c%23],c===a.substr(8,1)},_fi:function(b){if(!/^[0-9]{6}[-+A][0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/.test(b))return!1;var c=parseInt(b.substr(0,2),10),d=parseInt(b.substr(2,2),10),e=parseInt(b.substr(4,2),10),f={"+":1800,"-":1900,A:2e3};if(e=f[b.charAt(6)]+e,!a.fn.bootstrapValidator.helpers.date(e,d,c))return!1;var g=parseInt(b.substr(7,3),10);if(2>g)return!1;var h=b.substr(0,6)+b.substr(7,3)+"";return h=parseInt(h,10),"0123456789ABCDEFHJKLMNPRSTUVWXY".charAt(h%31)===b.charAt(10)},_hr:function(b){return/^[0-9]{11}$/.test(b)?a.fn.bootstrapValidator.helpers.mod11And10(b):!1},_ie:function(a){if(!/^\d{7}[A-W][AHWTX]?$/.test(a))return!1;var b=function(a){for(;a.length<7;)a="0"+a;for(var b="WABCDEFGHIJKLMNOPQRSTUV",c=0,d=0;7>d;d++)c+=parseInt(a.charAt(d),10)*(8-d);return c+=9*b.indexOf(a.substr(7)),b[c%23]};return 9!==a.length||"A"!==a.charAt(8)&&"H"!==a.charAt(8)?a.charAt(7)===b(a.substr(0,7)):a.charAt(7)===b(a.substr(0,7)+a.substr(8)+"")},_is:function(b){if(!/^[0-9]{6}[-]{0,1}[0-9]{4}$/.test(b))return!1;b=b.replace(/-/g,"");var c=parseInt(b.substr(0,2),10),d=parseInt(b.substr(2,2),10),e=parseInt(b.substr(4,2),10),f=parseInt(b.charAt(9),10);if(e=9===f?1900+e:100*(20+f)+e,!a.fn.bootstrapValidator.helpers.date(e,d,c,!0))return!1;for(var g=0,h=[3,2,7,6,5,4,3,2],i=0;8>i;i++)g+=parseInt(b.charAt(i),10)*h[i];return g=11-g%11,g+""===b.charAt(8)},_lt:function(b){if(!/^[0-9]{11}$/.test(b))return!1;var c=parseInt(b.charAt(0),10),d=parseInt(b.substr(1,2),10),e=parseInt(b.substr(3,2),10),f=parseInt(b.substr(5,2),10),g=c%2===0?17+c/2:17+(c+1)/2;if(d=100*g+d,!a.fn.bootstrapValidator.helpers.date(d,e,f,!0))return!1;for(var h=0,i=[1,2,3,4,5,6,7,8,9,1],j=0;10>j;j++)h+=parseInt(b.charAt(j),10)*i[j];if(h%=11,10!==h)return h+""===b.charAt(10);for(h=0,i=[3,4,5,6,7,8,9,1,2,3],j=0;10>j;j++)h+=parseInt(b.charAt(j),10)*i[j];return h%=11,10===h&&(h=0),h+""===b.charAt(10)},_lv:function(b){if(!/^[0-9]{6}[-]{0,1}[0-9]{5}$/.test(b))return!1;b=b.replace(/\D/g,"");var c=parseInt(b.substr(0,2),10),d=parseInt(b.substr(2,2),10),e=parseInt(b.substr(4,2),10);if(e=e+1800+100*parseInt(b.charAt(6),10),!a.fn.bootstrapValidator.helpers.date(e,d,c,!0))return!1;for(var f=0,g=[10,5,8,4,2,1,6,3,7,9],h=0;10>h;h++)f+=parseInt(b.charAt(h),10)*g[h];return f=(f+1)%11%10,f+""===b.charAt(10)},_nl:function(a){for(;a.length<9;)a="0"+a;if(!/^[0-9]{4}[.]{0,1}[0-9]{2}[.]{0,1}[0-9]{3}$/.test(a))return!1;if(a=a.replace(/\./g,""),0===parseInt(a,10))return!1;for(var b=0,c=a.length,d=0;c-1>d;d++)b+=(9-d)*parseInt(a.charAt(d),10);return b%=11,10===b&&(b=0),b+""===a.charAt(c-1)},_ro:function(b){if(!/^[0-9]{13}$/.test(b))return!1;var c=parseInt(b.charAt(0),10);if(0===c||7===c||8===c)return!1;var d=parseInt(b.substr(1,2),10),e=parseInt(b.substr(3,2),10),f=parseInt(b.substr(5,2),10),g={1:1900,2:1900,3:1800,4:1800,5:2e3,6:2e3};if(f>31&&e>12)return!1;if(9!==c&&(d=g[c+""]+d,!a.fn.bootstrapValidator.helpers.date(d,e,f)))return!1;for(var h=0,i=[2,7,9,1,4,6,3,5,8,2,7,9],j=b.length,k=0;j-1>k;k++)h+=parseInt(b.charAt(k),10)*i[k];return h%=11,10===h&&(h=1),h+""===b.charAt(j-1)},_se:function(b){if(!/^[0-9]{10}$/.test(b)&&!/^[0-9]{6}[-|+][0-9]{4}$/.test(b))return!1;b=b.replace(/[^0-9]/g,"");var c=parseInt(b.substr(0,2),10)+1900,d=parseInt(b.substr(2,2),10),e=parseInt(b.substr(4,2),10);return a.fn.bootstrapValidator.helpers.date(c,d,e)?a.fn.bootstrapValidator.helpers.luhn(b):!1},_sk:function(a){return this._cz(a)},_sm:function(a){return/^\d{5}$/.test(a)},_th:function(a){if(13!==a.length)return!1;for(var b=0,c=0;12>c;c++)b+=parseInt(a.charAt(c),10)*(13-c);return(11-b%11)%10===parseInt(a.charAt(12),10)},_za:function(b){if(!/^[0-9]{10}[0|1][8|9][0-9]$/.test(b))return!1;var c=parseInt(b.substr(0,2),10),d=(new Date).getFullYear()%100,e=parseInt(b.substr(2,2),10),f=parseInt(b.substr(4,2),10);return c=c>=d?c+1900:c+2e3,a.fn.bootstrapValidator.helpers.date(c,e,f)?a.fn.bootstrapValidator.helpers.luhn(b):!1}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.identical=a.extend(a.fn.bootstrapValidator.i18n.identical||{},{"default":"Please enter the same value"}),a.fn.bootstrapValidator.validators.identical={html5Attributes:{message:"message",field:"field"},validate:function(a,b,c){var d=b.val();if(""===d)return!0;var e=a.getFieldElements(c.field);return null===e||0===e.length?!0:d===e.val()?(a.updateStatus(c.field,a.STATUS_VALID,"identical"),!0):!1}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.imei=a.extend(a.fn.bootstrapValidator.i18n.imei||{},{"default":"Please enter a valid IMEI number"}),a.fn.bootstrapValidator.validators.imei={validate:function(b,c){var d=c.val();if(""===d)return!0;switch(!0){case/^\d{15}$/.test(d):case/^\d{2}-\d{6}-\d{6}-\d{1}$/.test(d):case/^\d{2}\s\d{6}\s\d{6}\s\d{1}$/.test(d):return d=d.replace(/[^0-9]/g,""),a.fn.bootstrapValidator.helpers.luhn(d);case/^\d{14}$/.test(d):case/^\d{16}$/.test(d):case/^\d{2}-\d{6}-\d{6}(|-\d{2})$/.test(d):case/^\d{2}\s\d{6}\s\d{6}(|\s\d{2})$/.test(d):return!0;default:return!1}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.imo=a.extend(a.fn.bootstrapValidator.i18n.imo||{},{"default":"Please enter a valid IMO number"}),a.fn.bootstrapValidator.validators.imo={validate:function(a,b){var c=b.val();if(""===c)return!0;if(!/^IMO \d{7}$/i.test(c))return!1;for(var d=0,e=c.replace(/^.*(\d{7})$/,"$1"),f=6;f>=1;f--)d+=e.slice(6-f,-f)*(f+1);return d%10===parseInt(e.charAt(6),10)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.integer=a.extend(a.fn.bootstrapValidator.i18n.integer||{},{"default":"Please enter a valid number"}),a.fn.bootstrapValidator.validators.integer={enableByHtml5:function(a){return"number"===a.attr("type")&&(void 0===a.attr("step")||a.attr("step")%1===0)},validate:function(a,b){if(this.enableByHtml5(b)&&b.get(0).validity&&b.get(0).validity.badInput===!0)return!1;var c=b.val();return""===c?!0:/^(?:-?(?:0|[1-9][0-9]*))$/.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.ip=a.extend(a.fn.bootstrapValidator.i18n.ip||{},{"default":"Please enter a valid IP address",ipv4:"Please enter a valid IPv4 address",ipv6:"Please enter a valid IPv6 address"}),a.fn.bootstrapValidator.validators.ip={html5Attributes:{message:"message",ipv4:"ipv4",ipv6:"ipv6"},validate:function(b,c,d){var e=c.val();if(""===e)return!0;d=a.extend({},{ipv4:!0,ipv6:!0},d);var f,g=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,h=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,i=!1;switch(!0){case d.ipv4&&!d.ipv6:i=g.test(e),f=d.message||a.fn.bootstrapValidator.i18n.ip.ipv4;break;case!d.ipv4&&d.ipv6:i=h.test(e),f=d.message||a.fn.bootstrapValidator.i18n.ip.ipv6;break;case d.ipv4&&d.ipv6:default:i=g.test(e)||h.test(e),f=d.message||a.fn.bootstrapValidator.i18n.ip["default"]}return{valid:i,message:f}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.isbn=a.extend(a.fn.bootstrapValidator.i18n.isbn||{},{"default":"Please enter a valid ISBN number"}),a.fn.bootstrapValidator.validators.isbn={validate:function(a,b){var c=b.val();if(""===c)return!0;var d;switch(!0){case/^\d{9}[\dX]$/.test(c):case 13===c.length&&/^(\d+)-(\d+)-(\d+)-([\dX])$/.test(c):case 13===c.length&&/^(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(c):d="ISBN10";break;case/^(978|979)\d{9}[\dX]$/.test(c):case 17===c.length&&/^(978|979)-(\d+)-(\d+)-(\d+)-([\dX])$/.test(c):case 17===c.length&&/^(978|979)\s(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(c):d="ISBN13";break;default:return!1}c=c.replace(/[^0-9X]/gi,"");var e,f,g=c.split(""),h=g.length,i=0;switch(d){case"ISBN10":for(i=0,e=0;h-1>e;e++)i+=parseInt(g[e],10)*(10-e);return f=11-i%11,11===f?f=0:10===f&&(f="X"),f+""===g[h-1];case"ISBN13":for(i=0,e=0;h-1>e;e++)i+=e%2===0?parseInt(g[e],10):3*parseInt(g[e],10);return f=10-i%10,10===f&&(f="0"),f+""===g[h-1];default:return!1}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.isin=a.extend(a.fn.bootstrapValidator.i18n.isin||{},{"default":"Please enter a valid ISIN number"}),a.fn.bootstrapValidator.validators.isin={COUNTRY_CODES:"AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|SS|ES|LK|SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|YE|ZM|ZW",validate:function(a,b){var c=b.val();if(""===c)return!0;c=c.toUpperCase();var d=new RegExp("^("+this.COUNTRY_CODES+")[0-9A-Z]{10}$");if(!d.test(c))return!1;for(var e="",f=c.length,g=0;f-1>g;g++){var h=c.charCodeAt(g);e+=h>57?(h-55).toString():c.charAt(g)}var i="",j=e.length,k=j%2!==0?0:1;for(g=0;j>g;g++)i+=parseInt(e[g],10)*(g%2===k?2:1)+"";var l=0;for(g=0;g<i.length;g++)l+=parseInt(i.charAt(g),10);return l=(10-l%10)%10,l+""===c.charAt(f-1)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.ismn=a.extend(a.fn.bootstrapValidator.i18n.ismn||{},{"default":"Please enter a valid ISMN number"}),a.fn.bootstrapValidator.validators.ismn={validate:function(a,b){var c=b.val();if(""===c)return!0;var d;switch(!0){case/^M\d{9}$/.test(c):case/^M-\d{4}-\d{4}-\d{1}$/.test(c):case/^M\s\d{4}\s\d{4}\s\d{1}$/.test(c):d="ISMN10";break;case/^9790\d{9}$/.test(c):case/^979-0-\d{4}-\d{4}-\d{1}$/.test(c):case/^979\s0\s\d{4}\s\d{4}\s\d{1}$/.test(c):d="ISMN13";break;default:return!1}"ISMN10"===d&&(c="9790"+c.substr(1)),c=c.replace(/[^0-9]/gi,"");for(var e=c.length,f=0,g=[1,3],h=0;e-1>h;h++)f+=parseInt(c.charAt(h),10)*g[h%2];return f=10-f%10,f+""===c.charAt(e-1)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.issn=a.extend(a.fn.bootstrapValidator.i18n.issn||{},{"default":"Please enter a valid ISSN number"}),a.fn.bootstrapValidator.validators.issn={validate:function(a,b){var c=b.val();if(""===c)return!0;if(!/^\d{4}\-\d{3}[\dX]$/.test(c))return!1;c=c.replace(/[^0-9X]/gi,"");var d=c.split(""),e=d.length,f=0;"X"===d[7]&&(d[7]=10);for(var g=0;e>g;g++)f+=parseInt(d[g],10)*(8-g);return f%11===0}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.lessThan=a.extend(a.fn.bootstrapValidator.i18n.lessThan||{},{"default":"Please enter a value less than or equal to %s",notInclusive:"Please enter a value less than %s"}),a.fn.bootstrapValidator.validators.lessThan={html5Attributes:{message:"message",value:"value",inclusive:"inclusive"},enableByHtml5:function(a){var b=a.attr("type"),c=a.attr("max");return c&&"date"!==b?{value:c}:!1},validate:function(b,c,d){var e=c.val();if(""===e)return!0;if(e=this._format(e),!a.isNumeric(e))return!1;var f=a.isNumeric(d.value)?d.value:b.getDynamicOption(c,d.value),g=this._format(f);return e=parseFloat(e),d.inclusive===!0||void 0===d.inclusive?{valid:g>=e,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.lessThan["default"],f)}:{valid:g>e,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.lessThan.notInclusive,f)}},_format:function(a){return(a+"").replace(",",".")}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.mac=a.extend(a.fn.bootstrapValidator.i18n.mac||{},{"default":"Please enter a valid MAC address"}),a.fn.bootstrapValidator.validators.mac={validate:function(a,b){var c=b.val();return""===c?!0:/^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$/.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.meid=a.extend(a.fn.bootstrapValidator.i18n.meid||{},{"default":"Please enter a valid MEID number"}),a.fn.bootstrapValidator.validators.meid={validate:function(b,c){var d=c.val();if(""===d)return!0;switch(!0){case/^[0-9A-F]{15}$/i.test(d):case/^[0-9A-F]{2}[- ][0-9A-F]{6}[- ][0-9A-F]{6}[- ][0-9A-F]$/i.test(d):case/^\d{19}$/.test(d):case/^\d{5}[- ]\d{5}[- ]\d{4}[- ]\d{4}[- ]\d$/.test(d):var e=d.charAt(d.length-1);if(d=d.replace(/[- ]/g,""),d.match(/^\d*$/i))return a.fn.bootstrapValidator.helpers.luhn(d);d=d.slice(0,-1);for(var f="",g=1;13>=g;g+=2)f+=(2*parseInt(d.charAt(g),16)).toString(16);var h=0;for(g=0;g<f.length;g++)h+=parseInt(f.charAt(g),16);return h%10===0?"0"===e:e===(2*(10*Math.floor((h+10)/10)-h)).toString(16);case/^[0-9A-F]{14}$/i.test(d):case/^[0-9A-F]{2}[- ][0-9A-F]{6}[- ][0-9A-F]{6}$/i.test(d):case/^\d{18}$/.test(d):case/^\d{5}[- ]\d{5}[- ]\d{4}[- ]\d{4}$/.test(d):return!0;default:return!1}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.notEmpty=a.extend(a.fn.bootstrapValidator.i18n.notEmpty||{},{"default":"Please enter a value"}),a.fn.bootstrapValidator.validators.notEmpty={enableByHtml5:function(a){var b=a.attr("required")+"";return"required"===b||"true"===b},validate:function(b,c){var d=c.attr("type");return"radio"===d||"checkbox"===d?b.getFieldElements(c.attr("data-bv-field")).filter(":checked").length>0:"number"===d&&c.get(0).validity&&c.get(0).validity.badInput===!0?!0:""!==a.trim(c.val())}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.numeric=a.extend(a.fn.bootstrapValidator.i18n.numeric||{},{"default":"Please enter a valid float number"}),a.fn.bootstrapValidator.validators.numeric={html5Attributes:{message:"message",separator:"separator"},enableByHtml5:function(a){return"number"===a.attr("type")&&void 0!==a.attr("step")&&a.attr("step")%1!==0},validate:function(a,b,c){if(this.enableByHtml5(b)&&b.get(0).validity&&b.get(0).validity.badInput===!0)return!1;var d=b.val();if(""===d)return!0;var e=c.separator||".";return"."!==e&&(d=d.replace(e,".")),!isNaN(parseFloat(d))&&isFinite(d)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.phone=a.extend(a.fn.bootstrapValidator.i18n.phone||{},{"default":"Please enter a valid phone number",countryNotSupported:"The country code %s is not supported",country:"Please enter a valid phone number in %s",countries:{BR:"Brazil",CN:"China",CZ:"Czech Republic",DE:"Germany",DK:"Denmark",ES:"Spain",FR:"France",GB:"United Kingdom",MA:"Morocco",PK:"Pakistan",RO:"Romania",RU:"Russia",SK:"Slovakia",TH:"Thailand",US:"USA",VE:"Venezuela"}}),a.fn.bootstrapValidator.validators.phone={html5Attributes:{message:"message",country:"country"},COUNTRY_CODES:["BR","CN","CZ","DE","DK","ES","FR","GB","MA","PK","RO","RU","SK","TH","US","VE"],validate:function(b,c,d){var e=c.val();if(""===e)return!0;var f=d.country;if(("string"!=typeof f||-1===a.inArray(f,this.COUNTRY_CODES))&&(f=b.getDynamicOption(c,f)),!f||-1===a.inArray(f.toUpperCase(),this.COUNTRY_CODES))return{valid:!1,message:a.fn.bootstrapValidator.helpers.format(a.fn.bootstrapValidator.i18n.phone.countryNotSupported,f)};var g=!0;switch(f.toUpperCase()){case"BR":e=a.trim(e),g=/^(([\d]{4}[-.\s]{1}[\d]{2,3}[-.\s]{1}[\d]{2}[-.\s]{1}[\d]{2})|([\d]{4}[-.\s]{1}[\d]{3}[-.\s]{1}[\d]{4})|((\(?\+?[0-9]{2}\)?\s?)?(\(?\d{2}\)?\s?)?\d{4,5}[-.\s]?\d{4}))$/.test(e);break;case"CN":e=a.trim(e),g=/^((00|\+)?(86(?:-| )))?((\d{11})|(\d{3}[- ]{1}\d{4}[- ]{1}\d{4})|((\d{2,4}[- ]){1}(\d{7,8}|(\d{3,4}[- ]{1}\d{4}))([- ]{1}\d{1,4})?))$/.test(e);break;case"CZ":g=/^(((00)([- ]?)|\+)(420)([- ]?))?((\d{3})([- ]?)){2}(\d{3})$/.test(e);break;case"DE":e=a.trim(e),g=/^(((((((00|\+)49[ \-/]?)|0)[1-9][0-9]{1,4})[ \-/]?)|((((00|\+)49\()|\(0)[1-9][0-9]{1,4}\)[ \-/]?))[0-9]{1,7}([ \-/]?[0-9]{1,5})?)$/.test(e);break;case"DK":e=a.trim(e),g=/^(\+45|0045|\(45\))?\s?[2-9](\s?\d){7}$/.test(e);break;case"ES":e=a.trim(e),g=/^(?:(?:(?:\+|00)34\D?))?(?:9|6)(?:\d\D?){8}$/.test(e);break;case"FR":e=a.trim(e),g=/^(?:(?:(?:\+|00)33[ ]?(?:\(0\)[ ]?)?)|0){1}[1-9]{1}([ .-]?)(?:\d{2}\1?){3}\d{2}$/.test(e);break;case"GB":e=a.trim(e),g=/^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}|\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4}|\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3})|\d{5}\)?[\s-]?\d{4,5}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|\#)\d+)?)$/.test(e);break;case"MA":e=a.trim(e),g=/^(?:(?:(?:\+|00)212[\s]?(?:[\s]?\(0\)[\s]?)?)|0){1}(?:5[\s.-]?[2-3]|6[\s.-]?[13-9]){1}[0-9]{1}(?:[\s.-]?\d{2}){3}$/.test(e);break;case"PK":e=a.trim(e),g=/^0?3[0-9]{2}[0-9]{7}$/.test(e);break;case"RO":g=/^(\+4|)?(07[0-8]{1}[0-9]{1}|02[0-9]{2}|03[0-9]{2}){1}?(\s|\.|\-)?([0-9]{3}(\s|\.|\-|)){2}$/g.test(e);break;case"RU":g=/^((8|\+7|007)[\-\.\/ ]?)?([\(\/\.]?\d{3}[\)\/\.]?[\-\.\/ ]?)?[\d\-\.\/ ]{7,10}$/g.test(e);break;case"SK":g=/^(((00)([- ]?)|\+)(420)([- ]?))?((\d{3})([- ]?)){2}(\d{3})$/.test(e);break;case"TH":g=/^0\(?([6|8-9]{2})*-([0-9]{3})*-([0-9]{4})$/.test(e);break;case"VE":e=a.trim(e),g=/^0(?:2(?:12|4[0-9]|5[1-9]|6[0-9]|7[0-8]|8[1-35-8]|9[1-5]|3[45789])|4(?:1[246]|2[46]))\d{7}$/.test(e);break;case"US":default:e=e.replace(/\D/g,""),g=/^(?:(1\-?)|(\+1 ?))?\(?(\d{3})[\)\-\.]?(\d{3})[\-\.]?(\d{4})$/.test(e)&&10===e.length}return{valid:g,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.phone.country,a.fn.bootstrapValidator.i18n.phone.countries[f])}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.regexp=a.extend(a.fn.bootstrapValidator.i18n.regexp||{},{"default":"Please enter a value matching the pattern"}),a.fn.bootstrapValidator.validators.regexp={html5Attributes:{message:"message",regexp:"regexp"},enableByHtml5:function(a){var b=a.attr("pattern");return b?{regexp:b}:!1},validate:function(a,b,c){var d=b.val();if(""===d)return!0;var e="string"==typeof c.regexp?new RegExp(c.regexp):c.regexp;return e.test(d)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.remote=a.extend(a.fn.bootstrapValidator.i18n.remote||{},{"default":"Please enter a valid value"}),a.fn.bootstrapValidator.validators.remote={html5Attributes:{message:"message",name:"name",type:"type",url:"url",data:"data",delay:"delay"},destroy:function(a,b){b.data("bv.remote.timer")&&(clearTimeout(b.data("bv.remote.timer")),b.removeData("bv.remote.timer"))},validate:function(b,c,d){function e(){var b=a.ajax({type:k,headers:l,url:j,dataType:"json",data:i});return b.then(function(a){a.valid=a.valid===!0||"true"===a.valid,g.resolve(c,"remote",a)}),g.fail(function(){b.abort()}),g}var f=c.val(),g=new a.Deferred;if(""===f)return g.resolve(c,"remote",{valid:!0}),g;var h=c.attr("data-bv-field"),i=d.data||{},j=d.url,k=d.type||"GET",l=d.headers||{};return"function"==typeof i&&(i=i.call(this,b)),"string"==typeof i&&(i=JSON.parse(i)),"function"==typeof j&&(j=j.call(this,b)),i[d.name||h]=f,d.delay?(c.data("bv.remote.timer")&&clearTimeout(c.data("bv.remote.timer")),c.data("bv.remote.timer",setTimeout(e,d.delay)),g):e()}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.rtn=a.extend(a.fn.bootstrapValidator.i18n.rtn||{},{"default":"Please enter a valid RTN number"}),a.fn.bootstrapValidator.validators.rtn={validate:function(a,b){var c=b.val();if(""===c)return!0;if(!/^\d{9}$/.test(c))return!1;for(var d=0,e=0;e<c.length;e+=3)d+=3*parseInt(c.charAt(e),10)+7*parseInt(c.charAt(e+1),10)+parseInt(c.charAt(e+2),10);return 0!==d&&d%10===0}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.sedol=a.extend(a.fn.bootstrapValidator.i18n.sedol||{},{"default":"Please enter a valid SEDOL number"}),a.fn.bootstrapValidator.validators.sedol={validate:function(a,b){var c=b.val();if(""===c)return!0;if(c=c.toUpperCase(),!/^[0-9A-Z]{7}$/.test(c))return!1;for(var d=0,e=[1,3,1,7,3,9,1],f=c.length,g=0;f-1>g;g++)d+=e[g]*parseInt(c.charAt(g),36);return d=(10-d%10)%10,d+""===c.charAt(f-1)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.siren=a.extend(a.fn.bootstrapValidator.i18n.siren||{},{"default":"Please enter a valid SIREN number"}),a.fn.bootstrapValidator.validators.siren={validate:function(b,c){var d=c.val();return""===d?!0:/^\d{9}$/.test(d)?a.fn.bootstrapValidator.helpers.luhn(d):!1}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.siret=a.extend(a.fn.bootstrapValidator.i18n.siret||{},{"default":"Please enter a valid SIRET number"}),a.fn.bootstrapValidator.validators.siret={validate:function(a,b){var c=b.val();if(""===c)return!0;for(var d,e=0,f=c.length,g=0;f>g;g++)d=parseInt(c.charAt(g),10),g%2===0&&(d=2*d,d>9&&(d-=9)),e+=d;return e%10===0}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.step=a.extend(a.fn.bootstrapValidator.i18n.step||{},{"default":"Please enter a valid step of %s"}),a.fn.bootstrapValidator.validators.step={html5Attributes:{message:"message",base:"baseValue",step:"step"},validate:function(b,c,d){var e=c.val();if(""===e)return!0;if(d=a.extend({},{baseValue:0,step:1},d),e=parseFloat(e),!a.isNumeric(e))return!1;var f=function(a,b){var c=Math.pow(10,b);a*=c;var d=a>0|-(0>a),e=a%1===.5*d;return e?(Math.floor(a)+(d>0))/c:Math.round(a)/c},g=function(a,b){if(0===b)return 1;var c=(a+"").split("."),d=(b+"").split("."),e=(1===c.length?0:c[1].length)+(1===d.length?0:d[1].length);return f(a-b*Math.floor(a/b),e)},h=g(e-d.baseValue,d.step);return{valid:0===h||h===d.step,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.step["default"],[d.step])}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.stringCase=a.extend(a.fn.bootstrapValidator.i18n.stringCase||{},{"default":"Please enter only lowercase characters",upper:"Please enter only uppercase characters"}),a.fn.bootstrapValidator.validators.stringCase={html5Attributes:{message:"message","case":"case"},validate:function(b,c,d){var e=c.val();if(""===e)return!0;var f=(d["case"]||"lower").toLowerCase();return{valid:"upper"===f?e===e.toUpperCase():e===e.toLowerCase(),message:d.message||("upper"===f?a.fn.bootstrapValidator.i18n.stringCase.upper:a.fn.bootstrapValidator.i18n.stringCase["default"])}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.stringLength=a.extend(a.fn.bootstrapValidator.i18n.stringLength||{},{"default":"Please enter a value with valid length",less:"Please enter less than %s characters",more:"Please enter more than %s characters",between:"Please enter value between %s and %s characters long"}),a.fn.bootstrapValidator.validators.stringLength={html5Attributes:{message:"message",min:"min",max:"max",trim:"trim",utf8bytes:"utf8Bytes"},enableByHtml5:function(b){var c={},d=b.attr("maxlength"),e=b.attr("minlength");return d&&(c.max=parseInt(d,10)),e&&(c.min=parseInt(e,10)),a.isEmptyObject(c)?!1:c},validate:function(b,c,d){var e=c.val();if((d.trim===!0||"true"===d.trim)&&(e=a.trim(e)),""===e)return!0;var f=a.isNumeric(d.min)?d.min:b.getDynamicOption(c,d.min),g=a.isNumeric(d.max)?d.max:b.getDynamicOption(c,d.max),h=function(a){for(var b=a.length,c=a.length-1;c>=0;c--){var d=a.charCodeAt(c);d>127&&2047>=d?b++:d>2047&&65535>=d&&(b+=2),d>=56320&&57343>=d&&c--}return b},i=d.utf8Bytes?h(e):e.length,j=!0,k=d.message||a.fn.bootstrapValidator.i18n.stringLength["default"];switch((f&&i<parseInt(f,10)||g&&i>parseInt(g,10))&&(j=!1),!0){case!!f&&!!g:k=a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.stringLength.between,[parseInt(f,10),parseInt(g,10)]);break;case!!f:k=a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.stringLength.more,parseInt(f,10));break;case!!g:k=a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.stringLength.less,parseInt(g,10))}return{valid:j,message:k}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.uri=a.extend(a.fn.bootstrapValidator.i18n.uri||{},{"default":"Please enter a valid URI"}),a.fn.bootstrapValidator.validators.uri={html5Attributes:{message:"message",allowlocal:"allowLocal",protocol:"protocol"},enableByHtml5:function(a){return"url"===a.attr("type")},validate:function(a,b,c){var d=b.val();if(""===d)return!0;var e=c.allowLocal===!0||"true"===c.allowLocal,f=(c.protocol||"http, https, ftp").split(",").join("|").replace(/\s/g,""),g=new RegExp("^(?:(?:"+f+")://)(?:\\S+(?::\\S*)?@)?(?:"+(e?"":"(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})")+"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"+(e?"?":"")+")(?::\\d{2,5})?(?:/[^\\s]*)?$","i");return g.test(d)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.uuid=a.extend(a.fn.bootstrapValidator.i18n.uuid||{},{"default":"Please enter a valid UUID number",version:"Please enter a valid UUID version %s number"}),a.fn.bootstrapValidator.validators.uuid={html5Attributes:{message:"message",version:"version"},validate:function(b,c,d){var e=c.val();if(""===e)return!0;var f={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i},g=d.version?d.version+"":"all";return{valid:null===f[g]?!0:f[g].test(e),message:d.version?a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.uuid.version,d.version):d.message||a.fn.bootstrapValidator.i18n.uuid["default"]}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.vat=a.extend(a.fn.bootstrapValidator.i18n.vat||{},{"default":"Please enter a valid VAT number",countryNotSupported:"The country code %s is not supported",country:"Please enter a valid VAT number in %s",countries:{AT:"Austria",BE:"Belgium",BG:"Bulgaria",BR:"Brazil",CH:"Switzerland",CY:"Cyprus",CZ:"Czech Republic",DE:"Germany",DK:"Denmark",EE:"Estonia",ES:"Spain",FI:"Finland",FR:"France",GB:"United Kingdom",GR:"Greek",EL:"Greek",HU:"Hungary",HR:"Croatia",IE:"Ireland",IS:"Iceland",IT:"Italy",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",MT:"Malta",NL:"Netherlands",NO:"Norway",PL:"Poland",PT:"Portugal",RO:"Romania",RU:"Russia",RS:"Serbia",SE:"Sweden",SI:"Slovenia",SK:"Slovakia",VE:"Venezuela",ZA:"South Africa"}}),a.fn.bootstrapValidator.validators.vat={html5Attributes:{message:"message",country:"country"},COUNTRY_CODES:["AT","BE","BG","BR","CH","CY","CZ","DE","DK","EE","EL","ES","FI","FR","GB","GR","HR","HU","IE","IS","IT","LT","LU","LV","MT","NL","NO","PL","PT","RO","RU","RS","SE","SK","SI","VE","ZA"],validate:function(b,c,d){var e=c.val();if(""===e)return!0;var f=d.country;if(f?("string"!=typeof f||-1===a.inArray(f.toUpperCase(),this.COUNTRY_CODES))&&(f=b.getDynamicOption(c,f)):f=e.substr(0,2),-1===a.inArray(f,this.COUNTRY_CODES))return{valid:!1,message:a.fn.bootstrapValidator.helpers.format(a.fn.bootstrapValidator.i18n.vat.countryNotSupported,f)};var g=["_",f.toLowerCase()].join("");return this[g](e)?!0:{valid:!1,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.vat.country,a.fn.bootstrapValidator.i18n.vat.countries[f.toUpperCase()])}},_at:function(a){if(/^ATU[0-9]{8}$/.test(a)&&(a=a.substr(2)),!/^U[0-9]{8}$/.test(a))return!1;a=a.substr(1);for(var b=0,c=[1,2,1,2,1,2,1],d=0,e=0;7>e;e++)d=parseInt(a.charAt(e),10)*c[e],d>9&&(d=Math.floor(d/10)+d%10),b+=d;return b=10-(b+4)%10,10===b&&(b=0),b+""===a.substr(7,1)},_be:function(a){if(/^BE[0]{0,1}[0-9]{9}$/.test(a)&&(a=a.substr(2)),!/^[0]{0,1}[0-9]{9}$/.test(a))return!1;if(9===a.length&&(a="0"+a),"0"===a.substr(1,1))return!1;var b=parseInt(a.substr(0,8),10)+parseInt(a.substr(8,2),10);return b%97===0},_bg:function(b){if(/^BG[0-9]{9,10}$/.test(b)&&(b=b.substr(2)),!/^[0-9]{9,10}$/.test(b))return!1;var c=0,d=0;if(9===b.length){for(d=0;8>d;d++)c+=parseInt(b.charAt(d),10)*(d+1);if(c%=11,10===c)for(c=0,d=0;8>d;d++)c+=parseInt(b.charAt(d),10)*(d+3);return c%=10,c+""===b.substr(8)}if(10===b.length){var e=function(b){var c=parseInt(b.substr(0,2),10)+1900,d=parseInt(b.substr(2,2),10),e=parseInt(b.substr(4,2),10);if(d>40?(c+=100,d-=40):d>20&&(c-=100,d-=20),!a.fn.bootstrapValidator.helpers.date(c,d,e))return!1;for(var f=0,g=[2,4,8,5,10,9,7,3,6],h=0;9>h;h++)f+=parseInt(b.charAt(h),10)*g[h];return f=f%11%10,f+""===b.substr(9,1)},f=function(a){for(var b=0,c=[21,19,17,13,11,9,7,3,1],d=0;9>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b%=10,b+""===a.substr(9,1)},g=function(a){for(var b=0,c=[4,3,2,7,6,5,4,3,2],d=0;9>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b=11-b%11,10===b?!1:(11===b&&(b=0),b+""===a.substr(9,1))};return e(b)||f(b)||g(b)}return!1},_br:function(a){if(""===a)return!0;var b=a.replace(/[^\d]+/g,"");if(""===b||14!==b.length)return!1;if("00000000000000"===b||"11111111111111"===b||"22222222222222"===b||"33333333333333"===b||"44444444444444"===b||"55555555555555"===b||"66666666666666"===b||"77777777777777"===b||"88888888888888"===b||"99999999999999"===b)return!1;for(var c=b.length-2,d=b.substring(0,c),e=b.substring(c),f=0,g=c-7,h=c;h>=1;h--)f+=parseInt(d.charAt(c-h),10)*g--,2>g&&(g=9);var i=2>f%11?0:11-f%11;if(i!==parseInt(e.charAt(0),10))return!1;for(c+=1,d=b.substring(0,c),f=0,g=c-7,h=c;h>=1;h--)f+=parseInt(d.charAt(c-h),10)*g--,2>g&&(g=9);return i=2>f%11?0:11-f%11,i===parseInt(e.charAt(1),10)},_ch:function(a){if(/^CHE[0-9]{9}(MWST)?$/.test(a)&&(a=a.substr(2)),!/^E[0-9]{9}(MWST)?$/.test(a))return!1;a=a.substr(1);for(var b=0,c=[5,4,3,2,7,6,5,4],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b=11-b%11,10===b?!1:(11===b&&(b=0),b+""===a.substr(8,1))},_cy:function(a){if(/^CY[0-5|9]{1}[0-9]{7}[A-Z]{1}$/.test(a)&&(a=a.substr(2)),!/^[0-5|9]{1}[0-9]{7}[A-Z]{1}$/.test(a))return!1;if("12"===a.substr(0,2))return!1;for(var b=0,c={0:1,1:0,2:5,3:7,4:9,5:13,6:15,7:17,8:19,9:21},d=0;8>d;d++){var e=parseInt(a.charAt(d),10);d%2===0&&(e=c[e+""]),b+=e}return b="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[b%26],b+""===a.substr(8,1)},_cz:function(b){if(/^CZ[0-9]{8,10}$/.test(b)&&(b=b.substr(2)),!/^[0-9]{8,10}$/.test(b))return!1;var c=0,d=0;if(8===b.length){if(b.charAt(0)+""=="9")return!1;for(c=0,d=0;7>d;d++)c+=parseInt(b.charAt(d),10)*(8-d);return c=11-c%11,10===c&&(c=0),11===c&&(c=1),c+""===b.substr(7,1) +}if(9===b.length&&b.charAt(0)+""=="6"){for(c=0,d=0;7>d;d++)c+=parseInt(b.charAt(d+1),10)*(8-d);return c=11-c%11,10===c&&(c=0),11===c&&(c=1),c=[8,7,6,5,4,3,2,1,0,9,10][c-1],c+""===b.substr(8,1)}if(9===b.length||10===b.length){var e=1900+parseInt(b.substr(0,2),10),f=parseInt(b.substr(2,2),10)%50%20,g=parseInt(b.substr(4,2),10);if(9===b.length){if(e>=1980&&(e-=100),e>1953)return!1}else 1954>e&&(e+=100);if(!a.fn.bootstrapValidator.helpers.date(e,f,g))return!1;if(10===b.length){var h=parseInt(b.substr(0,9),10)%11;return 1985>e&&(h%=10),h+""===b.substr(9,1)}return!0}return!1},_de:function(b){return/^DE[0-9]{9}$/.test(b)&&(b=b.substr(2)),/^[0-9]{9}$/.test(b)?a.fn.bootstrapValidator.helpers.mod11And10(b):!1},_dk:function(a){if(/^DK[0-9]{8}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{8}$/.test(a))return!1;for(var b=0,c=[2,7,6,5,4,3,2,1],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b%11===0},_ee:function(a){if(/^EE[0-9]{9}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{9}$/.test(a))return!1;for(var b=0,c=[3,7,1,3,7,1,3,7,1],d=0;9>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b%10===0},_es:function(a){if(/^ES[0-9A-Z][0-9]{7}[0-9A-Z]$/.test(a)&&(a=a.substr(2)),!/^[0-9A-Z][0-9]{7}[0-9A-Z]$/.test(a))return!1;var b=function(a){var b=parseInt(a.substr(0,8),10);return b="TRWAGMYFPDXBNJZSQVHLCKE"[b%23],b+""===a.substr(8,1)},c=function(a){var b=["XYZ".indexOf(a.charAt(0)),a.substr(1)].join("");return b=parseInt(b,10),b="TRWAGMYFPDXBNJZSQVHLCKE"[b%23],b+""===a.substr(8,1)},d=function(a){var b,c=a.charAt(0);if(-1!=="KLM".indexOf(c))return b=parseInt(a.substr(1,8),10),b="TRWAGMYFPDXBNJZSQVHLCKE"[b%23],b+""===a.substr(8,1);if(-1!=="ABCDEFGHJNPQRSUVW".indexOf(c)){for(var d=0,e=[2,1,2,1,2,1,2],f=0,g=0;7>g;g++)f=parseInt(a.charAt(g+1),10)*e[g],f>9&&(f=Math.floor(f/10)+f%10),d+=f;return d=10-d%10,d+""===a.substr(8,1)||"JABCDEFGHI"[d]===a.substr(8,1)}return!1},e=a.charAt(0);return/^[0-9]$/.test(e)?b(a):/^[XYZ]$/.test(e)?c(a):d(a)},_fi:function(a){if(/^FI[0-9]{8}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{8}$/.test(a))return!1;for(var b=0,c=[7,9,10,5,8,4,2,1],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b%11===0},_fr:function(b){if(/^FR[0-9A-Z]{2}[0-9]{9}$/.test(b)&&(b=b.substr(2)),!/^[0-9A-Z]{2}[0-9]{9}$/.test(b))return!1;if(!a.fn.bootstrapValidator.helpers.luhn(b.substr(2)))return!1;if(/^[0-9]{2}$/.test(b.substr(0,2)))return b.substr(0,2)===parseInt(b.substr(2)+"12",10)%97+"";var c,d="0123456789ABCDEFGHJKLMNPQRSTUVWXYZ";return c=/^[0-9]{1}$/.test(b.charAt(0))?24*d.indexOf(b.charAt(0))+d.indexOf(b.charAt(1))-10:34*d.indexOf(b.charAt(0))+d.indexOf(b.charAt(1))-100,(parseInt(b.substr(2),10)+1+Math.floor(c/11))%11===c%11},_gb:function(a){if((/^GB[0-9]{9}$/.test(a)||/^GB[0-9]{12}$/.test(a)||/^GBGD[0-9]{3}$/.test(a)||/^GBHA[0-9]{3}$/.test(a)||/^GB(GD|HA)8888[0-9]{5}$/.test(a))&&(a=a.substr(2)),!(/^[0-9]{9}$/.test(a)||/^[0-9]{12}$/.test(a)||/^GD[0-9]{3}$/.test(a)||/^HA[0-9]{3}$/.test(a)||/^(GD|HA)8888[0-9]{5}$/.test(a)))return!1;var b=a.length;if(5===b){var c=a.substr(0,2),d=parseInt(a.substr(2),10);return"GD"===c&&500>d||"HA"===c&&d>=500}if(11===b&&("GD8888"===a.substr(0,6)||"HA8888"===a.substr(0,6)))return"GD"===a.substr(0,2)&&parseInt(a.substr(6,3),10)>=500||"HA"===a.substr(0,2)&&parseInt(a.substr(6,3),10)<500?!1:parseInt(a.substr(6,3),10)%97===parseInt(a.substr(9,2),10);if(9===b||12===b){for(var e=0,f=[8,7,6,5,4,3,2,10,1],g=0;9>g;g++)e+=parseInt(a.charAt(g),10)*f[g];return e%=97,parseInt(a.substr(0,3),10)>=100?0===e||42===e||55===e:0===e}return!0},_gr:function(a){if(/^(GR|EL)[0-9]{9}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{9}$/.test(a))return!1;8===a.length&&(a="0"+a);for(var b=0,c=[256,128,64,32,16,8,4,2],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b=b%11%10,b+""===a.substr(8,1)},_el:function(a){return this._gr(a)},_hu:function(a){if(/^HU[0-9]{8}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{8}$/.test(a))return!1;for(var b=0,c=[9,7,3,1,9,7,3,1],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b%10===0},_hr:function(b){return/^HR[0-9]{11}$/.test(b)&&(b=b.substr(2)),/^[0-9]{11}$/.test(b)?a.fn.bootstrapValidator.helpers.mod11And10(b):!1},_ie:function(a){if(/^IE[0-9]{1}[0-9A-Z\*\+]{1}[0-9]{5}[A-Z]{1,2}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{1}[0-9A-Z\*\+]{1}[0-9]{5}[A-Z]{1,2}$/.test(a))return!1;var b=function(a){for(;a.length<7;)a="0"+a;for(var b="WABCDEFGHIJKLMNOPQRSTUV",c=0,d=0;7>d;d++)c+=parseInt(a.charAt(d),10)*(8-d);return c+=9*b.indexOf(a.substr(7)),b[c%23]};return/^[0-9]+$/.test(a.substr(0,7))?a.charAt(7)===b(a.substr(0,7)+a.substr(8)+""):-1!=="ABCDEFGHIJKLMNOPQRSTUVWXYZ+*".indexOf(a.charAt(1))?a.charAt(7)===b(a.substr(2,5)+a.substr(0,1)+""):!0},_is:function(a){return/^IS[0-9]{5,6}$/.test(a)&&(a=a.substr(2)),/^[0-9]{5,6}$/.test(a)},_it:function(b){if(/^IT[0-9]{11}$/.test(b)&&(b=b.substr(2)),!/^[0-9]{11}$/.test(b))return!1;if(0===parseInt(b.substr(0,7),10))return!1;var c=parseInt(b.substr(7,3),10);return 1>c||c>201&&999!==c&&888!==c?!1:a.fn.bootstrapValidator.helpers.luhn(b)},_lt:function(a){if(/^LT([0-9]{7}1[0-9]{1}|[0-9]{10}1[0-9]{1})$/.test(a)&&(a=a.substr(2)),!/^([0-9]{7}1[0-9]{1}|[0-9]{10}1[0-9]{1})$/.test(a))return!1;var b,c=a.length,d=0;for(b=0;c-1>b;b++)d+=parseInt(a.charAt(b),10)*(1+b%9);var e=d%11;if(10===e)for(d=0,b=0;c-1>b;b++)d+=parseInt(a.charAt(b),10)*(1+(b+2)%9);return e=e%11%10,e+""===a.charAt(c-1)},_lu:function(a){return/^LU[0-9]{8}$/.test(a)&&(a=a.substr(2)),/^[0-9]{8}$/.test(a)?parseInt(a.substr(0,6),10)%89+""===a.substr(6,2):!1},_lv:function(b){if(/^LV[0-9]{11}$/.test(b)&&(b=b.substr(2)),!/^[0-9]{11}$/.test(b))return!1;var c,d=parseInt(b.charAt(0),10),e=0,f=[],g=b.length;if(d>3){for(e=0,f=[9,1,4,8,3,10,2,5,7,6,1],c=0;g>c;c++)e+=parseInt(b.charAt(c),10)*f[c];return e%=11,3===e}var h=parseInt(b.substr(0,2),10),i=parseInt(b.substr(2,2),10),j=parseInt(b.substr(4,2),10);if(j=j+1800+100*parseInt(b.charAt(6),10),!a.fn.bootstrapValidator.helpers.date(j,i,h))return!1;for(e=0,f=[10,5,8,4,2,1,6,3,7,9],c=0;g-1>c;c++)e+=parseInt(b.charAt(c),10)*f[c];return e=(e+1)%11%10,e+""===b.charAt(g-1)},_mt:function(a){if(/^MT[0-9]{8}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{8}$/.test(a))return!1;for(var b=0,c=[3,4,6,7,8,9,10,1],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b%37===0},_nl:function(a){if(/^NL[0-9]{9}B[0-9]{2}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{9}B[0-9]{2}$/.test(a))return!1;for(var b=0,c=[9,8,7,6,5,4,3,2],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b%=11,b>9&&(b=0),b+""===a.substr(8,1)},_no:function(a){if(/^NO[0-9]{9}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{9}$/.test(a))return!1;for(var b=0,c=[3,2,7,6,5,4,3,2],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b=11-b%11,11===b&&(b=0),b+""===a.substr(8,1)},_pl:function(a){if(/^PL[0-9]{10}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{10}$/.test(a))return!1;for(var b=0,c=[6,5,7,2,3,4,5,6,7,-1],d=0;10>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b%11===0},_pt:function(a){if(/^PT[0-9]{9}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{9}$/.test(a))return!1;for(var b=0,c=[9,8,7,6,5,4,3,2],d=0;8>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b=11-b%11,b>9&&(b=0),b+""===a.substr(8,1)},_ro:function(a){if(/^RO[1-9][0-9]{1,9}$/.test(a)&&(a=a.substr(2)),!/^[1-9][0-9]{1,9}$/.test(a))return!1;for(var b=a.length,c=[7,5,3,2,1,7,5,3,2].slice(10-b),d=0,e=0;b-1>e;e++)d+=parseInt(a.charAt(e),10)*c[e];return d=10*d%11%10,d+""===a.substr(b-1,1)},_ru:function(a){if(/^RU([0-9]{10}|[0-9]{12})$/.test(a)&&(a=a.substr(2)),!/^([0-9]{10}|[0-9]{12})$/.test(a))return!1;var b=0;if(10===a.length){var c=0,d=[2,4,10,3,5,9,4,6,8,0];for(b=0;10>b;b++)c+=parseInt(a.charAt(b),10)*d[b];return c%=11,c>9&&(c%=10),c+""===a.substr(9,1)}if(12===a.length){var e=0,f=[7,2,4,10,3,5,9,4,6,8,0],g=0,h=[3,7,2,4,10,3,5,9,4,6,8,0];for(b=0;11>b;b++)e+=parseInt(a.charAt(b),10)*f[b],g+=parseInt(a.charAt(b),10)*h[b];return e%=11,e>9&&(e%=10),g%=11,g>9&&(g%=10),e+""===a.substr(10,1)&&g+""===a.substr(11,1)}return!1},_rs:function(a){if(/^RS[0-9]{9}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{9}$/.test(a))return!1;for(var b=10,c=0,d=0;8>d;d++)c=(parseInt(a.charAt(d),10)+b)%10,0===c&&(c=10),b=2*c%11;return(b+parseInt(a.substr(8,1),10))%10===1},_se:function(b){return/^SE[0-9]{10}01$/.test(b)&&(b=b.substr(2)),/^[0-9]{10}01$/.test(b)?(b=b.substr(0,10),a.fn.bootstrapValidator.helpers.luhn(b)):!1},_si:function(a){if(/^SI[0-9]{8}$/.test(a)&&(a=a.substr(2)),!/^[0-9]{8}$/.test(a))return!1;for(var b=0,c=[8,7,6,5,4,3,2],d=0;7>d;d++)b+=parseInt(a.charAt(d),10)*c[d];return b=11-b%11,10===b&&(b=0),b+""===a.substr(7,1)},_sk:function(a){return/^SK[1-9][0-9][(2-4)|(6-9)][0-9]{7}$/.test(a)&&(a=a.substr(2)),/^[1-9][0-9][(2-4)|(6-9)][0-9]{7}$/.test(a)?parseInt(a,10)%11===0:!1},_ve:function(a){if(/^VE[VEJPG][0-9]{9}$/.test(a)&&(a=a.substr(2)),!/^[VEJPG][0-9]{9}$/.test(a))return!1;for(var b={V:4,E:8,J:12,P:16,G:20},c=b[a.charAt(0)],d=[3,2,7,6,5,4,3,2],e=0;8>e;e++)c+=parseInt(a.charAt(e+1),10)*d[e];return c=11-c%11,(11===c||10===c)&&(c=0),c+""===a.substr(9,1)},_za:function(a){return/^ZA4[0-9]{9}$/.test(a)&&(a=a.substr(2)),/^4[0-9]{9}$/.test(a)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.vin=a.extend(a.fn.bootstrapValidator.i18n.vin||{},{"default":"Please enter a valid VIN number"}),a.fn.bootstrapValidator.validators.vin={validate:function(a,b){var c=b.val();if(""===c)return!0;if(!/^[a-hj-npr-z0-9]{8}[0-9xX][a-hj-npr-z0-9]{8}$/i.test(c))return!1;c=c.toUpperCase();for(var d={A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,J:1,K:2,L:3,M:4,N:5,P:7,R:9,S:2,T:3,U:4,V:5,W:6,X:7,Y:8,Z:9,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,0:0},e=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],f=0,g=c.length,h=0;g>h;h++)f+=d[c.charAt(h)+""]*e[h];var i=f%11;return 10===i&&(i="X"),i+""===c.charAt(8)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.i18n.zipCode=a.extend(a.fn.bootstrapValidator.i18n.zipCode||{},{"default":"Please enter a valid postal code",countryNotSupported:"The country code %s is not supported",country:"Please enter a valid postal code in %s",countries:{AT:"Austria",BR:"Brazil",CA:"Canada",CH:"Switzerland",CZ:"Czech Republic",DE:"Germany",DK:"Denmark",FR:"France",GB:"United Kingdom",IE:"Ireland",IT:"Italy",MA:"Morocco",NL:"Netherlands",PT:"Portugal",RO:"Romania",RU:"Russia",SE:"Sweden",SG:"Singapore",SK:"Slovakia",US:"USA"}}),a.fn.bootstrapValidator.validators.zipCode={html5Attributes:{message:"message",country:"country"},COUNTRY_CODES:["AT","BR","CA","CH","CZ","DE","DK","FR","GB","IE","IT","MA","NL","PT","RO","RU","SE","SG","SK","US"],validate:function(b,c,d){var e=c.val();if(""===e||!d.country)return!0;var f=d.country;if(("string"!=typeof f||-1===a.inArray(f,this.COUNTRY_CODES))&&(f=b.getDynamicOption(c,f)),!f||-1===a.inArray(f.toUpperCase(),this.COUNTRY_CODES))return{valid:!1,message:a.fn.bootstrapValidator.helpers.format(a.fn.bootstrapValidator.i18n.zipCode.countryNotSupported,f)};var g=!1;switch(f=f.toUpperCase()){case"AT":g=/^([1-9]{1})(\d{3})$/.test(e);break;case"BR":g=/^(\d{2})([\.]?)(\d{3})([\-]?)(\d{3})$/.test(e);break;case"CA":g=/^(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|X|Y){1}[0-9]{1}(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|W|X|Y|Z){1}\s?[0-9]{1}(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|W|X|Y|Z){1}[0-9]{1}$/i.test(e);break;case"CH":g=/^([1-9]{1})(\d{3})$/.test(e);break;case"CZ":g=/^(\d{3})([ ]?)(\d{2})$/.test(e);break;case"DE":g=/^(?!01000|99999)(0[1-9]\d{3}|[1-9]\d{4})$/.test(e);break;case"DK":g=/^(DK(-|\s)?)?\d{4}$/i.test(e);break;case"FR":g=/^[0-9]{5}$/i.test(e);break;case"GB":g=this._gb(e);break;case"IE":g=/^(D6W|[ACDEFHKNPRTVWXY]\d{2})\s[0-9ACDEFHKNPRTVWXY]{4}$/.test(e);break;case"IT":g=/^(I-|IT-)?\d{5}$/i.test(e);break;case"MA":g=/^[1-9][0-9]{4}$/i.test(e);break;case"NL":g=/^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i.test(e);break;case"PT":g=/^[1-9]\d{3}-\d{3}$/.test(e);break;case"RO":g=/^(0[1-8]{1}|[1-9]{1}[0-5]{1})?[0-9]{4}$/i.test(e);break;case"RU":g=/^[0-9]{6}$/i.test(e);break;case"SE":g=/^(S-)?\d{3}\s?\d{2}$/i.test(e);break;case"SG":g=/^([0][1-9]|[1-6][0-9]|[7]([0-3]|[5-9])|[8][0-2])(\d{4})$/i.test(e);break;case"SK":g=/^(\d{3})([ ]?)(\d{2})$/.test(e);break;case"US":default:g=/^\d{4,5}([\-]?\d{4})?$/.test(e)}return{valid:g,message:a.fn.bootstrapValidator.helpers.format(d.message||a.fn.bootstrapValidator.i18n.zipCode.country,a.fn.bootstrapValidator.i18n.zipCode.countries[f])}},_gb:function(a){for(var b="[ABCDEFGHIJKLMNOPRSTUWYZ]",c="[ABCDEFGHKLMNOPQRSTUVWXY]",d="[ABCDEFGHJKPMNRSTUVWXY]",e="[ABEHMNPRVWXY]",f="[ABDEFGHJLNPQRSTUWXYZ]",g=[new RegExp("^("+b+"{1}"+c+"?[0-9]{1,2})(\\s*)([0-9]{1}"+f+"{2})$","i"),new RegExp("^("+b+"{1}[0-9]{1}"+d+"{1})(\\s*)([0-9]{1}"+f+"{2})$","i"),new RegExp("^("+b+"{1}"+c+"{1}?[0-9]{1}"+e+"{1})(\\s*)([0-9]{1}"+f+"{2})$","i"),new RegExp("^(BF1)(\\s*)([0-6]{1}[ABDEFGHJLNPQRST]{1}[ABDEFGHJLNPQRSTUWZYZ]{1})$","i"),/^(GIR)(\s*)(0AA)$/i,/^(BFPO)(\s*)([0-9]{1,4})$/i,/^(BFPO)(\s*)(c\/o\s*[0-9]{1,3})$/i,/^([A-Z]{4})(\s*)(1ZZ)$/i,/^(AI-2640)$/i],h=0;h<g.length;h++)if(g[h].test(a))return!0;return!1}}}(window.jQuery); \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/validate/zh_CN.js b/user/guns-admin/src/main/webapp/static/js/plugins/validate/zh_CN.js new file mode 100644 index 0000000..0c1ed5d --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/validate/zh_CN.js @@ -0,0 +1,370 @@ +(function ($) { + /** + * Simplified Chinese language package + * Translated by @shamiao + */ + $.fn.bootstrapValidator.i18n = $.extend(true, $.fn.bootstrapValidator.i18n, { + base64: { + 'default': '请输入有效的Base64编码' + }, + between: { + 'default': '请输入在 %s 和 %s 之间的数值', + notInclusive: '请输入在 %s 和 %s 之间(不含两端)的数值' + }, + callback: { + 'default': '请输入有效的值' + }, + choice: { + 'default': '请输入有效的值', + less: '请至少选中 %s 个选项', + more: '最多只能选中 %s 个选项', + between: '请选择 %s 至 %s 个选项' + }, + color: { + 'default': '请输入有效的颜色值' + }, + creditCard: { + 'default': '请输入有效的信用卡号码' + }, + cusip: { + 'default': '请输入有效的美国CUSIP代码' + }, + cvv: { + 'default': '请输入有效的CVV代码' + }, + date: { + 'default': '请输入有效的日期', + min: '请输入 %s 或之后的日期', + max: '请输入 %s 或以前的日期', + range: '请输入 %s 和 %s 之间的日期' + }, + different: { + 'default': '请输入不同的值' + }, + digits: { + 'default': '请输入有效的数字' + }, + ean: { + 'default': '请输入有效的EAN商品编码' + }, + emailAddress: { + 'default': '请输入有效的邮件地址' + }, + file: { + 'default': '请选择有效的文件' + }, + greaterThan: { + 'default': '请输入大于等于 %s 的数值', + notInclusive: '请输入大于 %s 的数值' + }, + grid: { + 'default': '请输入有效的GRId编码' + }, + hex: { + 'default': '请输入有效的16进制数' + }, + hexColor: { + 'default': '请输入有效的16进制颜色值' + }, + iban: { + 'default': '请输入有效的IBAN(国际银行账户)号码', + countryNotSupported: '不支持 %s 国家或地区', + country: '请输入有效的 %s 国家或地区的IBAN(国际银行账户)号码', + countries: { + AD: '安道尔', + AE: '阿联酋', + AL: '阿尔巴尼亚', + AO: '安哥拉', + AT: '奥地利', + AZ: '阿塞拜疆', + BA: '波斯尼亚和黑塞哥维那', + BE: '比利时', + BF: '布基纳法索', + BG: '保加利亚', + BH: '巴林', + BI: '布隆迪', + BJ: '贝宁', + BR: '巴西', + CH: '瑞士', + CI: '科特迪瓦', + CM: '喀麦隆', + CR: '哥斯达黎加', + CV: '佛得角', + CY: '塞浦路斯', + CZ: '捷克共和国', + DE: '德国', + DK: '丹麦', + DO: '多米尼加共和国', + DZ: '阿尔及利亚', + EE: '爱沙尼亚', + ES: '西班牙', + FI: '芬兰', + FO: '法罗群岛', + FR: '法国', + GB: '英国', + GE: '格鲁吉亚', + GI: '直布罗陀', + GL: '格陵兰岛', + GR: '希腊', + GT: '危地马拉', + HR: '克罗地亚', + HU: '匈牙利', + IE: '爱尔兰', + IL: '以色列', + IR: '伊朗', + IS: '冰岛', + IT: '意大利', + JO: '约旦', + KW: '科威特', + KZ: '哈萨克斯坦', + LB: '黎巴嫩', + LI: '列支敦士登', + LT: '立陶宛', + LU: '卢森堡', + LV: '拉脱维亚', + MC: '摩纳哥', + MD: '摩尔多瓦', + ME: '黑山', + MG: '马达加斯加', + MK: '马其顿', + ML: '马里', + MR: '毛里塔尼亚', + MT: '马耳他', + MU: '毛里求斯', + MZ: '莫桑比克', + NL: '荷兰', + NO: '挪威', + PK: '巴基斯坦', + PL: '波兰', + PS: '巴勒斯坦', + PT: '葡萄牙', + QA: '卡塔尔', + RO: '罗马尼亚', + RS: '塞尔维亚', + SA: '沙特阿拉伯', + SE: '瑞典', + SI: '斯洛文尼亚', + SK: '斯洛伐克', + SM: '圣马力诺', + SN: '塞内加尔', + TN: '突尼斯', + TR: '土耳其', + VG: '英属维尔京群岛' + } + }, + id: { + 'default': '请输入有效的身份证件号码', + countryNotSupported: '不支持 %s 国家或地区', + country: '请输入有效的 %s 国家或地区的身份证件号码', + countries: { + BA: '波黑', + BG: '保加利亚', + BR: '巴西', + CH: '瑞士', + CL: '智利', + CN: '中国', + CZ: '捷克共和国', + DK: '丹麦', + EE: '爱沙尼亚', + ES: '西班牙', + FI: '芬兰', + HR: '克罗地亚', + IE: '爱尔兰', + IS: '冰岛', + LT: '立陶宛', + LV: '拉脱维亚', + ME: '黑山', + MK: '马其顿', + NL: '荷兰', + RO: '罗马尼亚', + RS: '塞尔维亚', + SE: '瑞典', + SI: '斯洛文尼亚', + SK: '斯洛伐克', + SM: '圣马力诺', + TH: '泰国', + ZA: '南非' + } + }, + identical: { + 'default': '请输入相同的值' + }, + imei: { + 'default': '请输入有效的IMEI(手机串号)' + }, + imo: { + 'default': '请输入有效的国际海事组织(IMO)号码' + }, + integer: { + 'default': '请输入有效的整数值' + }, + ip: { + 'default': '请输入有效的IP地址', + ipv4: '请输入有效的IPv4地址', + ipv6: '请输入有效的IPv6地址' + }, + isbn: { + 'default': '请输入有效的ISBN(国际标准书号)' + }, + isin: { + 'default': '请输入有效的ISIN(国际证券编码)' + }, + ismn: { + 'default': '请输入有效的ISMN(印刷音乐作品编码)' + }, + issn: { + 'default': '请输入有效的ISSN(国际标准杂志书号)' + }, + lessThan: { + 'default': '请输入小于等于 %s 的数值', + notInclusive: '请输入小于 %s 的数值' + }, + mac: { + 'default': '请输入有效的MAC物理地址' + }, + meid: { + 'default': '请输入有效的MEID(移动设备识别码)' + }, + notEmpty: { + 'default': '请填写必填项目' + }, + numeric: { + 'default': '请输入有效的数值,允许小数' + }, + phone: { + 'default': '请输入有效的电话号码', + countryNotSupported: '不支持 %s 国家或地区', + country: '请输入有效的 %s 国家或地区的电话号码', + countries: { + BR: '巴西', + CN: '中国', + CZ: '捷克共和国', + DE: '德国', + DK: '丹麦', + ES: '西班牙', + FR: '法国', + GB: '英国', + MA: '摩洛哥', + PK: '巴基斯坦', + RO: '罗马尼亚', + RU: '俄罗斯', + SK: '斯洛伐克', + TH: '泰国', + US: '美国', + VE: '委内瑞拉' + } + }, + regexp: { + 'default': '请输入符合正则表达式限制的值' + }, + remote: { + 'default': '请输入有效的值' + }, + rtn: { + 'default': '请输入有效的RTN号码' + }, + sedol: { + 'default': '请输入有效的SEDOL代码' + }, + siren: { + 'default': '请输入有效的SIREN号码' + }, + siret: { + 'default': '请输入有效的SIRET号码' + }, + step: { + 'default': '请输入在基础值上,增加 %s 的整数倍的数值' + }, + stringCase: { + 'default': '只能输入小写字母', + upper: '只能输入大写字母' + }, + stringLength: { + 'default': '请输入符合长度限制的值', + less: '最多只能输入 %s 个字符', + more: '需要输入至少 %s 个字符', + between: '请输入 %s 至 %s 个字符' + }, + uri: { + 'default': '请输入一个有效的URL地址' + }, + uuid: { + 'default': '请输入有效的UUID', + version: '请输入版本 %s 的UUID' + }, + vat: { + 'default': '请输入有效的VAT(税号)', + countryNotSupported: '不支持 %s 国家或地区', + country: '请输入有效的 %s 国家或地区的VAT(税号)', + countries: { + AT: '奥地利', + BE: '比利时', + BG: '保加利亚', + BR: '巴西', + CH: '瑞士', + CY: '塞浦路斯', + CZ: '捷克共和国', + DE: '德国', + DK: '丹麦', + EE: '爱沙尼亚', + ES: '西班牙', + FI: '芬兰', + FR: '法语', + GB: '英国', + GR: '希腊', + EL: '希腊', + HU: '匈牙利', + HR: '克罗地亚', + IE: '爱尔兰', + IS: '冰岛', + IT: '意大利', + LT: '立陶宛', + LU: '卢森堡', + LV: '拉脱维亚', + MT: '马耳他', + NL: '荷兰', + NO: '挪威', + PL: '波兰', + PT: '葡萄牙', + RO: '罗马尼亚', + RU: '俄罗斯', + RS: '塞尔维亚', + SE: '瑞典', + SI: '斯洛文尼亚', + SK: '斯洛伐克', + VE: '委内瑞拉', + ZA: '南非' + } + }, + vin: { + 'default': '请输入有效的VIN(美国车辆识别号码)' + }, + zipCode: { + 'default': '请输入有效的邮政编码', + countryNotSupported: '不支持 %s 国家或地区', + country: '请输入有效的 %s 国家或地区的邮政编码', + countries: { + AT: '奥地利', + BR: '巴西', + CA: '加拿大', + CH: '瑞士', + CZ: '捷克共和国', + DE: '德国', + DK: '丹麦', + FR: '法国', + GB: '英国', + IE: '爱尔兰', + IT: '意大利', + MA: '摩洛哥', + NL: '荷兰', + PT: '葡萄牙', + RO: '罗马尼亚', + RU: '俄罗斯', + SE: '瑞典', + SG: '新加坡', + SK: '斯洛伐克', + US: '美国' + } + } + }); +}(window.jQuery)); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/wangEditor/wangEditor.js b/user/guns-admin/src/main/webapp/static/js/plugins/wangEditor/wangEditor.js new file mode 100644 index 0000000..e9c8afa --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/wangEditor/wangEditor.js @@ -0,0 +1,3967 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.wangEditor = factory()); +}(this, (function () { 'use strict'; + + /* + poly-fill + */ + + var polyfill = function () { + + // Object.assign + if (typeof Object.assign != 'function') { + Object.assign = function (target, varArgs) { + // .length of function is 2 + if (target == null) { + // TypeError if undefined or null + throw new TypeError('Cannot convert undefined or null to object'); + } + + var to = Object(target); + + for (var index = 1; index < arguments.length; index++) { + var nextSource = arguments[index]; + + if (nextSource != null) { + // Skip over if undefined or null + for (var nextKey in nextSource) { + // Avoid bugs when hasOwnProperty is shadowed + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + to[nextKey] = nextSource[nextKey]; + } + } + } + } + return to; + }; + } + + // IE 中兼容 Element.prototype.matches + if (!Element.prototype.matches) { + Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = matches.length; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; + } + }; + + /* + DOM 操作 API + */ + +// 根据 html 代码片段创建 dom 对象 + function createElemByHTML(html) { + var div = void 0; + div = document.createElement('div'); + div.innerHTML = html; + return div.children; + } + +// 是否是 DOM List + function isDOMList(selector) { + if (!selector) { + return false; + } + if (selector instanceof HTMLCollection || selector instanceof NodeList) { + return true; + } + return false; + } + +// 封装 document.querySelectorAll + function querySelectorAll(selector) { + var result = document.querySelectorAll(selector); + if (isDOMList(result)) { + return result; + } else { + return [result]; + } + } + +// 创建构造函数 + function DomElement(selector) { + if (!selector) { + return; + } + + // selector 本来就是 DomElement 对象,直接返回 + if (selector instanceof DomElement) { + return selector; + } + + this.selector = selector; + + // 根据 selector 得出的结果(如 DOM,DOM List) + var selectorResult = []; + if (selector.nodeType === 1) { + // 单个 DOM 节点 + selectorResult = [selector]; + } else if (isDOMList(selector)) { + // DOM List + selectorResult = selector; + } else if (typeof selector === 'string') { + // 字符串 + selector = selector.replace('/\n/mg', '').trim(); + if (selector.indexOf('<') === 0) { + // 如 <div> + selectorResult = createElemByHTML(selector); + } else { + // 如 #id .class + selectorResult = querySelectorAll(selector); + } + } + + var length = selectorResult.length; + if (!length) { + // 空数组 + return this; + } + + // 加入 DOM 节点 + var i = void 0; + for (i = 0; i < length; i++) { + this[i] = selectorResult[i]; + } + this.length = length; + } + +// 修改原型 + DomElement.prototype = { + constructor: DomElement, + + // 类数组,forEach + forEach: function forEach(fn) { + var i = void 0; + for (i = 0; i < this.length; i++) { + var elem = this[i]; + var result = fn.call(elem, elem, i); + if (result === false) { + break; + } + } + return this; + }, + + // 获取第几个元素 + get: function get(index) { + var length = this.length; + if (index >= length) { + index = index % length; + } + return $(this[index]); + }, + + // 第一个 + first: function first() { + return this.get(0); + }, + + // 最后一个 + last: function last() { + var length = this.length; + return this.get(length - 1); + }, + + // 绑定事件 + on: function on(type, selector, fn) { + // selector 不为空,证明绑定事件要加代理 + if (!fn) { + fn = selector; + selector = null; + } + + // type 是否有多个 + var types = []; + types = type.split(/\s+/); + + return this.forEach(function (elem) { + types.forEach(function (type) { + if (!type) { + return; + } + + if (!selector) { + // 无代理 + elem.addEventListener(type, fn, false); + return; + } + + // 有代理 + elem.addEventListener(type, function (e) { + var target = e.target; + if (target.matches(selector)) { + fn.call(target, e); + } + }, false); + }); + }); + }, + + // 取消事件绑定 + off: function off(type, fn) { + return this.forEach(function (elem) { + elem.removeEventListener(type, fn, false); + }); + }, + + // 获取/设置 属性 + attr: function attr(key, val) { + if (val == null) { + // 获取值 + return this[0].getAttribute(key); + } else { + // 设置值 + return this.forEach(function (elem) { + elem.setAttribute(key, val); + }); + } + }, + + // 添加 class + addClass: function addClass(className) { + if (!className) { + return this; + } + return this.forEach(function (elem) { + var arr = void 0; + if (elem.className) { + // 解析当前 className 转换为数组 + arr = elem.className.split(/\s/); + arr = arr.filter(function (item) { + return !!item.trim(); + }); + // 添加 class + if (arr.indexOf(className) < 0) { + arr.push(className); + } + // 修改 elem.class + elem.className = arr.join(' '); + } else { + elem.className = className; + } + }); + }, + + // 删除 class + removeClass: function removeClass(className) { + if (!className) { + return this; + } + return this.forEach(function (elem) { + var arr = void 0; + if (elem.className) { + // 解析当前 className 转换为数组 + arr = elem.className.split(/\s/); + arr = arr.filter(function (item) { + item = item.trim(); + // 删除 class + if (!item || item === className) { + return false; + } + return true; + }); + // 修改 elem.class + elem.className = arr.join(' '); + } + }); + }, + + // 修改 css + css: function css(key, val) { + var currentStyle = key + ':' + val + ';'; + return this.forEach(function (elem) { + var style = (elem.getAttribute('style') || '').trim(); + var styleArr = void 0, + resultArr = []; + if (style) { + // 将 style 按照 ; 拆分为数组 + styleArr = style.split(';'); + styleArr.forEach(function (item) { + // 对每项样式,按照 : 拆分为 key 和 value + var arr = item.split(':').map(function (i) { + return i.trim(); + }); + if (arr.length === 2) { + resultArr.push(arr[0] + ':' + arr[1]); + } + }); + // 替换或者新增 + resultArr = resultArr.map(function (item) { + if (item.indexOf(key) === 0) { + return currentStyle; + } else { + return item; + } + }); + if (resultArr.indexOf(currentStyle) < 0) { + resultArr.push(currentStyle); + } + // 结果 + elem.setAttribute('style', resultArr.join('; ')); + } else { + // style 无值 + elem.setAttribute('style', currentStyle); + } + }); + }, + + // 显示 + show: function show() { + return this.css('display', 'block'); + }, + + // 隐藏 + hide: function hide() { + return this.css('display', 'none'); + }, + + // 获取子节点 + children: function children() { + var elem = this[0]; + if (!elem) { + return null; + } + + return $(elem.children); + }, + + // 增加子节点 + append: function append($children) { + return this.forEach(function (elem) { + $children.forEach(function (child) { + elem.appendChild(child); + }); + }); + }, + + // 移除当前节点 + remove: function remove() { + return this.forEach(function (elem) { + if (elem.remove) { + elem.remove(); + } else { + var parent = elem.parentElement; + parent && parent.removeChild(elem); + } + }); + }, + + // 是否包含某个子节点 + isContain: function isContain($child) { + var elem = this[0]; + var child = $child[0]; + return elem.contains(child); + }, + + // 尺寸数据 + getSizeData: function getSizeData() { + var elem = this[0]; + return elem.getBoundingClientRect(); // 可得到 bottom height left right top width 的数据 + }, + + // 封装 nodeName + getNodeName: function getNodeName() { + var elem = this[0]; + return elem.nodeName; + }, + + // 从当前元素查找 + find: function find(selector) { + var elem = this[0]; + return $(elem.querySelectorAll(selector)); + }, + + // 获取当前元素的 text + text: function text(val) { + if (!val) { + // 获取 text + var elem = this[0]; + return elem.innerHTML.replace(/<.*?>/g, function () { + return ''; + }); + } else { + // 设置 text + return this.forEach(function (elem) { + elem.innerHTML = val; + }); + } + }, + + // 获取 html + html: function html(value) { + var elem = this[0]; + if (value == null) { + return elem.innerHTML; + } else { + elem.innerHTML = value; + return this; + } + }, + + // 获取 value + val: function val() { + var elem = this[0]; + return elem.value.trim(); + }, + + // focus + focus: function focus() { + return this.forEach(function (elem) { + elem.focus(); + }); + }, + + // parent + parent: function parent() { + var elem = this[0]; + return $(elem.parentElement); + }, + + // parentUntil 找到符合 selector 的父节点 + parentUntil: function parentUntil(selector, _currentElem) { + var results = document.querySelectorAll(selector); + var length = results.length; + if (!length) { + // 传入的 selector 无效 + return null; + } + + var elem = _currentElem || this[0]; + if (elem.nodeName === 'BODY') { + return null; + } + + var parent = elem.parentElement; + var i = void 0; + for (i = 0; i < length; i++) { + if (parent === results[i]) { + // 找到,并返回 + return $(parent); + } + } + + // 继续查找 + return this.parentUntil(selector, parent); + }, + + // 判断两个 elem 是否相等 + equal: function equal($elem) { + if ($elem.nodeType === 1) { + return this[0] === $elem; + } else { + return this[0] === $elem[0]; + } + }, + + // 将该元素插入到某个元素前面 + insertBefore: function insertBefore(selector) { + var $referenceNode = $(selector); + var referenceNode = $referenceNode[0]; + if (!referenceNode) { + return this; + } + return this.forEach(function (elem) { + var parent = referenceNode.parentNode; + parent.insertBefore(elem, referenceNode); + }); + }, + + // 将该元素插入到某个元素后面 + insertAfter: function insertAfter(selector) { + var $referenceNode = $(selector); + var referenceNode = $referenceNode[0]; + if (!referenceNode) { + return this; + } + return this.forEach(function (elem) { + var parent = referenceNode.parentNode; + if (parent.lastChild === referenceNode) { + // 最后一个元素 + parent.appendChild(elem); + } else { + // 不是最后一个元素 + parent.insertBefore(elem, referenceNode.nextSibling); + } + }); + } + }; + +// new 一个对象 + function $(selector) { + return new DomElement(selector); + } + + /* + 配置信息 + */ + + var config = { + + // 默认菜单配置 + menus: ['head', 'bold', 'italic', 'underline', 'strikeThrough', 'foreColor', 'backColor', 'link', 'list', 'justify', 'quote', 'emoticon', 'image', 'table', 'video', 'code', 'undo', 'redo'], + + // 编辑区域的 z-index + zIndex: 10000, + + // 是否开启 debug 模式(debug 模式下错误会 throw error 形式抛出) + debug: false, + + // onchange 事件 + // onchange: function (html) { + // // html 即变化之后的内容 + // console.log(html) + // }, + + // 是否显示添加网络图片的 tab + showLinkImg: true, + + // 默认上传图片 max size: 5M + uploadImgMaxSize: 5 * 1024 * 1024, + + // 配置一次最多上传几个图片 + // uploadImgMaxLength: 5, + + // 上传图片,是否显示 base64 格式 + uploadImgShowBase64: false, + + // 上传图片,server 地址(如果有值,则 base64 格式的配置则失效) + // uploadImgServer: '/upload', + + // 自定义配置 filename + uploadFileName: '', + + // 上传图片的自定义参数 + uploadImgParams: { + token: 'abcdef12345' + }, + + // 上传图片的自定义header + uploadImgHeaders: { + // 'Accept': 'text/x-json' + }, + + // 配置 XHR withCredentials + withCredentials: false, + + // 自定义上传图片超时时间 ms + uploadImgTimeout: 5000, + + // 上传图片 hook + uploadImgHooks: { + // customInsert: function (insertLinkImg, result, editor) { + // console.log('customInsert') + // // 图片上传并返回结果,自定义插入图片的事件,而不是编辑器自动插入图片 + // const data = result.data1 || [] + // data.forEach(link => { + // insertLinkImg(link) + // }) + // }, + before: function before(xhr, editor, files) { + // 图片上传之前触发 + }, + success: function success(xhr, editor, result) { + // 图片上传并返回结果,图片插入成功之后触发 + }, + fail: function fail(xhr, editor, result) { + // 图片上传并返回结果,但图片插入错误时触发 + }, + error: function error(xhr, editor) { + // 图片上传出错时触发 + }, + timeout: function timeout(xhr, editor) { + // 图片上传超时时触发 + } + } + }; + + /* + 工具 + */ + +// 和 UA 相关的属性 + var UA = { + _ua: navigator.userAgent, + + // 是否 webkit + isWebkit: function isWebkit() { + var reg = /webkit/i; + return reg.test(this._ua); + }, + + // 是否 IE + isIE: function isIE() { + return 'ActiveXObject' in window; + } + }; + +// 遍历对象 + function objForEach(obj, fn) { + var key = void 0, + result = void 0; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + result = fn.call(obj, key, obj[key]); + if (result === false) { + break; + } + } + } + } + +// 遍历类数组 + function arrForEach(fakeArr, fn) { + var i = void 0, + item = void 0, + result = void 0; + var length = fakeArr.length || 0; + for (i = 0; i < length; i++) { + item = fakeArr[i]; + result = fn.call(fakeArr, item, i); + if (result === false) { + break; + } + } + } + +// 获取随机数 + function getRandom(prefix) { + return prefix + Math.random().toString().slice(2); + } + +// 替换 html 特殊字符 + function replaceHtmlSymbol(html) { + if (html == null) { + return ''; + } + return html.replace(/</gm, '<').replace(/>/gm, '>').replace(/"/gm, '"'); + } + +// 返回百分比的格式 + + /* + bold-menu + */ +// 构造函数 + function Bold(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-bold"><i/>\n </div>'); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Bold.prototype = { + constructor: Bold, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + var isSeleEmpty = editor.selection.isSelectionEmpty(); + + if (isSeleEmpty) { + // 选区是空的,插入并选中一个“空白” + editor.selection.createEmptyRange(); + } + + // 执行 bold 命令 + editor.cmd.do('bold'); + + if (isSeleEmpty) { + // 需要将选取折叠起来 + editor.selection.collapseRange(); + editor.selection.restoreSelection(); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('bold')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + droplist + */ + var _emptyFn = function _emptyFn() {}; + +// 构造函数 + function DropList(menu, opt) { + var _this = this; + + // droplist 所依附的菜单 + this.menu = menu; + this.opt = opt; + // 容器 + var $container = $('<div class="w-e-droplist"></div>'); + + // 标题 + var $title = opt.$title; + if ($title) { + $title.addClass('w-e-dp-title'); + $container.append($title); + } + + var list = opt.list || []; + var type = opt.type || 'list'; // 'list' 列表形式(如“标题”菜单) / 'inline-block' 块状形式(如“颜色”菜单) + var onClick = opt.onClick || _emptyFn; + + // 加入 DOM 并绑定事件 + var $list = $('<ul class="' + (type === 'list' ? 'w-e-list' : 'w-e-block') + '"></ul>'); + $container.append($list); + list.forEach(function (item) { + var $elem = item.$elem; + var value = item.value; + var $li = $('<li class="w-e-item"></li>'); + if ($elem) { + $li.append($elem); + $list.append($li); + $elem.on('click', function (e) { + onClick(value); + + // 隐藏 + _this.hideTimeoutId = setTimeout(function () { + _this.hide(); + }, 0); + }); + } + }); + + // 绑定隐藏事件 + $container.on('mouseleave', function (e) { + _this.hideTimeoutId = setTimeout(function () { + _this.hide(); + }, 0); + }); + + // 记录属性 + this.$container = $container; + + // 基本属性 + this._rendered = false; + this._show = false; + } + +// 原型 + DropList.prototype = { + constructor: DropList, + + // 显示(插入DOM) + show: function show() { + if (this.hideTimeoutId) { + // 清除之前的定时隐藏 + clearTimeout(this.hideTimeoutId); + } + + var menu = this.menu; + var $menuELem = menu.$elem; + var $container = this.$container; + if (this._show) { + return; + } + if (this._rendered) { + // 显示 + $container.show(); + } else { + // 加入 DOM 之前先定位位置 + var menuHeight = $menuELem.getSizeData().height || 0; + var width = this.opt.width || 100; // 默认为 100 + $container.css('margin-top', menuHeight + 'px').css('width', width + 'px'); + + // 加入到 DOM + $menuELem.append($container); + this._rendered = true; + } + + // 修改属性 + this._show = true; + }, + + // 隐藏(移除DOM) + hide: function hide() { + if (this.showTimeoutId) { + // 清除之前的定时显示 + clearTimeout(this.showTimeoutId); + } + + var $container = this.$container; + if (!this._show) { + return; + } + // 隐藏并需改属性 + $container.hide(); + this._show = false; + } + }; + + /* + menu - header + */ +// 构造函数 + function Head(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-header"><i/></div>'); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 100, + $title: $('<p>设置标题</p>'), + type: 'list', // droplist 以列表形式展示 + list: [{ $elem: $('<h1>H1</h1>'), value: '<h1>' }, { $elem: $('<h2>H2</h2>'), value: '<h2>' }, { $elem: $('<h3>H3</h3>'), value: '<h3>' }, { $elem: $('<h4>H4</h4>'), value: '<h4>' }, { $elem: $('<h5>H5</h5>'), value: '<h5>' }, { $elem: $('<p>正文</p>'), value: '<p>' }], + onClick: function onClick(value) { + // 注意 this 是指向当前的 Head 对象 + _this._command(value); + } + }); + } + +// 原型 + Head.prototype = { + constructor: Head, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do('formatBlock', value); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var reg = /^h/i; + var cmdValue = editor.cmd.queryCommandValue('formatBlock'); + if (reg.test(cmdValue)) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + panel + */ + + var emptyFn = function emptyFn() {}; + +// 记录已经显示 panel 的菜单 + var _isCreatedPanelMenus = []; + +// 构造函数 + function Panel(menu, opt) { + this.menu = menu; + this.opt = opt; + } + +// 原型 + Panel.prototype = { + constructor: Panel, + + // 显示(插入DOM) + show: function show() { + var _this = this; + + var menu = this.menu; + if (_isCreatedPanelMenus.indexOf(menu) >= 0) { + // 该菜单已经创建了 panel 不能再创建 + return; + } + + var editor = menu.editor; + var $body = $('body'); + var $textContainerElem = editor.$textContainerElem; + var opt = this.opt; + + // panel 的容器 + var $container = $('<div class="w-e-panel-container"></div>'); + var width = opt.width || 300; // 默认 300px + $container.css('width', width + 'px').css('margin-left', (0 - width) / 2 + 'px'); + + // 添加关闭按钮 + var $closeBtn = $('<i class="w-e-icon-close w-e-panel-close"></i>'); + $container.append($closeBtn); + $closeBtn.on('click', function () { + _this.hide(); + }); + + // 准备 tabs 容器 + var $tabTitleContainer = $('<ul class="w-e-panel-tab-title"></ul>'); + var $tabContentContainer = $('<div class="w-e-panel-tab-content"></div>'); + $container.append($tabTitleContainer).append($tabContentContainer); + + // 设置高度 + var height = opt.height; + if (height) { + $tabContentContainer.css('height', height + 'px').css('overflow-y', 'auto'); + } + + // tabs + var tabs = opt.tabs || []; + var tabTitleArr = []; + var tabContentArr = []; + tabs.forEach(function (tab, tabIndex) { + if (!tab) { + return; + } + var title = tab.title || ''; + var tpl = tab.tpl || ''; + + // 添加到 DOM + var $title = $('<li class="w-e-item">' + title + '</li>'); + $tabTitleContainer.append($title); + var $content = $(tpl); + $tabContentContainer.append($content); + + // 记录到内存 + $title._index = tabIndex; + tabTitleArr.push($title); + tabContentArr.push($content); + + // 设置 active 项 + if (tabIndex === 0) { + $title._active = true; + $title.addClass('w-e-active'); + } else { + $content.hide(); + } + + // 绑定 tab 的事件 + $title.on('click', function (e) { + if ($title._active) { + return; + } + // 隐藏所有的 tab + tabTitleArr.forEach(function ($title) { + $title._active = false; + $title.removeClass('w-e-active'); + }); + tabContentArr.forEach(function ($content) { + $content.hide(); + }); + + // 显示当前的 tab + $title._active = true; + $title.addClass('w-e-active'); + $content.show(); + }); + }); + + // 绑定关闭事件 + $container.on('click', function (e) { + // 点击时阻止冒泡 + e.stopPropagation(); + }); + $body.on('click', function (e) { + _this.hide(); + }); + + // 添加到 DOM + $textContainerElem.append($container); + + // 绑定 opt 的事件,只有添加到 DOM 之后才能绑定成功 + tabs.forEach(function (tab, index) { + if (!tab) { + return; + } + var events = tab.events || []; + events.forEach(function (event) { + var selector = event.selector; + var type = event.type; + var fn = event.fn || emptyFn; + var $content = tabContentArr[index]; + $content.find(selector).on(type, function (e) { + e.stopPropagation(); + var needToHide = fn(e); + // 执行完事件之后,是否要关闭 panel + if (needToHide) { + _this.hide(); + } + }); + }); + }); + + // focus 第一个 elem + var $inputs = $container.find('input[type=text],textarea'); + if ($inputs.length) { + $inputs.get(0).focus(); + } + + // 添加到属性 + this.$container = $container; + + // 隐藏其他 panel + this._hideOtherPanels(); + // 记录该 menu 已经创建了 panel + _isCreatedPanelMenus.push(menu); + }, + + // 隐藏(移除DOM) + hide: function hide() { + var menu = this.menu; + var $container = this.$container; + if ($container) { + $container.remove(); + } + + // 将该 menu 记录中移除 + _isCreatedPanelMenus = _isCreatedPanelMenus.filter(function (item) { + if (item === menu) { + return false; + } else { + return true; + } + }); + }, + + // 一个 panel 展示时,隐藏其他 panel + _hideOtherPanels: function _hideOtherPanels() { + if (!_isCreatedPanelMenus.length) { + return; + } + _isCreatedPanelMenus.forEach(function (menu) { + var panel = menu.panel || {}; + if (panel.hide) { + panel.hide(); + } + }); + } + }; + + /* + menu - link + */ +// 构造函数 + function Link(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-link"><i/></div>'); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Link.prototype = { + constructor: Link, + + // 点击事件 + onClick: function onClick(e) { + var editor = this.editor; + var $linkelem = void 0; + + if (this._active) { + // 当前选区在链接里面 + $linkelem = editor.selection.getSelectionContainerElem(); + if (!$linkelem) { + return; + } + // 将该元素都包含在选取之内,以便后面整体替换 + editor.selection.createRangeByElem($linkelem); + editor.selection.restoreSelection(); + // 显示 panel + this._createPanel($linkelem.text(), $linkelem.attr('href')); + } else { + // 当前选区不在链接里面 + if (editor.selection.isSelectionEmpty()) { + // 选区是空的,未选中内容 + this._createPanel('', ''); + } else { + // 选中内容了 + this._createPanel(editor.selection.getSelectionText(), ''); + } + } + }, + + // 创建 panel + _createPanel: function _createPanel(text, link) { + var _this = this; + + // panel 中需要用到的id + var inputLinkId = getRandom('input-link'); + var inputTextId = getRandom('input-text'); + var btnOkId = getRandom('btn-ok'); + var btnDelId = getRandom('btn-del'); + + // 是否显示“删除链接” + var delBtnDisplay = this._active ? 'inline-block' : 'none'; + + // 初始化并显示 panel + var panel = new Panel(this, { + width: 300, + // panel 中可包含多个 tab + tabs: [{ + // tab 的标题 + title: '链接', + // 模板 + tpl: '<div>\n <input id="' + inputTextId + '" type="text" class="block" value="' + text + '" placeholder="\u94FE\u63A5\u6587\u5B57"/></td>\n <input id="' + inputLinkId + '" type="text" class="block" value="' + link + '" placeholder="http://..."/></td>\n <div class="w-e-button-container">\n <button id="' + btnOkId + '" class="right">\u63D2\u5165</button>\n <button id="' + btnDelId + '" class="gray right" style="display:' + delBtnDisplay + '">\u5220\u9664\u94FE\u63A5</button>\n </div>\n </div>', + // 事件绑定 + events: [ + // 插入链接 + { + selector: '#' + btnOkId, + type: 'click', + fn: function fn() { + // 执行插入链接 + var $link = $('#' + inputLinkId); + var $text = $('#' + inputTextId); + var link = $link.val(); + var text = $text.val(); + _this._insertLink(text, link); + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, + // 删除链接 + { + selector: '#' + btnDelId, + type: 'click', + fn: function fn() { + // 执行删除链接 + _this._delLink(); + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // tab end + ] // tabs end + }); + + // 显示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 删除当前链接 + _delLink: function _delLink() { + if (!this._active) { + return; + } + var editor = this.editor; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var selectionText = editor.selection.getSelectionText(); + editor.cmd.do('insertHTML', '<span>' + selectionText + '</span>'); + }, + + // 插入链接 + _insertLink: function _insertLink(text, link) { + if (!text || !link) { + return; + } + var editor = this.editor; + editor.cmd.do('insertHTML', '<a href="' + link + '" target="_blank">' + text + '</a>'); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + if ($selectionELem.getNodeName() === 'A') { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + italic-menu + */ +// 构造函数 + function Italic(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-italic"><i/>\n </div>'); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Italic.prototype = { + constructor: Italic, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + var isSeleEmpty = editor.selection.isSelectionEmpty(); + + if (isSeleEmpty) { + // 选区是空的,插入并选中一个“空白” + editor.selection.createEmptyRange(); + } + + // 执行 italic 命令 + editor.cmd.do('italic'); + + if (isSeleEmpty) { + // 需要将选取折叠起来 + editor.selection.collapseRange(); + editor.selection.restoreSelection(); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('italic')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + redo-menu + */ +// 构造函数 + function Redo(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-redo"><i/>\n </div>'); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Redo.prototype = { + constructor: Redo, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + + // 执行 redo 命令 + editor.cmd.do('redo'); + } + }; + + /* + strikeThrough-menu + */ +// 构造函数 + function StrikeThrough(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-strikethrough"><i/>\n </div>'); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + StrikeThrough.prototype = { + constructor: StrikeThrough, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + var isSeleEmpty = editor.selection.isSelectionEmpty(); + + if (isSeleEmpty) { + // 选区是空的,插入并选中一个“空白” + editor.selection.createEmptyRange(); + } + + // 执行 strikeThrough 命令 + editor.cmd.do('strikeThrough'); + + if (isSeleEmpty) { + // 需要将选取折叠起来 + editor.selection.collapseRange(); + editor.selection.restoreSelection(); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('strikeThrough')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + underline-menu + */ +// 构造函数 + function Underline(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-underline"><i/>\n </div>'); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Underline.prototype = { + constructor: Underline, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + var isSeleEmpty = editor.selection.isSelectionEmpty(); + + if (isSeleEmpty) { + // 选区是空的,插入并选中一个“空白” + editor.selection.createEmptyRange(); + } + + // 执行 underline 命令 + editor.cmd.do('underline'); + + if (isSeleEmpty) { + // 需要将选取折叠起来 + editor.selection.collapseRange(); + editor.selection.restoreSelection(); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('underline')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + undo-menu + */ +// 构造函数 + function Undo(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-undo"><i/>\n </div>'); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Undo.prototype = { + constructor: Undo, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + + // 执行 undo 命令 + editor.cmd.do('undo'); + } + }; + + /* + menu - list + */ +// 构造函数 + function List(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-list2"><i/></div>'); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 120, + $title: $('<p>设置列表</p>'), + type: 'list', // droplist 以列表形式展示 + list: [{ $elem: $('<span><i class="w-e-icon-list-numbered"></i> 有序列表</span>'), value: 'insertOrderedList' }, { $elem: $('<span><i class="w-e-icon-list2"></i> 无序列表</span>'), value: 'insertUnorderedList' }], + onClick: function onClick(value) { + // 注意 this 是指向当前的 List 对象 + _this._command(value); + } + }); + } + +// 原型 + List.prototype = { + constructor: List, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + var $textElem = editor.$textElem; + editor.selection.restoreSelection(); + if (editor.cmd.queryCommandState(value)) { + return; + } + editor.cmd.do(value); + + // 验证列表是否被包裹在 <p> 之内 + var $selectionElem = editor.selection.getSelectionContainerElem(); + if ($selectionElem.getNodeName() === 'LI') { + $selectionElem = $selectionElem.parent(); + } + if (/^ol|ul$/i.test($selectionElem.getNodeName()) === false) { + return; + } + if ($selectionElem.equal($textElem)) { + // 证明是顶级标签,没有被 <p> 包裹 + return; + } + var $parent = $selectionElem.parent(); + if ($parent.equal($textElem)) { + // $parent 是顶级标签,不能删除 + return; + } + + $selectionElem.insertAfter($parent); + $parent.remove(); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('insertUnOrderedList') || editor.cmd.queryCommandState('insertOrderedList')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - justify + */ +// 构造函数 + function Justify(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-paragraph-left"><i/></div>'); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 100, + $title: $('<p>对齐方式</p>'), + type: 'list', // droplist 以列表形式展示 + list: [{ $elem: $('<span><i class="w-e-icon-paragraph-left"></i> 靠左</span>'), value: 'justifyLeft' }, { $elem: $('<span><i class="w-e-icon-paragraph-center"></i> 居中</span>'), value: 'justifyCenter' }, { $elem: $('<span><i class="w-e-icon-paragraph-right"></i> 靠右</span>'), value: 'justifyRight' }], + onClick: function onClick(value) { + // 注意 this 是指向当前的 List 对象 + _this._command(value); + } + }); + } + +// 原型 + Justify.prototype = { + constructor: Justify, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do(value); + } + }; + + /* + menu - backcolor + */ +// 构造函数 + function BackColor(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-pencil2"><i/></div>'); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 120, + $title: $('<p>文字颜色</p>'), + type: 'inline-block', // droplist 内容以 block 形式展示 + list: [{ $elem: $('<i style="color:#000000;" class="w-e-icon-pencil2"></i>'), value: '#000000' }, { $elem: $('<i style="color:#eeece0;" class="w-e-icon-pencil2"></i>'), value: '#eeece0' }, { $elem: $('<i style="color:#1c487f;" class="w-e-icon-pencil2"></i>'), value: '#1c487f' }, { $elem: $('<i style="color:#4d80bf;" class="w-e-icon-pencil2"></i>'), value: '#4d80bf' }, { $elem: $('<i style="color:#c24f4a;" class="w-e-icon-pencil2"></i>'), value: '#c24f4a' }, { $elem: $('<i style="color:#8baa4a;" class="w-e-icon-pencil2"></i>'), value: '#8baa4a' }, { $elem: $('<i style="color:#7b5ba1;" class="w-e-icon-pencil2"></i>'), value: '#7b5ba1' }, { $elem: $('<i style="color:#46acc8;" class="w-e-icon-pencil2"></i>'), value: '#46acc8' }, { $elem: $('<i style="color:#f9963b;" class="w-e-icon-pencil2"></i>'), value: '#f9963b' }, { $elem: $('<i style="color:#ffffff;" class="w-e-icon-pencil2"></i>'), value: '#ffffff' }], + onClick: function onClick(value) { + // 注意 this 是指向当前的 BackColor 对象 + _this._command(value); + } + }); + } + +// 原型 + BackColor.prototype = { + constructor: BackColor, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do('foreColor', value); + } + }; + + /* + menu - forecolor + */ +// 构造函数 + function ForeColor$1(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-paint-brush"><i/></div>'); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 120, + $title: $('<p>背景色</p>'), + type: 'inline-block', // droplist 内容以 block 形式展示 + list: [{ $elem: $('<i style="color:#000000;" class="w-e-icon-paint-brush"></i>'), value: '#000000' }, { $elem: $('<i style="color:#eeece0;" class="w-e-icon-paint-brush"></i>'), value: '#eeece0' }, { $elem: $('<i style="color:#1c487f;" class="w-e-icon-paint-brush"></i>'), value: '#1c487f' }, { $elem: $('<i style="color:#4d80bf;" class="w-e-icon-paint-brush"></i>'), value: '#4d80bf' }, { $elem: $('<i style="color:#c24f4a;" class="w-e-icon-paint-brush"></i>'), value: '#c24f4a' }, { $elem: $('<i style="color:#8baa4a;" class="w-e-icon-paint-brush"></i>'), value: '#8baa4a' }, { $elem: $('<i style="color:#7b5ba1;" class="w-e-icon-paint-brush"></i>'), value: '#7b5ba1' }, { $elem: $('<i style="color:#46acc8;" class="w-e-icon-paint-brush"></i>'), value: '#46acc8' }, { $elem: $('<i style="color:#f9963b;" class="w-e-icon-paint-brush"></i>'), value: '#f9963b' }, { $elem: $('<i style="color:#ffffff;" class="w-e-icon-paint-brush"></i>'), value: '#ffffff' }], + onClick: function onClick(value) { + // 注意 this 是指向当前的 ForeColor 对象 + _this._command(value); + } + }); + } + +// 原型 + ForeColor$1.prototype = { + constructor: ForeColor$1, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do('backColor', value); + } + }; + + /* + menu - quote + */ +// 构造函数 + function Quote(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-quotes-left"><i/>\n </div>'); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Quote.prototype = { + constructor: Quote, + + onClick: function onClick(e) { + var editor = this.editor; + editor.cmd.do('formatBlock', '<BLOCKQUOTE>'); + }, + + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var reg = /^BLOCKQUOTE$/i; + var cmdValue = editor.cmd.queryCommandValue('formatBlock'); + if (reg.test(cmdValue)) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - code + */ +// 构造函数 + function Code(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-terminal"><i/>\n </div>'); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Code.prototype = { + constructor: Code, + + onClick: function onClick(e) { + var editor = this.editor; + var $startElem = editor.selection.getSelectionStartElem(); + var $endElem = editor.selection.getSelectionEndElem(); + var isSeleEmpty = editor.selection.isSelectionEmpty(); + var selectionText = editor.selection.getSelectionText(); + var $code = void 0; + + if (!$startElem.equal($endElem)) { + // 跨元素选择,不做处理 + editor.selection.restoreSelection(); + return; + } + if (!isSeleEmpty) { + // 选取不是空,用 <code> 包裹即可 + $code = $('<code>' + selectionText + '</code>'); + editor.cmd.do('insertElem', $code); + editor.selection.createRangeByElem($code, false); + editor.selection.restoreSelection(); + return; + } + + // 选取是空,且没有夸元素选择,则插入 <pre><code></code></prev> + if (this._active) { + // 选中状态,将编辑内容 + this._createPanel($startElem.html()); + } else { + // 未选中状态,将创建内容 + this._createPanel(); + } + }, + + _createPanel: function _createPanel(value) { + var _this = this; + + // value - 要编辑的内容 + value = value || ''; + var type = !value ? 'new' : 'edit'; + var textId = getRandom('texxt'); + var btnId = getRandom('btn'); + + var panel = new Panel(this, { + width: 500, + // 一个 Panel 包含多个 tab + tabs: [{ + // 标题 + title: '插入代码', + // 模板 + tpl: '<div>\n <textarea id="' + textId + '" style="height:145px;;">' + value + '</textarea>\n <div class="w-e-button-container">\n <button id="' + btnId + '" class="right">\u63D2\u5165</button>\n </div>\n <div>', + // 事件绑定 + events: [ + // 插入代码 + { + selector: '#' + btnId, + type: 'click', + fn: function fn() { + var $text = $('#' + textId); + var text = $text.val() || $text.html(); + text = replaceHtmlSymbol(text); + if (type === 'new') { + // 新插入 + _this._insertCode(text); + } else { + // 编辑更新 + _this._updateCode(text); + } + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // first tab end + ] // tabs end + }); // new Panel end + + // 显示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 插入代码 + _insertCode: function _insertCode(value) { + var editor = this.editor; + editor.cmd.do('insertHTML', '<pre><code>' + value + '</code></pre><p><br></p>'); + }, + + // 更新代码 + _updateCode: function _updateCode(value) { + var editor = this.editor; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + $selectionELem.html(value); + editor.selection.restoreSelection(); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var $parentElem = $selectionELem.parent(); + if ($selectionELem.getNodeName() === 'CODE' && $parentElem.getNodeName() === 'PRE') { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - emoticon + */ +// 构造函数 + function Emoticon(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-happy"><i/>\n </div>'); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Emoticon.prototype = { + constructor: Emoticon, + + onClick: function onClick() { + this._createPanel(); + }, + + _createPanel: function _createPanel() { + var _this = this; + + // 拼接表情字符串 + var faceHtml = ''; + var faceStr = '😀 😃 😄 😁 😆 😅 😂 😊 😇 🙂 🙃 😉 😌 😍 😘 😗 😙 😚 😋 😜 😝 😛 🤑 🤗 🤓 😎 😏 😒 😞 😔 😟 😕 🙁 😣 😖 😫 😩 😤 😠 😡 😶 😐 😑 😯 😦 😧 😮 😲 😵 😳 😱 😨 😰 😢 😥 😭 😓 😪 😴 🙄 🤔 😬 🤐'; + faceStr.split(/\s/).forEach(function (item) { + if (item) { + faceHtml += '<span class="w-e-item">' + item + '</span>'; + } + }); + + var handHtml = ''; + var handStr = '🙌 👏 👋 👍 👎 👊 ✊ ️👌 ✋ 👐 💪 🙏 ️👆 👇 👈 👉 🖕 🖐 🤘 🖖'; + handStr.split(/\s/).forEach(function (item) { + if (item) { + handHtml += '<span class="w-e-item">' + item + '</span>'; + } + }); + + var panel = new Panel(this, { + width: 300, + height: 200, + // 一个 Panel 包含多个 tab + tabs: [{ + // 标题 + title: '表情', + // 模板 + tpl: '<div class="w-e-emoticon-container">' + faceHtml + '</div>', + // 事件绑定 + events: [{ + selector: 'span.w-e-item', + type: 'click', + fn: function fn(e) { + var target = e.target; + _this._insert(target.innerHTML); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + }, // first tab end + { + // 标题 + title: '手势', + // 模板 + tpl: '<div class="w-e-emoticon-container">' + handHtml + '</div>', + // 事件绑定 + events: [{ + selector: 'span.w-e-item', + type: 'click', + fn: function fn(e) { + var target = e.target; + _this._insert(target.innerHTML); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // second tab end + ] // tabs end + }); + + // 显示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 插入表情 + _insert: function _insert(emoji) { + var editor = this.editor; + editor.cmd.do('insertHTML', '<span>' + emoji + '</span>'); + } + }; + + /* + menu - table + */ +// 构造函数 + function Table(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-table2"><i/></div>'); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Table.prototype = { + constructor: Table, + + onClick: function onClick() { + if (this._active) { + // 编辑现有表格 + this._createEditPanel(); + } else { + // 插入新表格 + this._createInsertPanel(); + } + }, + + // 创建插入新表格的 panel + _createInsertPanel: function _createInsertPanel() { + var _this = this; + + // 用到的 id + var btnInsertId = getRandom('btn'); + var textRowNum = getRandom('row'); + var textColNum = getRandom('col'); + + var panel = new Panel(this, { + width: 250, + // panel 包含多个 tab + tabs: [{ + // 标题 + title: '插入表格', + // 模板 + tpl: '<div>\n <p style="text-align:left; padding:5px 0;">\n \u521B\u5EFA\n <input id="' + textRowNum + '" type="text" value="5" style="width:40px;text-align:center;"/>\n \u884C\n <input id="' + textColNum + '" type="text" value="5" style="width:40px;text-align:center;"/>\n \u5217\u7684\u8868\u683C\n </p>\n <div class="w-e-button-container">\n <button id="' + btnInsertId + '" class="right">\u63D2\u5165</button>\n </div>\n </div>', + // 事件绑定 + events: [{ + // 点击按钮,插入表格 + selector: '#' + btnInsertId, + type: 'click', + fn: function fn() { + var rowNum = parseInt($('#' + textRowNum).val()); + var colNum = parseInt($('#' + textColNum).val()); + + if (rowNum && colNum && rowNum > 0 && colNum > 0) { + // form 数据有效 + _this._insert(rowNum, colNum); + } + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // first tab end + ] // tabs end + }); // panel end + + // 展示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 插入表格 + _insert: function _insert(rowNum, colNum) { + // 拼接 table 模板 + var r = void 0, + c = void 0; + var html = '<table border="0" width="100%" cellpadding="0" cellspacing="0">'; + for (r = 0; r < rowNum; r++) { + html += '<tr>'; + if (r === 0) { + for (c = 0; c < colNum; c++) { + html += '<th> </th>'; + } + } else { + for (c = 0; c < colNum; c++) { + html += '<td> </td>'; + } + } + html += '</tr>'; + } + html += '</table><p><br></p>'; + + // 执行命令 + var editor = this.editor; + editor.cmd.do('insertHTML', html); + + // 防止 firefox 下出现 resize 的控制点 + editor.cmd.do('enableObjectResizing', false); + editor.cmd.do('enableInlineTableEditing', false); + }, + + // 创建编辑表格的 panel + _createEditPanel: function _createEditPanel() { + var _this2 = this; + + // 可用的 id + var addRowBtnId = getRandom('add-row'); + var addColBtnId = getRandom('add-col'); + var delRowBtnId = getRandom('del-row'); + var delColBtnId = getRandom('del-col'); + var delTableBtnId = getRandom('del-table'); + + // 创建 panel 对象 + var panel = new Panel(this, { + width: 320, + // panel 包含多个 tab + tabs: [{ + // 标题 + title: '编辑表格', + // 模板 + tpl: '<div>\n <div class="w-e-button-container" style="border-bottom:1px solid #f1f1f1;padding-bottom:5px;margin-bottom:5px;">\n <button id="' + addRowBtnId + '" class="left">\u589E\u52A0\u884C</button>\n <button id="' + delRowBtnId + '" class="red left">\u5220\u9664\u884C</button>\n <button id="' + addColBtnId + '" class="left">\u589E\u52A0\u5217</button>\n <button id="' + delColBtnId + '" class="red left">\u5220\u9664\u5217</button>\n </div>\n <div class="w-e-button-container">\n <button id="' + delTableBtnId + '" class="gray left">\u5220\u9664\u8868\u683C</button>\n </dv>\n </div>', + // 事件绑定 + events: [{ + // 增加行 + selector: '#' + addRowBtnId, + type: 'click', + fn: function fn() { + _this2._addRow(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + // 增加列 + selector: '#' + addColBtnId, + type: 'click', + fn: function fn() { + _this2._addCol(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + // 删除行 + selector: '#' + delRowBtnId, + type: 'click', + fn: function fn() { + _this2._delRow(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + // 删除列 + selector: '#' + delColBtnId, + type: 'click', + fn: function fn() { + _this2._delCol(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + // 删除表格 + selector: '#' + delTableBtnId, + type: 'click', + fn: function fn() { + _this2._delTable(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + }] + }); + // 显示 panel + panel.show(); + }, + + // 获取选中的单元格的位置信息 + _getLocationData: function _getLocationData() { + var result = {}; + var editor = this.editor; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var nodeName = $selectionELem.getNodeName(); + if (nodeName !== 'TD' && nodeName !== 'TH') { + return; + } + + // 获取 td index + var $tr = $selectionELem.parent(); + var $tds = $tr.children(); + var tdLength = $tds.length; + $tds.forEach(function (td, index) { + if (td === $selectionELem[0]) { + // 记录并跳出循环 + result.td = { + index: index, + elem: td, + length: tdLength + }; + return false; + } + }); + + // 获取 tr index + var $tbody = $tr.parent(); + var $trs = $tbody.children(); + var trLength = $trs.length; + $trs.forEach(function (tr, index) { + if (tr === $tr[0]) { + // 记录并跳出循环 + result.tr = { + index: index, + elem: tr, + length: trLength + }; + return false; + } + }); + + // 返回结果 + return result; + }, + + // 增加行 + _addRow: function _addRow() { + // 获取当前单元格的位置信息 + var locationData = this._getLocationData(); + if (!locationData) { + return; + } + var trData = locationData.tr; + var $currentTr = $(trData.elem); + var tdData = locationData.td; + var tdLength = tdData.length; + + // 拼接即将插入的字符串 + var newTr = document.createElement('tr'); + var tpl = '', + i = void 0; + for (i = 0; i < tdLength; i++) { + tpl += '<td> </td>'; + } + newTr.innerHTML = tpl; + // 插入 + $(newTr).insertAfter($currentTr); + }, + + // 增加列 + _addCol: function _addCol() { + // 获取当前单元格的位置信息 + var locationData = this._getLocationData(); + if (!locationData) { + return; + } + var trData = locationData.tr; + var tdData = locationData.td; + var tdIndex = tdData.index; + var $currentTr = $(trData.elem); + var $trParent = $currentTr.parent(); + var $trs = $trParent.children(); + + // 遍历所有行 + $trs.forEach(function (tr) { + var $tr = $(tr); + var $tds = $tr.children(); + var $currentTd = $tds.get(tdIndex); + var name = $currentTd.getNodeName().toLowerCase(); + + // new 一个 td,并插入 + var newTd = document.createElement(name); + $(newTd).insertAfter($currentTd); + }); + }, + + // 删除行 + _delRow: function _delRow() { + // 获取当前单元格的位置信息 + var locationData = this._getLocationData(); + if (!locationData) { + return; + } + var trData = locationData.tr; + var $currentTr = $(trData.elem); + $currentTr.remove(); + }, + + // 删除列 + _delCol: function _delCol() { + // 获取当前单元格的位置信息 + var locationData = this._getLocationData(); + if (!locationData) { + return; + } + var trData = locationData.tr; + var tdData = locationData.td; + var tdIndex = tdData.index; + var $currentTr = $(trData.elem); + var $trParent = $currentTr.parent(); + var $trs = $trParent.children(); + + // 遍历所有行 + $trs.forEach(function (tr) { + var $tr = $(tr); + var $tds = $tr.children(); + var $currentTd = $tds.get(tdIndex); + // 删除 + $currentTd.remove(); + }); + }, + + // 删除表格 + _delTable: function _delTable() { + var editor = this.editor; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var $table = $selectionELem.parentUntil('table'); + if (!$table) { + return; + } + $table.remove(); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var nodeName = $selectionELem.getNodeName(); + if (nodeName === 'TD' || nodeName === 'TH') { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - video + */ +// 构造函数 + function Video(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-play"><i/></div>'); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Video.prototype = { + constructor: Video, + + onClick: function onClick() { + this._createPanel(); + }, + + _createPanel: function _createPanel() { + var _this = this; + + // 创建 id + var textValId = getRandom('text-val'); + var btnId = getRandom('btn'); + + // 创建 panel + var panel = new Panel(this, { + width: 350, + // 一个 panel 多个 tab + tabs: [{ + // 标题 + title: '插入视频', + // 模板 + tpl: '<div>\n <input id="' + textValId + '" type="text" class="block" placeholder="\u683C\u5F0F\u5982\uFF1A<iframe src=... ></iframe>"/>\n <div class="w-e-button-container">\n <button id="' + btnId + '" class="right">\u63D2\u5165</button>\n </div>\n </div>', + // 事件绑定 + events: [{ + selector: '#' + btnId, + type: 'click', + fn: function fn() { + var $text = $('#' + textValId); + var val = $text.val().trim(); + + // 测试用视频地址 + // <iframe height=498 width=510 src='http://player.youku.com/embed/XMjcwMzc3MzM3Mg==' frameborder=0 'allowfullscreen'></iframe> + + if (val) { + // 插入视频 + _this._insert(val); + } + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // first tab end + ] // tabs end + }); // panel end + + // 显示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 插入视频 + _insert: function _insert(val) { + var editor = this.editor; + editor.cmd.do('insertHTML', val + '<p><br></p>'); + } + }; + + /* + menu - img + */ +// 构造函数 + function Image(editor) { + this.editor = editor; + this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-image"><i/></div>'); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Image.prototype = { + constructor: Image, + + onClick: function onClick() { + if (this._active) { + this._createEditPanel(); + } else { + this._createInsertPanel(); + } + }, + + _createEditPanel: function _createEditPanel() { + var editor = this.editor; + + // id + var width30 = getRandom('width-30'); + var width50 = getRandom('width-50'); + var width100 = getRandom('width-100'); + var delBtn = getRandom('del-btn'); + + // tab 配置 + var tabsConfig = [{ + title: '编辑图片', + tpl: '<div>\n <div class="w-e-button-container" style="border-bottom:1px solid #f1f1f1;padding-bottom:5px;margin-bottom:5px;">\n <span style="float:left;font-size:14px;margin:4px 5px 0 5px;color:#333;">\u6700\u5927\u5BBD\u5EA6\uFF1A</span>\n <button id="' + width30 + '" class="left">30%</button>\n <button id="' + width50 + '" class="left">50%</button>\n <button id="' + width100 + '" class="left">100%</button>\n </div>\n <div class="w-e-button-container">\n <button id="' + delBtn + '" class="gray left">\u5220\u9664\u56FE\u7247</button>\n </dv>\n </div>', + events: [{ + selector: '#' + width30, + type: 'click', + fn: function fn() { + var $img = editor._selectedImg; + if ($img) { + $img.css('max-width', '30%'); + } + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + selector: '#' + width50, + type: 'click', + fn: function fn() { + var $img = editor._selectedImg; + if ($img) { + $img.css('max-width', '50%'); + } + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + selector: '#' + width100, + type: 'click', + fn: function fn() { + var $img = editor._selectedImg; + if ($img) { + $img.css('max-width', '100%'); + } + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + selector: '#' + delBtn, + type: 'click', + fn: function fn() { + var $img = editor._selectedImg; + if ($img) { + $img.remove(); + } + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + }]; + + // 创建 panel 并显示 + var panel = new Panel(this, { + width: 300, + tabs: tabsConfig + }); + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + _createInsertPanel: function _createInsertPanel() { + var editor = this.editor; + var uploadImg = editor.uploadImg; + var config = editor.config; + + // id + var upTriggerId = getRandom('up-trigger'); + var upFileId = getRandom('up-file'); + var linkUrlId = getRandom('link-url'); + var linkBtnId = getRandom('link-btn'); + + // tabs 的配置 + var tabsConfig = [{ + title: '上传图片', + tpl: '<div class="w-e-up-img-container">\n <div id="' + upTriggerId + '" class="w-e-up-btn">\n <i class="w-e-icon-upload2"></i>\n </div>\n <div style="display:none;">\n <input id="' + upFileId + '" type="file" multiple="multiple" accept="image/jpg,image/jpeg,image/png,image/gif,image/bmp"/>\n </div>\n </div>', + events: [{ + // 触发选择图片 + selector: '#' + upTriggerId, + type: 'click', + fn: function fn() { + var $file = $('#' + upFileId); + var fileElem = $file[0]; + if (fileElem) { + fileElem.click(); + } else { + // 返回 true 可关闭 panel + return true; + } + } + }, { + // 选择图片完毕 + selector: '#' + upFileId, + type: 'change', + fn: function fn() { + var $file = $('#' + upFileId); + var fileElem = $file[0]; + if (!fileElem) { + // 返回 true 可关闭 panel + return true; + } + + // 获取选中的 file 对象列表 + var fileList = fileElem.files; + if (fileList.length) { + uploadImg.uploadImg(fileList); + } + + // 返回 true 可关闭 panel + return true; + } + }] + }, // first tab end + { + title: '网络图片', + tpl: '<div>\n <input id="' + linkUrlId + '" type="text" class="block" placeholder="\u56FE\u7247\u94FE\u63A5"/></td>\n <div class="w-e-button-container">\n <button id="' + linkBtnId + '" class="right">\u63D2\u5165</button>\n </div>\n </div>', + events: [{ + selector: '#' + linkBtnId, + type: 'click', + fn: function fn() { + var $linkUrl = $('#' + linkUrlId); + var url = $linkUrl.val().trim(); + + if (url) { + uploadImg.insertLinkImg(url); + } + + // 返回 true 表示函数执行结束之后关闭 panel + return true; + } + }] + } // second tab end + ]; // tabs end + + // 判断 tabs 的显示 + var tabsConfigResult = []; + if ((config.uploadImgShowBase64 || config.uploadImgServer) && window.FileReader) { + // 显示“上传图片” + tabsConfigResult.push(tabsConfig[0]); + } + if (config.showLinkImg) { + // 显示“网络图片” + tabsConfigResult.push(tabsConfig[1]); + } + + // 创建 panel 并显示 + var panel = new Panel(this, { + width: 300, + tabs: tabsConfigResult + }); + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor._selectedImg) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + 所有菜单的汇总 + */ + +// 存储菜单的构造函数 + var MenuConstructors = {}; + + MenuConstructors.bold = Bold; + + MenuConstructors.head = Head; + + MenuConstructors.link = Link; + + MenuConstructors.italic = Italic; + + MenuConstructors.redo = Redo; + + MenuConstructors.strikeThrough = StrikeThrough; + + MenuConstructors.underline = Underline; + + MenuConstructors.undo = Undo; + + MenuConstructors.list = List; + + MenuConstructors.justify = Justify; + + MenuConstructors.foreColor = BackColor; + + MenuConstructors.backColor = ForeColor$1; + + MenuConstructors.quote = Quote; + + MenuConstructors.code = Code; + + MenuConstructors.emoticon = Emoticon; + + MenuConstructors.table = Table; + + MenuConstructors.video = Video; + + MenuConstructors.image = Image; + + /* + 菜单集合 + */ +// 构造函数 + function Menus(editor) { + this.editor = editor; + this.menus = {}; + } + +// 修改原型 + Menus.prototype = { + constructor: Menus, + + // 初始化菜单 + init: function init() { + var _this = this; + + var editor = this.editor; + var config = editor.config || {}; + var configMenus = config.menus || []; // 获取配置中的菜单 + + // 根据配置信息,创建菜单 + configMenus.forEach(function (menuKey) { + var MenuConstructor = MenuConstructors[menuKey]; + if (MenuConstructor && typeof MenuConstructor === 'function') { + // 创建单个菜单 + _this.menus[menuKey] = new MenuConstructor(editor); + } + }); + + // 添加到菜单栏 + this._addToToolbar(); + + // 绑定事件 + this._bindEvent(); + }, + + // 添加到菜单栏 + _addToToolbar: function _addToToolbar() { + var editor = this.editor; + var $toolbarElem = editor.$toolbarElem; + var menus = this.menus; + objForEach(menus, function (key, menu) { + var $elem = menu.$elem; + if ($elem) { + $toolbarElem.append($elem); + } + }); + }, + + // 绑定菜单 click mouseenter 事件 + _bindEvent: function _bindEvent() { + var menus = this.menus; + var editor = this.editor; + objForEach(menus, function (key, menu) { + var type = menu.type; + if (!type) { + return; + } + var $elem = menu.$elem; + var droplist = menu.droplist; + var panel = menu.panel; + + // 点击类型,例如 bold + if (type === 'click' && menu.onClick) { + $elem.on('click', function (e) { + if (editor.selection.getRange() == null) { + return; + } + menu.onClick(e); + }); + } + + // 下拉框,例如 head + if (type === 'droplist' && droplist) { + $elem.on('mouseenter', function (e) { + if (editor.selection.getRange() == null) { + return; + } + // 显示 + droplist.showTimeoutId = setTimeout(function () { + droplist.show(); + }, 200); + }).on('mouseleave', function (e) { + // 隐藏 + droplist.hideTimeoutId = setTimeout(function () { + droplist.hide(); + }, 0); + }); + } + + // 弹框类型,例如 link + if (type === 'panel' && menu.onClick) { + $elem.on('click', function (e) { + e.stopPropagation(); + if (editor.selection.getRange() == null) { + return; + } + // 在自定义事件中显示 panel + menu.onClick(e); + }); + } + }); + }, + + // 尝试修改菜单状态 + changeActive: function changeActive() { + var menus = this.menus; + objForEach(menus, function (key, menu) { + if (menu.tryChangeActive) { + setTimeout(function () { + menu.tryChangeActive(); + }, 100); + } + }); + } + }; + + /* + 粘贴信息的处理 + */ + +// 获取粘贴的纯文本 + function getPasteText(e) { + var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData; + var pasteText = void 0; + if (clipboardData == null) { + pasteText = window.clipboardData && window.clipboardData.getData('text'); + } else { + pasteText = clipboardData.getData('text/plain'); + } + + return replaceHtmlSymbol(pasteText); + } + +// 获取粘贴的html + function getPasteHtml(e) { + var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData; + var pasteText = void 0, + pasteHtml = void 0; + if (clipboardData == null) { + pasteText = window.clipboardData && window.clipboardData.getData('text'); + } else { + pasteText = clipboardData.getData('text/plain'); + pasteHtml = clipboardData.getData('text/html'); + } + if (!pasteHtml && pasteText) { + pasteHtml = '<p>' + replaceHtmlSymbol(pasteText) + '</p>'; + } + if (!pasteHtml) { + return; + } + + // 过滤word中状态过来的无用字符 + var docSplitHtml = pasteHtml.split('</html>'); + if (docSplitHtml.length === 2) { + pasteHtml = docSplitHtml[0]; + } + + // 过滤无用标签 + pasteHtml = pasteHtml.replace(/<(meta|script|link).+?>/igm, ''); + + // 过滤样式 + pasteHtml = pasteHtml.replace(/\s?(class|style)=('|").+?('|")/igm, ''); + + return pasteHtml; + } + +// 获取粘贴的图片文件 + function getPasteImgs(e) { + var result = []; + var txt = getPasteText(e); + if (txt) { + // 有文字,就忽略图片 + return result; + } + + var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData || {}; + var items = clipboardData.items; + if (!items) { + return result; + } + + objForEach(items, function (key, value) { + var type = value.type; + if (/image/i.test(type)) { + result.push(value.getAsFile()); + } + }); + + return result; + } + + /* + 编辑区域 + */ + +// 构造函数 + function Text(editor) { + this.editor = editor; + } + +// 修改原型 + Text.prototype = { + constructor: Text, + + // 初始化 + init: function init() { + // 绑定事件 + this._bindEvent(); + }, + + // 清空内容 + clear: function clear() { + this.html('<p><br></p>'); + }, + + // 获取 设置 html + html: function html(val) { + var editor = this.editor; + var $textElem = editor.$textElem; + if (val == null) { + return $textElem.html(); + } else { + $textElem.html(val); + + // 初始化选取,将光标定位到内容尾部 + editor.initSelection(); + } + }, + + // 获取 设置 text + text: function text(val) { + var editor = this.editor; + var $textElem = editor.$textElem; + if (val == null) { + return $textElem.text(); + } else { + $textElem.text('<p>' + val + '</p>'); + + // 初始化选取,将光标定位到内容尾部 + editor.initSelection(); + } + }, + + // 追加内容 + append: function append(html) { + var editor = this.editor; + var $textElem = editor.$textElem; + $textElem.append($(html)); + + // 初始化选取,将光标定位到内容尾部 + editor.initSelection(); + }, + + // 绑定事件 + _bindEvent: function _bindEvent() { + // 实时保存选取 + this._saveRangeRealTime(); + + // 按回车建时的特殊处理 + this._enterKeyHandle(); + + // 清空时保留 <p><br></p> + this._clearHandle(); + + // 粘贴事件(粘贴文字,粘贴图片) + this._pasteHandle(); + + // tab 特殊处理 + this._tabHandle(); + + // img 点击 + this._imgHandle(); + }, + + // 实时保存选取 + _saveRangeRealTime: function _saveRangeRealTime() { + var editor = this.editor; + var $textElem = editor.$textElem; + + // 保存当前的选区 + function saveRange(e) { + // 随时保存选区 + editor.selection.saveRange(); + // 更新按钮 ative 状态 + editor.menus.changeActive(); + } + // 按键后保存 + $textElem.on('keyup', saveRange); + $textElem.on('mousedown', function (e) { + // mousedown 状态下,鼠标滑动到编辑区域外面,也需要保存选区 + $textElem.on('mouseleave', saveRange); + }); + $textElem.on('mouseup', function (e) { + saveRange(); + // 在编辑器区域之内完成点击,取消鼠标滑动到编辑区外面的事件 + $textElem.off('mouseleave', saveRange); + }); + }, + + // 按回车键时的特殊处理 + _enterKeyHandle: function _enterKeyHandle() { + var editor = this.editor; + var $textElem = editor.$textElem; + + // 将回车之后生成的非 <p> 的顶级标签,改为 <p> + function pHandle(e) { + var $selectionElem = editor.selection.getSelectionContainerElem(); + var $parentElem = $selectionElem.parent(); + if (!$parentElem.equal($textElem)) { + // 不是顶级标签 + return; + } + var nodeName = $selectionElem.getNodeName(); + if (nodeName === 'P') { + // 当前的标签是 P ,不用做处理 + return; + } + + if ($selectionElem.text()) { + // 有内容,不做处理 + return; + } + + // 插入 <p> ,并将选取定位到 <p>,删除当前标签 + var $p = $('<p><br></p>'); + $p.insertBefore($selectionElem); + editor.selection.createRangeByElem($p, true); + editor.selection.restoreSelection(); + $selectionElem.remove(); + } + + $textElem.on('keyup', function (e) { + if (e.keyCode !== 13) { + // 不是回车键 + return; + } + // 将回车之后生成的非 <p> 的顶级标签,改为 <p> + pHandle(e); + }); + + // <pre><code></code></pre> 回车时 特殊处理 + function codeHandle(e) { + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (!$selectionElem) { + return; + } + var $parentElem = $selectionElem.parent(); + var selectionNodeName = $selectionElem.getNodeName(); + var parentNodeName = $parentElem.getNodeName(); + + if (selectionNodeName !== 'CODE' || parentNodeName !== 'PRE') { + // 不符合要求 忽略 + return; + } + + if (!editor.cmd.queryCommandSupported('insertHTML')) { + // 必须原生支持 insertHTML 命令 + return; + } + + var _startOffset = editor.selection.getRange().startOffset; + editor.cmd.do('insertHTML', '\n'); + editor.selection.saveRange(); + if (editor.selection.getRange().startOffset === _startOffset) { + // 没起作用,再来一遍 + editor.cmd.do('insertHTML', '\n'); + } + + // 阻止默认行为 + e.preventDefault(); + } + + $textElem.on('keydown', function (e) { + if (e.keyCode !== 13) { + // 不是回车键 + return; + } + // <pre><code></code></pre> 回车时 特殊处理 + codeHandle(e); + }); + }, + + // 清空时保留 <p><br></p> + _clearHandle: function _clearHandle() { + var editor = this.editor; + var $textElem = editor.$textElem; + + $textElem.on('keydown', function (e) { + if (e.keyCode !== 8) { + return; + } + var txtHtml = $textElem.html().toLowerCase().trim(); + if (txtHtml === '<p><br></p>') { + // 最后剩下一个空行,就不再删除了 + e.preventDefault(); + return; + } + }); + + $textElem.on('keyup', function (e) { + if (e.keyCode !== 8) { + return; + } + var $p = void 0; + var txtHtml = $textElem.html().toLowerCase().trim(); + + // firefox 时用 txtHtml === '<br>' 判断,其他用 !txtHtml 判断 + if (!txtHtml || txtHtml === '<br>') { + // 内容空了 + $p = $('<p><br/></p>'); + $textElem.html(''); // 一定要先清空,否则在 firefox 下有问题 + $textElem.append($p); + editor.selection.createRangeByElem($p, false, true); + editor.selection.restoreSelection(); + } + }); + }, + + // 粘贴事件(粘贴文字 粘贴图片) + _pasteHandle: function _pasteHandle() { + var editor = this.editor; + var $textElem = editor.$textElem; + + // 粘贴文字 + $textElem.on('paste', function (e) { + if (UA.isIE()) { + // IE 下放弃下面的判断 + return; + } + + // 阻止默认行为,使用 execCommand 的粘贴命令 + e.preventDefault(); + + // 获取粘贴的文字 + var pasteHtml = getPasteHtml(e); + var pasteText = getPasteText(e); + pasteText = pasteText.replace(/\n/gm, '<br>'); + + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (!$selectionElem) { + return; + } + var nodeName = $selectionElem.getNodeName(); + + // code 中粘贴忽略 + if (nodeName === 'CODE' || nodeName === 'PRE') { + return; + } + + // 表格中忽略,可能会出现异常问题 + if (nodeName === 'TD' || nodeName === 'TH') { + return; + } + + if (nodeName === 'DIV' || $textElem.html() === '<p><br></p>') { + // 是 div,可粘贴过滤样式的文字和链接 + if (!pasteHtml) { + return; + } + try { + // firefox 中,获取的 pasteHtml 可能是没有 <ul> 包裹的 <li> + // 因此执行 insertHTML 会报错 + editor.cmd.do('insertHTML', pasteHtml); + } catch (ex) { + // 此时使用 pasteText 来兼容一下 + editor.cmd.do('insertHTML', '<p>' + pasteText + '</p>'); + } + } else { + // 不是 div,证明在已有内容的元素中粘贴,只粘贴纯文本 + if (!pasteText) { + return; + } + editor.cmd.do('insertHTML', '<p>' + pasteText + '</p>'); + } + }); + + // 粘贴图片 + $textElem.on('paste', function (e) { + e.preventDefault(); + + // 获取粘贴的图片 + var pasteFiles = getPasteImgs(e); + if (!pasteFiles || !pasteFiles.length) { + return; + } + + // 获取当前的元素 + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (!$selectionElem) { + return; + } + var nodeName = $selectionElem.getNodeName(); + + // code 中粘贴忽略 + if (nodeName === 'CODE' || nodeName === 'PRE') { + return; + } + + // 上传图片 + var uploadImg = editor.uploadImg; + uploadImg.uploadImg(pasteFiles); + }); + }, + + // tab 特殊处理 + _tabHandle: function _tabHandle() { + var editor = this.editor; + var $textElem = editor.$textElem; + + $textElem.on('keydown', function (e) { + if (e.keyCode !== 9) { + return; + } + if (!editor.cmd.queryCommandSupported('insertHTML')) { + // 必须原生支持 insertHTML 命令 + return; + } + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (!$selectionElem) { + return; + } + var $parentElem = $selectionElem.parent(); + var selectionNodeName = $selectionElem.getNodeName(); + var parentNodeName = $parentElem.getNodeName(); + + if (selectionNodeName === 'CODE' && parentNodeName === 'PRE') { + // <pre><code> 里面 + editor.cmd.do('insertHTML', ' '); + } else { + // 普通文字 + editor.cmd.do('insertHTML', ' '); + } + + e.preventDefault(); + }); + }, + + // img 点击 + _imgHandle: function _imgHandle() { + var editor = this.editor; + var $textElem = editor.$textElem; + var selectedClass = 'w-e-selected'; + + // 为图片增加 selected 样式 + $textElem.on('click', 'img', function (e) { + var img = this; + var $img = $(img); + + // 去掉所有图片的 selected 样式 + $textElem.find('img').removeClass(selectedClass); + + // 为点击的图片增加样式,并记录当前图片 + $img.addClass(selectedClass); + editor._selectedImg = $img; + + // 修改选取 + editor.selection.createRangeByElem($img); + }); + + // 去掉图片的 selected 样式 + $textElem.on('click keyup', function (e) { + if (e.target.matches('img')) { + // 点击的是图片,忽略 + return; + } + // 取消掉 selected 样式,并删除记录 + $textElem.find('img').removeClass(selectedClass); + editor._selectedImg = null; + }); + } + }; + + /* + 命令,封装 document.execCommand + */ + +// 构造函数 + function Command(editor) { + this.editor = editor; + } + +// 修改原型 + Command.prototype = { + constructor: Command, + + // 执行命令 + do: function _do(name, value) { + var editor = this.editor; + + // 如果无选区,忽略 + if (!editor.selection.getRange()) { + return; + } + + // 恢复选取 + editor.selection.restoreSelection(); + + // 执行 + var _name = '_' + name; + if (this[_name]) { + // 有自定义事件 + this[_name](value); + } else { + // 默认 command + this._execCommand(name, value); + } + + // 修改菜单状态 + editor.menus.changeActive(); + + // 最后,恢复选取保证光标在原来的位置闪烁 + editor.selection.saveRange(); + editor.selection.restoreSelection(); + + // 触发 onchange + editor.change && editor.change(); + }, + + // 自定义 insertHTML 事件 + _insertHTML: function _insertHTML(html) { + var editor = this.editor; + var range = editor.selection.getRange(); + + // 保证传入的参数是 html 代码 + var test = /^<.+>$/.test(html); + if (!test && !UA.isWebkit()) { + // webkit 可以插入非 html 格式的文字 + throw new Error('执行 insertHTML 命令时传入的参数必须是 html 格式'); + } + + if (this.queryCommandSupported('insertHTML')) { + // W3C + this._execCommand('insertHTML', html); + } else if (range.insertNode) { + // IE + range.deleteContents(); + range.insertNode($(html)[0]); + } else if (range.pasteHTML) { + // IE <= 10 + range.pasteHTML(html); + } + }, + + // 插入 elem + _insertElem: function _insertElem($elem) { + var editor = this.editor; + var range = editor.selection.getRange(); + + if (range.insertNode) { + range.deleteContents(); + range.insertNode($elem[0]); + } + }, + + // 封装 execCommand + _execCommand: function _execCommand(name, value) { + document.execCommand(name, false, value); + }, + + // 封装 document.queryCommandValue + queryCommandValue: function queryCommandValue(name) { + return document.queryCommandValue(name); + }, + + // 封装 document.queryCommandState + queryCommandState: function queryCommandState(name) { + return document.queryCommandState(name); + }, + + // 封装 document.queryCommandSupported + queryCommandSupported: function queryCommandSupported(name) { + return document.queryCommandSupported(name); + } + }; + + /* + selection range API + */ + +// 构造函数 + function API(editor) { + this.editor = editor; + this._currentRange = null; + } + +// 修改原型 + API.prototype = { + constructor: API, + + // 获取 range 对象 + getRange: function getRange() { + return this._currentRange; + }, + + // 保存选区 + saveRange: function saveRange(_range) { + if (_range) { + // 保存已有选区 + this._currentRange = _range; + return; + } + + // 获取当前的选区 + var selection = window.getSelection(); + if (selection.rangeCount === 0) { + return; + } + var range = selection.getRangeAt(0); + + // 判断选区内容是否在编辑内容之内 + var $containerElem = this.getSelectionContainerElem(range); + if (!$containerElem) { + return; + } + var editor = this.editor; + var $textElem = editor.$textElem; + if ($textElem.isContain($containerElem)) { + // 是编辑内容之内的 + this._currentRange = range; + } + }, + + // 折叠选区 + collapseRange: function collapseRange(toStart) { + if (toStart == null) { + // 默认为 false + toStart = false; + } + var range = this._currentRange; + if (range) { + range.collapse(toStart); + } + }, + + // 选中区域的文字 + getSelectionText: function getSelectionText() { + var range = this._currentRange; + if (range) { + return this._currentRange.toString(); + } else { + return ''; + } + }, + + // 选区的 $Elem + getSelectionContainerElem: function getSelectionContainerElem(range) { + range = range || this._currentRange; + var elem = void 0; + if (range) { + elem = range.commonAncestorContainer; + return $(elem.nodeType === 1 ? elem : elem.parentNode); + } + }, + getSelectionStartElem: function getSelectionStartElem(range) { + range = range || this._currentRange; + var elem = void 0; + if (range) { + elem = range.startContainer; + return $(elem.nodeType === 1 ? elem : elem.parentNode); + } + }, + getSelectionEndElem: function getSelectionEndElem(range) { + range = range || this._currentRange; + var elem = void 0; + if (range) { + elem = range.endContainer; + return $(elem.nodeType === 1 ? elem : elem.parentNode); + } + }, + + // 选区是否为空 + isSelectionEmpty: function isSelectionEmpty() { + var range = this._currentRange; + if (range && range.startContainer) { + if (range.startContainer === range.endContainer) { + if (range.startOffset === range.endOffset) { + return true; + } + } + } + return false; + }, + + // 恢复选区 + restoreSelection: function restoreSelection() { + var selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(this._currentRange); + }, + + // 创建一个空白(即 ​ 字符)选区 + createEmptyRange: function createEmptyRange() { + var editor = this.editor; + var range = this.getRange(); + var $elem = void 0; + + if (!range) { + // 当前无 range + return; + } + if (!this.isSelectionEmpty()) { + // 当前选区必须没有内容才可以 + return; + } + + // 目前只支持 webkit 内核 + if (UA.isWebkit()) { + // 插入 ​ + editor.cmd.do('insertHTML', '​'); + // 修改 offset 位置 + range.setEnd(range.endContainer, range.endOffset + 1); + // 存储 + this.saveRange(range); + } else { + $elem = $('<strong>​</strong>'); + editor.cmd.do('insertElem', $elem); + this.createRangeByElem($elem, true); + } + }, + + // 根据 $Elem 设置选区 + createRangeByElem: function createRangeByElem($elem, toStart, isContent) { + // $elem - 经过封装的 elem + // toStart - true 开始位置,false 结束位置 + // isContent - 是否选中Elem的内容 + if (!$elem.length) { + return; + } + + var elem = $elem[0]; + var range = document.createRange(); + + if (isContent) { + range.selectNodeContents(elem); + } else { + range.selectNode(elem); + } + + if (typeof toStart === 'boolean') { + range.collapse(toStart); + } + + // 存储 range + this.saveRange(range); + } + }; + + /* + 上传进度条 + */ + + function Progress(editor) { + this.editor = editor; + this._time = 0; + this._isShow = false; + this._isRender = false; + this._timeoutId = 0; + this.$textContainer = editor.$textContainerElem; + this.$bar = $('<div class="w-e-progress"></div>'); + } + + Progress.prototype = { + constructor: Progress, + + show: function show(progress) { + var _this = this; + + // 状态处理 + if (this._isShow) { + return; + } + this._isShow = true; + + // 渲染 + var $bar = this.$bar; + if (!this._isRender) { + var $textContainer = this.$textContainer; + $textContainer.append($bar); + } else { + this._isRender = true; + } + + // 改变进度(节流,100ms 渲染一次) + if (Date.now() - this._time > 100) { + if (progress <= 1) { + $bar.css('width', progress * 100 + '%'); + this._time = Date.now(); + } + } + + // 隐藏 + var timeoutId = this._timeoutId; + if (timeoutId) { + clearTimeout(timeoutId); + } + timeoutId = setTimeout(function () { + _this._hide(); + }, 500); + }, + + _hide: function _hide() { + var $bar = this.$bar; + $bar.remove(); + + // 修改状态 + this._time = 0; + this._isShow = false; + this._isRender = false; + } + }; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + /* + 上传图片 + */ + +// 构造函数 + function UploadImg(editor) { + this.editor = editor; + } + +// 原型 + UploadImg.prototype = { + constructor: UploadImg, + + // 根据 debug 弹出不同的信息 + _alert: function _alert(alertInfo, debugInfo) { + var editor = this.editor; + var debug = editor.config.debug; + + if (debug) { + throw new Error('wangEditor: ' + (debugInfo || alertInfo)); + } else { + alert(alertInfo); + } + }, + + // 根据链接插入图片 + insertLinkImg: function insertLinkImg(link) { + var _this2 = this; + + if (!link) { + return; + } + var editor = this.editor; + + var img = document.createElement('img'); + img.onload = function () { + img = null; + editor.cmd.do('insertHTML', '<img src="' + link + '" style="max-width:100%;"/>'); + }; + img.onerror = function () { + img = null; + // 无法成功下载图片 + _this2._alert('插入图片错误', 'wangEditor: \u63D2\u5165\u56FE\u7247\u51FA\u9519\uFF0C\u56FE\u7247\u94FE\u63A5\u662F "' + link + '"\uFF0C\u4E0B\u8F7D\u8BE5\u94FE\u63A5\u5931\u8D25'); + return; + }; + img.onabort = function () { + img = null; + }; + img.src = link; + }, + + // 上传图片 + uploadImg: function uploadImg(files) { + var _this3 = this; + + if (!files || !files.length) { + return; + } + + // ------------------------------ 获取配置信息 ------------------------------ + var editor = this.editor; + var config = editor.config; + var maxSize = config.uploadImgMaxSize; + var maxSizeM = maxSize / 1000 / 1000; + var maxLength = config.uploadImgMaxLength || 10000; + var uploadImgServer = config.uploadImgServer; + var uploadImgShowBase64 = config.uploadImgShowBase64; + var uploadFileName = config.uploadFileName || ''; + var uploadImgParams = config.uploadImgParams || {}; + var uploadImgHeaders = config.uploadImgHeaders || {}; + var hooks = config.uploadImgHooks || {}; + var timeout = config.uploadImgTimeout || 3000; + var withCredentials = config.withCredentials; + if (withCredentials == null) { + withCredentials = false; + } + + // ------------------------------ 验证文件信息 ------------------------------ + var resultFiles = []; + var errInfo = []; + arrForEach(files, function (file) { + var name = file.name; + var size = file.size; + if (/\.(jpg|jpeg|png|bmp|gif)$/i.test(name) === false) { + // 后缀名不合法,不是图片 + errInfo.push('\u3010' + name + '\u3011\u4E0D\u662F\u56FE\u7247'); + return; + } + if (maxSize < size) { + // 上传图片过大 + errInfo.push('\u3010' + name + '\u3011\u5927\u4E8E ' + maxSizeM + 'M'); + return; + } + + // 验证通过的加入结果列表 + resultFiles.push(file); + }); + // 抛出验证信息 + if (errInfo.length) { + this._alert('图片验证未通过: \n' + errInfo.join('\n')); + return; + } + if (resultFiles.length > maxLength) { + this._alert('一次最多上传' + maxLength + '张图片'); + return; + } + + // 添加图片数据 + var formdata = new FormData(); + arrForEach(resultFiles, function (file) { + var name = uploadFileName || file.name; + formdata.append(name, file); + }); + + // ------------------------------ 上传图片 ------------------------------ + if (uploadImgServer && typeof uploadImgServer === 'string') { + // 添加参数 + var uploadImgServerArr = uploadImgServer.split('#'); + uploadImgServer = uploadImgServerArr[0]; + var uploadImgServerHash = uploadImgServerArr[1] || ''; + objForEach(uploadImgParams, function (key, val) { + val = encodeURIComponent(val); + + // 第一,将参数拼接到 url 中 + if (uploadImgServer.indexOf('?') > 0) { + uploadImgServer += '&'; + } else { + uploadImgServer += '?'; + } + uploadImgServer = uploadImgServer + key + '=' + val; + + // 第二,将参数添加到 formdata 中 + formdata.append(key, val); + }); + if (uploadImgServerHash) { + uploadImgServer += '#' + uploadImgServerHash; + } + + // 定义 xhr + var xhr = new XMLHttpRequest(); + xhr.open('POST', uploadImgServer); + + // 设置超时 + xhr.timeout = timeout; + xhr.ontimeout = function () { + // hook - timeout + if (hooks.timeout && typeof hooks.timeout === 'function') { + hooks.timeout(xhr, editor); + } + + _this3._alert('上传图片超时'); + }; + + // 监控 progress + if (xhr.upload) { + xhr.upload.onprogress = function (e) { + var percent = void 0; + // 进度条 + var progressBar = new Progress(editor); + if (e.lengthComputable) { + percent = e.loaded / e.total; + progressBar.show(percent); + } + }; + } + + // 返回数据 + xhr.onreadystatechange = function () { + var result = void 0; + if (xhr.readyState === 4) { + if (xhr.status < 200 || xhr.status >= 300) { + // hook - error + if (hooks.error && typeof hooks.error === 'function') { + hooks.error(xhr, editor); + } + + // xhr 返回状态错误 + _this3._alert('上传图片发生错误', '\u4E0A\u4F20\u56FE\u7247\u53D1\u751F\u9519\u8BEF\uFF0C\u670D\u52A1\u5668\u8FD4\u56DE\u72B6\u6001\u662F ' + xhr.status); + return; + } + + result = xhr.responseText; + if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) !== 'object') { + try { + result = JSON.parse(result); + } catch (ex) { + // hook - fail + if (hooks.fail && typeof hooks.fail === 'function') { + hooks.fail(xhr, editor, result); + } + + _this3._alert('上传图片失败', '上传图片返回结果错误,返回结果是: ' + result); + return; + } + } + if (!hooks.customInsert && result.errno != '0') { + // hook - fail + if (hooks.fail && typeof hooks.fail === 'function') { + hooks.fail(xhr, editor, result); + } + + // 数据错误 + _this3._alert('上传图片失败', '上传图片返回结果错误,返回结果 errno=' + result.errno); + } else { + if (hooks.customInsert && typeof hooks.customInsert === 'function') { + // 使用者自定义插入方法 + hooks.customInsert(_this3.insertLinkImg.bind(_this3), result, editor); + } else { + // 将图片插入编辑器 + var data = result.data || []; + data.forEach(function (link) { + _this3.insertLinkImg(link); + }); + } + + // hook - success + if (hooks.success && typeof hooks.success === 'function') { + hooks.success(xhr, editor, result); + } + } + } + }; + + // hook - before + if (hooks.before && typeof hooks.before === 'function') { + hooks.before(xhr, editor, resultFiles); + } + + // 自定义 headers + objForEach(uploadImgHeaders, function (key, val) { + xhr.setRequestHeader(key, val); + }); + + // 跨域传 cookie + xhr.withCredentials = withCredentials; + + // 发送请求 + xhr.send(formdata); + + // 注意,要 return 。不去操作接下来的 base64 显示方式 + return; + } + + // 显示 base64 格式 + if (uploadImgShowBase64) { + arrForEach(files, function (file) { + var _this = _this3; + var reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function () { + _this.insertLinkImg(this.result); + }; + }); + } + } + }; + + /* + 编辑器构造函数 + */ + +// id,累加 + var editorId = 1; + +// 构造函数 + function Editor(toolbarSelector, textSelector) { + if (toolbarSelector == null) { + // 没有传入任何参数,报错 + throw new Error('错误:初始化编辑器时候未传入任何参数,请查阅文档'); + } + // id,用以区分单个页面不同的编辑器对象 + this.id = 'wangEditor-' + editorId++; + + this.toolbarSelector = toolbarSelector; + this.textSelector = textSelector; + + // 自定义配置 + this.customConfig = {}; + } + +// 修改原型 + Editor.prototype = { + constructor: Editor, + + // 初始化配置 + _initConfig: function _initConfig() { + // _config 是默认配置,this.customConfig 是用户自定义配置,将它们 merge 之后再赋值 + var target = {}; + this.config = Object.assign(target, config, this.customConfig); + }, + + // 初始化 DOM + _initDom: function _initDom() { + var _this = this; + + var toolbarSelector = this.toolbarSelector; + var $toolbarSelector = $(toolbarSelector); + var textSelector = this.textSelector; + + var config$$1 = this.config; + var zIndex = config$$1.zIndex || '10000'; + + // 定义变量 + var $toolbarElem = void 0, + $textContainerElem = void 0, + $textElem = void 0, + $children = void 0; + + if (textSelector == null) { + // 只传入一个参数,即是容器的选择器或元素,toolbar 和 text 的元素自行创建 + $toolbarElem = $('<div></div>'); + $textContainerElem = $('<div></div>'); + + // 将编辑器区域原有的内容,暂存起来 + $children = $toolbarSelector.children(); + + // 添加到 DOM 结构中 + $toolbarSelector.append($toolbarElem).append($textContainerElem); + + // 自行创建的,需要配置默认的样式 + $toolbarElem.css('background-color', '#f1f1f1').css('border', '1px solid #ccc'); + $textContainerElem.css('border', '1px solid #ccc').css('border-top', 'none').css('height', '150px'); + } else { + // toolbar 和 text 的选择器都有值,记录属性 + $toolbarElem = $toolbarSelector; + $textContainerElem = $(textSelector); + // 将编辑器区域原有的内容,暂存起来 + $children = $textContainerElem.children(); + } + + // 编辑区域 + $textElem = $('<div></div>'); + $textElem.attr('contenteditable', 'true').css('width', '100%').css('height', '100%'); + + // 初始化编辑区域内容 + if ($children && $children.length) { + $textElem.append($children); + } else { + $textElem.append($('<p><br></p>')); + } + + // 编辑区域加入DOM + $textContainerElem.append($textElem); + + // 设置通用的 class + $toolbarElem.addClass('w-e-toolbar'); + $textContainerElem.addClass('w-e-text-container'); + $textContainerElem.css('z-index', zIndex); + $textElem.addClass('w-e-text'); + + // 记录属性 + this.$toolbarElem = $toolbarElem; + this.$textContainerElem = $textContainerElem; + this.$textElem = $textElem; + + // 绑定 onchange + $textContainerElem.on('click keyup', function () { + _this.change && _this.change(); + }); + $toolbarElem.on('click', function () { + this.change && this.change(); + }); + }, + + // 封装 command + _initCommand: function _initCommand() { + this.cmd = new Command(this); + }, + + // 封装 selection range API + _initSelectionAPI: function _initSelectionAPI() { + this.selection = new API(this); + }, + + // 添加图片上传 + _initUploadImg: function _initUploadImg() { + this.uploadImg = new UploadImg(this); + }, + + // 初始化菜单 + _initMenus: function _initMenus() { + this.menus = new Menus(this); + this.menus.init(); + }, + + // 添加 text 区域 + _initText: function _initText() { + this.txt = new Text(this); + this.txt.init(); + }, + + // 初始化选区,将光标定位到内容尾部 + initSelection: function initSelection() { + var $textElem = this.$textElem; + var $children = $textElem.children(); + if (!$children.length) { + // 如果编辑器区域无内容,添加一个空行,重新设置选区 + $textElem.append($('<p><br></p>')); + this.initSelection(); + return; + } + + var $last = $children.last(); + var html = $last.html().toLowerCase(); + var nodeName = $last.getNodeName(); + if (html !== '<br>' && html !== '<br\/>' || nodeName !== 'P') { + // 最后一个元素不是 <p><br></p>,添加一个空行,重新设置选区 + $textElem.append($('<p><br></p>')); + this.initSelection(); + return; + } + + this.selection.createRangeByElem($last, true); + this.selection.restoreSelection(); + }, + + // 绑定事件 + _bindEvent: function _bindEvent() { + // -------- 绑定 onchange 事件 -------- + var onChangeTimeoutId = 0; + var beforeChangeHtml = this.txt.html(); + var config$$1 = this.config; + var onchange = config$$1.onchange; + if (onchange && typeof onchange === 'function') { + // 触发 change 的有三个场景: + // 1. $textContainerElem.on('click keyup') + // 2. $toolbarElem.on('click') + // 3. editor.cmd.do() + this.change = function () { + // 判断是否有变化 + var currentHtml = this.txt.html(); + if (currentHtml.length === beforeChangeHtml.length) { + return; + } + + // 执行,使用节流 + if (onChangeTimeoutId) { + clearTimeout(onChangeTimeoutId); + } + onChangeTimeoutId = setTimeout(function () { + // 触发配置的 onchange 函数 + onchange(currentHtml); + beforeChangeHtml = currentHtml; + }, 200); + }; + } + }, + + // 创建编辑器 + create: function create() { + // 初始化配置信息 + this._initConfig(); + + // 初始化 DOM + this._initDom(); + + // 封装 command API + this._initCommand(); + + // 封装 selection range API + this._initSelectionAPI(); + + // 添加 text + this._initText(); + + // 初始化菜单 + this._initMenus(); + + // 添加 图片上传 + this._initUploadImg(); + + // 初始化选区,将光标定位到内容尾部 + this.initSelection(); + + // 绑定事件 + this._bindEvent(); + } + }; + +// 检验是否浏览器环境 + try { + document; + } catch (ex) { + throw new Error('请在浏览器环境下运行'); + } + +// polyfill + polyfill(); + +// 这里的 `inlinecss` 将被替换成 css 代码的内容,详情可去 ./gulpfile.js 中搜索 `inlinecss` 关键字 + var inlinecss = '.w-e-toolbar,.w-e-text-container,.w-e-menu-panel { padding: 0; margin: 0; box-sizing: border-box;}.w-e-toolbar *,.w-e-text-container *,.w-e-menu-panel * { padding: 0; margin: 0; box-sizing: border-box;}.w-e-clear-fix:after { content: ""; display: table; clear: both;}.w-e-toolbar .w-e-droplist { position: absolute; left: 0; top: 0; background-color: #fff; border: 1px solid #f1f1f1; border-right-color: #ccc; border-bottom-color: #ccc;}.w-e-toolbar .w-e-droplist .w-e-dp-title { text-align: center; color: #999; line-height: 2; border-bottom: 1px solid #f1f1f1; font-size: 13px;}.w-e-toolbar .w-e-droplist ul.w-e-list { list-style: none; line-height: 1;}.w-e-toolbar .w-e-droplist ul.w-e-list li.w-e-item { color: #333; padding: 5px 0;}.w-e-toolbar .w-e-droplist ul.w-e-list li.w-e-item:hover { background-color: #f1f1f1;}.w-e-toolbar .w-e-droplist ul.w-e-block { list-style: none; text-align: left; padding: 5px;}.w-e-toolbar .w-e-droplist ul.w-e-block li.w-e-item { display: inline-block; *display: inline; *zoom: 1; padding: 3px 5px;}.w-e-toolbar .w-e-droplist ul.w-e-block li.w-e-item:hover { background-color: #f1f1f1;}@font-face { font-family: \'icomoon\'; src: url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAABXAAAsAAAAAFXQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIPAmNtYXAAAAFoAAAA9AAAAPRAxxN6Z2FzcAAAAlwAAAAIAAAACAAAABBnbHlmAAACZAAAEHwAABB8kRGt5WhlYWQAABLgAAAANgAAADYN4rlyaGhlYQAAExgAAAAkAAAAJAfEA99obXR4AAATPAAAAHwAAAB8cAcDvGxvY2EAABO4AAAAQAAAAEAx8jYEbWF4cAAAE/gAAAAgAAAAIAAqALZuYW1lAAAUGAAAAYYAAAGGmUoJ+3Bvc3QAABWgAAAAIAAAACAAAwAAAAMD3AGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA8fwDwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEANgAAAAyACAABAASAAEAIOkG6Q3pEulH6Wbpd+m56bvpxunL6d/qDepl6mjqcep58A3wFPEg8dzx/P/9//8AAAAAACDpBukN6RLpR+ll6Xfpuem76cbpy+nf6g3qYupo6nHqd/AN8BTxIPHc8fz//f//AAH/4xb+FvgW9BbAFqMWkxZSFlEWRxZDFjAWAxWvFa0VpRWgEA0QBw78DkEOIgADAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAPAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAIAAP/ABAADwAAEABMAAAE3AScBAy4BJxM3ASMBAyUBNQEHAYCAAcBA/kCfFzsyY4ABgMD+gMACgAGA/oBOAUBAAcBA/kD+nTI7FwERTgGA/oD9gMABgMD+gIAABAAAAAAEAAOAABAAIQAtADQAAAE4ATEROAExITgBMRE4ATEhNSEiBhURFBYzITI2NRE0JiMHFAYjIiY1NDYzMhYTITUTATM3A8D8gAOA/IAaJiYaA4AaJiYagDgoKDg4KCg4QP0A4AEAQOADQP0AAwBAJhr9ABomJhoDABom4Cg4OCgoODj9uIABgP7AwAAAAgAAAEAEAANAACgALAAAAS4DIyIOAgcOAxUUHgIXHgMzMj4CNz4DNTQuAicBEQ0BA9U2cXZ5Pz95dnE2Cw8LBgYLDws2cXZ5Pz95dnE2Cw8LBgYLDwv9qwFA/sADIAgMCAQECAwIKVRZWy8vW1lUKQgMCAQECAwIKVRZWy8vW1lUKf3gAYDAwAAAAAACAMD/wANAA8AAEwAfAAABIg4CFRQeAjEwPgI1NC4CAyImNTQ2MzIWFRQGAgBCdVcyZHhkZHhkMld1QlBwcFBQcHADwDJXdUJ4+syCgsz6eEJ1VzL+AHBQUHBwUFBwAAABAAAAAAQAA4AAIQAAASIOAgcnESEnPgEzMh4CFRQOAgcXPgM1NC4CIwIANWRcUiOWAYCQNYtQUItpPBIiMB5VKEAtGFCLu2oDgBUnNyOW/oCQNDw8aYtQK1FJQRpgI1ZibDlqu4tQAAEAAAAABAADgAAgAAATFB4CFzcuAzU0PgIzMhYXByERBy4DIyIOAgAYLUAoVR4wIhI8aYtQUIs1kAGAliNSXGQ1aruLUAGAOWxiViNgGkFJUStQi2k8PDSQAYCWIzcnFVCLuwACAAAAQAQBAwAAHgA9AAATMh4CFRQOAiMiLgI1JzQ+AjMVIgYHDgEHPgEhMh4CFRQOAiMiLgI1JzQ+AjMVIgYHDgEHPgHhLlI9IyM9Ui4uUj0jAUZ6o11AdS0JEAcIEgJJLlI9IyM9Ui4uUj0jAUZ6o11AdS0JEAcIEgIAIz1SLi5SPSMjPVIuIF2jekaAMC4IEwoCASM9Ui4uUj0jIz1SLiBdo3pGgDAuCBMKAgEAAAYAQP/ABAADwAADAAcACwARAB0AKQAAJSEVIREhFSERIRUhJxEjNSM1ExUzFSM1NzUjNTMVFREjNTM1IzUzNSM1AYACgP2AAoD9gAKA/YDAQEBAgMCAgMDAgICAgICAAgCAAgCAwP8AwED98jJAkjwyQJLu/sBAQEBAQAAGAAD/wAQAA8AAAwAHAAsAFwAjAC8AAAEhFSERIRUhESEVIQE0NjMyFhUUBiMiJhE0NjMyFhUUBiMiJhE0NjMyFhUUBiMiJgGAAoD9gAKA/YACgP2A/oBLNTVLSzU1S0s1NUtLNTVLSzU1S0s1NUsDgID/AID/AIADQDVLSzU1S0v+tTVLSzU1S0v+tTVLSzU1S0sAAwAAAAAEAAOgAAMADQAUAAA3IRUhJRUhNRMhFSE1ISUJASMRIxEABAD8AAQA/ACAAQABAAEA/WABIAEg4IBAQMBAQAEAgIDAASD+4P8AAQAAAAAAAgBT/8wDrQO0AC8AXAAAASImJy4BNDY/AT4BMzIWFx4BFAYPAQYiJyY0PwE2NCcuASMiBg8BBhQXFhQHDgEjAyImJy4BNDY/ATYyFxYUDwEGFBceATMyNj8BNjQnJjQ3NjIXHgEUBg8BDgEjAbgKEwgjJCQjwCNZMTFZIyMkJCNYDywPDw9YKSkUMxwcMxTAKSkPDwgTCrgxWSMjJCQjWA8sDw8PWCkpFDMcHDMUwCkpDw8PKxAjJCQjwCNZMQFECAckWl5aJMAiJSUiJFpeWiRXEBAPKw9YKXQpFBUVFMApdCkPKxAHCP6IJSIkWl5aJFcQEA8rD1gpdCkUFRUUwCl0KQ8rEA8PJFpeWiTAIiUAAAAABQAA/8AEAAPAABMAJwA7AEcAUwAABTI+AjU0LgIjIg4CFRQeAhMyHgIVFA4CIyIuAjU0PgITMj4CNw4DIyIuAiceAyc0NjMyFhUUBiMiJiU0NjMyFhUUBiMiJgIAaruLUFCLu2pqu4tQUIu7alaYcUFBcZhWVphxQUFxmFYrVVFMIwU3Vm8/P29WNwUjTFFV1SUbGyUlGxslAYAlGxslJRsbJUBQi7tqaruLUFCLu2pqu4tQA6BBcZhWVphxQUFxmFZWmHFB/gkMFSAUQ3RWMTFWdEMUIBUM9yg4OCgoODgoKDg4KCg4OAAAAAADAAD/wAQAA8AAEwAnADMAAAEiDgIVFB4CMzI+AjU0LgIDIi4CNTQ+AjMyHgIVFA4CEwcnBxcHFzcXNyc3AgBqu4tQUIu7amq7i1BQi7tqVphxQUFxmFZWmHFBQXGYSqCgYKCgYKCgYKCgA8BQi7tqaruLUFCLu2pqu4tQ/GBBcZhWVphxQUFxmFZWmHFBAqCgoGCgoGCgoGCgoAADAMAAAANAA4AAEgAbACQAAAE+ATU0LgIjIREhMj4CNTQmATMyFhUUBisBEyMRMzIWFRQGAsQcIChGXTX+wAGANV1GKET+hGUqPDwpZp+fnyw+PgHbIlQvNV1GKPyAKEZdNUZ0AUZLNTVL/oABAEs1NUsAAAIAwAAAA0ADgAAbAB8AAAEzERQOAiMiLgI1ETMRFBYXHgEzMjY3PgE1ASEVIQLAgDJXdUJCdVcygBsYHEkoKEkcGBv+AAKA/YADgP5gPGlOLS1OaTwBoP5gHjgXGBsbGBc4Hv6ggAAAAQCAAAADgAOAAAsAAAEVIwEzFSE1MwEjNQOAgP7AgP5AgAFAgAOAQP0AQEADAEAAAQAAAAAEAAOAAD0AAAEVIx4BFRQGBw4BIyImJy4BNTMUFjMyNjU0JiMhNSEuAScuATU0Njc+ATMyFhceARUjNCYjIgYVFBYzMhYXBADrFRY1MCxxPj5xLDA1gHJOTnJyTv4AASwCBAEwNTUwLHE+PnEsMDWAck5OcnJOO24rAcBAHUEiNWIkISQkISRiNTRMTDQ0TEABAwEkYjU1YiQhJCQhJGI1NExMNDRMIR8AAAAHAAD/wAQAA8AAAwAHAAsADwATABsAIwAAEzMVIzczFSMlMxUjNzMVIyUzFSMDEyETMxMhEwEDIQMjAyEDAICAwMDAAQCAgMDAwAEAgIAQEP0AECAQAoAQ/UAQAwAQIBD9gBABwEBAQEBAQEBAQAJA/kABwP6AAYD8AAGA/oABQP7AAAAKAAAAAAQAA4AAAwAHAAsADwATABcAGwAfACMAJwAAExEhEQE1IRUdASE1ARUhNSMVITURIRUhJSEVIRE1IRUBIRUhITUhFQAEAP2AAQD/AAEA/wBA/wABAP8AAoABAP8AAQD8gAEA/wACgAEAA4D8gAOA/cDAwEDAwAIAwMDAwP8AwMDAAQDAwP7AwMDAAAAFAAAAAAQAA4AAAwAHAAsADwATAAATIRUhFSEVIREhFSERIRUhESEVIQAEAPwAAoD9gAKA/YAEAPwABAD8AAOAgECA/wCAAUCA/wCAAAAAAAUAAAAABAADgAADAAcACwAPABMAABMhFSEXIRUhESEVIQMhFSERIRUhAAQA/ADAAoD9gAKA/YDABAD8AAQA/AADgIBAgP8AgAFAgP8AgAAABQAAAAAEAAOAAAMABwALAA8AEwAAEyEVIQUhFSERIRUhASEVIREhFSEABAD8AAGAAoD9gAKA/YD+gAQA/AAEAPwAA4CAQID/AIABQID/AIAAAAAAAQA/AD8C5gLmACwAACUUDwEGIyIvAQcGIyIvASY1ND8BJyY1ND8BNjMyHwE3NjMyHwEWFRQPARcWFQLmEE4QFxcQqKgQFxYQThAQqKgQEE4QFhcQqKgQFxcQThAQqKgQwxYQThAQqKgQEE4QFhcQqKgQFxcQThAQqKgQEE4QFxcQqKgQFwAAAAYAAAAAAyUDbgAUACgAPABNAFUAggAAAREUBwYrASInJjURNDc2OwEyFxYVMxEUBwYrASInJjURNDc2OwEyFxYXERQHBisBIicmNRE0NzY7ATIXFhMRIREUFxYXFjMhMjc2NzY1ASEnJicjBgcFFRQHBisBERQHBiMhIicmNREjIicmPQE0NzY7ATc2NzY7ATIXFh8BMzIXFhUBJQYFCCQIBQYGBQgkCAUGkgUFCCUIBQUFBQglCAUFkgUFCCUIBQUFBQglCAUFSf4ABAQFBAIB2wIEBAQE/oABABsEBrUGBAH3BgUINxobJv4lJhsbNwgFBQUFCLEoCBcWF7cXFhYJKLAIBQYCEv63CAUFBQUIAUkIBQYGBQj+twgFBQUFCAFJCAUGBgUI/rcIBQUFBQgBSQgFBgYF/lsCHf3jDQsKBQUFBQoLDQJmQwUCAgVVJAgGBf3jMCIjISIvAiAFBggkCAUFYBUPDw8PFWAFBQgAAgAHAEkDtwKvABoALgAACQEGIyIvASY1ND8BJyY1ND8BNjMyFwEWFRQHARUUBwYjISInJj0BNDc2MyEyFxYBTv72BgcIBR0GBuHhBgYdBQgHBgEKBgYCaQUFCP3bCAUFBQUIAiUIBQUBhf72BgYcBggHBuDhBgcHBh0FBf71BQgHBv77JQgFBQUFCCUIBQUFBQAAAAEAIwAAA90DbgCzAAAlIicmIyIHBiMiJyY1NDc2NzY3Njc2PQE0JyYjISIHBh0BFBcWFxYzFhcWFRQHBiMiJyYjIgcGIyInJjU0NzY3Njc2NzY9ARE0NTQ1NCc0JyYnJicmJyYnJiMiJyY1NDc2MzIXFjMyNzYzMhcWFRQHBiMGBwYHBh0BFBcWMyEyNzY9ATQnJicmJyY1NDc2MzIXFjMyNzYzMhcWFRQHBgciBwYHBhURFBcWFxYXMhcWFRQHBiMDwRkzMhoZMjMZDQgHCQoNDBEQChIBBxX+fhYHARUJEhMODgwLBwcOGzU1GhgxMRgNBwcJCQsMEA8JEgECAQIDBAQFCBIRDQ0KCwcHDho1NRoYMDEYDgcHCQoMDRAQCBQBBw8BkA4HARQKFxcPDgcHDhkzMhkZMTEZDgcHCgoNDRARCBQUCRERDg0KCwcHDgACAgICDAsPEQkJAQEDAwUMROAMBQMDBQzUUQ0GAQIBCAgSDwwNAgICAgwMDhEICQECAwMFDUUhAdACDQ0ICA4OCgoLCwcHAwYBAQgIEg8MDQICAgINDA8RCAgBAgEGDFC2DAcBAQcMtlAMBgEBBgcWDwwNAgICAg0MDxEICAEBAgYNT/3mRAwGAgIBCQgRDwwNAAACAAD/twP/A7cAEwA5AAABMhcWFRQHAgcGIyInJjU0NwE2MwEWFxYfARYHBiMiJyYnJicmNRYXFhcWFxYzMjc2NzY3Njc2NzY3A5soHh4avkw3RUg0NDUBbSEp/fgXJicvAQJMTHtHNjYhIRARBBMUEBASEQkXCA8SExUVHR0eHikDtxsaKCQz/plGNDU0SUkwAUsf/bErHx8NKHpNTBobLi86OkQDDw4LCwoKFiUbGhERCgsEBAIAAQAAAAAAANox8glfDzz1AAsEAAAAAADVYbp/AAAAANVhun8AAP+3BAEDwAAAAAgAAgAAAAAAAAABAAADwP/AAAAEAAAA//8EAQABAAAAAAAAAAAAAAAAAAAAHwQAAAAAAAAAAAAAAAIAAAAEAAAABAAAAAQAAAAEAADABAAAAAQAAAAEAAAABAAAQAQAAAAEAAAABAAAUwQAAAAEAAAABAAAwAQAAMAEAACABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAyUAPwMlAAADvgAHBAAAIwP/AAAAAAAAAAoAFAAeAEwAlADaAQoBPgFwAcgCBgJQAnoDBAN6A8gEAgQ2BE4EpgToBTAFWAWABaoF7gamBvAH4gg+AAEAAAAfALQACgAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAOAK4AAQAAAAAAAQAHAAAAAQAAAAAAAgAHAGAAAQAAAAAAAwAHADYAAQAAAAAABAAHAHUAAQAAAAAABQALABUAAQAAAAAABgAHAEsAAQAAAAAACgAaAIoAAwABBAkAAQAOAAcAAwABBAkAAgAOAGcAAwABBAkAAwAOAD0AAwABBAkABAAOAHwAAwABBAkABQAWACAAAwABBAkABgAOAFIAAwABBAkACgA0AKRpY29tb29uAGkAYwBvAG0AbwBvAG5WZXJzaW9uIDEuMABWAGUAcgBzAGkAbwBuACAAMQAuADBpY29tb29uAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG5SZWd1bGFyAFIAZQBnAHUAbABhAHJpY29tb29uAGkAYwBvAG0AbwBvAG5Gb250IGdlbmVyYXRlZCBieSBJY29Nb29uLgBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format(\'truetype\'); font-weight: normal; font-style: normal;}[class^="w-e-icon-"],[class*=" w-e-icon-"] { /* use !important to prevent issues with browser extensions that change fonts */ font-family: \'icomoon\' !important; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; /* Better Font Rendering =========== */ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;}.w-e-icon-close:before { content: "\\f00d";}.w-e-icon-upload2:before { content: "\\e9c6";}.w-e-icon-trash-o:before { content: "\\f014";}.w-e-icon-header:before { content: "\\f1dc";}.w-e-icon-pencil2:before { content: "\\e906";}.w-e-icon-paint-brush:before { content: "\\f1fc";}.w-e-icon-image:before { content: "\\e90d";}.w-e-icon-play:before { content: "\\e912";}.w-e-icon-location:before { content: "\\e947";}.w-e-icon-undo:before { content: "\\e965";}.w-e-icon-redo:before { content: "\\e966";}.w-e-icon-quotes-left:before { content: "\\e977";}.w-e-icon-list-numbered:before { content: "\\e9b9";}.w-e-icon-list2:before { content: "\\e9bb";}.w-e-icon-link:before { content: "\\e9cb";}.w-e-icon-happy:before { content: "\\e9df";}.w-e-icon-bold:before { content: "\\ea62";}.w-e-icon-underline:before { content: "\\ea63";}.w-e-icon-italic:before { content: "\\ea64";}.w-e-icon-strikethrough:before { content: "\\ea65";}.w-e-icon-table2:before { content: "\\ea71";}.w-e-icon-paragraph-left:before { content: "\\ea77";}.w-e-icon-paragraph-center:before { content: "\\ea78";}.w-e-icon-paragraph-right:before { content: "\\ea79";}.w-e-icon-terminal:before { content: "\\f120";}.w-e-icon-page-break:before { content: "\\ea68";}.w-e-icon-cancel-circle:before { content: "\\ea0d";}.w-e-toolbar { display: -webkit-box; display: -ms-flexbox; display: flex; padding: 0 5px; /* 单个菜单 */}.w-e-toolbar .w-e-menu { position: relative; z-index: 10001; text-align: center; padding: 5px 10px; cursor: pointer;}.w-e-toolbar .w-e-menu i { color: #999;}.w-e-toolbar .w-e-menu:hover i { color: #333;}.w-e-toolbar .w-e-active i { color: #1e88e5;}.w-e-toolbar .w-e-active:hover i { color: #1e88e5;}.w-e-text-container .w-e-panel-container { position: absolute; top: 0; left: 50%; border: 1px solid #ccc; border-top: 0; box-shadow: 1px 1px 2px #ccc; color: #333; background-color: #fff; /* 为 emotion panel 定制的样式 */ /* 上传图片的 panel 定制样式 */}.w-e-text-container .w-e-panel-container .w-e-panel-close { position: absolute; right: 0; top: 0; padding: 5px; margin: 2px 5px 0 0; cursor: pointer; color: #999;}.w-e-text-container .w-e-panel-container .w-e-panel-close:hover { color: #333;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title { list-style: none; display: -webkit-box; display: -ms-flexbox; display: flex; font-size: 14px; margin: 2px 10px 0 10px; border-bottom: 1px solid #f1f1f1;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title .w-e-item { padding: 3px 5px; color: #999; cursor: pointer; margin: 0 3px; position: relative; top: 1px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title .w-e-active { color: #333; border-bottom: 1px solid #333; cursor: default; font-weight: 700;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content { padding: 10px 15px 10px 15px; font-size: 16px; /* 输入框的样式 */ /* 按钮的样式 */}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input:focus,.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea:focus,.w-e-text-container .w-e-panel-container .w-e-panel-tab-content button:focus { outline: none;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea { width: 100%; border: 1px solid #ccc; padding: 5px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea:focus { border-color: #1e88e5;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text] { border: none; border-bottom: 1px solid #ccc; font-size: 14px; height: 20px; color: #333; text-align: left;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text].small { width: 30px; text-align: center;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text].block { display: block; width: 100%; margin: 10px 0;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text]:focus { border-bottom: 2px solid #1e88e5;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button { font-size: 14px; color: #1e88e5; border: none; padding: 5px 10px; background-color: #fff; cursor: pointer; border-radius: 3px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.left { float: left; margin-right: 10px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.right { float: right; margin-left: 10px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.gray { color: #999;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.red { color: #c24f4a;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button:hover { background-color: #f1f1f1;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container:after { content: ""; display: table; clear: both;}.w-e-text-container .w-e-panel-container .w-e-emoticon-container .w-e-item { cursor: pointer; font-size: 18px; padding: 0 3px; display: inline-block; *display: inline; *zoom: 1;}.w-e-text-container .w-e-panel-container .w-e-up-img-container { text-align: center;}.w-e-text-container .w-e-panel-container .w-e-up-img-container .w-e-up-btn { display: inline-block; *display: inline; *zoom: 1; color: #999; cursor: pointer; font-size: 60px; line-height: 1;}.w-e-text-container .w-e-panel-container .w-e-up-img-container .w-e-up-btn:hover { color: #333;}.w-e-text-container { position: relative;}.w-e-text-container .w-e-progress { position: absolute; background-color: #1e88e5; bottom: 0; left: 0; height: 1px;}.w-e-text { padding: 0 10px; overflow-y: scroll;}.w-e-text p,.w-e-text h1,.w-e-text h2,.w-e-text h3,.w-e-text h4,.w-e-text h5,.w-e-text table,.w-e-text pre { margin: 10px 0; line-height: 1.5;}.w-e-text ul,.w-e-text ol { margin: 10px 0 10px 20px;}.w-e-text blockquote { display: block; border-left: 8px solid #d0e5f2; padding: 5px 10px; margin: 10px 0; line-height: 1.4; font-size: 100%; background-color: #f1f1f1;}.w-e-text code { display: inline-block; *display: inline; *zoom: 1; background-color: #f1f1f1; border-radius: 3px; padding: 3px 5px; margin: 0 3px;}.w-e-text pre code { display: block;}.w-e-text table { border-top: 1px solid #ccc; border-left: 1px solid #ccc;}.w-e-text table td,.w-e-text table th { border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; padding: 3px 5px;}.w-e-text table th { border-bottom: 2px solid #ccc; text-align: center;}.w-e-text:focus { outline: none;}.w-e-text img { cursor: pointer;}.w-e-text img:hover { box-shadow: 0 0 5px #333;}.w-e-text img.w-e-selected { border: 2px solid #1e88e5;}.w-e-text img.w-e-selected:hover { box-shadow: none;}'; + +// 将 css 代码添加到 <style> 中 + var style = document.createElement('style'); + style.type = 'text/css'; + style.innerHTML = inlinecss; + document.getElementsByTagName('HEAD').item(0).appendChild(style); + +// 返回 + var index = window.wangEditor || Editor; + + return index; + +}))); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/Uploader.swf b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/Uploader.swf new file mode 100644 index 0000000..bd75d60 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/Uploader.swf Binary files differ diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.css b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.css new file mode 100644 index 0000000..12f451f --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.css @@ -0,0 +1,28 @@ +.webuploader-container { + position: relative; +} +.webuploader-element-invisible { + position: absolute !important; + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px,1px,1px,1px); +} +.webuploader-pick { + position: relative; + display: inline-block; + cursor: pointer; + background: #00b7ee; + padding: 10px 15px; + color: #fff; + text-align: center; + border-radius: 3px; + overflow: hidden; +} +.webuploader-pick-hover { + background: #00a2d4; +} + +.webuploader-pick-disable { + opacity: 0.6; + pointer-events:none; +} + diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.js new file mode 100644 index 0000000..7fca9c2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.js @@ -0,0 +1,6502 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。 + * + * AMD API 内部的简单不完全实现,请忽略。只有当WebUploader被合并成一个文件的时候才会引入。 + */ +(function( root, factory ) { + var modules = {}, + + // 内部require, 简单不完全实现。 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 如果deps不是数组,则直接返回指定module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 内部define,暂时不支持不指定id. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 设置module, 兼容CommonJs写法。 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 根据id获取module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 将所有modules,将路径ids装换成对象。 + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 操作相关 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * 直接来源于jquery的代码。 + * @fileOverview Promise/A+ + * @beta + */ + define('promise-builtin',[ + 'dollar' + ], function( $ ) { + + var api; + + // 简单版Callbacks, 默认memory,可选once. + function Callbacks( once ) { + var list = [], + stack = !once && [], + fire = function( data ) { + memory = data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ); + } + firing = false; + + if ( list ) { + if ( stack ) { + stack.length && fire( stack.shift() ); + } else { + list = []; + } + } + }, + self = { + add: function() { + if ( list ) { + var start = list.length; + (function add ( args ) { + $.each( args, function( _, arg ) { + var type = $.type( arg ); + if ( type === 'function' ) { + list.push( arg ); + } else if ( arg && arg.length && + type !== 'string' ) { + + add( arg ); + } + }); + })( arguments ); + + if ( firing ) { + firingLength = list.length; + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + + disable: function() { + list = stack = memory = undefined; + return this; + }, + + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + + fireWith: function( context, args ) { + if ( list && (!fired || stack) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + + fire: function() { + self.fireWith( this, arguments ); + return this; + } + }, + + fired, firing, firingStart, firingLength, firingIndex, memory; + + return self; + } + + function Deferred( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ 'resolve', 'done', Callbacks( true ), 'resolved' ], + [ 'reject', 'fail', Callbacks( true ), 'rejected' ], + [ 'notify', 'progress', Callbacks() ] + ], + state = 'pending', + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return Deferred(function( newDefer ) { + $.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = $.isFunction( fns[ i ] ) && fns[ i ]; + + // deferred[ done | fail | progress ] for + // forwarding actions to newDefer + deferred[ tuple[ 1 ] ](function() { + var returned; + + returned = fn && fn.apply( this, arguments ); + + if ( returned && + $.isFunction( returned.promise ) ) { + + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + 'With' ]( + this === promise ? + newDefer.promise() : + this, + fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + + return obj != null ? $.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + $.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + 'With' ]( this === deferred ? promise : + this, arguments ); + return this; + }; + deferred[ tuple[ 0 ] + 'With' ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + } + + api = { + /** + * 创建一个[Deferred](http://api.jquery.com/category/deferred-object/)对象。 + * 详细的Deferred用法说明,请参照jQuery的API文档。 + * + * Deferred对象在钩子回掉函数中经常要用到,用来处理需要等待的异步操作。 + * + * @for Base + * @method Deferred + * @grammar Base.Deferred() => Deferred + * @example + * // 在文件开始发送前做些异步操作。 + * // WebUploader会等待此异步操作完成后,开始发送文件。 + * Uploader.register({ + * 'before-send-file': 'doSomthingAsync' + * }, { + * + * doSomthingAsync: function() { + * var deferred = Base.Deferred(); + * + * // 模拟一次异步操作。 + * setTimeout(deferred.resolve, 2000); + * + * return deferred.promise(); + * } + * }); + */ + Deferred: Deferred, + + /** + * 判断传入的参数是否为一个promise对象。 + * @method isPromise + * @grammar Base.isPromise( anything ) => Boolean + * @param {*} anything 检测对象。 + * @return {Boolean} + * @for Base + * @example + * console.log( Base.isPromise() ); // => false + * console.log( Base.isPromise({ key: '123' }) ); // => false + * console.log( Base.isPromise( Base.Deferred().promise() ) ); // => true + * + * // Deferred也是一个Promise + * console.log( Base.isPromise( Base.Deferred() ) ); // => true + */ + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + }, + + /** + * 返回一个promise,此promise在所有传入的promise都完成了后完成。 + * 详细请查看[这里](http://api.jquery.com/jQuery.when/)。 + * + * @method when + * @for Base + * @grammar Base.when( promise1[, promise2[, promise3...]] ) => Promise + */ + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + slice = [].slice, + resolveValues = slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || (subordinate && + $.isFunction( subordinate.promise )) ? length : 0, + + // the master Deferred. If resolveValues consist of + // only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? + slice.call( arguments ) : value; + + if ( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !(--remaining) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && + $.isFunction( resolveValues[ i ].promise ) ) { + + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, + resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, + progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } + }; + + return api; + }); + define('promise',[ + 'promise-builtin' + ], function( $ ) { + return $; + }); + /** + * @fileOverview 基础类方法。 + */ + + /** + * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。 + * + * As you know, Web Uploader的每个文件都是用过[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)规范中的`define`组织起来的, 每个Module都会有个module id. + * 默认module id为该文件的路径,而此路径将会转化成名字空间存放在WebUploader中。如: + * + * * module `base`:WebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 以下文档中对类的使用可能省略掉了`WebUploader`前缀。 + * @module WebUploader + * @title WebUploader API文档 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 反科里化 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 基础类,提供一些简单常用的方法。 + * @class Base + */ + return { + + /** + * @property {String} version 当前版本号。 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 引用依赖的jQuery或者Zepto对象。 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 简单的浏览器检查结果。 + * + * * `webkit` webkit版本号,如果浏览器为非webkit内核,此属性为`undefined`。 + * * `chrome` chrome浏览器版本号,如果浏览器为chrome,此属性为`undefined`。 + * * `ie` ie浏览器版本号,如果浏览器为非ie,此属性为`undefined`。**暂不支持ie10+** + * * `firefox` firefox浏览器版本号,如果浏览器为非firefox,此属性为`undefined`。 + * * `safari` safari浏览器版本号,如果浏览器为非safari,此属性为`undefined`。 + * * `opera` opera浏览器版本号,如果浏览器为非opera,此属性为`undefined`。 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 操作系统检查结果。 + * + * * `android` 如果在android浏览器环境下,此值为对应的android版本号,否则为`undefined`。 + * * `ios` 如果在ios浏览器环境下,此值为对应的ios版本号,否则为`undefined`。 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 实现类与类之间的继承。 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 父类 + * @param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。 + * @param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。 + * @param {Object} [statics] 静态属性或方法。 + * @return {Class} 返回子类。 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 因为没有指定构造器,父类的构造器将会执行。 + * var instance = new Manager(); // => Super + * + * // 继承子父类的方法 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 子类的__super__属性指向父类 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 复制静态方法 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 让子类的__super__属性指向父类。 + child.__super__ = Super.prototype; + + // 构建原型,添加原型方法或属性。 + // 暂时用Object.create实现。 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 一个不做任何事情的方法。可以用来赋值给默认的callback. + * @method noop + */ + noop: noop, + + /** + * 返回一个新的方法,此方法将已指定的`context`来执行。 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 引用Console.log如果存在的话,否则引用一个[空函数noop](#WebUploader:Base.noop)。 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 当浏览器不在当前窗口时就停了。 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 被[uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)的数组slice方法。 + * 将用来将非数组对象转化成数组对象。 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 生成唯一的ID + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 格式化文件大小, 输出成带单位的字符串 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 文件大小 + * @param {Number} [pointLength=2] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 事件处理类,可以独立使用,也可以扩展给对象使用。 + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 根据条件过滤出事件handlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 不支持对象,只支持多个event用空格隔开 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 绑定事件。 + * + * `callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如 + * ```javascript + * var obj = {}; + * + * // 使得obj有事件行为 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。 + * 切会影响到`trigger`方法的返回值,为`false`。 + * + * `on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处, + * 就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 事件名,支持多个事件用空格隔开 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 绑定事件,且当handler执行完后,自动解除绑定。 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 事件名 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 解除事件绑定 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 事件名 + * @param {Function} [callback] 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 触发事件 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 事件名 + * @param {*} [...] 任意参数 + * @return {Boolean} 如果handler中return false了,则返回false, 否则返回true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 中介者,它本身是个单例,但可以通过[installTo](#WebUploader:Mediator:installTo)方法,使任何对象具备事件行为。 + * 主要目的是负责模块与模块之间的合作,降低耦合度。 + * + * @class Mediator + */ + return $.extend({ + + /** + * 可以通过这个接口,使任何对象具备事件功能。 + * @method installTo + * @param {Object} obj 需要具备事件行为的对象。 + * @return {Object} 返回obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader上传类 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 上传入口类。 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 开起分片上传。 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets中有相应扩展 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 批量添加纯命令式方法。 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 获取或者设置Uploader配置项。 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 初始状态图片上传前不会压缩 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 修改后图片上传前,尝试将图片压缩到1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 获取文件统计信息。返回一个包含一下信息的对象。 + * * `successNum` 上传成功的文件数 + * * `progressNum` 上传中的文件数 + * * `cancelNum` 被删除的文件数 + * * `invalidNum` 无效的文件数 + * * `uploadFailNum` 上传失败的文件数 + * * `queueNum` 还在队列中的文件数 + * * `interruptNum` 被暂停的文件数 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 调用通过on方法注册的handler. + Mediator.trigger.apply( this, arguments ) === false || + + // 调用opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 调用this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 广播所有uploader的事件。 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 销毁 webuploader 实例 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js将补充此方法的详细文档。 + request: Base.noop + }); + + /** + * 创建Uploader实例,等同于new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 暴露Uploader,可以通过它来扩展业务逻辑。 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 获取对象的第一个key + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 接口类。 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 添加Runtime实现。 + * @param {String} type 类型 + * @param {Runtime} factory 具体Runtime实现。 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 有些类型不能重用,比如filepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 允许runtime没有初始化之前,注册一些方法在初始化后执行。 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 像filePicker只能独立存在,不能公用。 + runtime = runtime || cache.get( null, standalone ); + + // 需要创建 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 来自cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 如果没有指定 mimetype, 但是知道文件后缀。 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 为了统一化Flash的File和HTML5的File而存在。 + * 以至于要调用Flash里面的File,也可以像调用HTML5版本的File一下。 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 支持其他类型文件的转换。 + // 如果有 mimetype, 但是文件名里面没有找出后缀规律 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('按钮指定错误'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 记录来源。 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 组件基类。 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 类Backbone的事件监听声明,监听uploader实例上的事件 + // widget直接无法监听事件,事件只能通过uploader来传递 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 如果无API响应声明则忽略 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 发送命令。当传入`callback`或者`handler`中返回`promise`时。返回一个当所有`handler`中的promise都完成后完成的新`promise`。 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 扩展Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 默认所有 Uploader.register 了的 widget 都会被加载,如果禁用某一部分,请通过此 option 指定黑名单。 + */ + + // 覆写_init用来初始化widgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred对象 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 如果有callback,则用异步方式。 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 很重要不能删除。删除了会死循环。 + // 保证执行顺序。让callback总是在下一个 tick 中执行。 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 添加组件 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 名称与函数实现的映射 + * @param {object} proto 组件原型,构造函数通过 constructor 属性定义 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 自动生成 map 表。 + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 删除插件,只有在注册时指定了名字的才能被删除。 + * @grammar Uploader.unRegister(name); + * @param {string} name 组件名字 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 删除指定的插件。 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview 文件选择相关 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 指定选择文件的按钮容器,不指定则不创建按钮。 + * + * * `id` {Seletor|dom} 指定选择文件的按钮容器,不指定则不创建按钮。**注意** 这里虽然写的是 id, 但是不是只支持 id, 还支持 class, 或者 dom 节点。 + * * `label` {String} 请采用 `innerHTML` 代替 + * * `innerHTML` {String} 指定按钮文字。不指定时优先从指定的容器中看是否自带文字。 + * * `multiple` {Boolean} 是否开起同时选择多个文件能力。 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 指定接受哪些类型的文件。 由于目前还有ext转mimeType表,所以这里需要分开指定。 + * + * * `title` {String} 文字描述 + * * `extensions` {String} 允许的文件后缀,不带点,多个用逗号分割。 + * * `mimeTypes` {String} 多个用逗号分割。 + * + * 如: + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 添加文件选择按钮,如果一个按钮不够,需要调用此方法来添加。参数跟[options.pick](#WebUploader:Uploader:options)一致。 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '选择文件' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 构造器。 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 默认选项。 + Image.options = { + + // 默认的图片处理质量 + quality: 90, + + // 是否裁剪 + crop: false, + + // 是否保留头部信息 + preserveHeaders: false, + + // 是否允许放大。 + allowMagnify: false + }; + + // 继承RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 根据要处理的文件大小来节流,一次不能处理太多,会卡。 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 配置生成缩略图的选项。 + * + * 默认为: + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 70, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: true, + * + * // 是否允许裁剪。 + * crop: true, + * + * // 为空的话则保留原有图片格式。 + * // 否则强制转换成指定的类型。 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 为空的话则保留原有图片格式。 + // 否则强制转换成指定的类型。 + // IE 8下面 base64 大小不能超过 32K 否则预览失败,而非 jpeg 编码的图片很可 + // 能会超过 32k, 所以这里设置成预览的时候都是 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 配置压缩的图片的选项。如果此选项为`false`, 则图片在上传前不进行压缩。 + * + * 默认为: + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 90, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: false, + * + * // 是否允许裁剪。 + * crop: false, + * + * // 是否保留头部meta信息。 + * preserveHeaders: true, + * + * // 如果发现压缩后文件大小比原来还大,则使用原来图片 + * // 此属性可能会影响图片自动纠正功能 + * noCompressIfLarger: false, + * + * // 单位字节,如果图片大小小于此值,不会采用压缩。 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 生成缩略图,此过程为异步,所以需要传入`callback`。 + * 通常情况在图片加入队里后调用此方法来生成预览图以增强交互效果。 + * + * 当 width 或者 height 的值介于 0 - 1 时,被当成百分比使用。 + * + * `callback`中可以接收到两个参数。 + * * 第一个为error,如果生成缩略图有错误,此error将为真。 + * * 第二个为ret, 缩略图的Data URL值。 + * + * **注意** + * Date URL在IE6/7中不支持,所以不用调用此方法了,直接显示一张暂不支持预览图片好了。 + * 也可以借助服务端,将 base64 数据传给服务端,生成一个临时文件供预览。 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('预览错误'); + * } else { + * $li.append('<img alt="" src="' + ret + '" />'); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 只预览图片格式。 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 如果传入的是object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 当 resize 完后 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 只压缩 jpeg 图片格式。 + // gif 可能会丢失针 + // bmp png 基本上尺寸都不大,且压缩比比较小。 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 移动端 UC / qq 浏览器的无图模式下 + // ctx.getImageData 处理大图的时候会报 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 如果压缩后,比原来还大则不用压缩后的。 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 标记,避免重复压缩。 + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 出错了直接继续,让其上传原始图片 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 文件属性封装 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 文件类 + * @class File + * @constructor 构造函数 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 + */ + function WUFile( source ) { + + /** + * 文件名,包括扩展名(后缀) + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 文件体积(字节) + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 文件最后修改日期 + * @property lastModifiedDate + * @type {int} + * @default 当前时间戳 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 文件ID,每个对象具有唯一ID,与文件名无关 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 文件扩展名,通过文件名获取,例如test.png的扩展名为png + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 状态文字说明。在不同的status语境下有不同的用途。 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 存储文件状态,防止通过属性直接修改 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 设置状态,状态变化时会触发`change`事件。 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status) + * @param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 文件状态变化 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 获取文件状态 + * @return {File.Status} + * @example + 文件状态具体包括以下几种类型: + { + // 初始化 + INITED: 0, + // 已入队列 + QUEUED: 1, + // 正在上传 + PROGRESS: 2, + // 上传出错 + ERROR: 3, + // 上传成功 + COMPLETE: 4, + // 上传取消 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 获取文件原始信息。 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 文件状态值,具体包括以下几种类型: + * * `inited` 初始状态 + * * `queued` 已经进入队列, 等待上传 + * * `progress` 上传中 + * * `complete` 上传完成。 + * * `error` 上传出错,可重试 + * * `interrupt` 上传中断,可续传。 + * * `invalid` 文件不合格,不能重试上传。会自动从队列中移除。 + * * `cancelled` 文件被移除。 + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 初始状态 + QUEUED: 'queued', // 已经进入队列, 等待上传 + PROGRESS: 'progress', // 上传中 + ERROR: 'error', // 上传出错,可重试 + COMPLETE: 'complete', // 上传完成。 + CANCELLED: 'cancelled', // 上传取消。 + INTERRUPT: 'interrupt', // 上传中断,可续传。 + INVALID: 'invalid' // 文件不合格,不能重试上传。 + }; + + return WUFile; + }); + + /** + * @fileOverview 文件队列 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 文件队列, 用来存储各个状态中的文件。 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 统计文件数。 + * * `numOfQueue` 队列中的文件数。 + * * `numOfSuccess` 上传成功的文件数 + * * `numOfCancel` 被取消的文件数 + * * `numOfProgress` 正在上传中的文件数 + * * `numOfUploadFailed` 上传错误的文件数。 + * * `numOfInvalid` 无效的文件数。 + * * `numofDeleted` 被移除的文件数。 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 上传队列,仅包括等待上传的文件 + this._queue = []; + + // 存储所有文件 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 将新文件加入对队列尾部 + * + * @method append + * @param {File} file 文件对象 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 将新文件加入对队列头部 + * + * @method prepend + * @param {File} file 文件对象 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 获取文件对象 + * + * @method getFile + * @param {String} fileId 文件ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 从队列中取出一个指定状态的文件。 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [文件状态值](#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 对队列进行排序,能够控制文件上传顺序。 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 排序方法 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [文件状态值](#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 在队列中删除文件。 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 文件对象。 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 队列 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept中的中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 如果当前不是html5运行时,那就算了。 + // 不执行后续操作 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 创建一个 html5 运行时的 placeholder + // 以至于外部添加原生 File 对象的时候能正确包裹一下供 webuploader 使用。 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 为了支持外部直接添加一个原生File对象。 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 判断文件是否可以被加入队列 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 如果名字中有后缀,才做后缀白名单处理。 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File对象 + * @description 当文件被加入队列之前触发,此事件的handler返回值为`false`,则此文件不会被添加进入队列。 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File对象 + * @description 当文件被加入队列以后触发。 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 不过类型判断允许不允许,先派送 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 类型不匹配,则派送错误事件,并返回。 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 数组,内容为原始File(lib/File)对象。 + * @description 当一批文件添加进队列以后触发。 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 对象 数组 + * @description 添加文件到队列 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File对象 + * @description 当文件被移除队列后触发。 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 返回指定状态的文件集合,不传参数将返回所有状态的文件。 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 重试上传,重试指定文件,或者从出错的文件开始重新上传。 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 排序队列中的文件,在上传之前调整可以控制上传顺序。 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 当 uploader 被重置的时候触发。 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 重置uploader。目前只重置了队列。 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 添加获取Runtime相关信息的方法。 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 指定运行时启动顺序。默认会想尝试 html5 是否支持,如果支持则使用 html5, 否则则使用 flash. + * + * 可以将此值设置成 `flash`,来强制使用 flash 运行时。 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 预测Uploader将采用哪个`Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 跨域时,是否允许携带cookie, 只有html5 runtime才有效 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2分钟 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 添加Blob, 只能添加一次,最后一次有效。 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 添加其他字段 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 让Transport具备事件功能。 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 负责文件上传相关。 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 添加默认配置项 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 是否允许在文件传输时提前把下一个文件准备好。 + * 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 + * 如果能提前在当前文件传输期处理,可以节省总体耗时。 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 是否要分片处理大文件上传。 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 如果要分片,分多大一片? 默认大小为5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 如果某个分片由于网络问题出错,允许自动重传多少次? + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 上传并发数。允许同时最大上传进程数。 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 文件上传请求的参数表,每次发送都会发送此对象中的参数。 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 设置文件上传域的name。 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 文件上传方式,`POST`或者`GET`。 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 是否已二进制的流的方式发送文件,这样整个上传内容`php://input`都为文件内容, + * 其他参数在$_GET数组中。 + */ + }); + + // 负责将文件切片。 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 记录当前正在传的数据,跟threads相关 + this.pool = []; + + // 缓存分好片的文件。 + this.stack = []; + + // 缓存即将上传的文件。 + this.pending = []; + + // 跟踪还有多少分片在上传中但是没有完成上传。 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 把其他块取消了。 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 当开始上传流程时触发。 + * @for Uploader + */ + + /** + * 开始上传。此方法可以从初始状态调用开始上传流程,也可以从暂停状态调用,继续上传流程。 + * + * 可以指定开始某一个文件。 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 移出invalid的文件 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 如果指定了开始某个文件,则只开始指定文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 之前暂停过。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 如果有暂停的,则续传 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 当开始上传流程暂停时触发。 + * @for Uploader + */ + + /** + * 暂停上传。第一个参数为是否中断上传当前正在上传的文件。 + * + * 如果第一个参数是文件,则只暂停指定文件。 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 如果只是暂停某个文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 只 abort 指定的文件。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 标记文件状态为已取消, 同时将中断文件传输。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 判断`Uplaode`r是否正在上传中。 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 掉过一个文件上传,直接标记指定文件为已上传状态。 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 当所有文件上传结束时触发。 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 上一个promise还没有结束,则等待完成后再执行。 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 还有位置,且还有文件要处理的话。 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 有可能是reject过来的,所以要检测val的类型。 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 没有要上传的了,且没有正在传输的了。 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 把已经处理完了的,或者,状态为非 progress(上传中)、 + // interupt(暂停中) 的移除。 + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 如果当前文件还有没有需要传输的,则直接返回剩下的。 + if ( (act = this._getStack()) ) { + + // 是否提前准备下一个文件 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 否则,如果正在运行,则准备下一个文件,并等待完成后返回下个分片。 + } else if ( me.runing ) { + + // 如果缓存中有,则直接在缓存中取,没有则去queue中取。 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 文件可能还在prepare中,也有可能已经完全准备好了。 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File对象 + * @description 某个文件开始上传前触发,一个文件只会触发一次。 + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 有可能文件被skip掉了。文件被skip掉后,状态坑定不是Queued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 如果还在pending中,则替换成文件本身。 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file的钩子就有错误发生。 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 让出位置了,可以让其他分片开始上传 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 有可能在 before-send-file 的 promise 期间改变了文件状态。 + // 如:暂停,取消 + // 我们不能中断 promise, 但是可以在 promise 完后,不做上传操作。 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 如果是中断,则还需要放回去。 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 如果没有分片,则直接使用原始的。 + // 不会丢失content-type信息。 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 每个分片发送之前可能要做些异步的事情。 + promise = me.request( 'before-send', block, function() { + + // 有可能文件已经上传出错了,所以不需要再传输了。 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 如果为fail了,则跳过此分片。 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 默认的上传参数,可以扩展此对象来控制上传参数。 + * @param {Object} headers 可以扩展此对象来控制上传头部。 + * @description 当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。 + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 服务端的返回数据,json格式,如果服务端不是json格式,从ret._raw中取数据,自行解析。 + * @description 当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为`false`, 则此文件将派送`server`类型的`uploadError`事件。 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File对象 + * @param {Number} percentage 上传进度 + * @description 上传过程中触发,携带上传进度。 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File对象 + * @param {String} reason 出错的code + * @description 当文件上传出错时触发。 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File对象 + * @param {Object} response 服务端返回的数据 + * @description 当文件上传成功时触发。 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File对象 + * @description 不管成功或者失败,文件上传完成时触发。 + * @for Uploader + */ + + // 做上传操作。 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 广播上传进度。以文件为单位。 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 用来询问,是否返回的结果是有错误的。 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 服务端响应了,不代表成功了,询问是否响应正确。 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 尝试重试,然后广播文件上传出错。 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 自动重试 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 上传成功 + tr.on( 'load', function() { + var reason; + + // 如果非预期,转向上传出错。 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 全部上传完成。 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 配置默认的上传字段。 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 在发送之间可以添加字段什么的。。。 + // 如果默认的字段不够使用,可以通过监听此事件来扩展 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 开始发送。 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 完成上传。 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 如果外部已经标记为invalid什么的,不再改状态。 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 日志组件,主要用来收集错误信息,可以帮助 webuploader 更好的定位问题和发展。 + * + * 如果您不想要启用此功能,请在打包的时候去掉 log 模块。 + * + * 或者可以在初始化的时候通过 options.disableWidgets 属性禁用。 + * + * 如: + * WebUploader.create({ + * ... + * + * disableWidgets: 'log', + * + * ... + * }) + */ + define('widgets/log',[ + 'base', + 'uploader', + 'widgets/widget' + ], function( Base, Uploader ) { + var $ = Base.$, + logUrl = ' http://static.tieba.baidu.com/tb/pms/img/st.gif??', + product = (location.hostname || location.host || 'protected').toLowerCase(), + + // 只针对 baidu 内部产品用户做统计功能。 + enable = product && /baidu/i.exec(product), + base; + + if (!enable) { + return; + } + + base = { + dv: 3, + master: 'webuploader', + online: /test/.exec(product) ? 0 : 1, + module: '', + product: product, + type: 0 + }; + + function send(data) { + var obj = $.extend({}, base, data), + url = logUrl.replace(/^(.*)\?/, '$1' + $.param( obj )), + image = new Image(); + + image.src = url; + } + + return Uploader.register({ + name: 'log', + + init: function() { + var owner = this.owner, + count = 0, + size = 0; + + owner + .on('error', function(code) { + send({ + type: 2, + c_error_code: code + }); + }) + .on('uploadError', function(file, reason) { + send({ + type: 2, + c_error_code: 'UPLOAD_ERROR', + c_reason: '' + reason + }); + }) + .on('uploadComplete', function(file) { + count++; + size += file.size; + }). + on('uploadFinished', function() { + send({ + c_count: count, + c_size: size + }); + count = size = 0; + }); + + send({ + c_usage: 1 + }); + } + }); + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 不需要连接其他程序,直接执行callback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 注册Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 注册html5运行时。 + // 只有在支持的前提下注册。 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox不支持单独指定后缀 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 更安全的方式调用,比如android里面就能把context改成其他的对象。 + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android不支持直接new Blob, 只能借助blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 抽出来主要是为了解决android下面canvas.toDataUrl不支持jpeg. + // 你得到的结果是png. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 代码来自于:https://github.com/blueimp/JavaScript-Load-Image + * 暂时项目中只用了orientation. + * + * 去除了 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF解析 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 尝试读取缩略图 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 标记是否被修改过。 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 读取meta信息。 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 解决 orientation 的问题。 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob需要重新生成。 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 释放内存。非常重要,否则释放不了image的内存。 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 交换width, height的值。 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 不允许放大。 + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 如果不是ios, 不需要这么复杂! + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * 这个方式性能不行,但是可以解决android里面的toDataUrl的bug + * android里面toDataUrl('image/jpege')得到的结果却是png. + * + * 所以这里没辙,只能借助这个工具 + * @fileOverview jpeg encoder + */ + define('runtime/html5/jpegencoder',[], function( require, exports, module ) { + + /* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /* + JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + + Basic GUI blocking jpeg encoder + */ + + function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr<nrupper; nr++) { + category[32767+nr] = cat; + bitcode[32767+nr] = []; + bitcode[32767+nr][1] = cat; + bitcode[32767+nr][0] = nr; + } + //Negative numbers + for (var nrneg =-(nrupper-1); nrneg<=-nrlower; nrneg++) { + category[32767+nrneg] = cat; + bitcode[32767+nrneg] = []; + bitcode[32767+nrneg][1] = cat; + bitcode[32767+nrneg][0] = nrupper-1+nrneg; + } + nrlower <<= 1; + nrupper <<= 1; + } + } + + function initRGBYUVTable() { + for(var i = 0; i < 256;i++) { + RGB_YUV_TABLE[i] = 19595 * i; + RGB_YUV_TABLE[(i+ 256)>>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + byteout.push(clt[value]); // write char directly instead of converting later + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i<I8; ++i) + { + d0 = data[dataOff]; + d1 = data[dataOff+1]; + d2 = data[dataOff+2]; + d3 = data[dataOff+3]; + d4 = data[dataOff+4]; + d5 = data[dataOff+5]; + d6 = data[dataOff+6]; + d7 = data[dataOff+7]; + + var tmp0 = d0 + d7; + var tmp7 = d0 - d7; + var tmp1 = d1 + d6; + var tmp6 = d1 - d6; + var tmp2 = d2 + d5; + var tmp5 = d2 - d5; + var tmp3 = d3 + d4; + var tmp4 = d3 - d4; + + /* Even part */ + var tmp10 = tmp0 + tmp3; /* phase 2 */ + var tmp13 = tmp0 - tmp3; + var tmp11 = tmp1 + tmp2; + var tmp12 = tmp1 - tmp2; + + data[dataOff] = tmp10 + tmp11; /* phase 3 */ + data[dataOff+4] = tmp10 - tmp11; + + var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */ + data[dataOff+2] = tmp13 + z1; /* phase 5 */ + data[dataOff+6] = tmp13 - z1; + + /* Odd part */ + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */ + var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */ + var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */ + var z3 = tmp11 * 0.707106781; /* c4 */ + + var z11 = tmp7 + z3; /* phase 5 */ + var z13 = tmp7 - z3; + + data[dataOff+5] = z13 + z2; /* phase 6 */ + data[dataOff+3] = z13 - z2; + data[dataOff+1] = z11 + z4; + data[dataOff+7] = z11 - z4; + + dataOff += 8; /* advance pointer to next row */ + } + + /* Pass 2: process columns. */ + dataOff = 0; + for (i=0; i<I8; ++i) + { + d0 = data[dataOff]; + d1 = data[dataOff + 8]; + d2 = data[dataOff + 16]; + d3 = data[dataOff + 24]; + d4 = data[dataOff + 32]; + d5 = data[dataOff + 40]; + d6 = data[dataOff + 48]; + d7 = data[dataOff + 56]; + + var tmp0p2 = d0 + d7; + var tmp7p2 = d0 - d7; + var tmp1p2 = d1 + d6; + var tmp6p2 = d1 - d6; + var tmp2p2 = d2 + d5; + var tmp5p2 = d2 - d5; + var tmp3p2 = d3 + d4; + var tmp4p2 = d3 - d4; + + /* Even part */ + var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */ + var tmp13p2 = tmp0p2 - tmp3p2; + var tmp11p2 = tmp1p2 + tmp2p2; + var tmp12p2 = tmp1p2 - tmp2p2; + + data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */ + data[dataOff+32] = tmp10p2 - tmp11p2; + + var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */ + data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */ + data[dataOff+48] = tmp13p2 - z1p2; + + /* Odd part */ + tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */ + tmp11p2 = tmp5p2 + tmp6p2; + tmp12p2 = tmp6p2 + tmp7p2; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */ + var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */ + var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */ + var z3p2 = tmp11p2 * 0.707106781; /* c4 */ + + var z11p2 = tmp7p2 + z3p2; /* phase 5 */ + var z13p2 = tmp7p2 - z3p2; + + data[dataOff+40] = z13p2 + z2p2; /* phase 6 */ + data[dataOff+24] = z13p2 - z2p2; + data[dataOff+ 8] = z11p2 + z4p2; + data[dataOff+56] = z11p2 - z4p2; + + dataOff++; /* advance pointer to next column */ + } + + // Quantize/descale the coefficients + var fDCTQuant; + for (i=0; i<I64; ++i) + { + // Apply the quantization and scaling factor & Round to nearest integer + fDCTQuant = data[i]*fdtbl[i]; + outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j<I64;++j) { + DU[ZigZag[j]]=DU_DCT[j]; + } + var Diff = DU[0] - DC; DC = DU[0]; + //Encode DC + if (Diff==0) { + writeBits(HTDC[0]); // Diff might be 0 + } else { + pos = 32767+Diff; + writeBits(HTDC[category[pos]]); + writeBits(bitcode[pos]); + } + //Encode ACs + var end0pos = 63; // was const... which is crazy + for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + // var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + // var duration = new Date().getTime() - time_start; + // console.log('Encoding time: '+ currentQuality + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + // console.log('Quality set to: '+quality +'%'); + } + + function init(){ + // var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + // var duration = new Date().getTime() - time_start; + // console.log('Initialization '+ duration + 'ms'); + } + + init(); + + }; + + JPEGEncoder.encode = function( data, quality ) { + var encoder = new JPEGEncoder( quality ); + + return encoder.encode( data ); + } + + return JPEGEncoder; + }); + /** + * @fileOverview Fix android canvas.toDataUrl bug. + */ + define('runtime/html5/androidpatch',[ + 'runtime/html5/util', + 'runtime/html5/jpegencoder', + 'base' + ], function( Util, encoder, Base ) { + var origin = Util.canvasToDataUrl, + supportJpeg; + + Util.canvasToDataUrl = function( canvas, type, quality ) { + var ctx, w, h, fragement, parts; + + // 非android手机直接跳过。 + if ( !Base.os.android ) { + return origin.apply( null, arguments ); + } + + // 检测是否canvas支持jpeg导出,根据数据格式来判断。 + // JPEG 前两位分别是:255, 216 + if ( type === 'image/jpeg' && typeof supportJpeg === 'undefined' ) { + fragement = origin.apply( null, arguments ); + + parts = fragement.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + fragement = atob( parts[ 1 ] ); + } else { + fragement = decodeURIComponent( parts[ 1 ] ); + } + + fragement = fragement.substring( 0, 2 ); + + supportJpeg = fragement.charCodeAt( 0 ) === 255 && + fragement.charCodeAt( 1 ) === 216; + } + + // 只有在android环境下才修复 + if ( type === 'image/jpeg' && !supportJpeg ) { + w = canvas.width; + h = canvas.height; + ctx = canvas.getContext('2d'); + + return encoder.encode( ctx.getImageData( 0, 0, w, h ), quality ); + } + + return origin.apply( null, arguments ); + }; + }); + /** + * @fileOverview Transport + * @todo 支持chunked传输,优势: + * 可以将大文件分成小块,挨个传输,可以提高大文件成功率,当失败的时候,也只需要重传那小部分, + * 而不需要重头再传一次。另外断点续传也需要用chunked方式。 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 强制设置成 content-type 为文件流。 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android直接发送blob会导致服务端接收到的是空文件。 + // bug详情。 + // https://code.google.com/p/android/issues/detail?id=39882 + // 所以先用fileReader读取出来再通过arraybuffer的方式发送。 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + define('webuploader',[ + 'base', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/log', + 'runtime/html5/blob', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/image', + 'runtime/html5/androidpatch', + 'runtime/html5/transport' + ], function( Base ) { + return Base; + }); + return require('webuploader'); +}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.min.js new file mode 100644 index 0000000..eaf9e64 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-builtin",["dollar"],function(a){function b(b){var c,d,e,f,g,h,i=[],j=!b&&[],k=function(a){for(h=a,c=!0,g=e||0,e=0,f=i.length,d=!0;i&&f>g;g++)i[g].apply(a[0],a[1]);d=!1,i&&(j?j.length&&k(j.shift()):i=[])},l={add:function(){if(i){var b=i.length;!function c(b){a.each(b,function(b,d){var e=a.type(d);"function"===e?i.push(d):d&&d.length&&"string"!==e&&c(d)})}(arguments),d?f=i.length:h&&(e=b,k(h))}return this},disable:function(){return i=j=h=void 0,this},lock:function(){return j=void 0,h||l.disable(),this},fireWith:function(a,b){return!i||c&&!j||(b=b||[],b=[a,b.slice?b.slice():b],d?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this}};return l}function c(d){var e=[["resolve","done",b(!0),"resolved"],["reject","fail",b(!0),"rejected"],["notify","progress",b()]],f="pending",g={state:function(){return f},always:function(){return h.done(arguments).fail(arguments),this},then:function(){var b=arguments;return c(function(c){a.each(e,function(d,e){var f=e[0],i=a.isFunction(b[d])&&b[d];h[e[1]](function(){var b;b=i&&i.apply(this,arguments),b&&a.isFunction(b.promise)?b.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===g?c.promise():this,i?[b]:arguments)})}),b=null}).promise()},promise:function(b){return null!=b?a.extend(b,g):g}},h={};return g.pipe=g.then,a.each(e,function(a,b){var c=b[2],d=b[3];g[b[1]]=c.add,d&&c.add(function(){f=d},e[1^a][2].disable,e[2][2].lock),h[b[0]]=function(){return h[b[0]+"With"](this===h?g:this,arguments),this},h[b[0]+"With"]=c.fireWith}),g.promise(h),d&&d.call(h,h),h}var d;return d={Deferred:c,isPromise:function(a){return a&&"function"==typeof a.then},when:function(b){var d,e,f,g=0,h=[].slice,i=h.call(arguments),j=i.length,k=1!==j||b&&a.isFunction(b.promise)?j:0,l=1===k?b:c(),m=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?h.call(arguments):e,c===d?l.notifyWith(b,c):--k||l.resolveWith(b,c)}};if(j>1)for(d=new Array(j),e=new Array(j),f=new Array(j);j>g;g++)i[g]&&a.isFunction(i[g].promise)?i[g].promise().done(m(g,f,i)).fail(l.reject).progress(m(g,e,d)):--k;return k||l.resolveWith(f,i),l.promise()}}}),b("promise",["promise-builtin"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e<f;)if(c=a[e],c.cb.apply(c.ctx2,b)===!1){d=!0;break}return!d}var e,f=a.$,g=[].slice,h=/\s+/;return e={on:function(a,b,d){var e,f=this;return b?(e=this._events||(this._events=[]),c(a,b,function(a,b){var c={e:a};c.cb=b,c.ctx=d,c.ctx2=d||f,c.id=e.length,e.push(c)}),this):this},once:function(a,b,d){var e=this;return b?(c(a,b,function(a,b){var c=function(){return e.off(a,c),b.apply(d||e,arguments)};c._cb=b,e.on(a,c,d)}),e):e},off:function(a,d,e){var g=this._events;return g?a||d||e?(c(a,d,function(a,c){f.each(b(g,a,c,e),function(){delete g[this.id]})}),this):(this._events=[],this):this},trigger:function(a){var c,e,f;return this._events&&a?(c=g.call(arguments,1),e=b(this._events,a),f=b(this._events,"all"),d(e,c)&&d(f,arguments)):this}},f.extend({installTo:function(a){return f.extend(a,e)}},e)}),b("uploader",["base","mediator"],function(a,b){function c(a){this.options=d.extend(!0,{},c.options,a),this._init(this.options)}var d=a.$;return c.options={},b.installTo(c.prototype),d.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",sort:"sort-files",removeFile:"remove-file",cancelFile:"cancel-file",skipFile:"skip-file",retry:"retry",isInProgress:"is-in-progress",makeThumb:"make-thumb",md5File:"md5-file",getDimension:"get-dimension",addButton:"add-btn",predictRuntimeType:"predict-runtime-type",refresh:"refresh",disable:"disable",enable:"enable",reset:"reset"},function(a,b){c.prototype[a]=function(){return this.request(b,arguments)}}),d.extend(c.prototype,{state:"pending",_init:function(a){var b=this;b.request("init",a,function(){b.state="ready",b.trigger("ready")})},option:function(a,b){var c=this.options;return arguments.length>1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("按钮指定错误");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size<h||b._compressed?void 0:(g=e.extend({},g),f=a.Deferred(),d=new c(g),f.always(function(){d.destroy(),d=null}),d.once("error",f.reject),d.once("load",function(){var a=g.width,c=g.height;b._info=b._info||d.info(),b._meta=b._meta||d.meta(),1>=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.size<c)&&(b.source=a,b.size=a.size,b.trigger("resize",a.size,c)),b._compressed=!0,f.resolve()}catch(e){f.resolve()}}),b._info&&d.info(b._info),b._meta&&d.meta(b._meta),d.loadFromBlob(b.source),f.promise())}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length<e.threads&&(c=d._nextBlock())?(d._trigged=!1,b=function(b){d._promise=null,b&&b.file&&d._startSend(b),a.nextTick(d.__tick)},d._promise=g(c)?c.always(b):b(c)):d.remaning||d._getStats().numOfQueue||d._getStats().numofInterrupt||(d.runing=!1,d._trigged||a.nextTick(function(){d.owner.trigger("uploadFinished")}),d._trigged=!0))},_putback:function(a){var b;a.cuted.unshift(a),b=this.stack.indexOf(a.cuted),~b||this.stack.unshift(a.cuted)},_getStack:function(){for(var a,b=0;a=this.stack[b++];){if(a.has()&&a.file.getStatus()===h.PROGRESS)return a;(!a.has()||a.file.getStatus()!==h.PROGRESS&&a.file.getStatus()!==h.INTERRUPT)&&this.stack.splice(--b,1)}return null},_nextBlock:function(){var a,b,c,d,f=this,h=f.options;return(a=this._getStack())?(h.prepareNextFile&&!f.pending.length&&f._prepareNextFile(),a.shift()):f.runing?(!f.pending.length&&f._getStats().numOfQueue&&f._prepareNextFile(),b=f.pending.shift(),c=function(b){return b?(a=e(b,h.chunked?h.chunkSize:0),f.stack.push(a),a.shift()):null},g(b)?(d=b.file,b=b[b.pipe?"pipe":"then"](c),b.file=d,b):c(b)):void 0},_prepareNextFile:function(){var a,b=this,c=b.request("fetch-file"),d=b.pending;c&&(a=b.request("before-send-file",c,function(){return c.getStatus()===h.PROGRESS||c.getStatus()===h.INTERRUPT?c:b._finishFile(c)}),b.owner.trigger("uploadStart",c),c.setStatus(h.PROGRESS),a.file=c,a.done(function(){var b=f.inArray(a,d);~b&&d.splice(b,1,c)}),a.fail(function(a){c.setStatus(h.ERROR,a),b.owner.trigger("uploadError",c,a),b.owner.trigger("uploadComplete",c)}),d.push(a))},_popBlock:function(a){var b=f.inArray(a,this.pool);this.pool.splice(b,1),a.file.remaning--,this.remaning--},_startSend:function(b){var c,d=this,e=b.file;return e.getStatus()!==h.PROGRESS?void(e.getStatus()===h.INTERRUPT&&d._putback(b)):(d.pool.push(b),d.remaning++,b.blob=1===b.chunks?e.source:e.source.slice(b.start,b.end),c=d.request("before-send",b,function(){e.getStatus()===h.PROGRESS?d._doSend(b):(d._popBlock(b),a.nextTick(d.__tick))}),void c.fail(function(){1===e.remaning?d._finishFile(e).always(function(){b.percentage=1,d._popBlock(b),d.owner.trigger("uploadComplete",e),a.nextTick(d.__tick)}):(b.percentage=1,d.updateFileProgress(e),d._popBlock(b),a.nextTick(d.__tick))}))},_doSend:function(b){var c,e,g=this,i=g.owner,j=g.options,k=b.file,l=new d(j),m=f.extend({},j.formData),n=f.extend({},j.headers);b.transport=l,l.on("destroy",function(){delete b.transport,g._popBlock(b),a.nextTick(g.__tick)}),l.on("progress",function(a){b.percentage=a,g.updateFileProgress(k)}),c=function(a){var c;return e=l.getResponseAsJson()||{},e._raw=l.getResponse(),c=function(b){a=b},i.trigger("uploadAccept",b,e,c)||(a=a||"server"),a},l.on("error",function(a,d){b.retried=b.retried||0,b.chunks>1&&~"http,abort".indexOf(a)&&b.retried<j.chunkRetry?(b.retried++,l.send()):(d||"server"!==a||(a=c(a)),k.setStatus(h.ERROR,a),i.trigger("uploadError",k,a),i.trigger("uploadComplete",k))}),l.on("load",function(){var a;return(a=c())?void l.trigger("error",a,!0):void(1===k.remaning?g._finishFile(k,e):l.destroy())}),m=f.extend(m,{id:k.id,name:k.name,type:k.type,lastModifiedDate:k.lastModifiedDate,size:k.size}),b.chunks>1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c) +}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b)}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/log",["base","uploader","widgets/widget"],function(a,b){function c(a){var b=e.extend({},d,a),c=f.replace(/^(.*)\?/,"$1"+e.param(b)),g=new Image;g.src=c}var d,e=a.$,f=" http://static.tieba.baidu.com/tb/pms/img/st.gif??",g=(location.hostname||location.host||"protected").toLowerCase(),h=g&&/baidu/i.exec(g);if(h)return d={dv:3,master:"webuploader",online:/test/.exec(g)?0:1,module:"",product:g,type:0},b.register({name:"log",init:function(){var a=this.owner,b=0,d=0;a.on("error",function(a){c({type:2,c_error_code:a})}).on("uploadError",function(a,b){c({type:2,c_error_code:"UPLOAD_ERROR",c_reason:""+b})}).on("uploadComplete",function(a){b++,d+=a.size}).on("uploadFinished",function(){c({c_count:b,c_size:d}),b=d=0}),c({c_usage:1})}})}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice;return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/util",["base"],function(b){var c=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL,d=b.noop,e=d;return c&&(d=function(){return c.createObjectURL.apply(c,arguments)},e=function(){return c.revokeObjectURL.apply(c,arguments)}),{createObjectURL:d,revokeObjectURL:e,dataURL2Blob:function(a){var b,c,d,e,f,g;for(g=a.split(","),b=~g[0].indexOf("base64")?atob(g[1]):decodeURIComponent(g[1]),d=new ArrayBuffer(b.length),c=new Uint8Array(d),e=0;e<b.length;e++)c[e]=b.charCodeAt(e);return f=g[0].split(":")[1].split(";")[0],this.arrayBufferToBlob(d,f)},dataURL2ArrayBuffer:function(a){var b,c,d,e;for(e=a.split(","),b=~e[0].indexOf("base64")?atob(e[1]):decodeURIComponent(e[1]),c=new Uint8Array(b.length),d=0;d<b.length;d++)c[d]=b.charCodeAt(d);return c.buffer},arrayBufferToBlob:function(b,c){var d,e=a.BlobBuilder||a.WebKitBlobBuilder;return e?(d=new e,d.append(b),d.getBlob(c)):new Blob([b],c?{type:c}:{})},canvasToDataUrl:function(a,b,c){return a.toDataURL(b,c/100)},parseMeta:function(a,b){b(!1,{})},updateImageHead:function(a){return a}}}),b("runtime/html5/imagemeta",["runtime/html5/util"],function(a){var b;return b={parsers:{65505:[]},maxMetaDataSize:262144,parse:function(a,b){var c=this,d=new FileReader;d.onload=function(){b(!1,c._parse(this.result)),d=d.onload=d.onerror=null},d.onerror=function(a){b(a.message),d=d.onload=d.onerror=null},a=a.slice(0,c.maxMetaDataSize),d.readAsArrayBuffer(a.getSource())},_parse:function(a,c){if(!(a.byteLength<6)){var d,e,f,g,h=new DataView(a),i=2,j=h.byteLength-4,k=i,l={};if(65496===h.getUint16(0)){for(;j>i&&(d=h.getUint16(i),d>=65504&&65519>=d||65534===d)&&(e=h.getUint16(i+2)+2,!(i+e>h.byteLength));){if(f=b.parsers[d],!c&&f)for(g=0;g<f.length;g+=1)f[g].call(b,h,i,e,l);i+=e,k=i}k>6&&(l.imageHead=a.slice?a.slice(2,k):new Uint8Array(a).subarray(2,k))}return l}},updateImageHead:function(a,b){var c,d,e,f=this._parse(a,!0);return e=2,f.imageHead&&(e=2+f.imageHead.byteLength),d=a.slice?a.slice(e):new Uint8Array(a).subarray(e),c=new Uint8Array(b.byteLength+2+d.byteLength),c[0]=255,c[1]=216,c.set(new Uint8Array(b),2),c.set(new Uint8Array(d),b.byteLength+2),c.buffer}},a.parseMeta=function(){return b.parse.apply(b,arguments)},a.updateImageHead=function(){return b.updateImageHead.apply(b,arguments)},b}),b("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(a,b){var c={};return c.ExifMap=function(){return this},c.ExifMap.prototype.map={Orientation:274},c.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},c.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},c.exifTagTypes[7]=c.exifTagTypes[1],c.getExifValue=function(b,d,e,f,g,h){var i,j,k,l,m,n,o=c.exifTagTypes[f];if(!o)return void a.log("Invalid Exif data: Invalid tag type.");if(i=o.size*g,j=i>4?d+b.getUint32(e+8,h):e+8,j+i>b.byteLength)return void a.log("Invalid Exif data: Invalid data offset.");if(1===g)return o.getValue(b,j,h);for(k=[],l=0;g>l;l+=1)k[l]=o.getValue(b,j+l*o.size,h);if(o.ascii){for(m="",l=0;l<k.length&&(n=k[l],"\x00"!==n);l+=1)m+=n;return m}return k},c.parseExifTag=function(a,b,d,e,f){var g=a.getUint16(d,e);f.exif[g]=c.getExifValue(a,b,d,a.getUint16(d+2,e),a.getUint32(d+4,e),e)},c.parseExifTags=function(b,c,d,e,f){var g,h,i;if(d+6>b.byteLength)return void a.log("Invalid Exif data: Invalid directory offset.");if(g=b.getUint16(d,e),h=d+2+12*g,h+4>b.byteLength)return void a.log("Invalid Exif data: Invalid directory size.");for(i=0;g>i;i+=1)this.parseExifTag(b,c,d+2+12*i,e,f);return b.getUint32(h,e)},c.parseExifData=function(b,d,e,f){var g,h,i=d+10;if(1165519206===b.getUint32(d+4)){if(i+8>b.byteLength)return void a.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(d+8))return void a.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(i)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void a.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(i+2,g))return void a.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(i+4,g),f.exif=new c.ExifMap,h=c.parseExifTags(b,i,i+h,g,f)}},b.parsers[65505].push(c.parseExifData),c}),b("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(a,b,c){var d="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D";return b.register("Image",{modified:!1,init:function(){var a=this,b=new Image;b.onload=function(){a._info={type:a.type,width:this.width,height:this.height},a._metas||"image/jpeg"!==a.type?a.owner.trigger("load"):c.parseMeta(a._blob,function(b,c){a._metas=c,a.owner.trigger("load")})},b.onerror=function(){a.owner.trigger("error")},a._img=b},loadFromBlob:function(a){var b=this,d=b._img;b._blob=a,b.type=a.type,d.src=c.createObjectURL(a.getSource()),b.owner.once("load",function(){c.revokeObjectURL(d.src)})},resize:function(a,b){var c=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,c,a,b),this._blob=null,this.modified=!0,this.owner.trigger("complete","resize")},crop:function(a,b,c,d,e){var f=this._canvas||(this._canvas=document.createElement("canvas")),g=this.options,h=this._img,i=h.naturalWidth,j=h.naturalHeight,k=this.getOrientation();e=e||1,f.width=c,f.height=d,g.preserveHeaders||this._rotate2Orientaion(f,k),this._renderImageToCanvas(f,h,-a,-b,i*e,j*e),this._blob=null,this.modified=!0,this.owner.trigger("complete","crop")},getAsBlob:function(a){var b,d=this._blob,e=this.options;if(a=a||this.type,this.modified||this.type!==a){if(b=this._canvas,"image/jpeg"===a){if(d=c.canvasToDataUrl(b,a,e.quality),e.preserveHeaders&&this._metas&&this._metas.imageHead)return d=c.dataURL2ArrayBuffer(d),d=c.updateImageHead(d,this._metas.imageHead),d=c.arrayBufferToBlob(d,a)}else d=c.canvasToDataUrl(b,a);d=c.dataURL2Blob(d)}return d},getAsDataUrl:function(a){var b=this.options;return a=a||this.type,"image/jpeg"===a?c.canvasToDataUrl(this._canvas,a,b.quality):this._canvas.toDataURL(a)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},destroy:function(){var a=this._canvas;this._img.onload=null,a&&(a.getContext("2d").clearRect(0,0,a.width,a.height),a.width=a.height=0,this._canvas=null),this._img.src=d,this._img=this._blob=null},_resize:function(a,b,c,d){var e,f,g,h,i,j=this.options,k=a.width,l=a.height,m=this.getOrientation();~[5,6,7,8].indexOf(m)&&(c^=d,d^=c,c^=d),e=Math[j.crop?"max":"min"](c/k,d/l),j.allowMagnify||(e=Math.min(1,e)),f=k*e,g=l*e,j.crop?(b.width=c,b.height=d):(b.width=f,b.height=g),h=(b.width-f)/2,i=(b.height-g)/2,j.preserveHeaders||this._rotate2Orientaion(b,m),this._renderImageToCanvas(b,a,h,i,f,g)},_rotate2Orientaion:function(a,b){var c=a.width,d=a.height,e=a.getContext("2d");switch(b){case 5:case 6:case 7:case 8:a.width=d,a.height=c}switch(b){case 2:e.translate(c,0),e.scale(-1,1);break;case 3:e.translate(c,d),e.rotate(Math.PI);break;case 4:e.translate(0,d),e.scale(1,-1);break;case 5:e.rotate(.5*Math.PI),e.scale(1,-1);break;case 6:e.rotate(.5*Math.PI),e.translate(0,-d);break;case 7:e.rotate(.5*Math.PI),e.translate(c,-d),e.scale(-1,1);break;case 8:e.rotate(-.5*Math.PI),e.translate(-c,0)}},_renderImageToCanvas:function(){function b(a,b,c){var d,e,f,g=document.createElement("canvas"),h=g.getContext("2d"),i=0,j=c,k=c;for(g.width=1,g.height=c,h.drawImage(a,0,0),d=h.getImageData(0,0,1,c).data;k>i;)e=d[4*(k-1)+3],0===e?j=k:i=k,k=j+i>>1;return f=k/c,0===f?1:f}function c(a){var b,c,d=a.naturalWidth,e=a.naturalHeight;return d*e>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-d+1,0),0===c.getImageData(0,0,1,1).data[3]):!1}return a.os.ios?a.os.ios>=7?function(a,c,d,e,f,g){var h=c.naturalWidth,i=c.naturalHeight,j=b(c,h,i);return a.getContext("2d").drawImage(c,0,0,h*j,i*j,d,e,f,g)}:function(a,d,e,f,g,h){var i,j,k,l,m,n,o,p=d.naturalWidth,q=d.naturalHeight,r=a.getContext("2d"),s=c(d),t="image/jpeg"===this.type,u=1024,v=0,w=0;for(s&&(p/=2,q/=2),r.save(),i=document.createElement("canvas"),i.width=i.height=u,j=i.getContext("2d"),k=t?b(d,p,q):1,l=Math.ceil(u*g/p),m=Math.ceil(u*h/q/k);q>v;){for(n=0,o=0;p>n;)j.clearRect(0,0,u,u),j.drawImage(d,-n,-v),r.drawImage(i,0,0,u,u,e+o,f+w,l,m),n+=u,o+=l;v+=u,w+=m}r.restore(),i=j=null}:function(b){var c=a.slice(arguments,1),d=b.getContext("2d");d.drawImage.apply(d,c)}}()})}),b("runtime/html5/jpegencoder",[],function(){function a(a){function b(a){for(var b=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],c=0;64>c;c++){var d=y((b[c]*a+50)/100);1>d?d=1:d>255&&(d=255),z[P[c]]=d}for(var e=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],f=0;64>f;f++){var g=y((e[f]*a+50)/100);1>g?g=1:g>255&&(g=255),A[P[f]]=g}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],i=0,j=0;8>j;j++)for(var k=0;8>k;k++)B[i]=1/(z[P[i]]*h[j]*h[k]*8),C[i]=1/(A[P[i]]*h[j]*h[k]*8),i++}function c(a,b){for(var c=0,d=0,e=new Array,f=1;16>=f;f++){for(var g=1;g<=a[f];g++)e[b[d]]=[],e[b[d]][0]=c,e[b[d]][1]=f,d++,c++;c*=2}return e}function d(){t=c(Q,R),u=c(U,V),v=c(S,T),w=c(W,X)}function e(){for(var a=1,b=2,c=1;15>=c;c++){for(var d=a;b>d;d++)E[32767+d]=c,D[32767+d]=[],D[32767+d][1]=c,D[32767+d][0]=d;for(var e=-(b-1);-a>=e;e++)E[32767+e]=c,D[32767+e]=[],D[32767+e][1]=c,D[32767+e][0]=b-1+e;a<<=1,b<<=1}}function f(){for(var a=0;256>a;a++)O[a]=19595*a,O[a+256>>0]=38470*a,O[a+512>>0]=7471*a+32768,O[a+768>>0]=-11059*a,O[a+1024>>0]=-21709*a,O[a+1280>>0]=32768*a+8421375,O[a+1536>>0]=-27439*a,O[a+1792>>0]=-5329*a}function g(a){for(var b=a[0],c=a[1]-1;c>=0;)b&1<<c&&(I|=1<<J),c--,J--,0>J&&(255==I?(h(255),h(0)):h(I),J=7,I=0)}function h(a){H.push(N[a])}function i(a){h(a>>8&255),h(255&a)}function j(a,b){var c,d,e,f,g,h,i,j,k,l=0,m=8,n=64;for(k=0;m>k;++k){c=a[l],d=a[l+1],e=a[l+2],f=a[l+3],g=a[l+4],h=a[l+5],i=a[l+6],j=a[l+7];var o=c+j,p=c-j,q=d+i,r=d-i,s=e+h,t=e-h,u=f+g,v=f-g,w=o+u,x=o-u,y=q+s,z=q-s;a[l]=w+y,a[l+4]=w-y;var A=.707106781*(z+x);a[l+2]=x+A,a[l+6]=x-A,w=v+t,y=t+r,z=r+p;var B=.382683433*(w-z),C=.5411961*w+B,D=1.306562965*z+B,E=.707106781*y,G=p+E,H=p-E;a[l+5]=H+C,a[l+3]=H-C,a[l+1]=G+D,a[l+7]=G-D,l+=8}for(l=0,k=0;m>k;++k){c=a[l],d=a[l+8],e=a[l+16],f=a[l+24],g=a[l+32],h=a[l+40],i=a[l+48],j=a[l+56];var I=c+j,J=c-j,K=d+i,L=d-i,M=e+h,N=e-h,O=f+g,P=f-g,Q=I+O,R=I-O,S=K+M,T=K-M;a[l]=Q+S,a[l+32]=Q-S;var U=.707106781*(T+R);a[l+16]=R+U,a[l+48]=R-U,Q=P+N,S=N+L,T=L+J;var V=.382683433*(Q-T),W=.5411961*Q+V,X=1.306562965*T+V,Y=.707106781*S,Z=J+Y,$=J-Y;a[l+40]=$+W,a[l+24]=$-W,a[l+8]=Z+X,a[l+56]=Z-X,l++}var _;for(k=0;n>k;++k)_=a[k]*b[k],F[k]=_>0?_+.5|0:_-.5|0;return F}function k(){i(65504),i(16),h(74),h(70),h(73),h(70),h(0),h(1),h(1),h(0),i(1),i(1),h(0),h(0)}function l(a,b){i(65472),i(17),h(8),i(b),i(a),h(3),h(1),h(17),h(0),h(2),h(17),h(1),h(3),h(17),h(1)}function m(){i(65499),i(132),h(0);for(var a=0;64>a;a++)h(z[a]);h(1);for(var b=0;64>b;b++)h(A[b])}function n(){i(65476),i(418),h(0);for(var a=0;16>a;a++)h(Q[a+1]);for(var b=0;11>=b;b++)h(R[b]);h(16);for(var c=0;16>c;c++)h(S[c+1]);for(var d=0;161>=d;d++)h(T[d]);h(1);for(var e=0;16>e;e++)h(U[e+1]);for(var f=0;11>=f;f++)h(V[f]);h(17);for(var g=0;16>g;g++)h(W[g+1]);for(var j=0;161>=j;j++)h(X[j])}function o(){i(65498),i(12),h(3),h(1),h(0),h(2),h(17),h(3),h(17),h(0),h(63),h(0)}function p(a,b,c,d,e){for(var f,h=e[0],i=e[240],k=16,l=63,m=64,n=j(a,b),o=0;m>o;++o)G[P[o]]=n[o];var p=G[0]-c;c=G[0],0==p?g(d[0]):(f=32767+p,g(d[E[f]]),g(D[f]));for(var q=63;q>0&&0==G[q];q--);if(0==q)return g(h),c;for(var r,s=1;q>=s;){for(var t=s;0==G[s]&&q>=s;++s);var u=s-t;if(u>=k){r=u>>4;for(var v=1;r>=v;++v)g(i);u=15&u}f=32767+G[s],g(e[(u<<4)+E[f]]),g(D[f]),s++}return q!=l&&g(h),c}function q(){for(var a=String.fromCharCode,b=0;256>b;b++)N[b]=a(b)}function r(a){if(0>=a&&(a=1),a>100&&(a=100),x!=a){var c=0;c=Math.floor(50>a?5e3/a:200-2*a),b(c),x=a}}function s(){a||(a=50),q(),d(),e(),f(),r(a)}var t,u,v,w,x,y=(Math.round,Math.floor),z=new Array(64),A=new Array(64),B=new Array(64),C=new Array(64),D=new Array(65535),E=new Array(65535),F=new Array(64),G=new Array(64),H=[],I=0,J=7,K=new Array(64),L=new Array(64),M=new Array(64),N=new Array(256),O=new Array(2048),P=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],Q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],S=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],T=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=[0,1,2,3,4,5,6,7,8,9,10,11],W=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],X=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];this.encode=function(a,b){b&&r(b),H=new Array,I=0,J=7,i(65496),k(),m(),l(a.width,a.height),n(),o();var c=0,d=0,e=0;I=0,J=7,this.encode.displayName="_encode_";for(var f,h,j,q,s,x,y,z,A,D=a.data,E=a.width,F=a.height,G=4*E,N=0;F>N;){for(f=0;G>f;){for(s=G*N+f,x=s,y=-1,z=0,A=0;64>A;A++)z=A>>3,y=4*(7&A),x=s+z*G+y,N+z>=F&&(x-=G*(N+1+z-F)),f+y>=G&&(x-=f+y-G+4),h=D[x++],j=D[x++],q=D[x++],K[A]=(O[h]+O[j+256>>0]+O[q+512>>0]>>16)-128,L[A]=(O[h+768>>0]+O[j+1024>>0]+O[q+1280>>0]>>16)-128,M[A]=(O[h+1280>>0]+O[j+1536>>0]+O[q+1792>>0]>>16)-128;c=p(K,B,c,t,v),d=p(L,C,d,u,w),e=p(M,C,e,u,w),f+=32}N+=8}if(J>=0){var P=[];P[1]=J+1,P[0]=(1<<J+1)-1,g(P)}i(65497);var Q="data:image/jpeg;base64,"+btoa(H.join(""));return H=[],Q},s()}return a.encode=function(b,c){var d=new a(c);return d.encode(b)},a}),b("runtime/html5/androidpatch",["runtime/html5/util","runtime/html5/jpegencoder","base"],function(a,b,c){var d,e=a.canvasToDataUrl;a.canvasToDataUrl=function(a,f,g){var h,i,j,k,l;return c.os.android?("image/jpeg"===f&&"undefined"==typeof d&&(k=e.apply(null,arguments),l=k.split(","),k=~l[0].indexOf("base64")?atob(l[1]):decodeURIComponent(l[1]),k=k.substring(0,2),d=255===k.charCodeAt(0)&&216===k.charCodeAt(1)),"image/jpeg"!==f||d?e.apply(null,arguments):(i=a.width,j=a.height,h=a.getContext("2d"),b.encode(h.getImageData(0,0,i,j),g))):e.apply(null,arguments)}}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("webuploader",["base","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/log","runtime/html5/blob","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/image","runtime/html5/androidpatch","runtime/html5/transport"],function(a){return a}),c("webuploader")}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.fis.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.fis.js new file mode 100644 index 0000000..431c519 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.fis.js @@ -0,0 +1,8083 @@ +/*! WebUploader 0.1.5 */ + + +var jQuery = require('example:widget/ui/jquery/jquery.js') + +return (function( root, factory ) { + var modules = {}, + + // 内部require, 简单不完全实现。 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 如果deps不是数组,则直接返回指定module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 内部define,暂时不支持不指定id. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 设置module, 兼容CommonJs写法。 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 根据id获取module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 将所有modules,将路径ids装换成对象。 + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }; + + return makeExport( jQuery ); +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 操作相关 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 使用jQuery的Promise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 基础类方法。 + */ + + /** + * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。 + * + * As you know, Web Uploader的每个文件都是用过[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)规范中的`define`组织起来的, 每个Module都会有个module id. + * 默认module id为该文件的路径,而此路径将会转化成名字空间存放在WebUploader中。如: + * + * * module `base`:WebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 以下文档中对类的使用可能省略掉了`WebUploader`前缀。 + * @module WebUploader + * @title WebUploader API文档 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 反科里化 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 基础类,提供一些简单常用的方法。 + * @class Base + */ + return { + + /** + * @property {String} version 当前版本号。 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 引用依赖的jQuery或者Zepto对象。 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 简单的浏览器检查结果。 + * + * * `webkit` webkit版本号,如果浏览器为非webkit内核,此属性为`undefined`。 + * * `chrome` chrome浏览器版本号,如果浏览器为chrome,此属性为`undefined`。 + * * `ie` ie浏览器版本号,如果浏览器为非ie,此属性为`undefined`。**暂不支持ie10+** + * * `firefox` firefox浏览器版本号,如果浏览器为非firefox,此属性为`undefined`。 + * * `safari` safari浏览器版本号,如果浏览器为非safari,此属性为`undefined`。 + * * `opera` opera浏览器版本号,如果浏览器为非opera,此属性为`undefined`。 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 操作系统检查结果。 + * + * * `android` 如果在android浏览器环境下,此值为对应的android版本号,否则为`undefined`。 + * * `ios` 如果在ios浏览器环境下,此值为对应的ios版本号,否则为`undefined`。 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 实现类与类之间的继承。 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 父类 + * @param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。 + * @param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。 + * @param {Object} [statics] 静态属性或方法。 + * @return {Class} 返回子类。 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 因为没有指定构造器,父类的构造器将会执行。 + * var instance = new Manager(); // => Super + * + * // 继承子父类的方法 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 子类的__super__属性指向父类 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 复制静态方法 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 让子类的__super__属性指向父类。 + child.__super__ = Super.prototype; + + // 构建原型,添加原型方法或属性。 + // 暂时用Object.create实现。 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 一个不做任何事情的方法。可以用来赋值给默认的callback. + * @method noop + */ + noop: noop, + + /** + * 返回一个新的方法,此方法将已指定的`context`来执行。 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 引用Console.log如果存在的话,否则引用一个[空函数noop](#WebUploader:Base.noop)。 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 当浏览器不在当前窗口时就停了。 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 被[uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)的数组slice方法。 + * 将用来将非数组对象转化成数组对象。 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 生成唯一的ID + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 格式化文件大小, 输出成带单位的字符串 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 文件大小 + * @param {Number} [pointLength=2] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 事件处理类,可以独立使用,也可以扩展给对象使用。 + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 根据条件过滤出事件handlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 不支持对象,只支持多个event用空格隔开 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 绑定事件。 + * + * `callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如 + * ```javascript + * var obj = {}; + * + * // 使得obj有事件行为 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。 + * 切会影响到`trigger`方法的返回值,为`false`。 + * + * `on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处, + * 就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 事件名,支持多个事件用空格隔开 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 绑定事件,且当handler执行完后,自动解除绑定。 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 事件名 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 解除事件绑定 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 事件名 + * @param {Function} [callback] 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 触发事件 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 事件名 + * @param {*} [...] 任意参数 + * @return {Boolean} 如果handler中return false了,则返回false, 否则返回true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 中介者,它本身是个单例,但可以通过[installTo](#WebUploader:Mediator:installTo)方法,使任何对象具备事件行为。 + * 主要目的是负责模块与模块之间的合作,降低耦合度。 + * + * @class Mediator + */ + return $.extend({ + + /** + * 可以通过这个接口,使任何对象具备事件功能。 + * @method installTo + * @param {Object} obj 需要具备事件行为的对象。 + * @return {Object} 返回obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader上传类 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 上传入口类。 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 开起分片上传。 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets中有相应扩展 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 批量添加纯命令式方法。 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 获取或者设置Uploader配置项。 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 初始状态图片上传前不会压缩 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 修改后图片上传前,尝试将图片压缩到1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 获取文件统计信息。返回一个包含一下信息的对象。 + * * `successNum` 上传成功的文件数 + * * `progressNum` 上传中的文件数 + * * `cancelNum` 被删除的文件数 + * * `invalidNum` 无效的文件数 + * * `uploadFailNum` 上传失败的文件数 + * * `queueNum` 还在队列中的文件数 + * * `interruptNum` 被暂停的文件数 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 调用通过on方法注册的handler. + Mediator.trigger.apply( this, arguments ) === false || + + // 调用opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 调用this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 广播所有uploader的事件。 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 销毁 webuploader 实例 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js将补充此方法的详细文档。 + request: Base.noop + }); + + /** + * 创建Uploader实例,等同于new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 暴露Uploader,可以通过它来扩展业务逻辑。 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 获取对象的第一个key + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 接口类。 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 添加Runtime实现。 + * @param {String} type 类型 + * @param {Runtime} factory 具体Runtime实现。 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 有些类型不能重用,比如filepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 允许runtime没有初始化之前,注册一些方法在初始化后执行。 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 像filePicker只能独立存在,不能公用。 + runtime = runtime || cache.get( null, standalone ); + + // 需要创建 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 来自cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 错误信息 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 类Backbone的事件监听声明,监听uploader实例上的事件 + // widget直接无法监听事件,事件只能通过uploader来传递 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 如果无API响应声明则忽略 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 发送命令。当传入`callback`或者`handler`中返回`promise`时。返回一个当所有`handler`中的promise都完成后完成的新`promise`。 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 扩展Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 默认所有 Uploader.register 了的 widget 都会被加载,如果禁用某一部分,请通过此 option 指定黑名单。 + */ + + // 覆写_init用来初始化widgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred对象 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 如果有callback,则用异步方式。 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 很重要不能删除。删除了会死循环。 + // 保证执行顺序。让callback总是在下一个 tick 中执行。 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 添加组件 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 名称与函数实现的映射 + * @param {object} proto 组件原型,构造函数通过 constructor 属性定义 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 自动生成 map 表。 + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 删除插件,只有在注册时指定了名字的才能被删除。 + * @grammar Uploader.unRegister(name); + * @param {string} name 组件名字 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 删除指定的插件。 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget。 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 指定Drag And Drop拖拽的容器,如果不指定,则不启动。 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 是否禁掉整个页面的拖拽功能,如果不禁用,图片拖进来的时候会默认被浏览器打开。 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 阻止此事件可以拒绝某些类型的文件拖入进来。目前只有 chrome 提供这样的 API,且只能通过 mime-type 验证。 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 检测文件是否全部允许添加。 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 指定监听paste事件的容器,如果不指定,不启用此功能。此功能为通过粘贴来添加截屏的图片。建议设置为`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 如果没有指定 mimetype, 但是知道文件后缀。 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 为了统一化Flash的File和HTML5的File而存在。 + * 以至于要调用Flash里面的File,也可以像调用HTML5版本的File一下。 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 支持其他类型文件的转换。 + // 如果有 mimetype, 但是文件名里面没有找出后缀规律 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('按钮指定错误'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 记录来源。 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 文件选择相关 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 指定选择文件的按钮容器,不指定则不创建按钮。 + * + * * `id` {Seletor|dom} 指定选择文件的按钮容器,不指定则不创建按钮。**注意** 这里虽然写的是 id, 但是不是只支持 id, 还支持 class, 或者 dom 节点。 + * * `label` {String} 请采用 `innerHTML` 代替 + * * `innerHTML` {String} 指定按钮文字。不指定时优先从指定的容器中看是否自带文字。 + * * `multiple` {Boolean} 是否开起同时选择多个文件能力。 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 指定接受哪些类型的文件。 由于目前还有ext转mimeType表,所以这里需要分开指定。 + * + * * `title` {String} 文字描述 + * * `extensions` {String} 允许的文件后缀,不带点,多个用逗号分割。 + * * `mimeTypes` {String} 多个用逗号分割。 + * + * 如: + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 添加文件选择按钮,如果一个按钮不够,需要调用此方法来添加。参数跟[options.pick](#WebUploader:Uploader:options)一致。 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '选择文件' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 构造器。 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 默认选项。 + Image.options = { + + // 默认的图片处理质量 + quality: 90, + + // 是否裁剪 + crop: false, + + // 是否保留头部信息 + preserveHeaders: false, + + // 是否允许放大。 + allowMagnify: false + }; + + // 继承RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 根据要处理的文件大小来节流,一次不能处理太多,会卡。 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 配置生成缩略图的选项。 + * + * 默认为: + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 70, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: true, + * + * // 是否允许裁剪。 + * crop: true, + * + * // 为空的话则保留原有图片格式。 + * // 否则强制转换成指定的类型。 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 为空的话则保留原有图片格式。 + // 否则强制转换成指定的类型。 + // IE 8下面 base64 大小不能超过 32K 否则预览失败,而非 jpeg 编码的图片很可 + // 能会超过 32k, 所以这里设置成预览的时候都是 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 配置压缩的图片的选项。如果此选项为`false`, 则图片在上传前不进行压缩。 + * + * 默认为: + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 90, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: false, + * + * // 是否允许裁剪。 + * crop: false, + * + * // 是否保留头部meta信息。 + * preserveHeaders: true, + * + * // 如果发现压缩后文件大小比原来还大,则使用原来图片 + * // 此属性可能会影响图片自动纠正功能 + * noCompressIfLarger: false, + * + * // 单位字节,如果图片大小小于此值,不会采用压缩。 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 生成缩略图,此过程为异步,所以需要传入`callback`。 + * 通常情况在图片加入队里后调用此方法来生成预览图以增强交互效果。 + * + * 当 width 或者 height 的值介于 0 - 1 时,被当成百分比使用。 + * + * `callback`中可以接收到两个参数。 + * * 第一个为error,如果生成缩略图有错误,此error将为真。 + * * 第二个为ret, 缩略图的Data URL值。 + * + * **注意** + * Date URL在IE6/7中不支持,所以不用调用此方法了,直接显示一张暂不支持预览图片好了。 + * 也可以借助服务端,将 base64 数据传给服务端,生成一个临时文件供预览。 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('预览错误'); + * } else { + * $li.append('<img alt="" src="' + ret + '" />'); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 只预览图片格式。 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 如果传入的是object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 当 resize 完后 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 只压缩 jpeg 图片格式。 + // gif 可能会丢失针 + // bmp png 基本上尺寸都不大,且压缩比比较小。 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 移动端 UC / qq 浏览器的无图模式下 + // ctx.getImageData 处理大图的时候会报 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 如果压缩后,比原来还大则不用压缩后的。 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 标记,避免重复压缩。 + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 出错了直接继续,让其上传原始图片 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 文件属性封装 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 文件类 + * @class File + * @constructor 构造函数 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 + */ + function WUFile( source ) { + + /** + * 文件名,包括扩展名(后缀) + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 文件体积(字节) + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 文件最后修改日期 + * @property lastModifiedDate + * @type {int} + * @default 当前时间戳 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 文件ID,每个对象具有唯一ID,与文件名无关 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 文件扩展名,通过文件名获取,例如test.png的扩展名为png + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 状态文字说明。在不同的status语境下有不同的用途。 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 存储文件状态,防止通过属性直接修改 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 设置状态,状态变化时会触发`change`事件。 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status) + * @param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 文件状态变化 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 获取文件状态 + * @return {File.Status} + * @example + 文件状态具体包括以下几种类型: + { + // 初始化 + INITED: 0, + // 已入队列 + QUEUED: 1, + // 正在上传 + PROGRESS: 2, + // 上传出错 + ERROR: 3, + // 上传成功 + COMPLETE: 4, + // 上传取消 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 获取文件原始信息。 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 文件状态值,具体包括以下几种类型: + * * `inited` 初始状态 + * * `queued` 已经进入队列, 等待上传 + * * `progress` 上传中 + * * `complete` 上传完成。 + * * `error` 上传出错,可重试 + * * `interrupt` 上传中断,可续传。 + * * `invalid` 文件不合格,不能重试上传。会自动从队列中移除。 + * * `cancelled` 文件被移除。 + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 初始状态 + QUEUED: 'queued', // 已经进入队列, 等待上传 + PROGRESS: 'progress', // 上传中 + ERROR: 'error', // 上传出错,可重试 + COMPLETE: 'complete', // 上传完成。 + CANCELLED: 'cancelled', // 上传取消。 + INTERRUPT: 'interrupt', // 上传中断,可续传。 + INVALID: 'invalid' // 文件不合格,不能重试上传。 + }; + + return WUFile; + }); + + /** + * @fileOverview 文件队列 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 文件队列, 用来存储各个状态中的文件。 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 统计文件数。 + * * `numOfQueue` 队列中的文件数。 + * * `numOfSuccess` 上传成功的文件数 + * * `numOfCancel` 被取消的文件数 + * * `numOfProgress` 正在上传中的文件数 + * * `numOfUploadFailed` 上传错误的文件数。 + * * `numOfInvalid` 无效的文件数。 + * * `numofDeleted` 被移除的文件数。 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 上传队列,仅包括等待上传的文件 + this._queue = []; + + // 存储所有文件 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 将新文件加入对队列尾部 + * + * @method append + * @param {File} file 文件对象 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 将新文件加入对队列头部 + * + * @method prepend + * @param {File} file 文件对象 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 获取文件对象 + * + * @method getFile + * @param {String} fileId 文件ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 从队列中取出一个指定状态的文件。 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [文件状态值](#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 对队列进行排序,能够控制文件上传顺序。 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 排序方法 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [文件状态值](#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 在队列中删除文件。 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 文件对象。 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 队列 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept中的中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 如果当前不是html5运行时,那就算了。 + // 不执行后续操作 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 创建一个 html5 运行时的 placeholder + // 以至于外部添加原生 File 对象的时候能正确包裹一下供 webuploader 使用。 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 为了支持外部直接添加一个原生File对象。 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 判断文件是否可以被加入队列 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 如果名字中有后缀,才做后缀白名单处理。 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File对象 + * @description 当文件被加入队列之前触发,此事件的handler返回值为`false`,则此文件不会被添加进入队列。 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File对象 + * @description 当文件被加入队列以后触发。 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 不过类型判断允许不允许,先派送 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 类型不匹配,则派送错误事件,并返回。 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 数组,内容为原始File(lib/File)对象。 + * @description 当一批文件添加进队列以后触发。 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 对象 数组 + * @description 添加文件到队列 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File对象 + * @description 当文件被移除队列后触发。 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 返回指定状态的文件集合,不传参数将返回所有状态的文件。 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 重试上传,重试指定文件,或者从出错的文件开始重新上传。 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 排序队列中的文件,在上传之前调整可以控制上传顺序。 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 当 uploader 被重置的时候触发。 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 重置uploader。目前只重置了队列。 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 添加获取Runtime相关信息的方法。 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 指定运行时启动顺序。默认会想尝试 html5 是否支持,如果支持则使用 html5, 否则则使用 flash. + * + * 可以将此值设置成 `flash`,来强制使用 flash 运行时。 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 预测Uploader将采用哪个`Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 跨域时,是否允许携带cookie, 只有html5 runtime才有效 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2分钟 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 添加Blob, 只能添加一次,最后一次有效。 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 添加其他字段 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 让Transport具备事件功能。 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 负责文件上传相关。 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 添加默认配置项 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 是否允许在文件传输时提前把下一个文件准备好。 + * 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 + * 如果能提前在当前文件传输期处理,可以节省总体耗时。 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 是否要分片处理大文件上传。 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 如果要分片,分多大一片? 默认大小为5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 如果某个分片由于网络问题出错,允许自动重传多少次? + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 上传并发数。允许同时最大上传进程数。 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 文件上传请求的参数表,每次发送都会发送此对象中的参数。 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 设置文件上传域的name。 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 文件上传方式,`POST`或者`GET`。 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 是否已二进制的流的方式发送文件,这样整个上传内容`php://input`都为文件内容, + * 其他参数在$_GET数组中。 + */ + }); + + // 负责将文件切片。 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 记录当前正在传的数据,跟threads相关 + this.pool = []; + + // 缓存分好片的文件。 + this.stack = []; + + // 缓存即将上传的文件。 + this.pending = []; + + // 跟踪还有多少分片在上传中但是没有完成上传。 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 把其他块取消了。 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 当开始上传流程时触发。 + * @for Uploader + */ + + /** + * 开始上传。此方法可以从初始状态调用开始上传流程,也可以从暂停状态调用,继续上传流程。 + * + * 可以指定开始某一个文件。 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 移出invalid的文件 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 如果指定了开始某个文件,则只开始指定文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 之前暂停过。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 如果有暂停的,则续传 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 当开始上传流程暂停时触发。 + * @for Uploader + */ + + /** + * 暂停上传。第一个参数为是否中断上传当前正在上传的文件。 + * + * 如果第一个参数是文件,则只暂停指定文件。 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 如果只是暂停某个文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 只 abort 指定的文件。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 标记文件状态为已取消, 同时将中断文件传输。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 判断`Uplaode`r是否正在上传中。 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 掉过一个文件上传,直接标记指定文件为已上传状态。 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 当所有文件上传结束时触发。 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 上一个promise还没有结束,则等待完成后再执行。 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 还有位置,且还有文件要处理的话。 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 有可能是reject过来的,所以要检测val的类型。 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 没有要上传的了,且没有正在传输的了。 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 把已经处理完了的,或者,状态为非 progress(上传中)、 + // interupt(暂停中) 的移除。 + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 如果当前文件还有没有需要传输的,则直接返回剩下的。 + if ( (act = this._getStack()) ) { + + // 是否提前准备下一个文件 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 否则,如果正在运行,则准备下一个文件,并等待完成后返回下个分片。 + } else if ( me.runing ) { + + // 如果缓存中有,则直接在缓存中取,没有则去queue中取。 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 文件可能还在prepare中,也有可能已经完全准备好了。 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File对象 + * @description 某个文件开始上传前触发,一个文件只会触发一次。 + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 有可能文件被skip掉了。文件被skip掉后,状态坑定不是Queued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 如果还在pending中,则替换成文件本身。 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file的钩子就有错误发生。 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 让出位置了,可以让其他分片开始上传 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 有可能在 before-send-file 的 promise 期间改变了文件状态。 + // 如:暂停,取消 + // 我们不能中断 promise, 但是可以在 promise 完后,不做上传操作。 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 如果是中断,则还需要放回去。 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 如果没有分片,则直接使用原始的。 + // 不会丢失content-type信息。 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 每个分片发送之前可能要做些异步的事情。 + promise = me.request( 'before-send', block, function() { + + // 有可能文件已经上传出错了,所以不需要再传输了。 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 如果为fail了,则跳过此分片。 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 默认的上传参数,可以扩展此对象来控制上传参数。 + * @param {Object} headers 可以扩展此对象来控制上传头部。 + * @description 当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。 + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 服务端的返回数据,json格式,如果服务端不是json格式,从ret._raw中取数据,自行解析。 + * @description 当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为`false`, 则此文件将派送`server`类型的`uploadError`事件。 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File对象 + * @param {Number} percentage 上传进度 + * @description 上传过程中触发,携带上传进度。 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File对象 + * @param {String} reason 出错的code + * @description 当文件上传出错时触发。 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File对象 + * @param {Object} response 服务端返回的数据 + * @description 当文件上传成功时触发。 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File对象 + * @description 不管成功或者失败,文件上传完成时触发。 + * @for Uploader + */ + + // 做上传操作。 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 广播上传进度。以文件为单位。 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 用来询问,是否返回的结果是有错误的。 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 服务端响应了,不代表成功了,询问是否响应正确。 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 尝试重试,然后广播文件上传出错。 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 自动重试 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 上传成功 + tr.on( 'load', function() { + var reason; + + // 如果非预期,转向上传出错。 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 全部上传完成。 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 配置默认的上传字段。 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 在发送之间可以添加字段什么的。。。 + // 如果默认的字段不够使用,可以通过监听此事件来扩展 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 开始发送。 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 完成上传。 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 如果外部已经标记为invalid什么的,不再改状态。 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 各种验证,包括文件总大小是否超出、单文件是否超出和文件是否重复。 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 错误类型。 + * @description 当validate不通过时,会以派送错误事件的形式通知调用者。通过`upload.on('error', handler)`可以捕获到此类错误,目前有以下错误会在特定的情况下派送错来。 + * + * * `Q_EXCEED_NUM_LIMIT` 在设置了`fileNumLimit`且尝试给`uploader`添加的文件数量超出这个值时派送。 + * * `Q_EXCEED_SIZE_LIMIT` 在设置了`Q_EXCEED_SIZE_LIMIT`且尝试给`uploader`添加的文件总大小超出这个值时派送。 + * * `Q_TYPE_DENIED` 当文件类型不满足时触发。。 + * @for Uploader + */ + + // 暴露给外面的api + api = { + + // 添加验证器 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 移除验证器 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 在Uploader初始化的时候启动Validators的初始化 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总数量, 超出则不允许加入队列。 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证单个文件大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 去重, 根据文件名字、文件大小和最后修改时间来生成hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 已经重复了 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Md5 + */ + define('lib/md5',[ + 'runtime/client', + 'mediator' + ], function( RuntimeClient, Mediator ) { + + function Md5() { + RuntimeClient.call( this, 'Md5' ); + } + + // 让 Md5 具备事件功能。 + Mediator.installTo( Md5.prototype ); + + Md5.prototype.loadFromBlob = function( blob ) { + var me = this; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + me.exec( 'loadFromBlob', blob ); + }); + }; + + Md5.prototype.getResult = function() { + return this.exec('getResult'); + }; + + return Md5; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/md5',[ + 'base', + 'uploader', + 'lib/md5', + 'lib/blob', + 'widgets/widget' + ], function( Base, Uploader, Md5, Blob ) { + + return Uploader.register({ + name: 'md5', + + + /** + * 计算文件 md5 值,返回一个 promise 对象,可以监听 progress 进度。 + * + * + * @method md5File + * @grammar md5File( file[, start[, end]] ) => promise + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.md5File( file ) + * + * // 及时显示进度 + * .progress(function(percentage) { + * console.log('Percentage:', percentage); + * }) + * + * // 完成 + * .then(function(val) { + * console.log('md5 result:', val); + * }); + * + * }); + */ + md5File: function( file, start, end ) { + var md5 = new Md5(), + deferred = Base.Deferred(), + blob = (file instanceof Blob) ? file : + this.request( 'get-file', file ).source; + + md5.on( 'progress load', function( e ) { + e = e || {}; + deferred.notify( e.total ? e.loaded / e.total : 1 ); + }); + + md5.on( 'complete', function() { + deferred.resolve( md5.getResult() ); + }); + + md5.on( 'error', function( reason ) { + deferred.reject( reason ); + }); + + if ( arguments.length > 1 ) { + start = start || 0; + end = end || 0; + start < 0 && (start = blob.size + start); + end < 0 && (end = blob.size + end); + end = Math.min( end, blob.size ); + blob = blob.slice( start, end ); + } + + md5.loadFromBlob( blob ); + + return deferred.promise(); + } + }); + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 不需要连接其他程序,直接执行callback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 注册Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 注册html5运行时。 + // 只有在支持的前提下注册。 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 注意只有 chrome 支持。 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 只处理框内的。 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 只处理框内的。 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 如果是页面内拖拽,还不能处理,不阻止事件。 + // 此处 ie11 下会报参数错误, + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 如果传入 callback 则去查看文件夹,否则只管当前文件夹。 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 为了保证顺序。 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 还没 init 就调用 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp的mimeTypes中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 不阻止非文件粘贴(文字粘贴)的事件冒泡 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox不支持单独指定后缀 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 更安全的方式调用,比如android里面就能把context改成其他的对象。 + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android不支持直接new Blob, 只能借助blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 抽出来主要是为了解决android下面canvas.toDataUrl不支持jpeg. + // 你得到的结果是png. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 代码来自于:https://github.com/blueimp/JavaScript-Load-Image + * 暂时项目中只用了orientation. + * + * 去除了 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF解析 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 尝试读取缩略图 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * 这个方式性能不行,但是可以解决android里面的toDataUrl的bug + * android里面toDataUrl('image/jpege')得到的结果却是png. + * + * 所以这里没辙,只能借助这个工具 + * @fileOverview jpeg encoder + */ + define('runtime/html5/jpegencoder',[], function( require, exports, module ) { + + /* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /* + JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + + Basic GUI blocking jpeg encoder + */ + + function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr<nrupper; nr++) { + category[32767+nr] = cat; + bitcode[32767+nr] = []; + bitcode[32767+nr][1] = cat; + bitcode[32767+nr][0] = nr; + } + //Negative numbers + for (var nrneg =-(nrupper-1); nrneg<=-nrlower; nrneg++) { + category[32767+nrneg] = cat; + bitcode[32767+nrneg] = []; + bitcode[32767+nrneg][1] = cat; + bitcode[32767+nrneg][0] = nrupper-1+nrneg; + } + nrlower <<= 1; + nrupper <<= 1; + } + } + + function initRGBYUVTable() { + for(var i = 0; i < 256;i++) { + RGB_YUV_TABLE[i] = 19595 * i; + RGB_YUV_TABLE[(i+ 256)>>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + byteout.push(clt[value]); // write char directly instead of converting later + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i<I8; ++i) + { + d0 = data[dataOff]; + d1 = data[dataOff+1]; + d2 = data[dataOff+2]; + d3 = data[dataOff+3]; + d4 = data[dataOff+4]; + d5 = data[dataOff+5]; + d6 = data[dataOff+6]; + d7 = data[dataOff+7]; + + var tmp0 = d0 + d7; + var tmp7 = d0 - d7; + var tmp1 = d1 + d6; + var tmp6 = d1 - d6; + var tmp2 = d2 + d5; + var tmp5 = d2 - d5; + var tmp3 = d3 + d4; + var tmp4 = d3 - d4; + + /* Even part */ + var tmp10 = tmp0 + tmp3; /* phase 2 */ + var tmp13 = tmp0 - tmp3; + var tmp11 = tmp1 + tmp2; + var tmp12 = tmp1 - tmp2; + + data[dataOff] = tmp10 + tmp11; /* phase 3 */ + data[dataOff+4] = tmp10 - tmp11; + + var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */ + data[dataOff+2] = tmp13 + z1; /* phase 5 */ + data[dataOff+6] = tmp13 - z1; + + /* Odd part */ + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */ + var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */ + var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */ + var z3 = tmp11 * 0.707106781; /* c4 */ + + var z11 = tmp7 + z3; /* phase 5 */ + var z13 = tmp7 - z3; + + data[dataOff+5] = z13 + z2; /* phase 6 */ + data[dataOff+3] = z13 - z2; + data[dataOff+1] = z11 + z4; + data[dataOff+7] = z11 - z4; + + dataOff += 8; /* advance pointer to next row */ + } + + /* Pass 2: process columns. */ + dataOff = 0; + for (i=0; i<I8; ++i) + { + d0 = data[dataOff]; + d1 = data[dataOff + 8]; + d2 = data[dataOff + 16]; + d3 = data[dataOff + 24]; + d4 = data[dataOff + 32]; + d5 = data[dataOff + 40]; + d6 = data[dataOff + 48]; + d7 = data[dataOff + 56]; + + var tmp0p2 = d0 + d7; + var tmp7p2 = d0 - d7; + var tmp1p2 = d1 + d6; + var tmp6p2 = d1 - d6; + var tmp2p2 = d2 + d5; + var tmp5p2 = d2 - d5; + var tmp3p2 = d3 + d4; + var tmp4p2 = d3 - d4; + + /* Even part */ + var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */ + var tmp13p2 = tmp0p2 - tmp3p2; + var tmp11p2 = tmp1p2 + tmp2p2; + var tmp12p2 = tmp1p2 - tmp2p2; + + data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */ + data[dataOff+32] = tmp10p2 - tmp11p2; + + var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */ + data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */ + data[dataOff+48] = tmp13p2 - z1p2; + + /* Odd part */ + tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */ + tmp11p2 = tmp5p2 + tmp6p2; + tmp12p2 = tmp6p2 + tmp7p2; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */ + var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */ + var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */ + var z3p2 = tmp11p2 * 0.707106781; /* c4 */ + + var z11p2 = tmp7p2 + z3p2; /* phase 5 */ + var z13p2 = tmp7p2 - z3p2; + + data[dataOff+40] = z13p2 + z2p2; /* phase 6 */ + data[dataOff+24] = z13p2 - z2p2; + data[dataOff+ 8] = z11p2 + z4p2; + data[dataOff+56] = z11p2 - z4p2; + + dataOff++; /* advance pointer to next column */ + } + + // Quantize/descale the coefficients + var fDCTQuant; + for (i=0; i<I64; ++i) + { + // Apply the quantization and scaling factor & Round to nearest integer + fDCTQuant = data[i]*fdtbl[i]; + outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j<I64;++j) { + DU[ZigZag[j]]=DU_DCT[j]; + } + var Diff = DU[0] - DC; DC = DU[0]; + //Encode DC + if (Diff==0) { + writeBits(HTDC[0]); // Diff might be 0 + } else { + pos = 32767+Diff; + writeBits(HTDC[category[pos]]); + writeBits(bitcode[pos]); + } + //Encode ACs + var end0pos = 63; // was const... which is crazy + for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + // var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + // var duration = new Date().getTime() - time_start; + // console.log('Encoding time: '+ currentQuality + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + // console.log('Quality set to: '+quality +'%'); + } + + function init(){ + // var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + // var duration = new Date().getTime() - time_start; + // console.log('Initialization '+ duration + 'ms'); + } + + init(); + + }; + + JPEGEncoder.encode = function( data, quality ) { + var encoder = new JPEGEncoder( quality ); + + return encoder.encode( data ); + } + + return JPEGEncoder; + }); + /** + * @fileOverview Fix android canvas.toDataUrl bug. + */ + define('runtime/html5/androidpatch',[ + 'runtime/html5/util', + 'runtime/html5/jpegencoder', + 'base' + ], function( Util, encoder, Base ) { + var origin = Util.canvasToDataUrl, + supportJpeg; + + Util.canvasToDataUrl = function( canvas, type, quality ) { + var ctx, w, h, fragement, parts; + + // 非android手机直接跳过。 + if ( !Base.os.android ) { + return origin.apply( null, arguments ); + } + + // 检测是否canvas支持jpeg导出,根据数据格式来判断。 + // JPEG 前两位分别是:255, 216 + if ( type === 'image/jpeg' && typeof supportJpeg === 'undefined' ) { + fragement = origin.apply( null, arguments ); + + parts = fragement.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + fragement = atob( parts[ 1 ] ); + } else { + fragement = decodeURIComponent( parts[ 1 ] ); + } + + fragement = fragement.substring( 0, 2 ); + + supportJpeg = fragement.charCodeAt( 0 ) === 255 && + fragement.charCodeAt( 1 ) === 216; + } + + // 只有在android环境下才修复 + if ( type === 'image/jpeg' && !supportJpeg ) { + w = canvas.width; + h = canvas.height; + ctx = canvas.getContext('2d'); + + return encoder.encode( ctx.getImageData( 0, 0, w, h ), quality ); + } + + return origin.apply( null, arguments ); + }; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 标记是否被修改过。 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 读取meta信息。 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 解决 orientation 的问题。 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob需要重新生成。 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 释放内存。非常重要,否则释放不了image的内存。 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 交换width, height的值。 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 不允许放大。 + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 如果不是ios, 不需要这么复杂! + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * @fileOverview Transport + * @todo 支持chunked传输,优势: + * 可以将大文件分成小块,挨个传输,可以提高大文件成功率,当失败的时候,也只需要重传那小部分, + * 而不需要重头再传一次。另外断点续传也需要用chunked方式。 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 强制设置成 content-type 为文件流。 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android直接发送blob会导致服务端接收到的是空文件。 + // bug详情。 + // https://code.google.com/p/android/issues/detail?id=39882 + // 所以先用fileReader读取出来再通过arraybuffer的方式发送。 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/html5/md5',[ + 'runtime/html5/runtime' + ], function( FlashRuntime ) { + + /* + * Fastest md5 implementation around (JKM md5) + * Credits: Joseph Myers + * + * @see http://www.myersdaily.org/joseph/javascript/md5-text.html + * @see http://jsperf.com/md5-shootout/7 + */ + + /* this function is much faster, + so if possible we use it. Some IEs + are the only ones I know of that + need the idiotic second function, + generated by an if clause. */ + var add32 = function (a, b) { + return (a + b) & 0xFFFFFFFF; + }, + + cmn = function (q, a, b, x, s, t) { + a = add32(add32(a, q), add32(x, t)); + return add32((a << s) | (a >>> (32 - s)), b); + }, + + ff = function (a, b, c, d, x, s, t) { + return cmn((b & c) | ((~b) & d), a, b, x, s, t); + }, + + gg = function (a, b, c, d, x, s, t) { + return cmn((b & d) | (c & (~d)), a, b, x, s, t); + }, + + hh = function (a, b, c, d, x, s, t) { + return cmn(b ^ c ^ d, a, b, x, s, t); + }, + + ii = function (a, b, c, d, x, s, t) { + return cmn(c ^ (b | (~d)), a, b, x, s, t); + }, + + md5cycle = function (x, k) { + var a = x[0], + b = x[1], + c = x[2], + d = x[3]; + + a = ff(a, b, c, d, k[0], 7, -680876936); + d = ff(d, a, b, c, k[1], 12, -389564586); + c = ff(c, d, a, b, k[2], 17, 606105819); + b = ff(b, c, d, a, k[3], 22, -1044525330); + a = ff(a, b, c, d, k[4], 7, -176418897); + d = ff(d, a, b, c, k[5], 12, 1200080426); + c = ff(c, d, a, b, k[6], 17, -1473231341); + b = ff(b, c, d, a, k[7], 22, -45705983); + a = ff(a, b, c, d, k[8], 7, 1770035416); + d = ff(d, a, b, c, k[9], 12, -1958414417); + c = ff(c, d, a, b, k[10], 17, -42063); + b = ff(b, c, d, a, k[11], 22, -1990404162); + a = ff(a, b, c, d, k[12], 7, 1804603682); + d = ff(d, a, b, c, k[13], 12, -40341101); + c = ff(c, d, a, b, k[14], 17, -1502002290); + b = ff(b, c, d, a, k[15], 22, 1236535329); + + a = gg(a, b, c, d, k[1], 5, -165796510); + d = gg(d, a, b, c, k[6], 9, -1069501632); + c = gg(c, d, a, b, k[11], 14, 643717713); + b = gg(b, c, d, a, k[0], 20, -373897302); + a = gg(a, b, c, d, k[5], 5, -701558691); + d = gg(d, a, b, c, k[10], 9, 38016083); + c = gg(c, d, a, b, k[15], 14, -660478335); + b = gg(b, c, d, a, k[4], 20, -405537848); + a = gg(a, b, c, d, k[9], 5, 568446438); + d = gg(d, a, b, c, k[14], 9, -1019803690); + c = gg(c, d, a, b, k[3], 14, -187363961); + b = gg(b, c, d, a, k[8], 20, 1163531501); + a = gg(a, b, c, d, k[13], 5, -1444681467); + d = gg(d, a, b, c, k[2], 9, -51403784); + c = gg(c, d, a, b, k[7], 14, 1735328473); + b = gg(b, c, d, a, k[12], 20, -1926607734); + + a = hh(a, b, c, d, k[5], 4, -378558); + d = hh(d, a, b, c, k[8], 11, -2022574463); + c = hh(c, d, a, b, k[11], 16, 1839030562); + b = hh(b, c, d, a, k[14], 23, -35309556); + a = hh(a, b, c, d, k[1], 4, -1530992060); + d = hh(d, a, b, c, k[4], 11, 1272893353); + c = hh(c, d, a, b, k[7], 16, -155497632); + b = hh(b, c, d, a, k[10], 23, -1094730640); + a = hh(a, b, c, d, k[13], 4, 681279174); + d = hh(d, a, b, c, k[0], 11, -358537222); + c = hh(c, d, a, b, k[3], 16, -722521979); + b = hh(b, c, d, a, k[6], 23, 76029189); + a = hh(a, b, c, d, k[9], 4, -640364487); + d = hh(d, a, b, c, k[12], 11, -421815835); + c = hh(c, d, a, b, k[15], 16, 530742520); + b = hh(b, c, d, a, k[2], 23, -995338651); + + a = ii(a, b, c, d, k[0], 6, -198630844); + d = ii(d, a, b, c, k[7], 10, 1126891415); + c = ii(c, d, a, b, k[14], 15, -1416354905); + b = ii(b, c, d, a, k[5], 21, -57434055); + a = ii(a, b, c, d, k[12], 6, 1700485571); + d = ii(d, a, b, c, k[3], 10, -1894986606); + c = ii(c, d, a, b, k[10], 15, -1051523); + b = ii(b, c, d, a, k[1], 21, -2054922799); + a = ii(a, b, c, d, k[8], 6, 1873313359); + d = ii(d, a, b, c, k[15], 10, -30611744); + c = ii(c, d, a, b, k[6], 15, -1560198380); + b = ii(b, c, d, a, k[13], 21, 1309151649); + a = ii(a, b, c, d, k[4], 6, -145523070); + d = ii(d, a, b, c, k[11], 10, -1120210379); + c = ii(c, d, a, b, k[2], 15, 718787259); + b = ii(b, c, d, a, k[9], 21, -343485551); + + x[0] = add32(a, x[0]); + x[1] = add32(b, x[1]); + x[2] = add32(c, x[2]); + x[3] = add32(d, x[3]); + }, + + /* there needs to be support for Unicode here, + * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps + * by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise + * I suggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then + * how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something + * like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard + * itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 + * 8-bit unsigned value arrays. + */ + md5blk = function (s) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + }, + + md5blk_array = function (a) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24); + } + return md5blks; + }, + + md51 = function (s) { + var n = s.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + length = s.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); + } + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + return state; + }, + + md51_array = function (a) { + var n = a.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk_array(a.subarray(i - 64, i))); + } + + // Not sure if it is a bug, however IE10 will always produce a sub array of length 1 + // containing the last element of the parent array if the sub array specified starts + // beyond the length of the parent array - weird. + // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue + a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0); + + length = a.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= a[i] << ((i % 4) << 3); + } + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + + return state; + }, + + hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'], + + rhex = function (n) { + var s = '', + j; + for (j = 0; j < 4; j += 1) { + s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; + } + return s; + }, + + hex = function (x) { + var i; + for (i = 0; i < x.length; i += 1) { + x[i] = rhex(x[i]); + } + return x.join(''); + }, + + md5 = function (s) { + return hex(md51(s)); + }, + + + + //////////////////////////////////////////////////////////////////////////// + + /** + * SparkMD5 OOP implementation. + * + * Use this class to perform an incremental md5, otherwise use the + * static methods instead. + */ + SparkMD5 = function () { + // call reset to init the instance + this.reset(); + }; + + + // In some cases the fast add32 function cannot be used.. + if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') { + add32 = function (x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF), + msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); + }; + } + + + /** + * Appends a string. + * A conversion will be applied if an utf8 string is detected. + * + * @param {String} str The string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.append = function (str) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + // then append as binary + this.appendBinary(str); + + return this; + }; + + /** + * Appends a binary string. + * + * @param {String} contents The binary string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.appendBinary = function (contents) { + this._buff += contents; + this._length += contents.length; + + var length = this._buff.length, + i; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk(this._buff.substring(i - 64, i))); + } + + this._buff = this._buff.substr(i - 64); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + i, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + /** + * Finish the final calculation based on the tail. + * + * @param {Array} tail The tail (will be modified) + * @param {Number} length The length of the remaining buffer + */ + SparkMD5.prototype._finish = function (tail, length) { + var i = length, + tmp, + lo, + hi; + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(this._state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + tmp = this._length * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + md5cycle(this._state, tail); + }; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.reset = function () { + this._buff = ""; + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.prototype.destroy = function () { + delete this._state; + delete this._buff; + delete this._length; + }; + + + /** + * Performs the md5 hash on a string. + * A conversion will be applied if utf8 string is detected. + * + * @param {String} str The string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hash = function (str, raw) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + var hash = md51(str); + + return !!raw ? hash : hex(hash); + }; + + /** + * Performs the md5 hash on a binary string. + * + * @param {String} content The binary string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hashBinary = function (content, raw) { + var hash = md51(content); + + return !!raw ? hash : hex(hash); + }; + + /** + * SparkMD5 OOP implementation for array buffers. + * + * Use this class to perform an incremental md5 ONLY for array buffers. + */ + SparkMD5.ArrayBuffer = function () { + // call reset to init the instance + this.reset(); + }; + + //////////////////////////////////////////////////////////////////////////// + + /** + * Appends an array buffer. + * + * @param {ArrayBuffer} arr The array to be appended + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.append = function (arr) { + // TODO: we could avoid the concatenation here but the algorithm would be more complex + // if you find yourself needing extra performance, please make a PR. + var buff = this._concatArrayBuffer(this._buff, arr), + length = buff.length, + i; + + this._length += arr.byteLength; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i))); + } + + // Avoids IE10 weirdness (documented above) + this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + i, + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff[i] << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.reset = function () { + this._buff = new Uint8Array(0); + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy; + + /** + * Concats two array buffers, returning a new one. + * + * @param {ArrayBuffer} first The first array buffer + * @param {ArrayBuffer} second The second array buffer + * + * @return {ArrayBuffer} The new array buffer + */ + SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) { + var firstLength = first.length, + result = new Uint8Array(firstLength + second.byteLength); + + result.set(first); + result.set(new Uint8Array(second), firstLength); + + return result; + }; + + /** + * Performs the md5 hash on an array buffer. + * + * @param {ArrayBuffer} arr The array buffer + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.hash = function (arr, raw) { + var hash = md51_array(new Uint8Array(arr)); + + return !!raw ? hash : hex(hash); + }; + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( file ) { + var blob = file.getSource(), + chunkSize = 2 * 1024 * 1024, + chunks = Math.ceil( blob.size / chunkSize ), + chunk = 0, + owner = this.owner, + spark = new SparkMD5.ArrayBuffer(), + me = this, + blobSlice = blob.mozSlice || blob.webkitSlice || blob.slice, + loadNext, fr; + + fr = new FileReader(); + + loadNext = function() { + var start, end; + + start = chunk * chunkSize; + end = Math.min( start + chunkSize, blob.size ); + + fr.onload = function( e ) { + spark.append( e.target.result ); + owner.trigger( 'progress', { + total: file.size, + loaded: end + }); + }; + + fr.onloadend = function() { + fr.onloadend = fr.onload = null; + + if ( ++chunk < chunks ) { + setTimeout( loadNext, 1 ); + } else { + setTimeout(function(){ + owner.trigger('load'); + me.result = spark.end(); + loadNext = file = blob = spark = null; + owner.trigger('complete'); + }, 50 ); + } + }; + + fr.readAsArrayBuffer( blobSlice.call( blob, start, end ) ); + }; + + loadNext(); + }, + + getResult: function() { + return this.result; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash的接受器。 + window[ jsreciver ] = function() { + var args = arguments; + + // 为了能捕获得到。 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '<object id="' + this.uid + '" type="application/' + + 'x-shockwave-flash" data="' + opts.swf + '" '; + + if ( Base.browser.ie ) { + html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; + } + + html += 'width="100%" height="100%" style="outline:0">' + + '<param name="movie" value="' + opts.swf + '" />' + + '<param name="flashvars" value="uid=' + this.uid + + '&jsreciver=' + this.jsreciver + '" />' + + '<param name="wmode" value="transparent" />' + + '<param name="allowscriptaccess" value="always" />' + + '</object>'; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 修复Flash再没有设置title的情况下无法弹出flash文件选择框的bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview 图片压缩 + */ + define('runtime/flash/image',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Image', { + // init: function( options ) { + // var owner = this.owner; + + // this.flashExec( 'Image', 'init', options ); + // owner.on( 'load', function() { + // debugger; + // }); + // }, + + loadFromBlob: function( blob ) { + var owner = this.owner; + + owner.info() && this.flashExec( 'Image', 'info', owner.info() ); + owner.meta() && this.flashExec( 'Image', 'meta', owner.meta() ); + + this.flashExec( 'Image', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 处理可能存在 bug, 没辙只能靠 js 了 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview Md5 flash实现 + */ + define('runtime/flash/md5',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( blob ) { + return this.flashExec( 'Md5', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview 完全版本。 + */ + define('preset/all',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + 'widgets/md5', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/androidpatch', + 'runtime/html5/image', + 'runtime/html5/transport', + 'runtime/html5/md5', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/image', + 'runtime/flash/transport', + 'runtime/flash/blob', + 'runtime/flash/md5' + ], function( Base ) { + return Base; + }); + /** + * @fileOverview 日志组件,主要用来收集错误信息,可以帮助 webuploader 更好的定位问题和发展。 + * + * 如果您不想要启用此功能,请在打包的时候去掉 log 模块。 + * + * 或者可以在初始化的时候通过 options.disableWidgets 属性禁用。 + * + * 如: + * WebUploader.create({ + * ... + * + * disableWidgets: 'log', + * + * ... + * }) + */ + define('widgets/log',[ + 'base', + 'uploader', + 'widgets/widget' + ], function( Base, Uploader ) { + var $ = Base.$, + logUrl = ' http://static.tieba.baidu.com/tb/pms/img/st.gif??', + product = (location.hostname || location.host || 'protected').toLowerCase(), + + // 只针对 baidu 内部产品用户做统计功能。 + enable = product && /baidu/i.exec(product), + base; + + if (!enable) { + return; + } + + base = { + dv: 3, + master: 'webuploader', + online: /test/.exec(product) ? 0 : 1, + module: '', + product: product, + type: 0 + }; + + function send(data) { + var obj = $.extend({}, base, data), + url = logUrl.replace(/^(.*)\?/, '$1' + $.param( obj )), + image = new Image(); + + image.src = url; + } + + return Uploader.register({ + name: 'log', + + init: function() { + var owner = this.owner, + count = 0, + size = 0; + + owner + .on('error', function(code) { + send({ + type: 2, + c_error_code: code + }); + }) + .on('uploadError', function(file, reason) { + send({ + type: 2, + c_error_code: 'UPLOAD_ERROR', + c_reason: '' + reason + }); + }) + .on('uploadComplete', function(file) { + count++; + size += file.size; + }). + on('uploadFinished', function() { + send({ + c_count: count, + c_size: size + }); + count = size = 0; + }); + + send({ + c_usage: 1 + }); + } + }); + }); + /** + * @fileOverview Uploader上传类 + */ + define('webuploader',[ + 'preset/all', + 'widgets/log' + ], function( preset ) { + return preset; + }); + + var _require = require; + return _require('webuploader'); +}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.js new file mode 100644 index 0000000..c2f5946 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.js @@ -0,0 +1,4622 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。 + * + * AMD API 内部的简单不完全实现,请忽略。只有当WebUploader被合并成一个文件的时候才会引入。 + */ +(function( root, factory ) { + var modules = {}, + + // 内部require, 简单不完全实现。 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 如果deps不是数组,则直接返回指定module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 内部define,暂时不支持不指定id. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 设置module, 兼容CommonJs写法。 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 根据id获取module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 将所有modules,将路径ids装换成对象。 + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 操作相关 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 使用jQuery的Promise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 基础类方法。 + */ + + /** + * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。 + * + * As you know, Web Uploader的每个文件都是用过[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)规范中的`define`组织起来的, 每个Module都会有个module id. + * 默认module id为该文件的路径,而此路径将会转化成名字空间存放在WebUploader中。如: + * + * * module `base`:WebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 以下文档中对类的使用可能省略掉了`WebUploader`前缀。 + * @module WebUploader + * @title WebUploader API文档 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 反科里化 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 基础类,提供一些简单常用的方法。 + * @class Base + */ + return { + + /** + * @property {String} version 当前版本号。 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 引用依赖的jQuery或者Zepto对象。 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 简单的浏览器检查结果。 + * + * * `webkit` webkit版本号,如果浏览器为非webkit内核,此属性为`undefined`。 + * * `chrome` chrome浏览器版本号,如果浏览器为chrome,此属性为`undefined`。 + * * `ie` ie浏览器版本号,如果浏览器为非ie,此属性为`undefined`。**暂不支持ie10+** + * * `firefox` firefox浏览器版本号,如果浏览器为非firefox,此属性为`undefined`。 + * * `safari` safari浏览器版本号,如果浏览器为非safari,此属性为`undefined`。 + * * `opera` opera浏览器版本号,如果浏览器为非opera,此属性为`undefined`。 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 操作系统检查结果。 + * + * * `android` 如果在android浏览器环境下,此值为对应的android版本号,否则为`undefined`。 + * * `ios` 如果在ios浏览器环境下,此值为对应的ios版本号,否则为`undefined`。 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 实现类与类之间的继承。 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 父类 + * @param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。 + * @param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。 + * @param {Object} [statics] 静态属性或方法。 + * @return {Class} 返回子类。 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 因为没有指定构造器,父类的构造器将会执行。 + * var instance = new Manager(); // => Super + * + * // 继承子父类的方法 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 子类的__super__属性指向父类 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 复制静态方法 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 让子类的__super__属性指向父类。 + child.__super__ = Super.prototype; + + // 构建原型,添加原型方法或属性。 + // 暂时用Object.create实现。 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 一个不做任何事情的方法。可以用来赋值给默认的callback. + * @method noop + */ + noop: noop, + + /** + * 返回一个新的方法,此方法将已指定的`context`来执行。 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 引用Console.log如果存在的话,否则引用一个[空函数noop](#WebUploader:Base.noop)。 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 当浏览器不在当前窗口时就停了。 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 被[uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)的数组slice方法。 + * 将用来将非数组对象转化成数组对象。 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 生成唯一的ID + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 格式化文件大小, 输出成带单位的字符串 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 文件大小 + * @param {Number} [pointLength=2] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 事件处理类,可以独立使用,也可以扩展给对象使用。 + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 根据条件过滤出事件handlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 不支持对象,只支持多个event用空格隔开 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 绑定事件。 + * + * `callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如 + * ```javascript + * var obj = {}; + * + * // 使得obj有事件行为 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。 + * 切会影响到`trigger`方法的返回值,为`false`。 + * + * `on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处, + * 就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 事件名,支持多个事件用空格隔开 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 绑定事件,且当handler执行完后,自动解除绑定。 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 事件名 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 解除事件绑定 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 事件名 + * @param {Function} [callback] 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 触发事件 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 事件名 + * @param {*} [...] 任意参数 + * @return {Boolean} 如果handler中return false了,则返回false, 否则返回true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 中介者,它本身是个单例,但可以通过[installTo](#WebUploader:Mediator:installTo)方法,使任何对象具备事件行为。 + * 主要目的是负责模块与模块之间的合作,降低耦合度。 + * + * @class Mediator + */ + return $.extend({ + + /** + * 可以通过这个接口,使任何对象具备事件功能。 + * @method installTo + * @param {Object} obj 需要具备事件行为的对象。 + * @return {Object} 返回obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader上传类 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 上传入口类。 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 开起分片上传。 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets中有相应扩展 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 批量添加纯命令式方法。 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 获取或者设置Uploader配置项。 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 初始状态图片上传前不会压缩 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 修改后图片上传前,尝试将图片压缩到1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 获取文件统计信息。返回一个包含一下信息的对象。 + * * `successNum` 上传成功的文件数 + * * `progressNum` 上传中的文件数 + * * `cancelNum` 被删除的文件数 + * * `invalidNum` 无效的文件数 + * * `uploadFailNum` 上传失败的文件数 + * * `queueNum` 还在队列中的文件数 + * * `interruptNum` 被暂停的文件数 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 调用通过on方法注册的handler. + Mediator.trigger.apply( this, arguments ) === false || + + // 调用opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 调用this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 广播所有uploader的事件。 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 销毁 webuploader 实例 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js将补充此方法的详细文档。 + request: Base.noop + }); + + /** + * 创建Uploader实例,等同于new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 暴露Uploader,可以通过它来扩展业务逻辑。 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 获取对象的第一个key + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 接口类。 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 添加Runtime实现。 + * @param {String} type 类型 + * @param {Runtime} factory 具体Runtime实现。 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 有些类型不能重用,比如filepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 允许runtime没有初始化之前,注册一些方法在初始化后执行。 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 像filePicker只能独立存在,不能公用。 + runtime = runtime || cache.get( null, standalone ); + + // 需要创建 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 来自cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 如果没有指定 mimetype, 但是知道文件后缀。 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 为了统一化Flash的File和HTML5的File而存在。 + * 以至于要调用Flash里面的File,也可以像调用HTML5版本的File一下。 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 支持其他类型文件的转换。 + // 如果有 mimetype, 但是文件名里面没有找出后缀规律 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('按钮指定错误'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 记录来源。 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 组件基类。 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 类Backbone的事件监听声明,监听uploader实例上的事件 + // widget直接无法监听事件,事件只能通过uploader来传递 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 如果无API响应声明则忽略 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 发送命令。当传入`callback`或者`handler`中返回`promise`时。返回一个当所有`handler`中的promise都完成后完成的新`promise`。 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 扩展Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 默认所有 Uploader.register 了的 widget 都会被加载,如果禁用某一部分,请通过此 option 指定黑名单。 + */ + + // 覆写_init用来初始化widgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred对象 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 如果有callback,则用异步方式。 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 很重要不能删除。删除了会死循环。 + // 保证执行顺序。让callback总是在下一个 tick 中执行。 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 添加组件 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 名称与函数实现的映射 + * @param {object} proto 组件原型,构造函数通过 constructor 属性定义 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 自动生成 map 表。 + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 删除插件,只有在注册时指定了名字的才能被删除。 + * @grammar Uploader.unRegister(name); + * @param {string} name 组件名字 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 删除指定的插件。 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview 文件选择相关 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 指定选择文件的按钮容器,不指定则不创建按钮。 + * + * * `id` {Seletor|dom} 指定选择文件的按钮容器,不指定则不创建按钮。**注意** 这里虽然写的是 id, 但是不是只支持 id, 还支持 class, 或者 dom 节点。 + * * `label` {String} 请采用 `innerHTML` 代替 + * * `innerHTML` {String} 指定按钮文字。不指定时优先从指定的容器中看是否自带文字。 + * * `multiple` {Boolean} 是否开起同时选择多个文件能力。 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 指定接受哪些类型的文件。 由于目前还有ext转mimeType表,所以这里需要分开指定。 + * + * * `title` {String} 文字描述 + * * `extensions` {String} 允许的文件后缀,不带点,多个用逗号分割。 + * * `mimeTypes` {String} 多个用逗号分割。 + * + * 如: + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 添加文件选择按钮,如果一个按钮不够,需要调用此方法来添加。参数跟[options.pick](#WebUploader:Uploader:options)一致。 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '选择文件' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 构造器。 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 默认选项。 + Image.options = { + + // 默认的图片处理质量 + quality: 90, + + // 是否裁剪 + crop: false, + + // 是否保留头部信息 + preserveHeaders: false, + + // 是否允许放大。 + allowMagnify: false + }; + + // 继承RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 根据要处理的文件大小来节流,一次不能处理太多,会卡。 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 配置生成缩略图的选项。 + * + * 默认为: + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 70, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: true, + * + * // 是否允许裁剪。 + * crop: true, + * + * // 为空的话则保留原有图片格式。 + * // 否则强制转换成指定的类型。 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 为空的话则保留原有图片格式。 + // 否则强制转换成指定的类型。 + // IE 8下面 base64 大小不能超过 32K 否则预览失败,而非 jpeg 编码的图片很可 + // 能会超过 32k, 所以这里设置成预览的时候都是 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 配置压缩的图片的选项。如果此选项为`false`, 则图片在上传前不进行压缩。 + * + * 默认为: + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 90, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: false, + * + * // 是否允许裁剪。 + * crop: false, + * + * // 是否保留头部meta信息。 + * preserveHeaders: true, + * + * // 如果发现压缩后文件大小比原来还大,则使用原来图片 + * // 此属性可能会影响图片自动纠正功能 + * noCompressIfLarger: false, + * + * // 单位字节,如果图片大小小于此值,不会采用压缩。 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 生成缩略图,此过程为异步,所以需要传入`callback`。 + * 通常情况在图片加入队里后调用此方法来生成预览图以增强交互效果。 + * + * 当 width 或者 height 的值介于 0 - 1 时,被当成百分比使用。 + * + * `callback`中可以接收到两个参数。 + * * 第一个为error,如果生成缩略图有错误,此error将为真。 + * * 第二个为ret, 缩略图的Data URL值。 + * + * **注意** + * Date URL在IE6/7中不支持,所以不用调用此方法了,直接显示一张暂不支持预览图片好了。 + * 也可以借助服务端,将 base64 数据传给服务端,生成一个临时文件供预览。 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('预览错误'); + * } else { + * $li.append('<img alt="" src="' + ret + '" />'); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 只预览图片格式。 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 如果传入的是object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 当 resize 完后 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 只压缩 jpeg 图片格式。 + // gif 可能会丢失针 + // bmp png 基本上尺寸都不大,且压缩比比较小。 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 移动端 UC / qq 浏览器的无图模式下 + // ctx.getImageData 处理大图的时候会报 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 如果压缩后,比原来还大则不用压缩后的。 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 标记,避免重复压缩。 + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 出错了直接继续,让其上传原始图片 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 文件属性封装 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 文件类 + * @class File + * @constructor 构造函数 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 + */ + function WUFile( source ) { + + /** + * 文件名,包括扩展名(后缀) + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 文件体积(字节) + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 文件最后修改日期 + * @property lastModifiedDate + * @type {int} + * @default 当前时间戳 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 文件ID,每个对象具有唯一ID,与文件名无关 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 文件扩展名,通过文件名获取,例如test.png的扩展名为png + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 状态文字说明。在不同的status语境下有不同的用途。 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 存储文件状态,防止通过属性直接修改 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 设置状态,状态变化时会触发`change`事件。 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status) + * @param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 文件状态变化 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 获取文件状态 + * @return {File.Status} + * @example + 文件状态具体包括以下几种类型: + { + // 初始化 + INITED: 0, + // 已入队列 + QUEUED: 1, + // 正在上传 + PROGRESS: 2, + // 上传出错 + ERROR: 3, + // 上传成功 + COMPLETE: 4, + // 上传取消 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 获取文件原始信息。 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 文件状态值,具体包括以下几种类型: + * * `inited` 初始状态 + * * `queued` 已经进入队列, 等待上传 + * * `progress` 上传中 + * * `complete` 上传完成。 + * * `error` 上传出错,可重试 + * * `interrupt` 上传中断,可续传。 + * * `invalid` 文件不合格,不能重试上传。会自动从队列中移除。 + * * `cancelled` 文件被移除。 + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 初始状态 + QUEUED: 'queued', // 已经进入队列, 等待上传 + PROGRESS: 'progress', // 上传中 + ERROR: 'error', // 上传出错,可重试 + COMPLETE: 'complete', // 上传完成。 + CANCELLED: 'cancelled', // 上传取消。 + INTERRUPT: 'interrupt', // 上传中断,可续传。 + INVALID: 'invalid' // 文件不合格,不能重试上传。 + }; + + return WUFile; + }); + + /** + * @fileOverview 文件队列 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 文件队列, 用来存储各个状态中的文件。 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 统计文件数。 + * * `numOfQueue` 队列中的文件数。 + * * `numOfSuccess` 上传成功的文件数 + * * `numOfCancel` 被取消的文件数 + * * `numOfProgress` 正在上传中的文件数 + * * `numOfUploadFailed` 上传错误的文件数。 + * * `numOfInvalid` 无效的文件数。 + * * `numofDeleted` 被移除的文件数。 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 上传队列,仅包括等待上传的文件 + this._queue = []; + + // 存储所有文件 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 将新文件加入对队列尾部 + * + * @method append + * @param {File} file 文件对象 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 将新文件加入对队列头部 + * + * @method prepend + * @param {File} file 文件对象 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 获取文件对象 + * + * @method getFile + * @param {String} fileId 文件ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 从队列中取出一个指定状态的文件。 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [文件状态值](#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 对队列进行排序,能够控制文件上传顺序。 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 排序方法 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [文件状态值](#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 在队列中删除文件。 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 文件对象。 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 队列 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept中的中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 如果当前不是html5运行时,那就算了。 + // 不执行后续操作 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 创建一个 html5 运行时的 placeholder + // 以至于外部添加原生 File 对象的时候能正确包裹一下供 webuploader 使用。 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 为了支持外部直接添加一个原生File对象。 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 判断文件是否可以被加入队列 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 如果名字中有后缀,才做后缀白名单处理。 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File对象 + * @description 当文件被加入队列之前触发,此事件的handler返回值为`false`,则此文件不会被添加进入队列。 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File对象 + * @description 当文件被加入队列以后触发。 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 不过类型判断允许不允许,先派送 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 类型不匹配,则派送错误事件,并返回。 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 数组,内容为原始File(lib/File)对象。 + * @description 当一批文件添加进队列以后触发。 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 对象 数组 + * @description 添加文件到队列 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File对象 + * @description 当文件被移除队列后触发。 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 返回指定状态的文件集合,不传参数将返回所有状态的文件。 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 重试上传,重试指定文件,或者从出错的文件开始重新上传。 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 排序队列中的文件,在上传之前调整可以控制上传顺序。 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 当 uploader 被重置的时候触发。 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 重置uploader。目前只重置了队列。 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 添加获取Runtime相关信息的方法。 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 指定运行时启动顺序。默认会想尝试 html5 是否支持,如果支持则使用 html5, 否则则使用 flash. + * + * 可以将此值设置成 `flash`,来强制使用 flash 运行时。 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 预测Uploader将采用哪个`Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 跨域时,是否允许携带cookie, 只有html5 runtime才有效 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2分钟 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 添加Blob, 只能添加一次,最后一次有效。 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 添加其他字段 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 让Transport具备事件功能。 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 负责文件上传相关。 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 添加默认配置项 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 是否允许在文件传输时提前把下一个文件准备好。 + * 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 + * 如果能提前在当前文件传输期处理,可以节省总体耗时。 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 是否要分片处理大文件上传。 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 如果要分片,分多大一片? 默认大小为5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 如果某个分片由于网络问题出错,允许自动重传多少次? + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 上传并发数。允许同时最大上传进程数。 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 文件上传请求的参数表,每次发送都会发送此对象中的参数。 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 设置文件上传域的name。 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 文件上传方式,`POST`或者`GET`。 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 是否已二进制的流的方式发送文件,这样整个上传内容`php://input`都为文件内容, + * 其他参数在$_GET数组中。 + */ + }); + + // 负责将文件切片。 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 记录当前正在传的数据,跟threads相关 + this.pool = []; + + // 缓存分好片的文件。 + this.stack = []; + + // 缓存即将上传的文件。 + this.pending = []; + + // 跟踪还有多少分片在上传中但是没有完成上传。 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 把其他块取消了。 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 当开始上传流程时触发。 + * @for Uploader + */ + + /** + * 开始上传。此方法可以从初始状态调用开始上传流程,也可以从暂停状态调用,继续上传流程。 + * + * 可以指定开始某一个文件。 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 移出invalid的文件 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 如果指定了开始某个文件,则只开始指定文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 之前暂停过。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 如果有暂停的,则续传 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 当开始上传流程暂停时触发。 + * @for Uploader + */ + + /** + * 暂停上传。第一个参数为是否中断上传当前正在上传的文件。 + * + * 如果第一个参数是文件,则只暂停指定文件。 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 如果只是暂停某个文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 只 abort 指定的文件。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 标记文件状态为已取消, 同时将中断文件传输。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 判断`Uplaode`r是否正在上传中。 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 掉过一个文件上传,直接标记指定文件为已上传状态。 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 当所有文件上传结束时触发。 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 上一个promise还没有结束,则等待完成后再执行。 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 还有位置,且还有文件要处理的话。 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 有可能是reject过来的,所以要检测val的类型。 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 没有要上传的了,且没有正在传输的了。 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 把已经处理完了的,或者,状态为非 progress(上传中)、 + // interupt(暂停中) 的移除。 + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 如果当前文件还有没有需要传输的,则直接返回剩下的。 + if ( (act = this._getStack()) ) { + + // 是否提前准备下一个文件 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 否则,如果正在运行,则准备下一个文件,并等待完成后返回下个分片。 + } else if ( me.runing ) { + + // 如果缓存中有,则直接在缓存中取,没有则去queue中取。 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 文件可能还在prepare中,也有可能已经完全准备好了。 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File对象 + * @description 某个文件开始上传前触发,一个文件只会触发一次。 + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 有可能文件被skip掉了。文件被skip掉后,状态坑定不是Queued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 如果还在pending中,则替换成文件本身。 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file的钩子就有错误发生。 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 让出位置了,可以让其他分片开始上传 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 有可能在 before-send-file 的 promise 期间改变了文件状态。 + // 如:暂停,取消 + // 我们不能中断 promise, 但是可以在 promise 完后,不做上传操作。 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 如果是中断,则还需要放回去。 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 如果没有分片,则直接使用原始的。 + // 不会丢失content-type信息。 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 每个分片发送之前可能要做些异步的事情。 + promise = me.request( 'before-send', block, function() { + + // 有可能文件已经上传出错了,所以不需要再传输了。 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 如果为fail了,则跳过此分片。 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 默认的上传参数,可以扩展此对象来控制上传参数。 + * @param {Object} headers 可以扩展此对象来控制上传头部。 + * @description 当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。 + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 服务端的返回数据,json格式,如果服务端不是json格式,从ret._raw中取数据,自行解析。 + * @description 当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为`false`, 则此文件将派送`server`类型的`uploadError`事件。 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File对象 + * @param {Number} percentage 上传进度 + * @description 上传过程中触发,携带上传进度。 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File对象 + * @param {String} reason 出错的code + * @description 当文件上传出错时触发。 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File对象 + * @param {Object} response 服务端返回的数据 + * @description 当文件上传成功时触发。 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File对象 + * @description 不管成功或者失败,文件上传完成时触发。 + * @for Uploader + */ + + // 做上传操作。 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 广播上传进度。以文件为单位。 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 用来询问,是否返回的结果是有错误的。 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 服务端响应了,不代表成功了,询问是否响应正确。 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 尝试重试,然后广播文件上传出错。 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 自动重试 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 上传成功 + tr.on( 'load', function() { + var reason; + + // 如果非预期,转向上传出错。 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 全部上传完成。 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 配置默认的上传字段。 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 在发送之间可以添加字段什么的。。。 + // 如果默认的字段不够使用,可以通过监听此事件来扩展 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 开始发送。 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 完成上传。 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 如果外部已经标记为invalid什么的,不再改状态。 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 各种验证,包括文件总大小是否超出、单文件是否超出和文件是否重复。 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 错误类型。 + * @description 当validate不通过时,会以派送错误事件的形式通知调用者。通过`upload.on('error', handler)`可以捕获到此类错误,目前有以下错误会在特定的情况下派送错来。 + * + * * `Q_EXCEED_NUM_LIMIT` 在设置了`fileNumLimit`且尝试给`uploader`添加的文件数量超出这个值时派送。 + * * `Q_EXCEED_SIZE_LIMIT` 在设置了`Q_EXCEED_SIZE_LIMIT`且尝试给`uploader`添加的文件总大小超出这个值时派送。 + * * `Q_TYPE_DENIED` 当文件类型不满足时触发。。 + * @for Uploader + */ + + // 暴露给外面的api + api = { + + // 添加验证器 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 移除验证器 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 在Uploader初始化的时候启动Validators的初始化 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总数量, 超出则不允许加入队列。 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证单个文件大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 去重, 根据文件名字、文件大小和最后修改时间来生成hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 已经重复了 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash的接受器。 + window[ jsreciver ] = function() { + var args = arguments; + + // 为了能捕获得到。 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '<object id="' + this.uid + '" type="application/' + + 'x-shockwave-flash" data="' + opts.swf + '" '; + + if ( Base.browser.ie ) { + html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; + } + + html += 'width="100%" height="100%" style="outline:0">' + + '<param name="movie" value="' + opts.swf + '" />' + + '<param name="flashvars" value="uid=' + this.uid + + '&jsreciver=' + this.jsreciver + '" />' + + '<param name="wmode" value="transparent" />' + + '<param name="allowscriptaccess" value="always" />' + + '</object>'; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 修复Flash再没有设置title的情况下无法弹出flash文件选择框的bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview 图片压缩 + */ + define('runtime/flash/image',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Image', { + // init: function( options ) { + // var owner = this.owner; + + // this.flashExec( 'Image', 'init', options ); + // owner.on( 'load', function() { + // debugger; + // }); + // }, + + loadFromBlob: function( blob ) { + var owner = this.owner; + + owner.info() && this.flashExec( 'Image', 'info', owner.info() ); + owner.meta() && this.flashExec( 'Image', 'meta', owner.meta() ); + + this.flashExec( 'Image', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 处理可能存在 bug, 没辙只能靠 js 了 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview 只有flash实现的文件版本。 + */ + define('preset/flashonly',[ + 'base', + + // widgets + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + + // runtimes + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/image', + 'runtime/flash/blob', + 'runtime/flash/transport' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/flashonly' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.min.js new file mode 100644 index 0000000..a50273d --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e<f;)if(c=a[e],c.cb.apply(c.ctx2,b)===!1){d=!0;break}return!d}var e,f=a.$,g=[].slice,h=/\s+/;return e={on:function(a,b,d){var e,f=this;return b?(e=this._events||(this._events=[]),c(a,b,function(a,b){var c={e:a};c.cb=b,c.ctx=d,c.ctx2=d||f,c.id=e.length,e.push(c)}),this):this},once:function(a,b,d){var e=this;return b?(c(a,b,function(a,b){var c=function(){return e.off(a,c),b.apply(d||e,arguments)};c._cb=b,e.on(a,c,d)}),e):e},off:function(a,d,e){var g=this._events;return g?a||d||e?(c(a,d,function(a,c){f.each(b(g,a,c,e),function(){delete g[this.id]})}),this):(this._events=[],this):this},trigger:function(a){var c,e,f;return this._events&&a?(c=g.call(arguments,1),e=b(this._events,a),f=b(this._events,"all"),d(e,c)&&d(f,arguments)):this}},f.extend({installTo:function(a){return f.extend(a,e)}},e)}),b("uploader",["base","mediator"],function(a,b){function c(a){this.options=d.extend(!0,{},c.options,a),this._init(this.options)}var d=a.$;return c.options={},b.installTo(c.prototype),d.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",sort:"sort-files",removeFile:"remove-file",cancelFile:"cancel-file",skipFile:"skip-file",retry:"retry",isInProgress:"is-in-progress",makeThumb:"make-thumb",md5File:"md5-file",getDimension:"get-dimension",addButton:"add-btn",predictRuntimeType:"predict-runtime-type",refresh:"refresh",disable:"disable",enable:"enable",reset:"reset"},function(a,b){c.prototype[a]=function(){return this.request(b,arguments)}}),d.extend(c.prototype,{state:"pending",_init:function(a){var b=this;b.request("init",a,function(){b.state="ready",b.trigger("ready")})},option:function(a,b){var c=this.options;return arguments.length>1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("按钮指定错误");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size<h||b._compressed?void 0:(g=e.extend({},g),f=a.Deferred(),d=new c(g),f.always(function(){d.destroy(),d=null}),d.once("error",f.reject),d.once("load",function(){var a=g.width,c=g.height;b._info=b._info||d.info(),b._meta=b._meta||d.meta(),1>=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.size<c)&&(b.source=a,b.size=a.size,b.trigger("resize",a.size,c)),b._compressed=!0,f.resolve()}catch(e){f.resolve()}}),b._info&&d.info(b._info),b._meta&&d.meta(b._meta),d.loadFromBlob(b.source),f.promise())}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length<e.threads&&(c=d._nextBlock())?(d._trigged=!1,b=function(b){d._promise=null,b&&b.file&&d._startSend(b),a.nextTick(d.__tick)},d._promise=g(c)?c.always(b):b(c)):d.remaning||d._getStats().numOfQueue||d._getStats().numofInterrupt||(d.runing=!1,d._trigged||a.nextTick(function(){d.owner.trigger("uploadFinished")}),d._trigged=!0))},_putback:function(a){var b;a.cuted.unshift(a),b=this.stack.indexOf(a.cuted),~b||this.stack.unshift(a.cuted)},_getStack:function(){for(var a,b=0;a=this.stack[b++];){if(a.has()&&a.file.getStatus()===h.PROGRESS)return a;(!a.has()||a.file.getStatus()!==h.PROGRESS&&a.file.getStatus()!==h.INTERRUPT)&&this.stack.splice(--b,1)}return null},_nextBlock:function(){var a,b,c,d,f=this,h=f.options;return(a=this._getStack())?(h.prepareNextFile&&!f.pending.length&&f._prepareNextFile(),a.shift()):f.runing?(!f.pending.length&&f._getStats().numOfQueue&&f._prepareNextFile(),b=f.pending.shift(),c=function(b){return b?(a=e(b,h.chunked?h.chunkSize:0),f.stack.push(a),a.shift()):null},g(b)?(d=b.file,b=b[b.pipe?"pipe":"then"](c),b.file=d,b):c(b)):void 0},_prepareNextFile:function(){var a,b=this,c=b.request("fetch-file"),d=b.pending;c&&(a=b.request("before-send-file",c,function(){return c.getStatus()===h.PROGRESS||c.getStatus()===h.INTERRUPT?c:b._finishFile(c)}),b.owner.trigger("uploadStart",c),c.setStatus(h.PROGRESS),a.file=c,a.done(function(){var b=f.inArray(a,d);~b&&d.splice(b,1,c)}),a.fail(function(a){c.setStatus(h.ERROR,a),b.owner.trigger("uploadError",c,a),b.owner.trigger("uploadComplete",c)}),d.push(a))},_popBlock:function(a){var b=f.inArray(a,this.pool);this.pool.splice(b,1),a.file.remaning--,this.remaning--},_startSend:function(b){var c,d=this,e=b.file;return e.getStatus()!==h.PROGRESS?void(e.getStatus()===h.INTERRUPT&&d._putback(b)):(d.pool.push(b),d.remaning++,b.blob=1===b.chunks?e.source:e.source.slice(b.start,b.end),c=d.request("before-send",b,function(){e.getStatus()===h.PROGRESS?d._doSend(b):(d._popBlock(b),a.nextTick(d.__tick))}),void c.fail(function(){1===e.remaning?d._finishFile(e).always(function(){b.percentage=1,d._popBlock(b),d.owner.trigger("uploadComplete",e),a.nextTick(d.__tick)}):(b.percentage=1,d.updateFileProgress(e),d._popBlock(b),a.nextTick(d.__tick))}))},_doSend:function(b){var c,e,g=this,i=g.owner,j=g.options,k=b.file,l=new d(j),m=f.extend({},j.formData),n=f.extend({},j.headers);b.transport=l,l.on("destroy",function(){delete b.transport,g._popBlock(b),a.nextTick(g.__tick)}),l.on("progress",function(a){b.percentage=a,g.updateFileProgress(k)}),c=function(a){var c;return e=l.getResponseAsJson()||{},e._raw=l.getResponse(),c=function(b){a=b},i.trigger("uploadAccept",b,e,c)||(a=a||"server"),a},l.on("error",function(a,d){b.retried=b.retried||0,b.chunks>1&&~"http,abort".indexOf(a)&&b.retried<j.chunkRetry?(b.retried++,l.send()):(d||"server"!==a||(a=c(a)),k.setStatus(h.ERROR,a),i.trigger("uploadError",k,a),i.trigger("uploadComplete",k))}),l.on("load",function(){var a;return(a=c())?void l.trigger("error",a,!0):void(1===k.remaning?g._finishFile(k,e):l.destroy())}),m=f.extend(m,{id:k.id,name:k.name,type:k.type,lastModifiedDate:k.lastModifiedDate,size:k.size}),b.chunks>1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b)}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate)); +return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1],10)}function f(){function d(a,b){var c,d,e=a.type||a;c=e.split("::"),d=c[0],e=c[1],"Ready"===e&&d===j.uid?j.trigger("ready"):f[d]&&f[d].trigger(e.toLowerCase(),a,b)}var e={},f={},g=this.destroy,j=this,k=b.guid("webuploader_");c.apply(j,arguments),j.type=h,j.exec=function(a,c){var d,g=this,h=g.uid,k=b.slice(arguments,2);return f[h]=g,i[a]&&(e[h]||(e[h]=new i[a](g,j)),d=e[h],d[c])?d[c].apply(d,k):j.flashExec.apply(g,arguments)},a[k]=function(){var a=arguments;setTimeout(function(){d.apply(null,a)},1)},this.jsreciver=k,this.destroy=function(){return g&&g.apply(this,arguments)},this.flashExec=function(a,c){var d=j.getFlash(),e=b.slice(arguments,2);return d.exec(this.uid,a,c,e)}}var g=b.$,h="flash",i={};return b.inherits(c,{constructor:f,init:function(){var a,c=this.getContainer(),d=this.options;c.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),a='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+d.swf+'" ',b.browser.ie&&(a+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),a+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+d.swf+'" /><param name="flashvars" value="uid='+this.uid+"&jsreciver="+this.jsreciver+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/image",["runtime/flash/runtime"],function(a){return a.register("Image",{loadFromBlob:function(a){var b=this.owner;b.info()&&this.flashExec("Image","info",b.info()),b.meta()&&this.flashExec("Image","meta",b.meta()),this.flashExec("Image","loadFromBlob",a.uid)}})}),b("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.flashExec("Blob","slice",a,c);return new b(d.uid,d)}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("preset/flashonly",["base","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","runtime/flash/filepicker","runtime/flash/image","runtime/flash/blob","runtime/flash/transport"],function(a){return a}),b("webuploader",["preset/flashonly"],function(a){return a}),c("webuploader")}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.js new file mode 100644 index 0000000..bec91d2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.js @@ -0,0 +1,6030 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。 + * + * AMD API 内部的简单不完全实现,请忽略。只有当WebUploader被合并成一个文件的时候才会引入。 + */ +(function( root, factory ) { + var modules = {}, + + // 内部require, 简单不完全实现。 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 如果deps不是数组,则直接返回指定module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 内部define,暂时不支持不指定id. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 设置module, 兼容CommonJs写法。 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 根据id获取module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 将所有modules,将路径ids装换成对象。 + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 操作相关 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 使用jQuery的Promise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 基础类方法。 + */ + + /** + * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。 + * + * As you know, Web Uploader的每个文件都是用过[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)规范中的`define`组织起来的, 每个Module都会有个module id. + * 默认module id为该文件的路径,而此路径将会转化成名字空间存放在WebUploader中。如: + * + * * module `base`:WebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 以下文档中对类的使用可能省略掉了`WebUploader`前缀。 + * @module WebUploader + * @title WebUploader API文档 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 反科里化 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 基础类,提供一些简单常用的方法。 + * @class Base + */ + return { + + /** + * @property {String} version 当前版本号。 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 引用依赖的jQuery或者Zepto对象。 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 简单的浏览器检查结果。 + * + * * `webkit` webkit版本号,如果浏览器为非webkit内核,此属性为`undefined`。 + * * `chrome` chrome浏览器版本号,如果浏览器为chrome,此属性为`undefined`。 + * * `ie` ie浏览器版本号,如果浏览器为非ie,此属性为`undefined`。**暂不支持ie10+** + * * `firefox` firefox浏览器版本号,如果浏览器为非firefox,此属性为`undefined`。 + * * `safari` safari浏览器版本号,如果浏览器为非safari,此属性为`undefined`。 + * * `opera` opera浏览器版本号,如果浏览器为非opera,此属性为`undefined`。 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 操作系统检查结果。 + * + * * `android` 如果在android浏览器环境下,此值为对应的android版本号,否则为`undefined`。 + * * `ios` 如果在ios浏览器环境下,此值为对应的ios版本号,否则为`undefined`。 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 实现类与类之间的继承。 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 父类 + * @param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。 + * @param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。 + * @param {Object} [statics] 静态属性或方法。 + * @return {Class} 返回子类。 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 因为没有指定构造器,父类的构造器将会执行。 + * var instance = new Manager(); // => Super + * + * // 继承子父类的方法 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 子类的__super__属性指向父类 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 复制静态方法 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 让子类的__super__属性指向父类。 + child.__super__ = Super.prototype; + + // 构建原型,添加原型方法或属性。 + // 暂时用Object.create实现。 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 一个不做任何事情的方法。可以用来赋值给默认的callback. + * @method noop + */ + noop: noop, + + /** + * 返回一个新的方法,此方法将已指定的`context`来执行。 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 引用Console.log如果存在的话,否则引用一个[空函数noop](#WebUploader:Base.noop)。 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 当浏览器不在当前窗口时就停了。 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 被[uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)的数组slice方法。 + * 将用来将非数组对象转化成数组对象。 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 生成唯一的ID + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 格式化文件大小, 输出成带单位的字符串 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 文件大小 + * @param {Number} [pointLength=2] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 事件处理类,可以独立使用,也可以扩展给对象使用。 + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 根据条件过滤出事件handlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 不支持对象,只支持多个event用空格隔开 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 绑定事件。 + * + * `callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如 + * ```javascript + * var obj = {}; + * + * // 使得obj有事件行为 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。 + * 切会影响到`trigger`方法的返回值,为`false`。 + * + * `on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处, + * 就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 事件名,支持多个事件用空格隔开 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 绑定事件,且当handler执行完后,自动解除绑定。 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 事件名 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 解除事件绑定 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 事件名 + * @param {Function} [callback] 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 触发事件 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 事件名 + * @param {*} [...] 任意参数 + * @return {Boolean} 如果handler中return false了,则返回false, 否则返回true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 中介者,它本身是个单例,但可以通过[installTo](#WebUploader:Mediator:installTo)方法,使任何对象具备事件行为。 + * 主要目的是负责模块与模块之间的合作,降低耦合度。 + * + * @class Mediator + */ + return $.extend({ + + /** + * 可以通过这个接口,使任何对象具备事件功能。 + * @method installTo + * @param {Object} obj 需要具备事件行为的对象。 + * @return {Object} 返回obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader上传类 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 上传入口类。 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 开起分片上传。 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets中有相应扩展 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 批量添加纯命令式方法。 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 获取或者设置Uploader配置项。 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 初始状态图片上传前不会压缩 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 修改后图片上传前,尝试将图片压缩到1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 获取文件统计信息。返回一个包含一下信息的对象。 + * * `successNum` 上传成功的文件数 + * * `progressNum` 上传中的文件数 + * * `cancelNum` 被删除的文件数 + * * `invalidNum` 无效的文件数 + * * `uploadFailNum` 上传失败的文件数 + * * `queueNum` 还在队列中的文件数 + * * `interruptNum` 被暂停的文件数 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 调用通过on方法注册的handler. + Mediator.trigger.apply( this, arguments ) === false || + + // 调用opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 调用this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 广播所有uploader的事件。 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 销毁 webuploader 实例 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js将补充此方法的详细文档。 + request: Base.noop + }); + + /** + * 创建Uploader实例,等同于new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 暴露Uploader,可以通过它来扩展业务逻辑。 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 获取对象的第一个key + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 接口类。 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 添加Runtime实现。 + * @param {String} type 类型 + * @param {Runtime} factory 具体Runtime实现。 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 有些类型不能重用,比如filepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 允许runtime没有初始化之前,注册一些方法在初始化后执行。 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 像filePicker只能独立存在,不能公用。 + runtime = runtime || cache.get( null, standalone ); + + // 需要创建 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 来自cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 错误信息 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 类Backbone的事件监听声明,监听uploader实例上的事件 + // widget直接无法监听事件,事件只能通过uploader来传递 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 如果无API响应声明则忽略 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 发送命令。当传入`callback`或者`handler`中返回`promise`时。返回一个当所有`handler`中的promise都完成后完成的新`promise`。 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 扩展Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 默认所有 Uploader.register 了的 widget 都会被加载,如果禁用某一部分,请通过此 option 指定黑名单。 + */ + + // 覆写_init用来初始化widgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred对象 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 如果有callback,则用异步方式。 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 很重要不能删除。删除了会死循环。 + // 保证执行顺序。让callback总是在下一个 tick 中执行。 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 添加组件 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 名称与函数实现的映射 + * @param {object} proto 组件原型,构造函数通过 constructor 属性定义 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 自动生成 map 表。 + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 删除插件,只有在注册时指定了名字的才能被删除。 + * @grammar Uploader.unRegister(name); + * @param {string} name 组件名字 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 删除指定的插件。 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget。 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 指定Drag And Drop拖拽的容器,如果不指定,则不启动。 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 是否禁掉整个页面的拖拽功能,如果不禁用,图片拖进来的时候会默认被浏览器打开。 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 阻止此事件可以拒绝某些类型的文件拖入进来。目前只有 chrome 提供这样的 API,且只能通过 mime-type 验证。 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 检测文件是否全部允许添加。 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 指定监听paste事件的容器,如果不指定,不启用此功能。此功能为通过粘贴来添加截屏的图片。建议设置为`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 如果没有指定 mimetype, 但是知道文件后缀。 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 为了统一化Flash的File和HTML5的File而存在。 + * 以至于要调用Flash里面的File,也可以像调用HTML5版本的File一下。 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 支持其他类型文件的转换。 + // 如果有 mimetype, 但是文件名里面没有找出后缀规律 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('按钮指定错误'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 记录来源。 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 文件选择相关 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 指定选择文件的按钮容器,不指定则不创建按钮。 + * + * * `id` {Seletor|dom} 指定选择文件的按钮容器,不指定则不创建按钮。**注意** 这里虽然写的是 id, 但是不是只支持 id, 还支持 class, 或者 dom 节点。 + * * `label` {String} 请采用 `innerHTML` 代替 + * * `innerHTML` {String} 指定按钮文字。不指定时优先从指定的容器中看是否自带文字。 + * * `multiple` {Boolean} 是否开起同时选择多个文件能力。 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 指定接受哪些类型的文件。 由于目前还有ext转mimeType表,所以这里需要分开指定。 + * + * * `title` {String} 文字描述 + * * `extensions` {String} 允许的文件后缀,不带点,多个用逗号分割。 + * * `mimeTypes` {String} 多个用逗号分割。 + * + * 如: + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 添加文件选择按钮,如果一个按钮不够,需要调用此方法来添加。参数跟[options.pick](#WebUploader:Uploader:options)一致。 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '选择文件' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 构造器。 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 默认选项。 + Image.options = { + + // 默认的图片处理质量 + quality: 90, + + // 是否裁剪 + crop: false, + + // 是否保留头部信息 + preserveHeaders: false, + + // 是否允许放大。 + allowMagnify: false + }; + + // 继承RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 根据要处理的文件大小来节流,一次不能处理太多,会卡。 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 配置生成缩略图的选项。 + * + * 默认为: + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 70, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: true, + * + * // 是否允许裁剪。 + * crop: true, + * + * // 为空的话则保留原有图片格式。 + * // 否则强制转换成指定的类型。 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 为空的话则保留原有图片格式。 + // 否则强制转换成指定的类型。 + // IE 8下面 base64 大小不能超过 32K 否则预览失败,而非 jpeg 编码的图片很可 + // 能会超过 32k, 所以这里设置成预览的时候都是 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 配置压缩的图片的选项。如果此选项为`false`, 则图片在上传前不进行压缩。 + * + * 默认为: + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 90, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: false, + * + * // 是否允许裁剪。 + * crop: false, + * + * // 是否保留头部meta信息。 + * preserveHeaders: true, + * + * // 如果发现压缩后文件大小比原来还大,则使用原来图片 + * // 此属性可能会影响图片自动纠正功能 + * noCompressIfLarger: false, + * + * // 单位字节,如果图片大小小于此值,不会采用压缩。 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 生成缩略图,此过程为异步,所以需要传入`callback`。 + * 通常情况在图片加入队里后调用此方法来生成预览图以增强交互效果。 + * + * 当 width 或者 height 的值介于 0 - 1 时,被当成百分比使用。 + * + * `callback`中可以接收到两个参数。 + * * 第一个为error,如果生成缩略图有错误,此error将为真。 + * * 第二个为ret, 缩略图的Data URL值。 + * + * **注意** + * Date URL在IE6/7中不支持,所以不用调用此方法了,直接显示一张暂不支持预览图片好了。 + * 也可以借助服务端,将 base64 数据传给服务端,生成一个临时文件供预览。 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('预览错误'); + * } else { + * $li.append('<img alt="" src="' + ret + '" />'); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 只预览图片格式。 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 如果传入的是object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 当 resize 完后 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 只压缩 jpeg 图片格式。 + // gif 可能会丢失针 + // bmp png 基本上尺寸都不大,且压缩比比较小。 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 移动端 UC / qq 浏览器的无图模式下 + // ctx.getImageData 处理大图的时候会报 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 如果压缩后,比原来还大则不用压缩后的。 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 标记,避免重复压缩。 + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 出错了直接继续,让其上传原始图片 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 文件属性封装 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 文件类 + * @class File + * @constructor 构造函数 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 + */ + function WUFile( source ) { + + /** + * 文件名,包括扩展名(后缀) + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 文件体积(字节) + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 文件最后修改日期 + * @property lastModifiedDate + * @type {int} + * @default 当前时间戳 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 文件ID,每个对象具有唯一ID,与文件名无关 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 文件扩展名,通过文件名获取,例如test.png的扩展名为png + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 状态文字说明。在不同的status语境下有不同的用途。 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 存储文件状态,防止通过属性直接修改 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 设置状态,状态变化时会触发`change`事件。 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status) + * @param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 文件状态变化 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 获取文件状态 + * @return {File.Status} + * @example + 文件状态具体包括以下几种类型: + { + // 初始化 + INITED: 0, + // 已入队列 + QUEUED: 1, + // 正在上传 + PROGRESS: 2, + // 上传出错 + ERROR: 3, + // 上传成功 + COMPLETE: 4, + // 上传取消 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 获取文件原始信息。 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 文件状态值,具体包括以下几种类型: + * * `inited` 初始状态 + * * `queued` 已经进入队列, 等待上传 + * * `progress` 上传中 + * * `complete` 上传完成。 + * * `error` 上传出错,可重试 + * * `interrupt` 上传中断,可续传。 + * * `invalid` 文件不合格,不能重试上传。会自动从队列中移除。 + * * `cancelled` 文件被移除。 + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 初始状态 + QUEUED: 'queued', // 已经进入队列, 等待上传 + PROGRESS: 'progress', // 上传中 + ERROR: 'error', // 上传出错,可重试 + COMPLETE: 'complete', // 上传完成。 + CANCELLED: 'cancelled', // 上传取消。 + INTERRUPT: 'interrupt', // 上传中断,可续传。 + INVALID: 'invalid' // 文件不合格,不能重试上传。 + }; + + return WUFile; + }); + + /** + * @fileOverview 文件队列 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 文件队列, 用来存储各个状态中的文件。 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 统计文件数。 + * * `numOfQueue` 队列中的文件数。 + * * `numOfSuccess` 上传成功的文件数 + * * `numOfCancel` 被取消的文件数 + * * `numOfProgress` 正在上传中的文件数 + * * `numOfUploadFailed` 上传错误的文件数。 + * * `numOfInvalid` 无效的文件数。 + * * `numofDeleted` 被移除的文件数。 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 上传队列,仅包括等待上传的文件 + this._queue = []; + + // 存储所有文件 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 将新文件加入对队列尾部 + * + * @method append + * @param {File} file 文件对象 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 将新文件加入对队列头部 + * + * @method prepend + * @param {File} file 文件对象 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 获取文件对象 + * + * @method getFile + * @param {String} fileId 文件ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 从队列中取出一个指定状态的文件。 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [文件状态值](#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 对队列进行排序,能够控制文件上传顺序。 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 排序方法 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [文件状态值](#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 在队列中删除文件。 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 文件对象。 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 队列 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept中的中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 如果当前不是html5运行时,那就算了。 + // 不执行后续操作 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 创建一个 html5 运行时的 placeholder + // 以至于外部添加原生 File 对象的时候能正确包裹一下供 webuploader 使用。 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 为了支持外部直接添加一个原生File对象。 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 判断文件是否可以被加入队列 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 如果名字中有后缀,才做后缀白名单处理。 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File对象 + * @description 当文件被加入队列之前触发,此事件的handler返回值为`false`,则此文件不会被添加进入队列。 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File对象 + * @description 当文件被加入队列以后触发。 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 不过类型判断允许不允许,先派送 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 类型不匹配,则派送错误事件,并返回。 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 数组,内容为原始File(lib/File)对象。 + * @description 当一批文件添加进队列以后触发。 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 对象 数组 + * @description 添加文件到队列 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File对象 + * @description 当文件被移除队列后触发。 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 返回指定状态的文件集合,不传参数将返回所有状态的文件。 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 重试上传,重试指定文件,或者从出错的文件开始重新上传。 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 排序队列中的文件,在上传之前调整可以控制上传顺序。 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 当 uploader 被重置的时候触发。 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 重置uploader。目前只重置了队列。 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 添加获取Runtime相关信息的方法。 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 指定运行时启动顺序。默认会想尝试 html5 是否支持,如果支持则使用 html5, 否则则使用 flash. + * + * 可以将此值设置成 `flash`,来强制使用 flash 运行时。 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 预测Uploader将采用哪个`Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 跨域时,是否允许携带cookie, 只有html5 runtime才有效 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2分钟 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 添加Blob, 只能添加一次,最后一次有效。 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 添加其他字段 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 让Transport具备事件功能。 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 负责文件上传相关。 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 添加默认配置项 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 是否允许在文件传输时提前把下一个文件准备好。 + * 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 + * 如果能提前在当前文件传输期处理,可以节省总体耗时。 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 是否要分片处理大文件上传。 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 如果要分片,分多大一片? 默认大小为5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 如果某个分片由于网络问题出错,允许自动重传多少次? + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 上传并发数。允许同时最大上传进程数。 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 文件上传请求的参数表,每次发送都会发送此对象中的参数。 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 设置文件上传域的name。 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 文件上传方式,`POST`或者`GET`。 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 是否已二进制的流的方式发送文件,这样整个上传内容`php://input`都为文件内容, + * 其他参数在$_GET数组中。 + */ + }); + + // 负责将文件切片。 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 记录当前正在传的数据,跟threads相关 + this.pool = []; + + // 缓存分好片的文件。 + this.stack = []; + + // 缓存即将上传的文件。 + this.pending = []; + + // 跟踪还有多少分片在上传中但是没有完成上传。 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 把其他块取消了。 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 当开始上传流程时触发。 + * @for Uploader + */ + + /** + * 开始上传。此方法可以从初始状态调用开始上传流程,也可以从暂停状态调用,继续上传流程。 + * + * 可以指定开始某一个文件。 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 移出invalid的文件 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 如果指定了开始某个文件,则只开始指定文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 之前暂停过。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 如果有暂停的,则续传 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 当开始上传流程暂停时触发。 + * @for Uploader + */ + + /** + * 暂停上传。第一个参数为是否中断上传当前正在上传的文件。 + * + * 如果第一个参数是文件,则只暂停指定文件。 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 如果只是暂停某个文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 只 abort 指定的文件。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 标记文件状态为已取消, 同时将中断文件传输。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 判断`Uplaode`r是否正在上传中。 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 掉过一个文件上传,直接标记指定文件为已上传状态。 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 当所有文件上传结束时触发。 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 上一个promise还没有结束,则等待完成后再执行。 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 还有位置,且还有文件要处理的话。 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 有可能是reject过来的,所以要检测val的类型。 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 没有要上传的了,且没有正在传输的了。 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 把已经处理完了的,或者,状态为非 progress(上传中)、 + // interupt(暂停中) 的移除。 + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 如果当前文件还有没有需要传输的,则直接返回剩下的。 + if ( (act = this._getStack()) ) { + + // 是否提前准备下一个文件 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 否则,如果正在运行,则准备下一个文件,并等待完成后返回下个分片。 + } else if ( me.runing ) { + + // 如果缓存中有,则直接在缓存中取,没有则去queue中取。 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 文件可能还在prepare中,也有可能已经完全准备好了。 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File对象 + * @description 某个文件开始上传前触发,一个文件只会触发一次。 + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 有可能文件被skip掉了。文件被skip掉后,状态坑定不是Queued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 如果还在pending中,则替换成文件本身。 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file的钩子就有错误发生。 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 让出位置了,可以让其他分片开始上传 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 有可能在 before-send-file 的 promise 期间改变了文件状态。 + // 如:暂停,取消 + // 我们不能中断 promise, 但是可以在 promise 完后,不做上传操作。 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 如果是中断,则还需要放回去。 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 如果没有分片,则直接使用原始的。 + // 不会丢失content-type信息。 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 每个分片发送之前可能要做些异步的事情。 + promise = me.request( 'before-send', block, function() { + + // 有可能文件已经上传出错了,所以不需要再传输了。 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 如果为fail了,则跳过此分片。 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 默认的上传参数,可以扩展此对象来控制上传参数。 + * @param {Object} headers 可以扩展此对象来控制上传头部。 + * @description 当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。 + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 服务端的返回数据,json格式,如果服务端不是json格式,从ret._raw中取数据,自行解析。 + * @description 当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为`false`, 则此文件将派送`server`类型的`uploadError`事件。 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File对象 + * @param {Number} percentage 上传进度 + * @description 上传过程中触发,携带上传进度。 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File对象 + * @param {String} reason 出错的code + * @description 当文件上传出错时触发。 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File对象 + * @param {Object} response 服务端返回的数据 + * @description 当文件上传成功时触发。 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File对象 + * @description 不管成功或者失败,文件上传完成时触发。 + * @for Uploader + */ + + // 做上传操作。 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 广播上传进度。以文件为单位。 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 用来询问,是否返回的结果是有错误的。 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 服务端响应了,不代表成功了,询问是否响应正确。 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 尝试重试,然后广播文件上传出错。 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 自动重试 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 上传成功 + tr.on( 'load', function() { + var reason; + + // 如果非预期,转向上传出错。 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 全部上传完成。 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 配置默认的上传字段。 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 在发送之间可以添加字段什么的。。。 + // 如果默认的字段不够使用,可以通过监听此事件来扩展 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 开始发送。 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 完成上传。 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 如果外部已经标记为invalid什么的,不再改状态。 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 各种验证,包括文件总大小是否超出、单文件是否超出和文件是否重复。 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 错误类型。 + * @description 当validate不通过时,会以派送错误事件的形式通知调用者。通过`upload.on('error', handler)`可以捕获到此类错误,目前有以下错误会在特定的情况下派送错来。 + * + * * `Q_EXCEED_NUM_LIMIT` 在设置了`fileNumLimit`且尝试给`uploader`添加的文件数量超出这个值时派送。 + * * `Q_EXCEED_SIZE_LIMIT` 在设置了`Q_EXCEED_SIZE_LIMIT`且尝试给`uploader`添加的文件总大小超出这个值时派送。 + * * `Q_TYPE_DENIED` 当文件类型不满足时触发。。 + * @for Uploader + */ + + // 暴露给外面的api + api = { + + // 添加验证器 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 移除验证器 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 在Uploader初始化的时候启动Validators的初始化 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总数量, 超出则不允许加入队列。 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证单个文件大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 去重, 根据文件名字、文件大小和最后修改时间来生成hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 已经重复了 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 不需要连接其他程序,直接执行callback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 注册Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 注册html5运行时。 + // 只有在支持的前提下注册。 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 注意只有 chrome 支持。 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 只处理框内的。 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 只处理框内的。 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 如果是页面内拖拽,还不能处理,不阻止事件。 + // 此处 ie11 下会报参数错误, + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 如果传入 callback 则去查看文件夹,否则只管当前文件夹。 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 为了保证顺序。 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 还没 init 就调用 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp的mimeTypes中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 不阻止非文件粘贴(文字粘贴)的事件冒泡 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox不支持单独指定后缀 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 更安全的方式调用,比如android里面就能把context改成其他的对象。 + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android不支持直接new Blob, 只能借助blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 抽出来主要是为了解决android下面canvas.toDataUrl不支持jpeg. + // 你得到的结果是png. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 代码来自于:https://github.com/blueimp/JavaScript-Load-Image + * 暂时项目中只用了orientation. + * + * 去除了 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF解析 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 尝试读取缩略图 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 标记是否被修改过。 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 读取meta信息。 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 解决 orientation 的问题。 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob需要重新生成。 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 释放内存。非常重要,否则释放不了image的内存。 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 交换width, height的值。 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 不允许放大。 + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 如果不是ios, 不需要这么复杂! + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * @fileOverview Transport + * @todo 支持chunked传输,优势: + * 可以将大文件分成小块,挨个传输,可以提高大文件成功率,当失败的时候,也只需要重传那小部分, + * 而不需要重头再传一次。另外断点续传也需要用chunked方式。 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 强制设置成 content-type 为文件流。 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android直接发送blob会导致服务端接收到的是空文件。 + // bug详情。 + // https://code.google.com/p/android/issues/detail?id=39882 + // 所以先用fileReader读取出来再通过arraybuffer的方式发送。 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview 只有html5实现的文件版本。 + */ + define('preset/html5only',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/image', + 'runtime/html5/transport' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/html5only' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.min.js new file mode 100644 index 0000000..4b83edd --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e<f;)if(c=a[e],c.cb.apply(c.ctx2,b)===!1){d=!0;break}return!d}var e,f=a.$,g=[].slice,h=/\s+/;return e={on:function(a,b,d){var e,f=this;return b?(e=this._events||(this._events=[]),c(a,b,function(a,b){var c={e:a};c.cb=b,c.ctx=d,c.ctx2=d||f,c.id=e.length,e.push(c)}),this):this},once:function(a,b,d){var e=this;return b?(c(a,b,function(a,b){var c=function(){return e.off(a,c),b.apply(d||e,arguments)};c._cb=b,e.on(a,c,d)}),e):e},off:function(a,d,e){var g=this._events;return g?a||d||e?(c(a,d,function(a,c){f.each(b(g,a,c,e),function(){delete g[this.id]})}),this):(this._events=[],this):this},trigger:function(a){var c,e,f;return this._events&&a?(c=g.call(arguments,1),e=b(this._events,a),f=b(this._events,"all"),d(e,c)&&d(f,arguments)):this}},f.extend({installTo:function(a){return f.extend(a,e)}},e)}),b("uploader",["base","mediator"],function(a,b){function c(a){this.options=d.extend(!0,{},c.options,a),this._init(this.options)}var d=a.$;return c.options={},b.installTo(c.prototype),d.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",sort:"sort-files",removeFile:"remove-file",cancelFile:"cancel-file",skipFile:"skip-file",retry:"retry",isInProgress:"is-in-progress",makeThumb:"make-thumb",md5File:"md5-file",getDimension:"get-dimension",addButton:"add-btn",predictRuntimeType:"predict-runtime-type",refresh:"refresh",disable:"disable",enable:"enable",reset:"reset"},function(a,b){c.prototype[a]=function(){return this.request(b,arguments)}}),d.extend(c.prototype,{state:"pending",_init:function(a){var b=this;b.request("init",a,function(){b.state="ready",b.trigger("ready")})},option:function(a,b){var c=this.options;return arguments.length>1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("按钮指定错误");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size<h||b._compressed?void 0:(g=e.extend({},g),f=a.Deferred(),d=new c(g),f.always(function(){d.destroy(),d=null}),d.once("error",f.reject),d.once("load",function(){var a=g.width,c=g.height;b._info=b._info||d.info(),b._meta=b._meta||d.meta(),1>=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.size<c)&&(b.source=a,b.size=a.size,b.trigger("resize",a.size,c)),b._compressed=!0,f.resolve()}catch(e){f.resolve()}}),b._info&&d.info(b._info),b._meta&&d.meta(b._meta),d.loadFromBlob(b.source),f.promise())}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length<e.threads&&(c=d._nextBlock())?(d._trigged=!1,b=function(b){d._promise=null,b&&b.file&&d._startSend(b),a.nextTick(d.__tick)},d._promise=g(c)?c.always(b):b(c)):d.remaning||d._getStats().numOfQueue||d._getStats().numofInterrupt||(d.runing=!1,d._trigged||a.nextTick(function(){d.owner.trigger("uploadFinished")}),d._trigged=!0))},_putback:function(a){var b;a.cuted.unshift(a),b=this.stack.indexOf(a.cuted),~b||this.stack.unshift(a.cuted)},_getStack:function(){for(var a,b=0;a=this.stack[b++];){if(a.has()&&a.file.getStatus()===h.PROGRESS)return a;(!a.has()||a.file.getStatus()!==h.PROGRESS&&a.file.getStatus()!==h.INTERRUPT)&&this.stack.splice(--b,1)}return null},_nextBlock:function(){var a,b,c,d,f=this,h=f.options;return(a=this._getStack())?(h.prepareNextFile&&!f.pending.length&&f._prepareNextFile(),a.shift()):f.runing?(!f.pending.length&&f._getStats().numOfQueue&&f._prepareNextFile(),b=f.pending.shift(),c=function(b){return b?(a=e(b,h.chunked?h.chunkSize:0),f.stack.push(a),a.shift()):null},g(b)?(d=b.file,b=b[b.pipe?"pipe":"then"](c),b.file=d,b):c(b)):void 0},_prepareNextFile:function(){var a,b=this,c=b.request("fetch-file"),d=b.pending;c&&(a=b.request("before-send-file",c,function(){return c.getStatus()===h.PROGRESS||c.getStatus()===h.INTERRUPT?c:b._finishFile(c)}),b.owner.trigger("uploadStart",c),c.setStatus(h.PROGRESS),a.file=c,a.done(function(){var b=f.inArray(a,d);~b&&d.splice(b,1,c)}),a.fail(function(a){c.setStatus(h.ERROR,a),b.owner.trigger("uploadError",c,a),b.owner.trigger("uploadComplete",c)}),d.push(a))},_popBlock:function(a){var b=f.inArray(a,this.pool);this.pool.splice(b,1),a.file.remaning--,this.remaning--},_startSend:function(b){var c,d=this,e=b.file;return e.getStatus()!==h.PROGRESS?void(e.getStatus()===h.INTERRUPT&&d._putback(b)):(d.pool.push(b),d.remaning++,b.blob=1===b.chunks?e.source:e.source.slice(b.start,b.end),c=d.request("before-send",b,function(){e.getStatus()===h.PROGRESS?d._doSend(b):(d._popBlock(b),a.nextTick(d.__tick))}),void c.fail(function(){1===e.remaning?d._finishFile(e).always(function(){b.percentage=1,d._popBlock(b),d.owner.trigger("uploadComplete",e),a.nextTick(d.__tick)}):(b.percentage=1,d.updateFileProgress(e),d._popBlock(b),a.nextTick(d.__tick))}))},_doSend:function(b){var c,e,g=this,i=g.owner,j=g.options,k=b.file,l=new d(j),m=f.extend({},j.formData),n=f.extend({},j.headers);b.transport=l,l.on("destroy",function(){delete b.transport,g._popBlock(b),a.nextTick(g.__tick)}),l.on("progress",function(a){b.percentage=a,g.updateFileProgress(k)}),c=function(a){var c;return e=l.getResponseAsJson()||{},e._raw=l.getResponse(),c=function(b){a=b},i.trigger("uploadAccept",b,e,c)||(a=a||"server"),a},l.on("error",function(a,d){b.retried=b.retried||0,b.chunks>1&&~"http,abort".indexOf(a)&&b.retried<j.chunkRetry?(b.retried++,l.send()):(d||"server"!==a||(a=c(a)),k.setStatus(h.ERROR,a),i.trigger("uploadError",k,a),i.trigger("uploadComplete",k))}),l.on("load",function(){var a;return(a=c())?void l.trigger("error",a,!0):void(1===k.remaning?g._finishFile(k,e):l.destroy())}),m=f.extend(m,{id:k.id,name:k.name,type:k.type,lastModifiedDate:k.lastModifiedDate,size:k.size}),b.chunks>1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b) +}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice;return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/util",["base"],function(b){var c=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL,d=b.noop,e=d;return c&&(d=function(){return c.createObjectURL.apply(c,arguments)},e=function(){return c.revokeObjectURL.apply(c,arguments)}),{createObjectURL:d,revokeObjectURL:e,dataURL2Blob:function(a){var b,c,d,e,f,g;for(g=a.split(","),b=~g[0].indexOf("base64")?atob(g[1]):decodeURIComponent(g[1]),d=new ArrayBuffer(b.length),c=new Uint8Array(d),e=0;e<b.length;e++)c[e]=b.charCodeAt(e);return f=g[0].split(":")[1].split(";")[0],this.arrayBufferToBlob(d,f)},dataURL2ArrayBuffer:function(a){var b,c,d,e;for(e=a.split(","),b=~e[0].indexOf("base64")?atob(e[1]):decodeURIComponent(e[1]),c=new Uint8Array(b.length),d=0;d<b.length;d++)c[d]=b.charCodeAt(d);return c.buffer},arrayBufferToBlob:function(b,c){var d,e=a.BlobBuilder||a.WebKitBlobBuilder;return e?(d=new e,d.append(b),d.getBlob(c)):new Blob([b],c?{type:c}:{})},canvasToDataUrl:function(a,b,c){return a.toDataURL(b,c/100)},parseMeta:function(a,b){b(!1,{})},updateImageHead:function(a){return a}}}),b("runtime/html5/imagemeta",["runtime/html5/util"],function(a){var b;return b={parsers:{65505:[]},maxMetaDataSize:262144,parse:function(a,b){var c=this,d=new FileReader;d.onload=function(){b(!1,c._parse(this.result)),d=d.onload=d.onerror=null},d.onerror=function(a){b(a.message),d=d.onload=d.onerror=null},a=a.slice(0,c.maxMetaDataSize),d.readAsArrayBuffer(a.getSource())},_parse:function(a,c){if(!(a.byteLength<6)){var d,e,f,g,h=new DataView(a),i=2,j=h.byteLength-4,k=i,l={};if(65496===h.getUint16(0)){for(;j>i&&(d=h.getUint16(i),d>=65504&&65519>=d||65534===d)&&(e=h.getUint16(i+2)+2,!(i+e>h.byteLength));){if(f=b.parsers[d],!c&&f)for(g=0;g<f.length;g+=1)f[g].call(b,h,i,e,l);i+=e,k=i}k>6&&(l.imageHead=a.slice?a.slice(2,k):new Uint8Array(a).subarray(2,k))}return l}},updateImageHead:function(a,b){var c,d,e,f=this._parse(a,!0);return e=2,f.imageHead&&(e=2+f.imageHead.byteLength),d=a.slice?a.slice(e):new Uint8Array(a).subarray(e),c=new Uint8Array(b.byteLength+2+d.byteLength),c[0]=255,c[1]=216,c.set(new Uint8Array(b),2),c.set(new Uint8Array(d),b.byteLength+2),c.buffer}},a.parseMeta=function(){return b.parse.apply(b,arguments)},a.updateImageHead=function(){return b.updateImageHead.apply(b,arguments)},b}),b("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(a,b){var c={};return c.ExifMap=function(){return this},c.ExifMap.prototype.map={Orientation:274},c.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},c.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},c.exifTagTypes[7]=c.exifTagTypes[1],c.getExifValue=function(b,d,e,f,g,h){var i,j,k,l,m,n,o=c.exifTagTypes[f];if(!o)return void a.log("Invalid Exif data: Invalid tag type.");if(i=o.size*g,j=i>4?d+b.getUint32(e+8,h):e+8,j+i>b.byteLength)return void a.log("Invalid Exif data: Invalid data offset.");if(1===g)return o.getValue(b,j,h);for(k=[],l=0;g>l;l+=1)k[l]=o.getValue(b,j+l*o.size,h);if(o.ascii){for(m="",l=0;l<k.length&&(n=k[l],"\x00"!==n);l+=1)m+=n;return m}return k},c.parseExifTag=function(a,b,d,e,f){var g=a.getUint16(d,e);f.exif[g]=c.getExifValue(a,b,d,a.getUint16(d+2,e),a.getUint32(d+4,e),e)},c.parseExifTags=function(b,c,d,e,f){var g,h,i;if(d+6>b.byteLength)return void a.log("Invalid Exif data: Invalid directory offset.");if(g=b.getUint16(d,e),h=d+2+12*g,h+4>b.byteLength)return void a.log("Invalid Exif data: Invalid directory size.");for(i=0;g>i;i+=1)this.parseExifTag(b,c,d+2+12*i,e,f);return b.getUint32(h,e)},c.parseExifData=function(b,d,e,f){var g,h,i=d+10;if(1165519206===b.getUint32(d+4)){if(i+8>b.byteLength)return void a.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(d+8))return void a.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(i)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void a.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(i+2,g))return void a.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(i+4,g),f.exif=new c.ExifMap,h=c.parseExifTags(b,i,i+h,g,f)}},b.parsers[65505].push(c.parseExifData),c}),b("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(a,b,c){var d="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D";return b.register("Image",{modified:!1,init:function(){var a=this,b=new Image;b.onload=function(){a._info={type:a.type,width:this.width,height:this.height},a._metas||"image/jpeg"!==a.type?a.owner.trigger("load"):c.parseMeta(a._blob,function(b,c){a._metas=c,a.owner.trigger("load")})},b.onerror=function(){a.owner.trigger("error")},a._img=b},loadFromBlob:function(a){var b=this,d=b._img;b._blob=a,b.type=a.type,d.src=c.createObjectURL(a.getSource()),b.owner.once("load",function(){c.revokeObjectURL(d.src)})},resize:function(a,b){var c=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,c,a,b),this._blob=null,this.modified=!0,this.owner.trigger("complete","resize")},crop:function(a,b,c,d,e){var f=this._canvas||(this._canvas=document.createElement("canvas")),g=this.options,h=this._img,i=h.naturalWidth,j=h.naturalHeight,k=this.getOrientation();e=e||1,f.width=c,f.height=d,g.preserveHeaders||this._rotate2Orientaion(f,k),this._renderImageToCanvas(f,h,-a,-b,i*e,j*e),this._blob=null,this.modified=!0,this.owner.trigger("complete","crop")},getAsBlob:function(a){var b,d=this._blob,e=this.options;if(a=a||this.type,this.modified||this.type!==a){if(b=this._canvas,"image/jpeg"===a){if(d=c.canvasToDataUrl(b,a,e.quality),e.preserveHeaders&&this._metas&&this._metas.imageHead)return d=c.dataURL2ArrayBuffer(d),d=c.updateImageHead(d,this._metas.imageHead),d=c.arrayBufferToBlob(d,a)}else d=c.canvasToDataUrl(b,a);d=c.dataURL2Blob(d)}return d},getAsDataUrl:function(a){var b=this.options;return a=a||this.type,"image/jpeg"===a?c.canvasToDataUrl(this._canvas,a,b.quality):this._canvas.toDataURL(a)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},destroy:function(){var a=this._canvas;this._img.onload=null,a&&(a.getContext("2d").clearRect(0,0,a.width,a.height),a.width=a.height=0,this._canvas=null),this._img.src=d,this._img=this._blob=null},_resize:function(a,b,c,d){var e,f,g,h,i,j=this.options,k=a.width,l=a.height,m=this.getOrientation();~[5,6,7,8].indexOf(m)&&(c^=d,d^=c,c^=d),e=Math[j.crop?"max":"min"](c/k,d/l),j.allowMagnify||(e=Math.min(1,e)),f=k*e,g=l*e,j.crop?(b.width=c,b.height=d):(b.width=f,b.height=g),h=(b.width-f)/2,i=(b.height-g)/2,j.preserveHeaders||this._rotate2Orientaion(b,m),this._renderImageToCanvas(b,a,h,i,f,g)},_rotate2Orientaion:function(a,b){var c=a.width,d=a.height,e=a.getContext("2d");switch(b){case 5:case 6:case 7:case 8:a.width=d,a.height=c}switch(b){case 2:e.translate(c,0),e.scale(-1,1);break;case 3:e.translate(c,d),e.rotate(Math.PI);break;case 4:e.translate(0,d),e.scale(1,-1);break;case 5:e.rotate(.5*Math.PI),e.scale(1,-1);break;case 6:e.rotate(.5*Math.PI),e.translate(0,-d);break;case 7:e.rotate(.5*Math.PI),e.translate(c,-d),e.scale(-1,1);break;case 8:e.rotate(-.5*Math.PI),e.translate(-c,0)}},_renderImageToCanvas:function(){function b(a,b,c){var d,e,f,g=document.createElement("canvas"),h=g.getContext("2d"),i=0,j=c,k=c;for(g.width=1,g.height=c,h.drawImage(a,0,0),d=h.getImageData(0,0,1,c).data;k>i;)e=d[4*(k-1)+3],0===e?j=k:i=k,k=j+i>>1;return f=k/c,0===f?1:f}function c(a){var b,c,d=a.naturalWidth,e=a.naturalHeight;return d*e>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-d+1,0),0===c.getImageData(0,0,1,1).data[3]):!1}return a.os.ios?a.os.ios>=7?function(a,c,d,e,f,g){var h=c.naturalWidth,i=c.naturalHeight,j=b(c,h,i);return a.getContext("2d").drawImage(c,0,0,h*j,i*j,d,e,f,g)}:function(a,d,e,f,g,h){var i,j,k,l,m,n,o,p=d.naturalWidth,q=d.naturalHeight,r=a.getContext("2d"),s=c(d),t="image/jpeg"===this.type,u=1024,v=0,w=0;for(s&&(p/=2,q/=2),r.save(),i=document.createElement("canvas"),i.width=i.height=u,j=i.getContext("2d"),k=t?b(d,p,q):1,l=Math.ceil(u*g/p),m=Math.ceil(u*h/q/k);q>v;){for(n=0,o=0;p>n;)j.clearRect(0,0,u,u),j.drawImage(d,-n,-v),r.drawImage(i,0,0,u,u,e+o,f+w,l,m),n+=u,o+=l;v+=u,w+=m}r.restore(),i=j=null}:function(b){var c=a.slice(arguments,1),d=b.getContext("2d");d.drawImage.apply(d,c)}}()})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("preset/html5only",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/image","runtime/html5/transport"],function(a){return a}),b("webuploader",["preset/html5only"],function(a){return a}),c("webuploader")}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.js new file mode 100644 index 0000000..c805c9a --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.js @@ -0,0 +1,8106 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。 + * + * AMD API 内部的简单不完全实现,请忽略。只有当WebUploader被合并成一个文件的时候才会引入。 + */ +(function( root, factory ) { + var modules = {}, + + // 内部require, 简单不完全实现。 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 如果deps不是数组,则直接返回指定module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 内部define,暂时不支持不指定id. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 设置module, 兼容CommonJs写法。 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 根据id获取module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 将所有modules,将路径ids装换成对象。 + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 操作相关 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 使用jQuery的Promise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 基础类方法。 + */ + + /** + * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。 + * + * As you know, Web Uploader的每个文件都是用过[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)规范中的`define`组织起来的, 每个Module都会有个module id. + * 默认module id为该文件的路径,而此路径将会转化成名字空间存放在WebUploader中。如: + * + * * module `base`:WebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 以下文档中对类的使用可能省略掉了`WebUploader`前缀。 + * @module WebUploader + * @title WebUploader API文档 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 反科里化 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 基础类,提供一些简单常用的方法。 + * @class Base + */ + return { + + /** + * @property {String} version 当前版本号。 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 引用依赖的jQuery或者Zepto对象。 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 简单的浏览器检查结果。 + * + * * `webkit` webkit版本号,如果浏览器为非webkit内核,此属性为`undefined`。 + * * `chrome` chrome浏览器版本号,如果浏览器为chrome,此属性为`undefined`。 + * * `ie` ie浏览器版本号,如果浏览器为非ie,此属性为`undefined`。**暂不支持ie10+** + * * `firefox` firefox浏览器版本号,如果浏览器为非firefox,此属性为`undefined`。 + * * `safari` safari浏览器版本号,如果浏览器为非safari,此属性为`undefined`。 + * * `opera` opera浏览器版本号,如果浏览器为非opera,此属性为`undefined`。 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 操作系统检查结果。 + * + * * `android` 如果在android浏览器环境下,此值为对应的android版本号,否则为`undefined`。 + * * `ios` 如果在ios浏览器环境下,此值为对应的ios版本号,否则为`undefined`。 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 实现类与类之间的继承。 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 父类 + * @param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。 + * @param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。 + * @param {Object} [statics] 静态属性或方法。 + * @return {Class} 返回子类。 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 因为没有指定构造器,父类的构造器将会执行。 + * var instance = new Manager(); // => Super + * + * // 继承子父类的方法 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 子类的__super__属性指向父类 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 复制静态方法 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 让子类的__super__属性指向父类。 + child.__super__ = Super.prototype; + + // 构建原型,添加原型方法或属性。 + // 暂时用Object.create实现。 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 一个不做任何事情的方法。可以用来赋值给默认的callback. + * @method noop + */ + noop: noop, + + /** + * 返回一个新的方法,此方法将已指定的`context`来执行。 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 引用Console.log如果存在的话,否则引用一个[空函数noop](#WebUploader:Base.noop)。 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 当浏览器不在当前窗口时就停了。 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 被[uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)的数组slice方法。 + * 将用来将非数组对象转化成数组对象。 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 生成唯一的ID + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 格式化文件大小, 输出成带单位的字符串 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 文件大小 + * @param {Number} [pointLength=2] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 事件处理类,可以独立使用,也可以扩展给对象使用。 + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 根据条件过滤出事件handlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 不支持对象,只支持多个event用空格隔开 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 绑定事件。 + * + * `callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如 + * ```javascript + * var obj = {}; + * + * // 使得obj有事件行为 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。 + * 切会影响到`trigger`方法的返回值,为`false`。 + * + * `on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处, + * 就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 事件名,支持多个事件用空格隔开 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 绑定事件,且当handler执行完后,自动解除绑定。 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 事件名 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 解除事件绑定 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 事件名 + * @param {Function} [callback] 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 触发事件 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 事件名 + * @param {*} [...] 任意参数 + * @return {Boolean} 如果handler中return false了,则返回false, 否则返回true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 中介者,它本身是个单例,但可以通过[installTo](#WebUploader:Mediator:installTo)方法,使任何对象具备事件行为。 + * 主要目的是负责模块与模块之间的合作,降低耦合度。 + * + * @class Mediator + */ + return $.extend({ + + /** + * 可以通过这个接口,使任何对象具备事件功能。 + * @method installTo + * @param {Object} obj 需要具备事件行为的对象。 + * @return {Object} 返回obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader上传类 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 上传入口类。 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 开起分片上传。 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets中有相应扩展 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 批量添加纯命令式方法。 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 获取或者设置Uploader配置项。 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 初始状态图片上传前不会压缩 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 修改后图片上传前,尝试将图片压缩到1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 获取文件统计信息。返回一个包含一下信息的对象。 + * * `successNum` 上传成功的文件数 + * * `progressNum` 上传中的文件数 + * * `cancelNum` 被删除的文件数 + * * `invalidNum` 无效的文件数 + * * `uploadFailNum` 上传失败的文件数 + * * `queueNum` 还在队列中的文件数 + * * `interruptNum` 被暂停的文件数 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 调用通过on方法注册的handler. + Mediator.trigger.apply( this, arguments ) === false || + + // 调用opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 调用this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 广播所有uploader的事件。 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 销毁 webuploader 实例 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js将补充此方法的详细文档。 + request: Base.noop + }); + + /** + * 创建Uploader实例,等同于new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 暴露Uploader,可以通过它来扩展业务逻辑。 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 获取对象的第一个key + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 接口类。 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 添加Runtime实现。 + * @param {String} type 类型 + * @param {Runtime} factory 具体Runtime实现。 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 有些类型不能重用,比如filepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 允许runtime没有初始化之前,注册一些方法在初始化后执行。 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 像filePicker只能独立存在,不能公用。 + runtime = runtime || cache.get( null, standalone ); + + // 需要创建 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 来自cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 错误信息 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 类Backbone的事件监听声明,监听uploader实例上的事件 + // widget直接无法监听事件,事件只能通过uploader来传递 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 如果无API响应声明则忽略 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 发送命令。当传入`callback`或者`handler`中返回`promise`时。返回一个当所有`handler`中的promise都完成后完成的新`promise`。 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 扩展Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 默认所有 Uploader.register 了的 widget 都会被加载,如果禁用某一部分,请通过此 option 指定黑名单。 + */ + + // 覆写_init用来初始化widgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred对象 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 如果有callback,则用异步方式。 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 很重要不能删除。删除了会死循环。 + // 保证执行顺序。让callback总是在下一个 tick 中执行。 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 添加组件 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 名称与函数实现的映射 + * @param {object} proto 组件原型,构造函数通过 constructor 属性定义 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 自动生成 map 表。 + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 删除插件,只有在注册时指定了名字的才能被删除。 + * @grammar Uploader.unRegister(name); + * @param {string} name 组件名字 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 删除指定的插件。 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget。 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 指定Drag And Drop拖拽的容器,如果不指定,则不启动。 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 是否禁掉整个页面的拖拽功能,如果不禁用,图片拖进来的时候会默认被浏览器打开。 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 阻止此事件可以拒绝某些类型的文件拖入进来。目前只有 chrome 提供这样的 API,且只能通过 mime-type 验证。 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 检测文件是否全部允许添加。 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 指定监听paste事件的容器,如果不指定,不启用此功能。此功能为通过粘贴来添加截屏的图片。建议设置为`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 如果没有指定 mimetype, 但是知道文件后缀。 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 为了统一化Flash的File和HTML5的File而存在。 + * 以至于要调用Flash里面的File,也可以像调用HTML5版本的File一下。 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 支持其他类型文件的转换。 + // 如果有 mimetype, 但是文件名里面没有找出后缀规律 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('按钮指定错误'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 记录来源。 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 文件选择相关 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 指定选择文件的按钮容器,不指定则不创建按钮。 + * + * * `id` {Seletor|dom} 指定选择文件的按钮容器,不指定则不创建按钮。**注意** 这里虽然写的是 id, 但是不是只支持 id, 还支持 class, 或者 dom 节点。 + * * `label` {String} 请采用 `innerHTML` 代替 + * * `innerHTML` {String} 指定按钮文字。不指定时优先从指定的容器中看是否自带文字。 + * * `multiple` {Boolean} 是否开起同时选择多个文件能力。 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 指定接受哪些类型的文件。 由于目前还有ext转mimeType表,所以这里需要分开指定。 + * + * * `title` {String} 文字描述 + * * `extensions` {String} 允许的文件后缀,不带点,多个用逗号分割。 + * * `mimeTypes` {String} 多个用逗号分割。 + * + * 如: + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 添加文件选择按钮,如果一个按钮不够,需要调用此方法来添加。参数跟[options.pick](#WebUploader:Uploader:options)一致。 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '选择文件' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 构造器。 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 默认选项。 + Image.options = { + + // 默认的图片处理质量 + quality: 90, + + // 是否裁剪 + crop: false, + + // 是否保留头部信息 + preserveHeaders: false, + + // 是否允许放大。 + allowMagnify: false + }; + + // 继承RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 根据要处理的文件大小来节流,一次不能处理太多,会卡。 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 配置生成缩略图的选项。 + * + * 默认为: + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 70, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: true, + * + * // 是否允许裁剪。 + * crop: true, + * + * // 为空的话则保留原有图片格式。 + * // 否则强制转换成指定的类型。 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 为空的话则保留原有图片格式。 + // 否则强制转换成指定的类型。 + // IE 8下面 base64 大小不能超过 32K 否则预览失败,而非 jpeg 编码的图片很可 + // 能会超过 32k, 所以这里设置成预览的时候都是 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 配置压缩的图片的选项。如果此选项为`false`, 则图片在上传前不进行压缩。 + * + * 默认为: + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 90, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: false, + * + * // 是否允许裁剪。 + * crop: false, + * + * // 是否保留头部meta信息。 + * preserveHeaders: true, + * + * // 如果发现压缩后文件大小比原来还大,则使用原来图片 + * // 此属性可能会影响图片自动纠正功能 + * noCompressIfLarger: false, + * + * // 单位字节,如果图片大小小于此值,不会采用压缩。 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 生成缩略图,此过程为异步,所以需要传入`callback`。 + * 通常情况在图片加入队里后调用此方法来生成预览图以增强交互效果。 + * + * 当 width 或者 height 的值介于 0 - 1 时,被当成百分比使用。 + * + * `callback`中可以接收到两个参数。 + * * 第一个为error,如果生成缩略图有错误,此error将为真。 + * * 第二个为ret, 缩略图的Data URL值。 + * + * **注意** + * Date URL在IE6/7中不支持,所以不用调用此方法了,直接显示一张暂不支持预览图片好了。 + * 也可以借助服务端,将 base64 数据传给服务端,生成一个临时文件供预览。 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('预览错误'); + * } else { + * $li.append('<img alt="" src="' + ret + '" />'); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 只预览图片格式。 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 如果传入的是object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 当 resize 完后 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 只压缩 jpeg 图片格式。 + // gif 可能会丢失针 + // bmp png 基本上尺寸都不大,且压缩比比较小。 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 移动端 UC / qq 浏览器的无图模式下 + // ctx.getImageData 处理大图的时候会报 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 如果压缩后,比原来还大则不用压缩后的。 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 标记,避免重复压缩。 + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 出错了直接继续,让其上传原始图片 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 文件属性封装 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 文件类 + * @class File + * @constructor 构造函数 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 + */ + function WUFile( source ) { + + /** + * 文件名,包括扩展名(后缀) + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 文件体积(字节) + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 文件最后修改日期 + * @property lastModifiedDate + * @type {int} + * @default 当前时间戳 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 文件ID,每个对象具有唯一ID,与文件名无关 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 文件扩展名,通过文件名获取,例如test.png的扩展名为png + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 状态文字说明。在不同的status语境下有不同的用途。 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 存储文件状态,防止通过属性直接修改 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 设置状态,状态变化时会触发`change`事件。 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status) + * @param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 文件状态变化 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 获取文件状态 + * @return {File.Status} + * @example + 文件状态具体包括以下几种类型: + { + // 初始化 + INITED: 0, + // 已入队列 + QUEUED: 1, + // 正在上传 + PROGRESS: 2, + // 上传出错 + ERROR: 3, + // 上传成功 + COMPLETE: 4, + // 上传取消 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 获取文件原始信息。 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 文件状态值,具体包括以下几种类型: + * * `inited` 初始状态 + * * `queued` 已经进入队列, 等待上传 + * * `progress` 上传中 + * * `complete` 上传完成。 + * * `error` 上传出错,可重试 + * * `interrupt` 上传中断,可续传。 + * * `invalid` 文件不合格,不能重试上传。会自动从队列中移除。 + * * `cancelled` 文件被移除。 + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 初始状态 + QUEUED: 'queued', // 已经进入队列, 等待上传 + PROGRESS: 'progress', // 上传中 + ERROR: 'error', // 上传出错,可重试 + COMPLETE: 'complete', // 上传完成。 + CANCELLED: 'cancelled', // 上传取消。 + INTERRUPT: 'interrupt', // 上传中断,可续传。 + INVALID: 'invalid' // 文件不合格,不能重试上传。 + }; + + return WUFile; + }); + + /** + * @fileOverview 文件队列 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 文件队列, 用来存储各个状态中的文件。 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 统计文件数。 + * * `numOfQueue` 队列中的文件数。 + * * `numOfSuccess` 上传成功的文件数 + * * `numOfCancel` 被取消的文件数 + * * `numOfProgress` 正在上传中的文件数 + * * `numOfUploadFailed` 上传错误的文件数。 + * * `numOfInvalid` 无效的文件数。 + * * `numofDeleted` 被移除的文件数。 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 上传队列,仅包括等待上传的文件 + this._queue = []; + + // 存储所有文件 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 将新文件加入对队列尾部 + * + * @method append + * @param {File} file 文件对象 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 将新文件加入对队列头部 + * + * @method prepend + * @param {File} file 文件对象 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 获取文件对象 + * + * @method getFile + * @param {String} fileId 文件ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 从队列中取出一个指定状态的文件。 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [文件状态值](#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 对队列进行排序,能够控制文件上传顺序。 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 排序方法 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [文件状态值](#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 在队列中删除文件。 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 文件对象。 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 队列 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept中的中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 如果当前不是html5运行时,那就算了。 + // 不执行后续操作 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 创建一个 html5 运行时的 placeholder + // 以至于外部添加原生 File 对象的时候能正确包裹一下供 webuploader 使用。 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 为了支持外部直接添加一个原生File对象。 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 判断文件是否可以被加入队列 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 如果名字中有后缀,才做后缀白名单处理。 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File对象 + * @description 当文件被加入队列之前触发,此事件的handler返回值为`false`,则此文件不会被添加进入队列。 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File对象 + * @description 当文件被加入队列以后触发。 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 不过类型判断允许不允许,先派送 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 类型不匹配,则派送错误事件,并返回。 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 数组,内容为原始File(lib/File)对象。 + * @description 当一批文件添加进队列以后触发。 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 对象 数组 + * @description 添加文件到队列 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File对象 + * @description 当文件被移除队列后触发。 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 返回指定状态的文件集合,不传参数将返回所有状态的文件。 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 重试上传,重试指定文件,或者从出错的文件开始重新上传。 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 排序队列中的文件,在上传之前调整可以控制上传顺序。 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 当 uploader 被重置的时候触发。 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 重置uploader。目前只重置了队列。 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 添加获取Runtime相关信息的方法。 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 指定运行时启动顺序。默认会想尝试 html5 是否支持,如果支持则使用 html5, 否则则使用 flash. + * + * 可以将此值设置成 `flash`,来强制使用 flash 运行时。 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 预测Uploader将采用哪个`Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 跨域时,是否允许携带cookie, 只有html5 runtime才有效 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2分钟 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 添加Blob, 只能添加一次,最后一次有效。 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 添加其他字段 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 让Transport具备事件功能。 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 负责文件上传相关。 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 添加默认配置项 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 是否允许在文件传输时提前把下一个文件准备好。 + * 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 + * 如果能提前在当前文件传输期处理,可以节省总体耗时。 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 是否要分片处理大文件上传。 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 如果要分片,分多大一片? 默认大小为5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 如果某个分片由于网络问题出错,允许自动重传多少次? + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 上传并发数。允许同时最大上传进程数。 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 文件上传请求的参数表,每次发送都会发送此对象中的参数。 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 设置文件上传域的name。 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 文件上传方式,`POST`或者`GET`。 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 是否已二进制的流的方式发送文件,这样整个上传内容`php://input`都为文件内容, + * 其他参数在$_GET数组中。 + */ + }); + + // 负责将文件切片。 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 记录当前正在传的数据,跟threads相关 + this.pool = []; + + // 缓存分好片的文件。 + this.stack = []; + + // 缓存即将上传的文件。 + this.pending = []; + + // 跟踪还有多少分片在上传中但是没有完成上传。 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 把其他块取消了。 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 当开始上传流程时触发。 + * @for Uploader + */ + + /** + * 开始上传。此方法可以从初始状态调用开始上传流程,也可以从暂停状态调用,继续上传流程。 + * + * 可以指定开始某一个文件。 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 移出invalid的文件 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 如果指定了开始某个文件,则只开始指定文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 之前暂停过。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 如果有暂停的,则续传 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 当开始上传流程暂停时触发。 + * @for Uploader + */ + + /** + * 暂停上传。第一个参数为是否中断上传当前正在上传的文件。 + * + * 如果第一个参数是文件,则只暂停指定文件。 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 如果只是暂停某个文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 只 abort 指定的文件。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 标记文件状态为已取消, 同时将中断文件传输。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 判断`Uplaode`r是否正在上传中。 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 掉过一个文件上传,直接标记指定文件为已上传状态。 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 当所有文件上传结束时触发。 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 上一个promise还没有结束,则等待完成后再执行。 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 还有位置,且还有文件要处理的话。 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 有可能是reject过来的,所以要检测val的类型。 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 没有要上传的了,且没有正在传输的了。 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 把已经处理完了的,或者,状态为非 progress(上传中)、 + // interupt(暂停中) 的移除。 + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 如果当前文件还有没有需要传输的,则直接返回剩下的。 + if ( (act = this._getStack()) ) { + + // 是否提前准备下一个文件 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 否则,如果正在运行,则准备下一个文件,并等待完成后返回下个分片。 + } else if ( me.runing ) { + + // 如果缓存中有,则直接在缓存中取,没有则去queue中取。 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 文件可能还在prepare中,也有可能已经完全准备好了。 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File对象 + * @description 某个文件开始上传前触发,一个文件只会触发一次。 + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 有可能文件被skip掉了。文件被skip掉后,状态坑定不是Queued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 如果还在pending中,则替换成文件本身。 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file的钩子就有错误发生。 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 让出位置了,可以让其他分片开始上传 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 有可能在 before-send-file 的 promise 期间改变了文件状态。 + // 如:暂停,取消 + // 我们不能中断 promise, 但是可以在 promise 完后,不做上传操作。 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 如果是中断,则还需要放回去。 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 如果没有分片,则直接使用原始的。 + // 不会丢失content-type信息。 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 每个分片发送之前可能要做些异步的事情。 + promise = me.request( 'before-send', block, function() { + + // 有可能文件已经上传出错了,所以不需要再传输了。 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 如果为fail了,则跳过此分片。 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 默认的上传参数,可以扩展此对象来控制上传参数。 + * @param {Object} headers 可以扩展此对象来控制上传头部。 + * @description 当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。 + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 服务端的返回数据,json格式,如果服务端不是json格式,从ret._raw中取数据,自行解析。 + * @description 当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为`false`, 则此文件将派送`server`类型的`uploadError`事件。 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File对象 + * @param {Number} percentage 上传进度 + * @description 上传过程中触发,携带上传进度。 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File对象 + * @param {String} reason 出错的code + * @description 当文件上传出错时触发。 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File对象 + * @param {Object} response 服务端返回的数据 + * @description 当文件上传成功时触发。 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File对象 + * @description 不管成功或者失败,文件上传完成时触发。 + * @for Uploader + */ + + // 做上传操作。 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 广播上传进度。以文件为单位。 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 用来询问,是否返回的结果是有错误的。 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 服务端响应了,不代表成功了,询问是否响应正确。 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 尝试重试,然后广播文件上传出错。 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 自动重试 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 上传成功 + tr.on( 'load', function() { + var reason; + + // 如果非预期,转向上传出错。 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 全部上传完成。 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 配置默认的上传字段。 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 在发送之间可以添加字段什么的。。。 + // 如果默认的字段不够使用,可以通过监听此事件来扩展 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 开始发送。 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 完成上传。 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 如果外部已经标记为invalid什么的,不再改状态。 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 各种验证,包括文件总大小是否超出、单文件是否超出和文件是否重复。 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 错误类型。 + * @description 当validate不通过时,会以派送错误事件的形式通知调用者。通过`upload.on('error', handler)`可以捕获到此类错误,目前有以下错误会在特定的情况下派送错来。 + * + * * `Q_EXCEED_NUM_LIMIT` 在设置了`fileNumLimit`且尝试给`uploader`添加的文件数量超出这个值时派送。 + * * `Q_EXCEED_SIZE_LIMIT` 在设置了`Q_EXCEED_SIZE_LIMIT`且尝试给`uploader`添加的文件总大小超出这个值时派送。 + * * `Q_TYPE_DENIED` 当文件类型不满足时触发。。 + * @for Uploader + */ + + // 暴露给外面的api + api = { + + // 添加验证器 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 移除验证器 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 在Uploader初始化的时候启动Validators的初始化 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总数量, 超出则不允许加入队列。 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证单个文件大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 去重, 根据文件名字、文件大小和最后修改时间来生成hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 已经重复了 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Md5 + */ + define('lib/md5',[ + 'runtime/client', + 'mediator' + ], function( RuntimeClient, Mediator ) { + + function Md5() { + RuntimeClient.call( this, 'Md5' ); + } + + // 让 Md5 具备事件功能。 + Mediator.installTo( Md5.prototype ); + + Md5.prototype.loadFromBlob = function( blob ) { + var me = this; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + me.exec( 'loadFromBlob', blob ); + }); + }; + + Md5.prototype.getResult = function() { + return this.exec('getResult'); + }; + + return Md5; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/md5',[ + 'base', + 'uploader', + 'lib/md5', + 'lib/blob', + 'widgets/widget' + ], function( Base, Uploader, Md5, Blob ) { + + return Uploader.register({ + name: 'md5', + + + /** + * 计算文件 md5 值,返回一个 promise 对象,可以监听 progress 进度。 + * + * + * @method md5File + * @grammar md5File( file[, start[, end]] ) => promise + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.md5File( file ) + * + * // 及时显示进度 + * .progress(function(percentage) { + * console.log('Percentage:', percentage); + * }) + * + * // 完成 + * .then(function(val) { + * console.log('md5 result:', val); + * }); + * + * }); + */ + md5File: function( file, start, end ) { + var md5 = new Md5(), + deferred = Base.Deferred(), + blob = (file instanceof Blob) ? file : + this.request( 'get-file', file ).source; + + md5.on( 'progress load', function( e ) { + e = e || {}; + deferred.notify( e.total ? e.loaded / e.total : 1 ); + }); + + md5.on( 'complete', function() { + deferred.resolve( md5.getResult() ); + }); + + md5.on( 'error', function( reason ) { + deferred.reject( reason ); + }); + + if ( arguments.length > 1 ) { + start = start || 0; + end = end || 0; + start < 0 && (start = blob.size + start); + end < 0 && (end = blob.size + end); + end = Math.min( end, blob.size ); + blob = blob.slice( start, end ); + } + + md5.loadFromBlob( blob ); + + return deferred.promise(); + } + }); + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 不需要连接其他程序,直接执行callback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 注册Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 注册html5运行时。 + // 只有在支持的前提下注册。 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 注意只有 chrome 支持。 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 只处理框内的。 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 只处理框内的。 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 如果是页面内拖拽,还不能处理,不阻止事件。 + // 此处 ie11 下会报参数错误, + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 如果传入 callback 则去查看文件夹,否则只管当前文件夹。 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 为了保证顺序。 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 还没 init 就调用 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp的mimeTypes中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 不阻止非文件粘贴(文字粘贴)的事件冒泡 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox不支持单独指定后缀 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 更安全的方式调用,比如android里面就能把context改成其他的对象。 + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android不支持直接new Blob, 只能借助blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 抽出来主要是为了解决android下面canvas.toDataUrl不支持jpeg. + // 你得到的结果是png. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 代码来自于:https://github.com/blueimp/JavaScript-Load-Image + * 暂时项目中只用了orientation. + * + * 去除了 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF解析 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 尝试读取缩略图 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * 这个方式性能不行,但是可以解决android里面的toDataUrl的bug + * android里面toDataUrl('image/jpege')得到的结果却是png. + * + * 所以这里没辙,只能借助这个工具 + * @fileOverview jpeg encoder + */ + define('runtime/html5/jpegencoder',[], function( require, exports, module ) { + + /* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /* + JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + + Basic GUI blocking jpeg encoder + */ + + function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr<nrupper; nr++) { + category[32767+nr] = cat; + bitcode[32767+nr] = []; + bitcode[32767+nr][1] = cat; + bitcode[32767+nr][0] = nr; + } + //Negative numbers + for (var nrneg =-(nrupper-1); nrneg<=-nrlower; nrneg++) { + category[32767+nrneg] = cat; + bitcode[32767+nrneg] = []; + bitcode[32767+nrneg][1] = cat; + bitcode[32767+nrneg][0] = nrupper-1+nrneg; + } + nrlower <<= 1; + nrupper <<= 1; + } + } + + function initRGBYUVTable() { + for(var i = 0; i < 256;i++) { + RGB_YUV_TABLE[i] = 19595 * i; + RGB_YUV_TABLE[(i+ 256)>>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + byteout.push(clt[value]); // write char directly instead of converting later + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i<I8; ++i) + { + d0 = data[dataOff]; + d1 = data[dataOff+1]; + d2 = data[dataOff+2]; + d3 = data[dataOff+3]; + d4 = data[dataOff+4]; + d5 = data[dataOff+5]; + d6 = data[dataOff+6]; + d7 = data[dataOff+7]; + + var tmp0 = d0 + d7; + var tmp7 = d0 - d7; + var tmp1 = d1 + d6; + var tmp6 = d1 - d6; + var tmp2 = d2 + d5; + var tmp5 = d2 - d5; + var tmp3 = d3 + d4; + var tmp4 = d3 - d4; + + /* Even part */ + var tmp10 = tmp0 + tmp3; /* phase 2 */ + var tmp13 = tmp0 - tmp3; + var tmp11 = tmp1 + tmp2; + var tmp12 = tmp1 - tmp2; + + data[dataOff] = tmp10 + tmp11; /* phase 3 */ + data[dataOff+4] = tmp10 - tmp11; + + var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */ + data[dataOff+2] = tmp13 + z1; /* phase 5 */ + data[dataOff+6] = tmp13 - z1; + + /* Odd part */ + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */ + var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */ + var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */ + var z3 = tmp11 * 0.707106781; /* c4 */ + + var z11 = tmp7 + z3; /* phase 5 */ + var z13 = tmp7 - z3; + + data[dataOff+5] = z13 + z2; /* phase 6 */ + data[dataOff+3] = z13 - z2; + data[dataOff+1] = z11 + z4; + data[dataOff+7] = z11 - z4; + + dataOff += 8; /* advance pointer to next row */ + } + + /* Pass 2: process columns. */ + dataOff = 0; + for (i=0; i<I8; ++i) + { + d0 = data[dataOff]; + d1 = data[dataOff + 8]; + d2 = data[dataOff + 16]; + d3 = data[dataOff + 24]; + d4 = data[dataOff + 32]; + d5 = data[dataOff + 40]; + d6 = data[dataOff + 48]; + d7 = data[dataOff + 56]; + + var tmp0p2 = d0 + d7; + var tmp7p2 = d0 - d7; + var tmp1p2 = d1 + d6; + var tmp6p2 = d1 - d6; + var tmp2p2 = d2 + d5; + var tmp5p2 = d2 - d5; + var tmp3p2 = d3 + d4; + var tmp4p2 = d3 - d4; + + /* Even part */ + var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */ + var tmp13p2 = tmp0p2 - tmp3p2; + var tmp11p2 = tmp1p2 + tmp2p2; + var tmp12p2 = tmp1p2 - tmp2p2; + + data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */ + data[dataOff+32] = tmp10p2 - tmp11p2; + + var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */ + data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */ + data[dataOff+48] = tmp13p2 - z1p2; + + /* Odd part */ + tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */ + tmp11p2 = tmp5p2 + tmp6p2; + tmp12p2 = tmp6p2 + tmp7p2; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */ + var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */ + var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */ + var z3p2 = tmp11p2 * 0.707106781; /* c4 */ + + var z11p2 = tmp7p2 + z3p2; /* phase 5 */ + var z13p2 = tmp7p2 - z3p2; + + data[dataOff+40] = z13p2 + z2p2; /* phase 6 */ + data[dataOff+24] = z13p2 - z2p2; + data[dataOff+ 8] = z11p2 + z4p2; + data[dataOff+56] = z11p2 - z4p2; + + dataOff++; /* advance pointer to next column */ + } + + // Quantize/descale the coefficients + var fDCTQuant; + for (i=0; i<I64; ++i) + { + // Apply the quantization and scaling factor & Round to nearest integer + fDCTQuant = data[i]*fdtbl[i]; + outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j<I64;++j) { + DU[ZigZag[j]]=DU_DCT[j]; + } + var Diff = DU[0] - DC; DC = DU[0]; + //Encode DC + if (Diff==0) { + writeBits(HTDC[0]); // Diff might be 0 + } else { + pos = 32767+Diff; + writeBits(HTDC[category[pos]]); + writeBits(bitcode[pos]); + } + //Encode ACs + var end0pos = 63; // was const... which is crazy + for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + // var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + // var duration = new Date().getTime() - time_start; + // console.log('Encoding time: '+ currentQuality + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + // console.log('Quality set to: '+quality +'%'); + } + + function init(){ + // var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + // var duration = new Date().getTime() - time_start; + // console.log('Initialization '+ duration + 'ms'); + } + + init(); + + }; + + JPEGEncoder.encode = function( data, quality ) { + var encoder = new JPEGEncoder( quality ); + + return encoder.encode( data ); + } + + return JPEGEncoder; + }); + /** + * @fileOverview Fix android canvas.toDataUrl bug. + */ + define('runtime/html5/androidpatch',[ + 'runtime/html5/util', + 'runtime/html5/jpegencoder', + 'base' + ], function( Util, encoder, Base ) { + var origin = Util.canvasToDataUrl, + supportJpeg; + + Util.canvasToDataUrl = function( canvas, type, quality ) { + var ctx, w, h, fragement, parts; + + // 非android手机直接跳过。 + if ( !Base.os.android ) { + return origin.apply( null, arguments ); + } + + // 检测是否canvas支持jpeg导出,根据数据格式来判断。 + // JPEG 前两位分别是:255, 216 + if ( type === 'image/jpeg' && typeof supportJpeg === 'undefined' ) { + fragement = origin.apply( null, arguments ); + + parts = fragement.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + fragement = atob( parts[ 1 ] ); + } else { + fragement = decodeURIComponent( parts[ 1 ] ); + } + + fragement = fragement.substring( 0, 2 ); + + supportJpeg = fragement.charCodeAt( 0 ) === 255 && + fragement.charCodeAt( 1 ) === 216; + } + + // 只有在android环境下才修复 + if ( type === 'image/jpeg' && !supportJpeg ) { + w = canvas.width; + h = canvas.height; + ctx = canvas.getContext('2d'); + + return encoder.encode( ctx.getImageData( 0, 0, w, h ), quality ); + } + + return origin.apply( null, arguments ); + }; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 标记是否被修改过。 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 读取meta信息。 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 解决 orientation 的问题。 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob需要重新生成。 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 释放内存。非常重要,否则释放不了image的内存。 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 交换width, height的值。 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 不允许放大。 + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 如果不是ios, 不需要这么复杂! + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * @fileOverview Transport + * @todo 支持chunked传输,优势: + * 可以将大文件分成小块,挨个传输,可以提高大文件成功率,当失败的时候,也只需要重传那小部分, + * 而不需要重头再传一次。另外断点续传也需要用chunked方式。 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 强制设置成 content-type 为文件流。 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android直接发送blob会导致服务端接收到的是空文件。 + // bug详情。 + // https://code.google.com/p/android/issues/detail?id=39882 + // 所以先用fileReader读取出来再通过arraybuffer的方式发送。 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/html5/md5',[ + 'runtime/html5/runtime' + ], function( FlashRuntime ) { + + /* + * Fastest md5 implementation around (JKM md5) + * Credits: Joseph Myers + * + * @see http://www.myersdaily.org/joseph/javascript/md5-text.html + * @see http://jsperf.com/md5-shootout/7 + */ + + /* this function is much faster, + so if possible we use it. Some IEs + are the only ones I know of that + need the idiotic second function, + generated by an if clause. */ + var add32 = function (a, b) { + return (a + b) & 0xFFFFFFFF; + }, + + cmn = function (q, a, b, x, s, t) { + a = add32(add32(a, q), add32(x, t)); + return add32((a << s) | (a >>> (32 - s)), b); + }, + + ff = function (a, b, c, d, x, s, t) { + return cmn((b & c) | ((~b) & d), a, b, x, s, t); + }, + + gg = function (a, b, c, d, x, s, t) { + return cmn((b & d) | (c & (~d)), a, b, x, s, t); + }, + + hh = function (a, b, c, d, x, s, t) { + return cmn(b ^ c ^ d, a, b, x, s, t); + }, + + ii = function (a, b, c, d, x, s, t) { + return cmn(c ^ (b | (~d)), a, b, x, s, t); + }, + + md5cycle = function (x, k) { + var a = x[0], + b = x[1], + c = x[2], + d = x[3]; + + a = ff(a, b, c, d, k[0], 7, -680876936); + d = ff(d, a, b, c, k[1], 12, -389564586); + c = ff(c, d, a, b, k[2], 17, 606105819); + b = ff(b, c, d, a, k[3], 22, -1044525330); + a = ff(a, b, c, d, k[4], 7, -176418897); + d = ff(d, a, b, c, k[5], 12, 1200080426); + c = ff(c, d, a, b, k[6], 17, -1473231341); + b = ff(b, c, d, a, k[7], 22, -45705983); + a = ff(a, b, c, d, k[8], 7, 1770035416); + d = ff(d, a, b, c, k[9], 12, -1958414417); + c = ff(c, d, a, b, k[10], 17, -42063); + b = ff(b, c, d, a, k[11], 22, -1990404162); + a = ff(a, b, c, d, k[12], 7, 1804603682); + d = ff(d, a, b, c, k[13], 12, -40341101); + c = ff(c, d, a, b, k[14], 17, -1502002290); + b = ff(b, c, d, a, k[15], 22, 1236535329); + + a = gg(a, b, c, d, k[1], 5, -165796510); + d = gg(d, a, b, c, k[6], 9, -1069501632); + c = gg(c, d, a, b, k[11], 14, 643717713); + b = gg(b, c, d, a, k[0], 20, -373897302); + a = gg(a, b, c, d, k[5], 5, -701558691); + d = gg(d, a, b, c, k[10], 9, 38016083); + c = gg(c, d, a, b, k[15], 14, -660478335); + b = gg(b, c, d, a, k[4], 20, -405537848); + a = gg(a, b, c, d, k[9], 5, 568446438); + d = gg(d, a, b, c, k[14], 9, -1019803690); + c = gg(c, d, a, b, k[3], 14, -187363961); + b = gg(b, c, d, a, k[8], 20, 1163531501); + a = gg(a, b, c, d, k[13], 5, -1444681467); + d = gg(d, a, b, c, k[2], 9, -51403784); + c = gg(c, d, a, b, k[7], 14, 1735328473); + b = gg(b, c, d, a, k[12], 20, -1926607734); + + a = hh(a, b, c, d, k[5], 4, -378558); + d = hh(d, a, b, c, k[8], 11, -2022574463); + c = hh(c, d, a, b, k[11], 16, 1839030562); + b = hh(b, c, d, a, k[14], 23, -35309556); + a = hh(a, b, c, d, k[1], 4, -1530992060); + d = hh(d, a, b, c, k[4], 11, 1272893353); + c = hh(c, d, a, b, k[7], 16, -155497632); + b = hh(b, c, d, a, k[10], 23, -1094730640); + a = hh(a, b, c, d, k[13], 4, 681279174); + d = hh(d, a, b, c, k[0], 11, -358537222); + c = hh(c, d, a, b, k[3], 16, -722521979); + b = hh(b, c, d, a, k[6], 23, 76029189); + a = hh(a, b, c, d, k[9], 4, -640364487); + d = hh(d, a, b, c, k[12], 11, -421815835); + c = hh(c, d, a, b, k[15], 16, 530742520); + b = hh(b, c, d, a, k[2], 23, -995338651); + + a = ii(a, b, c, d, k[0], 6, -198630844); + d = ii(d, a, b, c, k[7], 10, 1126891415); + c = ii(c, d, a, b, k[14], 15, -1416354905); + b = ii(b, c, d, a, k[5], 21, -57434055); + a = ii(a, b, c, d, k[12], 6, 1700485571); + d = ii(d, a, b, c, k[3], 10, -1894986606); + c = ii(c, d, a, b, k[10], 15, -1051523); + b = ii(b, c, d, a, k[1], 21, -2054922799); + a = ii(a, b, c, d, k[8], 6, 1873313359); + d = ii(d, a, b, c, k[15], 10, -30611744); + c = ii(c, d, a, b, k[6], 15, -1560198380); + b = ii(b, c, d, a, k[13], 21, 1309151649); + a = ii(a, b, c, d, k[4], 6, -145523070); + d = ii(d, a, b, c, k[11], 10, -1120210379); + c = ii(c, d, a, b, k[2], 15, 718787259); + b = ii(b, c, d, a, k[9], 21, -343485551); + + x[0] = add32(a, x[0]); + x[1] = add32(b, x[1]); + x[2] = add32(c, x[2]); + x[3] = add32(d, x[3]); + }, + + /* there needs to be support for Unicode here, + * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps + * by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise + * I suggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then + * how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something + * like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard + * itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 + * 8-bit unsigned value arrays. + */ + md5blk = function (s) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + }, + + md5blk_array = function (a) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24); + } + return md5blks; + }, + + md51 = function (s) { + var n = s.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + length = s.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); + } + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + return state; + }, + + md51_array = function (a) { + var n = a.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk_array(a.subarray(i - 64, i))); + } + + // Not sure if it is a bug, however IE10 will always produce a sub array of length 1 + // containing the last element of the parent array if the sub array specified starts + // beyond the length of the parent array - weird. + // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue + a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0); + + length = a.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= a[i] << ((i % 4) << 3); + } + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + + return state; + }, + + hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'], + + rhex = function (n) { + var s = '', + j; + for (j = 0; j < 4; j += 1) { + s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; + } + return s; + }, + + hex = function (x) { + var i; + for (i = 0; i < x.length; i += 1) { + x[i] = rhex(x[i]); + } + return x.join(''); + }, + + md5 = function (s) { + return hex(md51(s)); + }, + + + + //////////////////////////////////////////////////////////////////////////// + + /** + * SparkMD5 OOP implementation. + * + * Use this class to perform an incremental md5, otherwise use the + * static methods instead. + */ + SparkMD5 = function () { + // call reset to init the instance + this.reset(); + }; + + + // In some cases the fast add32 function cannot be used.. + if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') { + add32 = function (x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF), + msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); + }; + } + + + /** + * Appends a string. + * A conversion will be applied if an utf8 string is detected. + * + * @param {String} str The string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.append = function (str) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + // then append as binary + this.appendBinary(str); + + return this; + }; + + /** + * Appends a binary string. + * + * @param {String} contents The binary string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.appendBinary = function (contents) { + this._buff += contents; + this._length += contents.length; + + var length = this._buff.length, + i; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk(this._buff.substring(i - 64, i))); + } + + this._buff = this._buff.substr(i - 64); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + i, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + /** + * Finish the final calculation based on the tail. + * + * @param {Array} tail The tail (will be modified) + * @param {Number} length The length of the remaining buffer + */ + SparkMD5.prototype._finish = function (tail, length) { + var i = length, + tmp, + lo, + hi; + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(this._state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + tmp = this._length * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + md5cycle(this._state, tail); + }; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.reset = function () { + this._buff = ""; + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.prototype.destroy = function () { + delete this._state; + delete this._buff; + delete this._length; + }; + + + /** + * Performs the md5 hash on a string. + * A conversion will be applied if utf8 string is detected. + * + * @param {String} str The string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hash = function (str, raw) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + var hash = md51(str); + + return !!raw ? hash : hex(hash); + }; + + /** + * Performs the md5 hash on a binary string. + * + * @param {String} content The binary string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hashBinary = function (content, raw) { + var hash = md51(content); + + return !!raw ? hash : hex(hash); + }; + + /** + * SparkMD5 OOP implementation for array buffers. + * + * Use this class to perform an incremental md5 ONLY for array buffers. + */ + SparkMD5.ArrayBuffer = function () { + // call reset to init the instance + this.reset(); + }; + + //////////////////////////////////////////////////////////////////////////// + + /** + * Appends an array buffer. + * + * @param {ArrayBuffer} arr The array to be appended + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.append = function (arr) { + // TODO: we could avoid the concatenation here but the algorithm would be more complex + // if you find yourself needing extra performance, please make a PR. + var buff = this._concatArrayBuffer(this._buff, arr), + length = buff.length, + i; + + this._length += arr.byteLength; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i))); + } + + // Avoids IE10 weirdness (documented above) + this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + i, + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff[i] << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.reset = function () { + this._buff = new Uint8Array(0); + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy; + + /** + * Concats two array buffers, returning a new one. + * + * @param {ArrayBuffer} first The first array buffer + * @param {ArrayBuffer} second The second array buffer + * + * @return {ArrayBuffer} The new array buffer + */ + SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) { + var firstLength = first.length, + result = new Uint8Array(firstLength + second.byteLength); + + result.set(first); + result.set(new Uint8Array(second), firstLength); + + return result; + }; + + /** + * Performs the md5 hash on an array buffer. + * + * @param {ArrayBuffer} arr The array buffer + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.hash = function (arr, raw) { + var hash = md51_array(new Uint8Array(arr)); + + return !!raw ? hash : hex(hash); + }; + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( file ) { + var blob = file.getSource(), + chunkSize = 2 * 1024 * 1024, + chunks = Math.ceil( blob.size / chunkSize ), + chunk = 0, + owner = this.owner, + spark = new SparkMD5.ArrayBuffer(), + me = this, + blobSlice = blob.mozSlice || blob.webkitSlice || blob.slice, + loadNext, fr; + + fr = new FileReader(); + + loadNext = function() { + var start, end; + + start = chunk * chunkSize; + end = Math.min( start + chunkSize, blob.size ); + + fr.onload = function( e ) { + spark.append( e.target.result ); + owner.trigger( 'progress', { + total: file.size, + loaded: end + }); + }; + + fr.onloadend = function() { + fr.onloadend = fr.onload = null; + + if ( ++chunk < chunks ) { + setTimeout( loadNext, 1 ); + } else { + setTimeout(function(){ + owner.trigger('load'); + me.result = spark.end(); + loadNext = file = blob = spark = null; + owner.trigger('complete'); + }, 50 ); + } + }; + + fr.readAsArrayBuffer( blobSlice.call( blob, start, end ) ); + }; + + loadNext(); + }, + + getResult: function() { + return this.result; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash的接受器。 + window[ jsreciver ] = function() { + var args = arguments; + + // 为了能捕获得到。 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '<object id="' + this.uid + '" type="application/' + + 'x-shockwave-flash" data="' + opts.swf + '" '; + + if ( Base.browser.ie ) { + html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; + } + + html += 'width="100%" height="100%" style="outline:0">' + + '<param name="movie" value="' + opts.swf + '" />' + + '<param name="flashvars" value="uid=' + this.uid + + '&jsreciver=' + this.jsreciver + '" />' + + '<param name="wmode" value="transparent" />' + + '<param name="allowscriptaccess" value="always" />' + + '</object>'; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 修复Flash再没有设置title的情况下无法弹出flash文件选择框的bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview 图片压缩 + */ + define('runtime/flash/image',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Image', { + // init: function( options ) { + // var owner = this.owner; + + // this.flashExec( 'Image', 'init', options ); + // owner.on( 'load', function() { + // debugger; + // }); + // }, + + loadFromBlob: function( blob ) { + var owner = this.owner; + + owner.info() && this.flashExec( 'Image', 'info', owner.info() ); + owner.meta() && this.flashExec( 'Image', 'meta', owner.meta() ); + + this.flashExec( 'Image', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 处理可能存在 bug, 没辙只能靠 js 了 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview Md5 flash实现 + */ + define('runtime/flash/md5',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( blob ) { + return this.flashExec( 'Md5', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview 完全版本。 + */ + define('preset/all',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + 'widgets/md5', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/androidpatch', + 'runtime/html5/image', + 'runtime/html5/transport', + 'runtime/html5/md5', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/image', + 'runtime/flash/transport', + 'runtime/flash/blob', + 'runtime/flash/md5' + ], function( Base ) { + return Base; + }); + /** + * @fileOverview 日志组件,主要用来收集错误信息,可以帮助 webuploader 更好的定位问题和发展。 + * + * 如果您不想要启用此功能,请在打包的时候去掉 log 模块。 + * + * 或者可以在初始化的时候通过 options.disableWidgets 属性禁用。 + * + * 如: + * WebUploader.create({ + * ... + * + * disableWidgets: 'log', + * + * ... + * }) + */ + define('widgets/log',[ + 'base', + 'uploader', + 'widgets/widget' + ], function( Base, Uploader ) { + var $ = Base.$, + logUrl = ' http://static.tieba.baidu.com/tb/pms/img/st.gif??', + product = (location.hostname || location.host || 'protected').toLowerCase(), + + // 只针对 baidu 内部产品用户做统计功能。 + enable = product && /baidu/i.exec(product), + base; + + if (!enable) { + return; + } + + base = { + dv: 3, + master: 'webuploader', + online: /test/.exec(product) ? 0 : 1, + module: '', + product: product, + type: 0 + }; + + function send(data) { + var obj = $.extend({}, base, data), + url = logUrl.replace(/^(.*)\?/, '$1' + $.param( obj )), + image = new Image(); + + image.src = url; + } + + return Uploader.register({ + name: 'log', + + init: function() { + var owner = this.owner, + count = 0, + size = 0; + + owner + .on('error', function(code) { + send({ + type: 2, + c_error_code: code + }); + }) + .on('uploadError', function(file, reason) { + send({ + type: 2, + c_error_code: 'UPLOAD_ERROR', + c_reason: '' + reason + }); + }) + .on('uploadComplete', function(file) { + count++; + size += file.size; + }). + on('uploadFinished', function() { + send({ + c_count: count, + c_size: size + }); + count = size = 0; + }); + + send({ + c_usage: 1 + }); + } + }); + }); + /** + * @fileOverview Uploader上传类 + */ + define('webuploader',[ + 'preset/all', + 'widgets/log' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.min.js new file mode 100644 index 0000000..43cb93b --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.min.js @@ -0,0 +1,3 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e<f;)if(c=a[e],c.cb.apply(c.ctx2,b)===!1){d=!0;break}return!d}var e,f=a.$,g=[].slice,h=/\s+/;return e={on:function(a,b,d){var e,f=this;return b?(e=this._events||(this._events=[]),c(a,b,function(a,b){var c={e:a};c.cb=b,c.ctx=d,c.ctx2=d||f,c.id=e.length,e.push(c)}),this):this},once:function(a,b,d){var e=this;return b?(c(a,b,function(a,b){var c=function(){return e.off(a,c),b.apply(d||e,arguments)};c._cb=b,e.on(a,c,d)}),e):e},off:function(a,d,e){var g=this._events;return g?a||d||e?(c(a,d,function(a,c){f.each(b(g,a,c,e),function(){delete g[this.id]})}),this):(this._events=[],this):this},trigger:function(a){var c,e,f;return this._events&&a?(c=g.call(arguments,1),e=b(this._events,a),f=b(this._events,"all"),d(e,c)&&d(f,arguments)):this}},f.extend({installTo:function(a){return f.extend(a,e)}},e)}),b("uploader",["base","mediator"],function(a,b){function c(a){this.options=d.extend(!0,{},c.options,a),this._init(this.options)}var d=a.$;return c.options={},b.installTo(c.prototype),d.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",sort:"sort-files",removeFile:"remove-file",cancelFile:"cancel-file",skipFile:"skip-file",retry:"retry",isInProgress:"is-in-progress",makeThumb:"make-thumb",md5File:"md5-file",getDimension:"get-dimension",addButton:"add-btn",predictRuntimeType:"predict-runtime-type",refresh:"refresh",disable:"disable",enable:"enable",reset:"reset"},function(a,b){c.prototype[a]=function(){return this.request(b,arguments)}}),d.extend(c.prototype,{state:"pending",_init:function(a){var b=this;b.request("init",a,function(){b.state="ready",b.trigger("ready")})},option:function(a,b){var c=this.options;return arguments.length>1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("按钮指定错误");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size<h||b._compressed?void 0:(g=e.extend({},g),f=a.Deferred(),d=new c(g),f.always(function(){d.destroy(),d=null}),d.once("error",f.reject),d.once("load",function(){var a=g.width,c=g.height;b._info=b._info||d.info(),b._meta=b._meta||d.meta(),1>=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.size<c)&&(b.source=a,b.size=a.size,b.trigger("resize",a.size,c)),b._compressed=!0,f.resolve()}catch(e){f.resolve()}}),b._info&&d.info(b._info),b._meta&&d.meta(b._meta),d.loadFromBlob(b.source),f.promise())}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length<e.threads&&(c=d._nextBlock())?(d._trigged=!1,b=function(b){d._promise=null,b&&b.file&&d._startSend(b),a.nextTick(d.__tick)},d._promise=g(c)?c.always(b):b(c)):d.remaning||d._getStats().numOfQueue||d._getStats().numofInterrupt||(d.runing=!1,d._trigged||a.nextTick(function(){d.owner.trigger("uploadFinished")}),d._trigged=!0))},_putback:function(a){var b;a.cuted.unshift(a),b=this.stack.indexOf(a.cuted),~b||this.stack.unshift(a.cuted)},_getStack:function(){for(var a,b=0;a=this.stack[b++];){if(a.has()&&a.file.getStatus()===h.PROGRESS)return a;(!a.has()||a.file.getStatus()!==h.PROGRESS&&a.file.getStatus()!==h.INTERRUPT)&&this.stack.splice(--b,1)}return null},_nextBlock:function(){var a,b,c,d,f=this,h=f.options;return(a=this._getStack())?(h.prepareNextFile&&!f.pending.length&&f._prepareNextFile(),a.shift()):f.runing?(!f.pending.length&&f._getStats().numOfQueue&&f._prepareNextFile(),b=f.pending.shift(),c=function(b){return b?(a=e(b,h.chunked?h.chunkSize:0),f.stack.push(a),a.shift()):null},g(b)?(d=b.file,b=b[b.pipe?"pipe":"then"](c),b.file=d,b):c(b)):void 0},_prepareNextFile:function(){var a,b=this,c=b.request("fetch-file"),d=b.pending;c&&(a=b.request("before-send-file",c,function(){return c.getStatus()===h.PROGRESS||c.getStatus()===h.INTERRUPT?c:b._finishFile(c)}),b.owner.trigger("uploadStart",c),c.setStatus(h.PROGRESS),a.file=c,a.done(function(){var b=f.inArray(a,d);~b&&d.splice(b,1,c)}),a.fail(function(a){c.setStatus(h.ERROR,a),b.owner.trigger("uploadError",c,a),b.owner.trigger("uploadComplete",c)}),d.push(a))},_popBlock:function(a){var b=f.inArray(a,this.pool);this.pool.splice(b,1),a.file.remaning--,this.remaning--},_startSend:function(b){var c,d=this,e=b.file;return e.getStatus()!==h.PROGRESS?void(e.getStatus()===h.INTERRUPT&&d._putback(b)):(d.pool.push(b),d.remaning++,b.blob=1===b.chunks?e.source:e.source.slice(b.start,b.end),c=d.request("before-send",b,function(){e.getStatus()===h.PROGRESS?d._doSend(b):(d._popBlock(b),a.nextTick(d.__tick))}),void c.fail(function(){1===e.remaning?d._finishFile(e).always(function(){b.percentage=1,d._popBlock(b),d.owner.trigger("uploadComplete",e),a.nextTick(d.__tick)}):(b.percentage=1,d.updateFileProgress(e),d._popBlock(b),a.nextTick(d.__tick))}))},_doSend:function(b){var c,e,g=this,i=g.owner,j=g.options,k=b.file,l=new d(j),m=f.extend({},j.formData),n=f.extend({},j.headers);b.transport=l,l.on("destroy",function(){delete b.transport,g._popBlock(b),a.nextTick(g.__tick)}),l.on("progress",function(a){b.percentage=a,g.updateFileProgress(k)}),c=function(a){var c;return e=l.getResponseAsJson()||{},e._raw=l.getResponse(),c=function(b){a=b},i.trigger("uploadAccept",b,e,c)||(a=a||"server"),a},l.on("error",function(a,d){b.retried=b.retried||0,b.chunks>1&&~"http,abort".indexOf(a)&&b.retried<j.chunkRetry?(b.retried++,l.send()):(d||"server"!==a||(a=c(a)),k.setStatus(h.ERROR,a),i.trigger("uploadError",k,a),i.trigger("uploadComplete",k))}),l.on("load",function(){var a;return(a=c())?void l.trigger("error",a,!0):void(1===k.remaning?g._finishFile(k,e):l.destroy())}),m=f.extend(m,{id:k.id,name:k.name,type:k.type,lastModifiedDate:k.lastModifiedDate,size:k.size}),b.chunks>1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b) +}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("lib/md5",["runtime/client","mediator"],function(a,b){function c(){a.call(this,"Md5")}return b.installTo(c.prototype),c.prototype.loadFromBlob=function(a){var b=this;b.getRuid()&&b.disconnectRuntime(),b.connectRuntime(a.ruid,function(){b.exec("init"),b.exec("loadFromBlob",a)})},c.prototype.getResult=function(){return this.exec("getResult")},c}),b("widgets/md5",["base","uploader","lib/md5","lib/blob","widgets/widget"],function(a,b,c,d){return b.register({name:"md5",md5File:function(b,e,f){var g=new c,h=a.Deferred(),i=b instanceof d?b:this.request("get-file",b).source;return g.on("progress load",function(a){a=a||{},h.notify(a.total?a.loaded/a.total:1)}),g.on("complete",function(){h.resolve(g.getResult())}),g.on("error",function(a){h.reject(a)}),arguments.length>1&&(e=e||0,f=f||0,0>e&&(e=i.size+e),0>f&&(f=i.size+f),f=Math.min(f,i.size),i=i.slice(e,f)),g.loadFromBlob(i),h.promise()}})}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice;return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/util",["base"],function(b){var c=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL,d=b.noop,e=d;return c&&(d=function(){return c.createObjectURL.apply(c,arguments)},e=function(){return c.revokeObjectURL.apply(c,arguments)}),{createObjectURL:d,revokeObjectURL:e,dataURL2Blob:function(a){var b,c,d,e,f,g;for(g=a.split(","),b=~g[0].indexOf("base64")?atob(g[1]):decodeURIComponent(g[1]),d=new ArrayBuffer(b.length),c=new Uint8Array(d),e=0;e<b.length;e++)c[e]=b.charCodeAt(e);return f=g[0].split(":")[1].split(";")[0],this.arrayBufferToBlob(d,f)},dataURL2ArrayBuffer:function(a){var b,c,d,e;for(e=a.split(","),b=~e[0].indexOf("base64")?atob(e[1]):decodeURIComponent(e[1]),c=new Uint8Array(b.length),d=0;d<b.length;d++)c[d]=b.charCodeAt(d);return c.buffer},arrayBufferToBlob:function(b,c){var d,e=a.BlobBuilder||a.WebKitBlobBuilder;return e?(d=new e,d.append(b),d.getBlob(c)):new Blob([b],c?{type:c}:{})},canvasToDataUrl:function(a,b,c){return a.toDataURL(b,c/100)},parseMeta:function(a,b){b(!1,{})},updateImageHead:function(a){return a}}}),b("runtime/html5/imagemeta",["runtime/html5/util"],function(a){var b;return b={parsers:{65505:[]},maxMetaDataSize:262144,parse:function(a,b){var c=this,d=new FileReader;d.onload=function(){b(!1,c._parse(this.result)),d=d.onload=d.onerror=null},d.onerror=function(a){b(a.message),d=d.onload=d.onerror=null},a=a.slice(0,c.maxMetaDataSize),d.readAsArrayBuffer(a.getSource())},_parse:function(a,c){if(!(a.byteLength<6)){var d,e,f,g,h=new DataView(a),i=2,j=h.byteLength-4,k=i,l={};if(65496===h.getUint16(0)){for(;j>i&&(d=h.getUint16(i),d>=65504&&65519>=d||65534===d)&&(e=h.getUint16(i+2)+2,!(i+e>h.byteLength));){if(f=b.parsers[d],!c&&f)for(g=0;g<f.length;g+=1)f[g].call(b,h,i,e,l);i+=e,k=i}k>6&&(l.imageHead=a.slice?a.slice(2,k):new Uint8Array(a).subarray(2,k))}return l}},updateImageHead:function(a,b){var c,d,e,f=this._parse(a,!0);return e=2,f.imageHead&&(e=2+f.imageHead.byteLength),d=a.slice?a.slice(e):new Uint8Array(a).subarray(e),c=new Uint8Array(b.byteLength+2+d.byteLength),c[0]=255,c[1]=216,c.set(new Uint8Array(b),2),c.set(new Uint8Array(d),b.byteLength+2),c.buffer}},a.parseMeta=function(){return b.parse.apply(b,arguments)},a.updateImageHead=function(){return b.updateImageHead.apply(b,arguments)},b}),b("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(a,b){var c={};return c.ExifMap=function(){return this},c.ExifMap.prototype.map={Orientation:274},c.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},c.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},c.exifTagTypes[7]=c.exifTagTypes[1],c.getExifValue=function(b,d,e,f,g,h){var i,j,k,l,m,n,o=c.exifTagTypes[f];if(!o)return void a.log("Invalid Exif data: Invalid tag type.");if(i=o.size*g,j=i>4?d+b.getUint32(e+8,h):e+8,j+i>b.byteLength)return void a.log("Invalid Exif data: Invalid data offset.");if(1===g)return o.getValue(b,j,h);for(k=[],l=0;g>l;l+=1)k[l]=o.getValue(b,j+l*o.size,h);if(o.ascii){for(m="",l=0;l<k.length&&(n=k[l],"\x00"!==n);l+=1)m+=n;return m}return k},c.parseExifTag=function(a,b,d,e,f){var g=a.getUint16(d,e);f.exif[g]=c.getExifValue(a,b,d,a.getUint16(d+2,e),a.getUint32(d+4,e),e)},c.parseExifTags=function(b,c,d,e,f){var g,h,i;if(d+6>b.byteLength)return void a.log("Invalid Exif data: Invalid directory offset.");if(g=b.getUint16(d,e),h=d+2+12*g,h+4>b.byteLength)return void a.log("Invalid Exif data: Invalid directory size.");for(i=0;g>i;i+=1)this.parseExifTag(b,c,d+2+12*i,e,f);return b.getUint32(h,e)},c.parseExifData=function(b,d,e,f){var g,h,i=d+10;if(1165519206===b.getUint32(d+4)){if(i+8>b.byteLength)return void a.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(d+8))return void a.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(i)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void a.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(i+2,g))return void a.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(i+4,g),f.exif=new c.ExifMap,h=c.parseExifTags(b,i,i+h,g,f)}},b.parsers[65505].push(c.parseExifData),c}),b("runtime/html5/jpegencoder",[],function(){function a(a){function b(a){for(var b=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],c=0;64>c;c++){var d=y((b[c]*a+50)/100);1>d?d=1:d>255&&(d=255),z[P[c]]=d}for(var e=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],f=0;64>f;f++){var g=y((e[f]*a+50)/100);1>g?g=1:g>255&&(g=255),A[P[f]]=g}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],i=0,j=0;8>j;j++)for(var k=0;8>k;k++)B[i]=1/(z[P[i]]*h[j]*h[k]*8),C[i]=1/(A[P[i]]*h[j]*h[k]*8),i++}function c(a,b){for(var c=0,d=0,e=new Array,f=1;16>=f;f++){for(var g=1;g<=a[f];g++)e[b[d]]=[],e[b[d]][0]=c,e[b[d]][1]=f,d++,c++;c*=2}return e}function d(){t=c(Q,R),u=c(U,V),v=c(S,T),w=c(W,X)}function e(){for(var a=1,b=2,c=1;15>=c;c++){for(var d=a;b>d;d++)E[32767+d]=c,D[32767+d]=[],D[32767+d][1]=c,D[32767+d][0]=d;for(var e=-(b-1);-a>=e;e++)E[32767+e]=c,D[32767+e]=[],D[32767+e][1]=c,D[32767+e][0]=b-1+e;a<<=1,b<<=1}}function f(){for(var a=0;256>a;a++)O[a]=19595*a,O[a+256>>0]=38470*a,O[a+512>>0]=7471*a+32768,O[a+768>>0]=-11059*a,O[a+1024>>0]=-21709*a,O[a+1280>>0]=32768*a+8421375,O[a+1536>>0]=-27439*a,O[a+1792>>0]=-5329*a}function g(a){for(var b=a[0],c=a[1]-1;c>=0;)b&1<<c&&(I|=1<<J),c--,J--,0>J&&(255==I?(h(255),h(0)):h(I),J=7,I=0)}function h(a){H.push(N[a])}function i(a){h(a>>8&255),h(255&a)}function j(a,b){var c,d,e,f,g,h,i,j,k,l=0,m=8,n=64;for(k=0;m>k;++k){c=a[l],d=a[l+1],e=a[l+2],f=a[l+3],g=a[l+4],h=a[l+5],i=a[l+6],j=a[l+7];var o=c+j,p=c-j,q=d+i,r=d-i,s=e+h,t=e-h,u=f+g,v=f-g,w=o+u,x=o-u,y=q+s,z=q-s;a[l]=w+y,a[l+4]=w-y;var A=.707106781*(z+x);a[l+2]=x+A,a[l+6]=x-A,w=v+t,y=t+r,z=r+p;var B=.382683433*(w-z),C=.5411961*w+B,D=1.306562965*z+B,E=.707106781*y,G=p+E,H=p-E;a[l+5]=H+C,a[l+3]=H-C,a[l+1]=G+D,a[l+7]=G-D,l+=8}for(l=0,k=0;m>k;++k){c=a[l],d=a[l+8],e=a[l+16],f=a[l+24],g=a[l+32],h=a[l+40],i=a[l+48],j=a[l+56];var I=c+j,J=c-j,K=d+i,L=d-i,M=e+h,N=e-h,O=f+g,P=f-g,Q=I+O,R=I-O,S=K+M,T=K-M;a[l]=Q+S,a[l+32]=Q-S;var U=.707106781*(T+R);a[l+16]=R+U,a[l+48]=R-U,Q=P+N,S=N+L,T=L+J;var V=.382683433*(Q-T),W=.5411961*Q+V,X=1.306562965*T+V,Y=.707106781*S,Z=J+Y,$=J-Y;a[l+40]=$+W,a[l+24]=$-W,a[l+8]=Z+X,a[l+56]=Z-X,l++}var _;for(k=0;n>k;++k)_=a[k]*b[k],F[k]=_>0?_+.5|0:_-.5|0;return F}function k(){i(65504),i(16),h(74),h(70),h(73),h(70),h(0),h(1),h(1),h(0),i(1),i(1),h(0),h(0)}function l(a,b){i(65472),i(17),h(8),i(b),i(a),h(3),h(1),h(17),h(0),h(2),h(17),h(1),h(3),h(17),h(1)}function m(){i(65499),i(132),h(0);for(var a=0;64>a;a++)h(z[a]);h(1);for(var b=0;64>b;b++)h(A[b])}function n(){i(65476),i(418),h(0);for(var a=0;16>a;a++)h(Q[a+1]);for(var b=0;11>=b;b++)h(R[b]);h(16);for(var c=0;16>c;c++)h(S[c+1]);for(var d=0;161>=d;d++)h(T[d]);h(1);for(var e=0;16>e;e++)h(U[e+1]);for(var f=0;11>=f;f++)h(V[f]);h(17);for(var g=0;16>g;g++)h(W[g+1]);for(var j=0;161>=j;j++)h(X[j])}function o(){i(65498),i(12),h(3),h(1),h(0),h(2),h(17),h(3),h(17),h(0),h(63),h(0)}function p(a,b,c,d,e){for(var f,h=e[0],i=e[240],k=16,l=63,m=64,n=j(a,b),o=0;m>o;++o)G[P[o]]=n[o];var p=G[0]-c;c=G[0],0==p?g(d[0]):(f=32767+p,g(d[E[f]]),g(D[f]));for(var q=63;q>0&&0==G[q];q--);if(0==q)return g(h),c;for(var r,s=1;q>=s;){for(var t=s;0==G[s]&&q>=s;++s);var u=s-t;if(u>=k){r=u>>4;for(var v=1;r>=v;++v)g(i);u=15&u}f=32767+G[s],g(e[(u<<4)+E[f]]),g(D[f]),s++}return q!=l&&g(h),c}function q(){for(var a=String.fromCharCode,b=0;256>b;b++)N[b]=a(b)}function r(a){if(0>=a&&(a=1),a>100&&(a=100),x!=a){var c=0;c=Math.floor(50>a?5e3/a:200-2*a),b(c),x=a}}function s(){a||(a=50),q(),d(),e(),f(),r(a)}var t,u,v,w,x,y=(Math.round,Math.floor),z=new Array(64),A=new Array(64),B=new Array(64),C=new Array(64),D=new Array(65535),E=new Array(65535),F=new Array(64),G=new Array(64),H=[],I=0,J=7,K=new Array(64),L=new Array(64),M=new Array(64),N=new Array(256),O=new Array(2048),P=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],Q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],S=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],T=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=[0,1,2,3,4,5,6,7,8,9,10,11],W=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],X=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];this.encode=function(a,b){b&&r(b),H=new Array,I=0,J=7,i(65496),k(),m(),l(a.width,a.height),n(),o();var c=0,d=0,e=0;I=0,J=7,this.encode.displayName="_encode_";for(var f,h,j,q,s,x,y,z,A,D=a.data,E=a.width,F=a.height,G=4*E,N=0;F>N;){for(f=0;G>f;){for(s=G*N+f,x=s,y=-1,z=0,A=0;64>A;A++)z=A>>3,y=4*(7&A),x=s+z*G+y,N+z>=F&&(x-=G*(N+1+z-F)),f+y>=G&&(x-=f+y-G+4),h=D[x++],j=D[x++],q=D[x++],K[A]=(O[h]+O[j+256>>0]+O[q+512>>0]>>16)-128,L[A]=(O[h+768>>0]+O[j+1024>>0]+O[q+1280>>0]>>16)-128,M[A]=(O[h+1280>>0]+O[j+1536>>0]+O[q+1792>>0]>>16)-128;c=p(K,B,c,t,v),d=p(L,C,d,u,w),e=p(M,C,e,u,w),f+=32}N+=8}if(J>=0){var P=[];P[1]=J+1,P[0]=(1<<J+1)-1,g(P)}i(65497);var Q="data:image/jpeg;base64,"+btoa(H.join(""));return H=[],Q},s()}return a.encode=function(b,c){var d=new a(c);return d.encode(b)},a}),b("runtime/html5/androidpatch",["runtime/html5/util","runtime/html5/jpegencoder","base"],function(a,b,c){var d,e=a.canvasToDataUrl;a.canvasToDataUrl=function(a,f,g){var h,i,j,k,l;return c.os.android?("image/jpeg"===f&&"undefined"==typeof d&&(k=e.apply(null,arguments),l=k.split(","),k=~l[0].indexOf("base64")?atob(l[1]):decodeURIComponent(l[1]),k=k.substring(0,2),d=255===k.charCodeAt(0)&&216===k.charCodeAt(1)),"image/jpeg"!==f||d?e.apply(null,arguments):(i=a.width,j=a.height,h=a.getContext("2d"),b.encode(h.getImageData(0,0,i,j),g))):e.apply(null,arguments)}}),b("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(a,b,c){var d="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D";return b.register("Image",{modified:!1,init:function(){var a=this,b=new Image;b.onload=function(){a._info={type:a.type,width:this.width,height:this.height},a._metas||"image/jpeg"!==a.type?a.owner.trigger("load"):c.parseMeta(a._blob,function(b,c){a._metas=c,a.owner.trigger("load")})},b.onerror=function(){a.owner.trigger("error")},a._img=b},loadFromBlob:function(a){var b=this,d=b._img;b._blob=a,b.type=a.type,d.src=c.createObjectURL(a.getSource()),b.owner.once("load",function(){c.revokeObjectURL(d.src)})},resize:function(a,b){var c=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,c,a,b),this._blob=null,this.modified=!0,this.owner.trigger("complete","resize")},crop:function(a,b,c,d,e){var f=this._canvas||(this._canvas=document.createElement("canvas")),g=this.options,h=this._img,i=h.naturalWidth,j=h.naturalHeight,k=this.getOrientation();e=e||1,f.width=c,f.height=d,g.preserveHeaders||this._rotate2Orientaion(f,k),this._renderImageToCanvas(f,h,-a,-b,i*e,j*e),this._blob=null,this.modified=!0,this.owner.trigger("complete","crop")},getAsBlob:function(a){var b,d=this._blob,e=this.options;if(a=a||this.type,this.modified||this.type!==a){if(b=this._canvas,"image/jpeg"===a){if(d=c.canvasToDataUrl(b,a,e.quality),e.preserveHeaders&&this._metas&&this._metas.imageHead)return d=c.dataURL2ArrayBuffer(d),d=c.updateImageHead(d,this._metas.imageHead),d=c.arrayBufferToBlob(d,a)}else d=c.canvasToDataUrl(b,a);d=c.dataURL2Blob(d)}return d},getAsDataUrl:function(a){var b=this.options;return a=a||this.type,"image/jpeg"===a?c.canvasToDataUrl(this._canvas,a,b.quality):this._canvas.toDataURL(a)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},destroy:function(){var a=this._canvas;this._img.onload=null,a&&(a.getContext("2d").clearRect(0,0,a.width,a.height),a.width=a.height=0,this._canvas=null),this._img.src=d,this._img=this._blob=null},_resize:function(a,b,c,d){var e,f,g,h,i,j=this.options,k=a.width,l=a.height,m=this.getOrientation();~[5,6,7,8].indexOf(m)&&(c^=d,d^=c,c^=d),e=Math[j.crop?"max":"min"](c/k,d/l),j.allowMagnify||(e=Math.min(1,e)),f=k*e,g=l*e,j.crop?(b.width=c,b.height=d):(b.width=f,b.height=g),h=(b.width-f)/2,i=(b.height-g)/2,j.preserveHeaders||this._rotate2Orientaion(b,m),this._renderImageToCanvas(b,a,h,i,f,g)},_rotate2Orientaion:function(a,b){var c=a.width,d=a.height,e=a.getContext("2d");switch(b){case 5:case 6:case 7:case 8:a.width=d,a.height=c}switch(b){case 2:e.translate(c,0),e.scale(-1,1);break;case 3:e.translate(c,d),e.rotate(Math.PI);break;case 4:e.translate(0,d),e.scale(1,-1);break;case 5:e.rotate(.5*Math.PI),e.scale(1,-1);break;case 6:e.rotate(.5*Math.PI),e.translate(0,-d);break;case 7:e.rotate(.5*Math.PI),e.translate(c,-d),e.scale(-1,1);break;case 8:e.rotate(-.5*Math.PI),e.translate(-c,0)}},_renderImageToCanvas:function(){function b(a,b,c){var d,e,f,g=document.createElement("canvas"),h=g.getContext("2d"),i=0,j=c,k=c;for(g.width=1,g.height=c,h.drawImage(a,0,0),d=h.getImageData(0,0,1,c).data;k>i;)e=d[4*(k-1)+3],0===e?j=k:i=k,k=j+i>>1;return f=k/c,0===f?1:f}function c(a){var b,c,d=a.naturalWidth,e=a.naturalHeight;return d*e>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-d+1,0),0===c.getImageData(0,0,1,1).data[3]):!1}return a.os.ios?a.os.ios>=7?function(a,c,d,e,f,g){var h=c.naturalWidth,i=c.naturalHeight,j=b(c,h,i);return a.getContext("2d").drawImage(c,0,0,h*j,i*j,d,e,f,g)}:function(a,d,e,f,g,h){var i,j,k,l,m,n,o,p=d.naturalWidth,q=d.naturalHeight,r=a.getContext("2d"),s=c(d),t="image/jpeg"===this.type,u=1024,v=0,w=0;for(s&&(p/=2,q/=2),r.save(),i=document.createElement("canvas"),i.width=i.height=u,j=i.getContext("2d"),k=t?b(d,p,q):1,l=Math.ceil(u*g/p),m=Math.ceil(u*h/q/k);q>v;){for(n=0,o=0;p>n;)j.clearRect(0,0,u,u),j.drawImage(d,-n,-v),r.drawImage(i,0,0,u,u,e+o,f+w,l,m),n+=u,o+=l;v+=u,w+=m}r.restore(),i=j=null}:function(b){var c=a.slice(arguments,1),d=b.getContext("2d");d.drawImage.apply(d,c)}}()})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("runtime/html5/md5",["runtime/html5/runtime"],function(a){var b=function(a,b){return a+b&4294967295},c=function(a,c,d,e,f,g){return c=b(b(c,a),b(e,g)),b(c<<f|c>>>32-f,d)},d=function(a,b,d,e,f,g,h){return c(b&d|~b&e,a,b,f,g,h)},e=function(a,b,d,e,f,g,h){return c(b&e|d&~e,a,b,f,g,h)},f=function(a,b,d,e,f,g,h){return c(b^d^e,a,b,f,g,h)},g=function(a,b,d,e,f,g,h){return c(d^(b|~e),a,b,f,g,h)},h=function(a,c){var h=a[0],i=a[1],j=a[2],k=a[3];h=d(h,i,j,k,c[0],7,-680876936),k=d(k,h,i,j,c[1],12,-389564586),j=d(j,k,h,i,c[2],17,606105819),i=d(i,j,k,h,c[3],22,-1044525330),h=d(h,i,j,k,c[4],7,-176418897),k=d(k,h,i,j,c[5],12,1200080426),j=d(j,k,h,i,c[6],17,-1473231341),i=d(i,j,k,h,c[7],22,-45705983),h=d(h,i,j,k,c[8],7,1770035416),k=d(k,h,i,j,c[9],12,-1958414417),j=d(j,k,h,i,c[10],17,-42063),i=d(i,j,k,h,c[11],22,-1990404162),h=d(h,i,j,k,c[12],7,1804603682),k=d(k,h,i,j,c[13],12,-40341101),j=d(j,k,h,i,c[14],17,-1502002290),i=d(i,j,k,h,c[15],22,1236535329),h=e(h,i,j,k,c[1],5,-165796510),k=e(k,h,i,j,c[6],9,-1069501632),j=e(j,k,h,i,c[11],14,643717713),i=e(i,j,k,h,c[0],20,-373897302),h=e(h,i,j,k,c[5],5,-701558691),k=e(k,h,i,j,c[10],9,38016083),j=e(j,k,h,i,c[15],14,-660478335),i=e(i,j,k,h,c[4],20,-405537848),h=e(h,i,j,k,c[9],5,568446438),k=e(k,h,i,j,c[14],9,-1019803690),j=e(j,k,h,i,c[3],14,-187363961),i=e(i,j,k,h,c[8],20,1163531501),h=e(h,i,j,k,c[13],5,-1444681467),k=e(k,h,i,j,c[2],9,-51403784),j=e(j,k,h,i,c[7],14,1735328473),i=e(i,j,k,h,c[12],20,-1926607734),h=f(h,i,j,k,c[5],4,-378558),k=f(k,h,i,j,c[8],11,-2022574463),j=f(j,k,h,i,c[11],16,1839030562),i=f(i,j,k,h,c[14],23,-35309556),h=f(h,i,j,k,c[1],4,-1530992060),k=f(k,h,i,j,c[4],11,1272893353),j=f(j,k,h,i,c[7],16,-155497632),i=f(i,j,k,h,c[10],23,-1094730640),h=f(h,i,j,k,c[13],4,681279174),k=f(k,h,i,j,c[0],11,-358537222),j=f(j,k,h,i,c[3],16,-722521979),i=f(i,j,k,h,c[6],23,76029189),h=f(h,i,j,k,c[9],4,-640364487),k=f(k,h,i,j,c[12],11,-421815835),j=f(j,k,h,i,c[15],16,530742520),i=f(i,j,k,h,c[2],23,-995338651),h=g(h,i,j,k,c[0],6,-198630844),k=g(k,h,i,j,c[7],10,1126891415),j=g(j,k,h,i,c[14],15,-1416354905),i=g(i,j,k,h,c[5],21,-57434055),h=g(h,i,j,k,c[12],6,1700485571),k=g(k,h,i,j,c[3],10,-1894986606),j=g(j,k,h,i,c[10],15,-1051523),i=g(i,j,k,h,c[1],21,-2054922799),h=g(h,i,j,k,c[8],6,1873313359),k=g(k,h,i,j,c[15],10,-30611744),j=g(j,k,h,i,c[6],15,-1560198380),i=g(i,j,k,h,c[13],21,1309151649),h=g(h,i,j,k,c[4],6,-145523070),k=g(k,h,i,j,c[11],10,-1120210379),j=g(j,k,h,i,c[2],15,718787259),i=g(i,j,k,h,c[9],21,-343485551),a[0]=b(h,a[0]),a[1]=b(i,a[1]),a[2]=b(j,a[2]),a[3]=b(k,a[3])},i=function(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a.charCodeAt(b)+(a.charCodeAt(b+1)<<8)+(a.charCodeAt(b+2)<<16)+(a.charCodeAt(b+3)<<24);return c},j=function(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a[b]+(a[b+1]<<8)+(a[b+2]<<16)+(a[b+3]<<24);return c},k=function(a){var b,c,d,e,f,g,j=a.length,k=[1732584193,-271733879,-1732584194,271733878];for(b=64;j>=b;b+=64)h(k,i(a.substring(b-64,b)));for(a=a.substring(b-64),c=a.length,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=0;c>b;b+=1)d[b>>2]|=a.charCodeAt(b)<<(b%4<<3);if(d[b>>2]|=128<<(b%4<<3),b>55)for(h(k,d),b=0;16>b;b+=1)d[b]=0;return e=8*j,e=e.toString(16).match(/(.*?)(.{0,8})$/),f=parseInt(e[2],16),g=parseInt(e[1],16)||0,d[14]=f,d[15]=g,h(k,d),k},l=function(a){var b,c,d,e,f,g,i=a.length,k=[1732584193,-271733879,-1732584194,271733878];for(b=64;i>=b;b+=64)h(k,j(a.subarray(b-64,b)));for(a=i>b-64?a.subarray(b-64):new Uint8Array(0),c=a.length,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=0;c>b;b+=1)d[b>>2]|=a[b]<<(b%4<<3);if(d[b>>2]|=128<<(b%4<<3),b>55)for(h(k,d),b=0;16>b;b+=1)d[b]=0;return e=8*i,e=e.toString(16).match(/(.*?)(.{0,8})$/),f=parseInt(e[2],16),g=parseInt(e[1],16)||0,d[14]=f,d[15]=g,h(k,d),k},m=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n=function(a){var b,c="";for(b=0;4>b;b+=1)c+=m[a>>8*b+4&15]+m[a>>8*b&15];return c},o=function(a){var b;for(b=0;b<a.length;b+=1)a[b]=n(a[b]);return a.join("")},p=function(a){return o(k(a))},q=function(){this.reset()};return"5d41402abc4b2a76b9719d911017c592"!==p("hello")&&(b=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}),q.prototype.append=function(a){return/[\u0080-\uFFFF]/.test(a)&&(a=unescape(encodeURIComponent(a))),this.appendBinary(a),this},q.prototype.appendBinary=function(a){this._buff+=a,this._length+=a.length;var b,c=this._buff.length;for(b=64;c>=b;b+=64)h(this._state,i(this._buff.substring(b-64,b)));return this._buff=this._buff.substr(b-64),this},q.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(b=0;e>b;b+=1)f[b>>2]|=d.charCodeAt(b)<<(b%4<<3);return this._finish(f,e),c=a?this._state:o(this._state),this.reset(),c},q.prototype._finish=function(a,b){var c,d,e,f=b;if(a[f>>2]|=128<<(f%4<<3),f>55)for(h(this._state,a),f=0;16>f;f+=1)a[f]=0;c=8*this._length,c=c.toString(16).match(/(.*?)(.{0,8})$/),d=parseInt(c[2],16),e=parseInt(c[1],16)||0,a[14]=d,a[15]=e,h(this._state,a)},q.prototype.reset=function(){return this._buff="",this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},q.prototype.destroy=function(){delete this._state,delete this._buff,delete this._length},q.hash=function(a,b){/[\u0080-\uFFFF]/.test(a)&&(a=unescape(encodeURIComponent(a)));var c=k(a);return b?c:o(c)},q.hashBinary=function(a,b){var c=k(a);return b?c:o(c)},q.ArrayBuffer=function(){this.reset()},q.ArrayBuffer.prototype.append=function(a){var b,c=this._concatArrayBuffer(this._buff,a),d=c.length;for(this._length+=a.byteLength,b=64;d>=b;b+=64)h(this._state,j(c.subarray(b-64,b)));return this._buff=d>b-64?c.subarray(b-64):new Uint8Array(0),this},q.ArrayBuffer.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; +for(b=0;e>b;b+=1)f[b>>2]|=d[b]<<(b%4<<3);return this._finish(f,e),c=a?this._state:o(this._state),this.reset(),c},q.ArrayBuffer.prototype._finish=q.prototype._finish,q.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},q.ArrayBuffer.prototype.destroy=q.prototype.destroy,q.ArrayBuffer.prototype._concatArrayBuffer=function(a,b){var c=a.length,d=new Uint8Array(c+b.byteLength);return d.set(a),d.set(new Uint8Array(b),c),d},q.ArrayBuffer.hash=function(a,b){var c=l(new Uint8Array(a));return b?c:o(c)},a.register("Md5",{init:function(){},loadFromBlob:function(a){var b,c,d=a.getSource(),e=2097152,f=Math.ceil(d.size/e),g=0,h=this.owner,i=new q.ArrayBuffer,j=this,k=d.mozSlice||d.webkitSlice||d.slice;c=new FileReader,(b=function(){var l,m;l=g*e,m=Math.min(l+e,d.size),c.onload=function(b){i.append(b.target.result),h.trigger("progress",{total:a.size,loaded:m})},c.onloadend=function(){c.onloadend=c.onload=null,++g<f?setTimeout(b,1):setTimeout(function(){h.trigger("load"),j.result=i.end(),b=a=d=i=null,h.trigger("complete")},50)},c.readAsArrayBuffer(k.call(d,l,m))})()},getResult:function(){return this.result}})}),b("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1],10)}function f(){function d(a,b){var c,d,e=a.type||a;c=e.split("::"),d=c[0],e=c[1],"Ready"===e&&d===j.uid?j.trigger("ready"):f[d]&&f[d].trigger(e.toLowerCase(),a,b)}var e={},f={},g=this.destroy,j=this,k=b.guid("webuploader_");c.apply(j,arguments),j.type=h,j.exec=function(a,c){var d,g=this,h=g.uid,k=b.slice(arguments,2);return f[h]=g,i[a]&&(e[h]||(e[h]=new i[a](g,j)),d=e[h],d[c])?d[c].apply(d,k):j.flashExec.apply(g,arguments)},a[k]=function(){var a=arguments;setTimeout(function(){d.apply(null,a)},1)},this.jsreciver=k,this.destroy=function(){return g&&g.apply(this,arguments)},this.flashExec=function(a,c){var d=j.getFlash(),e=b.slice(arguments,2);return d.exec(this.uid,a,c,e)}}var g=b.$,h="flash",i={};return b.inherits(c,{constructor:f,init:function(){var a,c=this.getContainer(),d=this.options;c.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),a='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+d.swf+'" ',b.browser.ie&&(a+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),a+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+d.swf+'" /><param name="flashvars" value="uid='+this.uid+"&jsreciver="+this.jsreciver+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/image",["runtime/flash/runtime"],function(a){return a.register("Image",{loadFromBlob:function(a){var b=this.owner;b.info()&&this.flashExec("Image","info",b.info()),b.meta()&&this.flashExec("Image","meta",b.meta()),this.flashExec("Image","loadFromBlob",a.uid)}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.flashExec("Blob","slice",a,c);return new b(d.uid,d)}})}),b("runtime/flash/md5",["runtime/flash/runtime"],function(a){return a.register("Md5",{init:function(){},loadFromBlob:function(a){return this.flashExec("Md5","loadFromBlob",a.uid)}})}),b("preset/all",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","widgets/md5","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/androidpatch","runtime/html5/image","runtime/html5/transport","runtime/html5/md5","runtime/flash/filepicker","runtime/flash/image","runtime/flash/transport","runtime/flash/blob","runtime/flash/md5"],function(a){return a}),b("widgets/log",["base","uploader","widgets/widget"],function(a,b){function c(a){var b=e.extend({},d,a),c=f.replace(/^(.*)\?/,"$1"+e.param(b)),g=new Image;g.src=c}var d,e=a.$,f=" http://static.tieba.baidu.com/tb/pms/img/st.gif??",g=(location.hostname||location.host||"protected").toLowerCase(),h=g&&/baidu/i.exec(g);if(h)return d={dv:3,master:"webuploader",online:/test/.exec(g)?0:1,module:"",product:g,type:0},b.register({name:"log",init:function(){var a=this.owner,b=0,d=0;a.on("error",function(a){c({type:2,c_error_code:a})}).on("uploadError",function(a,b){c({type:2,c_error_code:"UPLOAD_ERROR",c_reason:""+b})}).on("uploadComplete",function(a){b++,d+=a.size}).on("uploadFinished",function(){c({c_count:b,c_size:d}),b=d=0}),c({c_usage:1})}})}),b("webuploader",["preset/all","widgets/log"],function(a){return a}),c("webuploader")}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.js new file mode 100644 index 0000000..fa51de5 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.js @@ -0,0 +1,5026 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。 + * + * AMD API 内部的简单不完全实现,请忽略。只有当WebUploader被合并成一个文件的时候才会引入。 + */ +(function( root, factory ) { + var modules = {}, + + // 内部require, 简单不完全实现。 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 如果deps不是数组,则直接返回指定module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 内部define,暂时不支持不指定id. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 设置module, 兼容CommonJs写法。 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 根据id获取module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 将所有modules,将路径ids装换成对象。 + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 操作相关 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 使用jQuery的Promise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 基础类方法。 + */ + + /** + * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。 + * + * As you know, Web Uploader的每个文件都是用过[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)规范中的`define`组织起来的, 每个Module都会有个module id. + * 默认module id为该文件的路径,而此路径将会转化成名字空间存放在WebUploader中。如: + * + * * module `base`:WebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 以下文档中对类的使用可能省略掉了`WebUploader`前缀。 + * @module WebUploader + * @title WebUploader API文档 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 反科里化 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 基础类,提供一些简单常用的方法。 + * @class Base + */ + return { + + /** + * @property {String} version 当前版本号。 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 引用依赖的jQuery或者Zepto对象。 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 简单的浏览器检查结果。 + * + * * `webkit` webkit版本号,如果浏览器为非webkit内核,此属性为`undefined`。 + * * `chrome` chrome浏览器版本号,如果浏览器为chrome,此属性为`undefined`。 + * * `ie` ie浏览器版本号,如果浏览器为非ie,此属性为`undefined`。**暂不支持ie10+** + * * `firefox` firefox浏览器版本号,如果浏览器为非firefox,此属性为`undefined`。 + * * `safari` safari浏览器版本号,如果浏览器为非safari,此属性为`undefined`。 + * * `opera` opera浏览器版本号,如果浏览器为非opera,此属性为`undefined`。 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 操作系统检查结果。 + * + * * `android` 如果在android浏览器环境下,此值为对应的android版本号,否则为`undefined`。 + * * `ios` 如果在ios浏览器环境下,此值为对应的ios版本号,否则为`undefined`。 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 实现类与类之间的继承。 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 父类 + * @param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。 + * @param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。 + * @param {Object} [statics] 静态属性或方法。 + * @return {Class} 返回子类。 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 因为没有指定构造器,父类的构造器将会执行。 + * var instance = new Manager(); // => Super + * + * // 继承子父类的方法 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 子类的__super__属性指向父类 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 复制静态方法 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 让子类的__super__属性指向父类。 + child.__super__ = Super.prototype; + + // 构建原型,添加原型方法或属性。 + // 暂时用Object.create实现。 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 一个不做任何事情的方法。可以用来赋值给默认的callback. + * @method noop + */ + noop: noop, + + /** + * 返回一个新的方法,此方法将已指定的`context`来执行。 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 引用Console.log如果存在的话,否则引用一个[空函数noop](#WebUploader:Base.noop)。 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 当浏览器不在当前窗口时就停了。 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 被[uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)的数组slice方法。 + * 将用来将非数组对象转化成数组对象。 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 生成唯一的ID + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 格式化文件大小, 输出成带单位的字符串 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 文件大小 + * @param {Number} [pointLength=2] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 事件处理类,可以独立使用,也可以扩展给对象使用。 + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 根据条件过滤出事件handlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 不支持对象,只支持多个event用空格隔开 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 绑定事件。 + * + * `callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如 + * ```javascript + * var obj = {}; + * + * // 使得obj有事件行为 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。 + * 切会影响到`trigger`方法的返回值,为`false`。 + * + * `on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处, + * 就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 事件名,支持多个事件用空格隔开 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 绑定事件,且当handler执行完后,自动解除绑定。 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 事件名 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 解除事件绑定 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 事件名 + * @param {Function} [callback] 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 触发事件 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 事件名 + * @param {*} [...] 任意参数 + * @return {Boolean} 如果handler中return false了,则返回false, 否则返回true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 中介者,它本身是个单例,但可以通过[installTo](#WebUploader:Mediator:installTo)方法,使任何对象具备事件行为。 + * 主要目的是负责模块与模块之间的合作,降低耦合度。 + * + * @class Mediator + */ + return $.extend({ + + /** + * 可以通过这个接口,使任何对象具备事件功能。 + * @method installTo + * @param {Object} obj 需要具备事件行为的对象。 + * @return {Object} 返回obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader上传类 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 上传入口类。 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 开起分片上传。 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets中有相应扩展 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 批量添加纯命令式方法。 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 获取或者设置Uploader配置项。 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 初始状态图片上传前不会压缩 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 修改后图片上传前,尝试将图片压缩到1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 获取文件统计信息。返回一个包含一下信息的对象。 + * * `successNum` 上传成功的文件数 + * * `progressNum` 上传中的文件数 + * * `cancelNum` 被删除的文件数 + * * `invalidNum` 无效的文件数 + * * `uploadFailNum` 上传失败的文件数 + * * `queueNum` 还在队列中的文件数 + * * `interruptNum` 被暂停的文件数 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 调用通过on方法注册的handler. + Mediator.trigger.apply( this, arguments ) === false || + + // 调用opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 调用this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 广播所有uploader的事件。 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 销毁 webuploader 实例 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js将补充此方法的详细文档。 + request: Base.noop + }); + + /** + * 创建Uploader实例,等同于new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 暴露Uploader,可以通过它来扩展业务逻辑。 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 获取对象的第一个key + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 接口类。 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 添加Runtime实现。 + * @param {String} type 类型 + * @param {Runtime} factory 具体Runtime实现。 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 有些类型不能重用,比如filepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 允许runtime没有初始化之前,注册一些方法在初始化后执行。 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 像filePicker只能独立存在,不能公用。 + runtime = runtime || cache.get( null, standalone ); + + // 需要创建 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 来自cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 错误信息 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 类Backbone的事件监听声明,监听uploader实例上的事件 + // widget直接无法监听事件,事件只能通过uploader来传递 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 如果无API响应声明则忽略 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 发送命令。当传入`callback`或者`handler`中返回`promise`时。返回一个当所有`handler`中的promise都完成后完成的新`promise`。 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 扩展Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 默认所有 Uploader.register 了的 widget 都会被加载,如果禁用某一部分,请通过此 option 指定黑名单。 + */ + + // 覆写_init用来初始化widgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred对象 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 如果有callback,则用异步方式。 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 很重要不能删除。删除了会死循环。 + // 保证执行顺序。让callback总是在下一个 tick 中执行。 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 添加组件 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 名称与函数实现的映射 + * @param {object} proto 组件原型,构造函数通过 constructor 属性定义 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 自动生成 map 表。 + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 删除插件,只有在注册时指定了名字的才能被删除。 + * @grammar Uploader.unRegister(name); + * @param {string} name 组件名字 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 删除指定的插件。 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget。 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 指定Drag And Drop拖拽的容器,如果不指定,则不启动。 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 是否禁掉整个页面的拖拽功能,如果不禁用,图片拖进来的时候会默认被浏览器打开。 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 阻止此事件可以拒绝某些类型的文件拖入进来。目前只有 chrome 提供这样的 API,且只能通过 mime-type 验证。 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 检测文件是否全部允许添加。 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 指定监听paste事件的容器,如果不指定,不启用此功能。此功能为通过粘贴来添加截屏的图片。建议设置为`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 如果没有指定 mimetype, 但是知道文件后缀。 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 为了统一化Flash的File和HTML5的File而存在。 + * 以至于要调用Flash里面的File,也可以像调用HTML5版本的File一下。 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 支持其他类型文件的转换。 + // 如果有 mimetype, 但是文件名里面没有找出后缀规律 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('按钮指定错误'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 记录来源。 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 文件选择相关 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 指定选择文件的按钮容器,不指定则不创建按钮。 + * + * * `id` {Seletor|dom} 指定选择文件的按钮容器,不指定则不创建按钮。**注意** 这里虽然写的是 id, 但是不是只支持 id, 还支持 class, 或者 dom 节点。 + * * `label` {String} 请采用 `innerHTML` 代替 + * * `innerHTML` {String} 指定按钮文字。不指定时优先从指定的容器中看是否自带文字。 + * * `multiple` {Boolean} 是否开起同时选择多个文件能力。 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 指定接受哪些类型的文件。 由于目前还有ext转mimeType表,所以这里需要分开指定。 + * + * * `title` {String} 文字描述 + * * `extensions` {String} 允许的文件后缀,不带点,多个用逗号分割。 + * * `mimeTypes` {String} 多个用逗号分割。 + * + * 如: + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 添加文件选择按钮,如果一个按钮不够,需要调用此方法来添加。参数跟[options.pick](#WebUploader:Uploader:options)一致。 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '选择文件' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview 文件属性封装 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 文件类 + * @class File + * @constructor 构造函数 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 + */ + function WUFile( source ) { + + /** + * 文件名,包括扩展名(后缀) + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 文件体积(字节) + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 文件最后修改日期 + * @property lastModifiedDate + * @type {int} + * @default 当前时间戳 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 文件ID,每个对象具有唯一ID,与文件名无关 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 文件扩展名,通过文件名获取,例如test.png的扩展名为png + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 状态文字说明。在不同的status语境下有不同的用途。 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 存储文件状态,防止通过属性直接修改 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 设置状态,状态变化时会触发`change`事件。 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status) + * @param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 文件状态变化 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 获取文件状态 + * @return {File.Status} + * @example + 文件状态具体包括以下几种类型: + { + // 初始化 + INITED: 0, + // 已入队列 + QUEUED: 1, + // 正在上传 + PROGRESS: 2, + // 上传出错 + ERROR: 3, + // 上传成功 + COMPLETE: 4, + // 上传取消 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 获取文件原始信息。 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 文件状态值,具体包括以下几种类型: + * * `inited` 初始状态 + * * `queued` 已经进入队列, 等待上传 + * * `progress` 上传中 + * * `complete` 上传完成。 + * * `error` 上传出错,可重试 + * * `interrupt` 上传中断,可续传。 + * * `invalid` 文件不合格,不能重试上传。会自动从队列中移除。 + * * `cancelled` 文件被移除。 + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 初始状态 + QUEUED: 'queued', // 已经进入队列, 等待上传 + PROGRESS: 'progress', // 上传中 + ERROR: 'error', // 上传出错,可重试 + COMPLETE: 'complete', // 上传完成。 + CANCELLED: 'cancelled', // 上传取消。 + INTERRUPT: 'interrupt', // 上传中断,可续传。 + INVALID: 'invalid' // 文件不合格,不能重试上传。 + }; + + return WUFile; + }); + + /** + * @fileOverview 文件队列 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 文件队列, 用来存储各个状态中的文件。 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 统计文件数。 + * * `numOfQueue` 队列中的文件数。 + * * `numOfSuccess` 上传成功的文件数 + * * `numOfCancel` 被取消的文件数 + * * `numOfProgress` 正在上传中的文件数 + * * `numOfUploadFailed` 上传错误的文件数。 + * * `numOfInvalid` 无效的文件数。 + * * `numofDeleted` 被移除的文件数。 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 上传队列,仅包括等待上传的文件 + this._queue = []; + + // 存储所有文件 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 将新文件加入对队列尾部 + * + * @method append + * @param {File} file 文件对象 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 将新文件加入对队列头部 + * + * @method prepend + * @param {File} file 文件对象 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 获取文件对象 + * + * @method getFile + * @param {String} fileId 文件ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 从队列中取出一个指定状态的文件。 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [文件状态值](#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 对队列进行排序,能够控制文件上传顺序。 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 排序方法 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [文件状态值](#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 在队列中删除文件。 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 文件对象。 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 队列 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept中的中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 如果当前不是html5运行时,那就算了。 + // 不执行后续操作 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 创建一个 html5 运行时的 placeholder + // 以至于外部添加原生 File 对象的时候能正确包裹一下供 webuploader 使用。 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 为了支持外部直接添加一个原生File对象。 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 判断文件是否可以被加入队列 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 如果名字中有后缀,才做后缀白名单处理。 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File对象 + * @description 当文件被加入队列之前触发,此事件的handler返回值为`false`,则此文件不会被添加进入队列。 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File对象 + * @description 当文件被加入队列以后触发。 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 不过类型判断允许不允许,先派送 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 类型不匹配,则派送错误事件,并返回。 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 数组,内容为原始File(lib/File)对象。 + * @description 当一批文件添加进队列以后触发。 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 对象 数组 + * @description 添加文件到队列 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File对象 + * @description 当文件被移除队列后触发。 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 返回指定状态的文件集合,不传参数将返回所有状态的文件。 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 重试上传,重试指定文件,或者从出错的文件开始重新上传。 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 排序队列中的文件,在上传之前调整可以控制上传顺序。 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 当 uploader 被重置的时候触发。 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 重置uploader。目前只重置了队列。 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 添加获取Runtime相关信息的方法。 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 指定运行时启动顺序。默认会想尝试 html5 是否支持,如果支持则使用 html5, 否则则使用 flash. + * + * 可以将此值设置成 `flash`,来强制使用 flash 运行时。 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 预测Uploader将采用哪个`Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 跨域时,是否允许携带cookie, 只有html5 runtime才有效 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2分钟 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 添加Blob, 只能添加一次,最后一次有效。 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 添加其他字段 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 让Transport具备事件功能。 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 负责文件上传相关。 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 添加默认配置项 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 是否允许在文件传输时提前把下一个文件准备好。 + * 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 + * 如果能提前在当前文件传输期处理,可以节省总体耗时。 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 是否要分片处理大文件上传。 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 如果要分片,分多大一片? 默认大小为5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 如果某个分片由于网络问题出错,允许自动重传多少次? + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 上传并发数。允许同时最大上传进程数。 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 文件上传请求的参数表,每次发送都会发送此对象中的参数。 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 设置文件上传域的name。 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 文件上传方式,`POST`或者`GET`。 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 是否已二进制的流的方式发送文件,这样整个上传内容`php://input`都为文件内容, + * 其他参数在$_GET数组中。 + */ + }); + + // 负责将文件切片。 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 记录当前正在传的数据,跟threads相关 + this.pool = []; + + // 缓存分好片的文件。 + this.stack = []; + + // 缓存即将上传的文件。 + this.pending = []; + + // 跟踪还有多少分片在上传中但是没有完成上传。 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 把其他块取消了。 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 当开始上传流程时触发。 + * @for Uploader + */ + + /** + * 开始上传。此方法可以从初始状态调用开始上传流程,也可以从暂停状态调用,继续上传流程。 + * + * 可以指定开始某一个文件。 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 移出invalid的文件 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 如果指定了开始某个文件,则只开始指定文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 之前暂停过。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 如果有暂停的,则续传 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 当开始上传流程暂停时触发。 + * @for Uploader + */ + + /** + * 暂停上传。第一个参数为是否中断上传当前正在上传的文件。 + * + * 如果第一个参数是文件,则只暂停指定文件。 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 如果只是暂停某个文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 只 abort 指定的文件。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 标记文件状态为已取消, 同时将中断文件传输。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 判断`Uplaode`r是否正在上传中。 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 掉过一个文件上传,直接标记指定文件为已上传状态。 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 当所有文件上传结束时触发。 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 上一个promise还没有结束,则等待完成后再执行。 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 还有位置,且还有文件要处理的话。 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 有可能是reject过来的,所以要检测val的类型。 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 没有要上传的了,且没有正在传输的了。 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 把已经处理完了的,或者,状态为非 progress(上传中)、 + // interupt(暂停中) 的移除。 + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 如果当前文件还有没有需要传输的,则直接返回剩下的。 + if ( (act = this._getStack()) ) { + + // 是否提前准备下一个文件 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 否则,如果正在运行,则准备下一个文件,并等待完成后返回下个分片。 + } else if ( me.runing ) { + + // 如果缓存中有,则直接在缓存中取,没有则去queue中取。 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 文件可能还在prepare中,也有可能已经完全准备好了。 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File对象 + * @description 某个文件开始上传前触发,一个文件只会触发一次。 + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 有可能文件被skip掉了。文件被skip掉后,状态坑定不是Queued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 如果还在pending中,则替换成文件本身。 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file的钩子就有错误发生。 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 让出位置了,可以让其他分片开始上传 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 有可能在 before-send-file 的 promise 期间改变了文件状态。 + // 如:暂停,取消 + // 我们不能中断 promise, 但是可以在 promise 完后,不做上传操作。 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 如果是中断,则还需要放回去。 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 如果没有分片,则直接使用原始的。 + // 不会丢失content-type信息。 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 每个分片发送之前可能要做些异步的事情。 + promise = me.request( 'before-send', block, function() { + + // 有可能文件已经上传出错了,所以不需要再传输了。 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 如果为fail了,则跳过此分片。 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 默认的上传参数,可以扩展此对象来控制上传参数。 + * @param {Object} headers 可以扩展此对象来控制上传头部。 + * @description 当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。 + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 服务端的返回数据,json格式,如果服务端不是json格式,从ret._raw中取数据,自行解析。 + * @description 当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为`false`, 则此文件将派送`server`类型的`uploadError`事件。 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File对象 + * @param {Number} percentage 上传进度 + * @description 上传过程中触发,携带上传进度。 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File对象 + * @param {String} reason 出错的code + * @description 当文件上传出错时触发。 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File对象 + * @param {Object} response 服务端返回的数据 + * @description 当文件上传成功时触发。 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File对象 + * @description 不管成功或者失败,文件上传完成时触发。 + * @for Uploader + */ + + // 做上传操作。 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 广播上传进度。以文件为单位。 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 用来询问,是否返回的结果是有错误的。 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 服务端响应了,不代表成功了,询问是否响应正确。 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 尝试重试,然后广播文件上传出错。 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 自动重试 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 上传成功 + tr.on( 'load', function() { + var reason; + + // 如果非预期,转向上传出错。 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 全部上传完成。 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 配置默认的上传字段。 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 在发送之间可以添加字段什么的。。。 + // 如果默认的字段不够使用,可以通过监听此事件来扩展 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 开始发送。 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 完成上传。 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 如果外部已经标记为invalid什么的,不再改状态。 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 各种验证,包括文件总大小是否超出、单文件是否超出和文件是否重复。 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 错误类型。 + * @description 当validate不通过时,会以派送错误事件的形式通知调用者。通过`upload.on('error', handler)`可以捕获到此类错误,目前有以下错误会在特定的情况下派送错来。 + * + * * `Q_EXCEED_NUM_LIMIT` 在设置了`fileNumLimit`且尝试给`uploader`添加的文件数量超出这个值时派送。 + * * `Q_EXCEED_SIZE_LIMIT` 在设置了`Q_EXCEED_SIZE_LIMIT`且尝试给`uploader`添加的文件总大小超出这个值时派送。 + * * `Q_TYPE_DENIED` 当文件类型不满足时触发。。 + * @for Uploader + */ + + // 暴露给外面的api + api = { + + // 添加验证器 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 移除验证器 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 在Uploader初始化的时候启动Validators的初始化 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总数量, 超出则不允许加入队列。 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证单个文件大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 去重, 根据文件名字、文件大小和最后修改时间来生成hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 已经重复了 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 不需要连接其他程序,直接执行callback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 注册Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 注册html5运行时。 + // 只有在支持的前提下注册。 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 注意只有 chrome 支持。 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 只处理框内的。 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 只处理框内的。 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 如果是页面内拖拽,还不能处理,不阻止事件。 + // 此处 ie11 下会报参数错误, + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 如果传入 callback 则去查看文件夹,否则只管当前文件夹。 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 为了保证顺序。 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 还没 init 就调用 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp的mimeTypes中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 不阻止非文件粘贴(文字粘贴)的事件冒泡 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox不支持单独指定后缀 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * @fileOverview Transport + * @todo 支持chunked传输,优势: + * 可以将大文件分成小块,挨个传输,可以提高大文件成功率,当失败的时候,也只需要重传那小部分, + * 而不需要重头再传一次。另外断点续传也需要用chunked方式。 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 强制设置成 content-type 为文件流。 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android直接发送blob会导致服务端接收到的是空文件。 + // bug详情。 + // https://code.google.com/p/android/issues/detail?id=39882 + // 所以先用fileReader读取出来再通过arraybuffer的方式发送。 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash的接受器。 + window[ jsreciver ] = function() { + var args = arguments; + + // 为了能捕获得到。 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '<object id="' + this.uid + '" type="application/' + + 'x-shockwave-flash" data="' + opts.swf + '" '; + + if ( Base.browser.ie ) { + html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; + } + + html += 'width="100%" height="100%" style="outline:0">' + + '<param name="movie" value="' + opts.swf + '" />' + + '<param name="flashvars" value="uid=' + this.uid + + '&jsreciver=' + this.jsreciver + '" />' + + '<param name="wmode" value="transparent" />' + + '<param name="allowscriptaccess" value="always" />' + + '</object>'; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 修复Flash再没有设置title的情况下无法弹出flash文件选择框的bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 处理可能存在 bug, 没辙只能靠 js 了 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview 没有图像处理的版本。 + */ + define('preset/withoutimage',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/transport', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/transport', + 'runtime/flash/blob' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/withoutimage' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.min.js new file mode 100644 index 0000000..7d889db --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e<f;)if(c=a[e],c.cb.apply(c.ctx2,b)===!1){d=!0;break}return!d}var e,f=a.$,g=[].slice,h=/\s+/;return e={on:function(a,b,d){var e,f=this;return b?(e=this._events||(this._events=[]),c(a,b,function(a,b){var c={e:a};c.cb=b,c.ctx=d,c.ctx2=d||f,c.id=e.length,e.push(c)}),this):this},once:function(a,b,d){var e=this;return b?(c(a,b,function(a,b){var c=function(){return e.off(a,c),b.apply(d||e,arguments)};c._cb=b,e.on(a,c,d)}),e):e},off:function(a,d,e){var g=this._events;return g?a||d||e?(c(a,d,function(a,c){f.each(b(g,a,c,e),function(){delete g[this.id]})}),this):(this._events=[],this):this},trigger:function(a){var c,e,f;return this._events&&a?(c=g.call(arguments,1),e=b(this._events,a),f=b(this._events,"all"),d(e,c)&&d(f,arguments)):this}},f.extend({installTo:function(a){return f.extend(a,e)}},e)}),b("uploader",["base","mediator"],function(a,b){function c(a){this.options=d.extend(!0,{},c.options,a),this._init(this.options)}var d=a.$;return c.options={},b.installTo(c.prototype),d.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",sort:"sort-files",removeFile:"remove-file",cancelFile:"cancel-file",skipFile:"skip-file",retry:"retry",isInProgress:"is-in-progress",makeThumb:"make-thumb",md5File:"md5-file",getDimension:"get-dimension",addButton:"add-btn",predictRuntimeType:"predict-runtime-type",refresh:"refresh",disable:"disable",enable:"enable",reset:"reset"},function(a,b){c.prototype[a]=function(){return this.request(b,arguments)}}),d.extend(c.prototype,{state:"pending",_init:function(a){var b=this;b.request("init",a,function(){b.state="ready",b.trigger("ready")})},option:function(a,b){var c=this.options;return arguments.length>1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("按钮指定错误");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length<e.threads&&(c=d._nextBlock())?(d._trigged=!1,b=function(b){d._promise=null,b&&b.file&&d._startSend(b),a.nextTick(d.__tick)},d._promise=g(c)?c.always(b):b(c)):d.remaning||d._getStats().numOfQueue||d._getStats().numofInterrupt||(d.runing=!1,d._trigged||a.nextTick(function(){d.owner.trigger("uploadFinished")}),d._trigged=!0))},_putback:function(a){var b;a.cuted.unshift(a),b=this.stack.indexOf(a.cuted),~b||this.stack.unshift(a.cuted)},_getStack:function(){for(var a,b=0;a=this.stack[b++];){if(a.has()&&a.file.getStatus()===h.PROGRESS)return a;(!a.has()||a.file.getStatus()!==h.PROGRESS&&a.file.getStatus()!==h.INTERRUPT)&&this.stack.splice(--b,1)}return null},_nextBlock:function(){var a,b,c,d,f=this,h=f.options;return(a=this._getStack())?(h.prepareNextFile&&!f.pending.length&&f._prepareNextFile(),a.shift()):f.runing?(!f.pending.length&&f._getStats().numOfQueue&&f._prepareNextFile(),b=f.pending.shift(),c=function(b){return b?(a=e(b,h.chunked?h.chunkSize:0),f.stack.push(a),a.shift()):null},g(b)?(d=b.file,b=b[b.pipe?"pipe":"then"](c),b.file=d,b):c(b)):void 0},_prepareNextFile:function(){var a,b=this,c=b.request("fetch-file"),d=b.pending;c&&(a=b.request("before-send-file",c,function(){return c.getStatus()===h.PROGRESS||c.getStatus()===h.INTERRUPT?c:b._finishFile(c)}),b.owner.trigger("uploadStart",c),c.setStatus(h.PROGRESS),a.file=c,a.done(function(){var b=f.inArray(a,d);~b&&d.splice(b,1,c)}),a.fail(function(a){c.setStatus(h.ERROR,a),b.owner.trigger("uploadError",c,a),b.owner.trigger("uploadComplete",c)}),d.push(a))},_popBlock:function(a){var b=f.inArray(a,this.pool);this.pool.splice(b,1),a.file.remaning--,this.remaning--},_startSend:function(b){var c,d=this,e=b.file;return e.getStatus()!==h.PROGRESS?void(e.getStatus()===h.INTERRUPT&&d._putback(b)):(d.pool.push(b),d.remaning++,b.blob=1===b.chunks?e.source:e.source.slice(b.start,b.end),c=d.request("before-send",b,function(){e.getStatus()===h.PROGRESS?d._doSend(b):(d._popBlock(b),a.nextTick(d.__tick))}),void c.fail(function(){1===e.remaning?d._finishFile(e).always(function(){b.percentage=1,d._popBlock(b),d.owner.trigger("uploadComplete",e),a.nextTick(d.__tick)}):(b.percentage=1,d.updateFileProgress(e),d._popBlock(b),a.nextTick(d.__tick))}))},_doSend:function(b){var c,e,g=this,i=g.owner,j=g.options,k=b.file,l=new d(j),m=f.extend({},j.formData),n=f.extend({},j.headers);b.transport=l,l.on("destroy",function(){delete b.transport,g._popBlock(b),a.nextTick(g.__tick)}),l.on("progress",function(a){b.percentage=a,g.updateFileProgress(k)}),c=function(a){var c;return e=l.getResponseAsJson()||{},e._raw=l.getResponse(),c=function(b){a=b},i.trigger("uploadAccept",b,e,c)||(a=a||"server"),a},l.on("error",function(a,d){b.retried=b.retried||0,b.chunks>1&&~"http,abort".indexOf(a)&&b.retried<j.chunkRetry?(b.retried++,l.send()):(d||"server"!==a||(a=c(a)),k.setStatus(h.ERROR,a),i.trigger("uploadError",k,a),i.trigger("uploadComplete",k))}),l.on("load",function(){var a;return(a=c())?void l.trigger("error",a,!0):void(1===k.remaning?g._finishFile(k,e):l.destroy())}),m=f.extend(m,{id:k.id,name:k.name,type:k.type,lastModifiedDate:k.lastModifiedDate,size:k.size}),b.chunks>1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b)}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice; +return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1],10)}function f(){function d(a,b){var c,d,e=a.type||a;c=e.split("::"),d=c[0],e=c[1],"Ready"===e&&d===j.uid?j.trigger("ready"):f[d]&&f[d].trigger(e.toLowerCase(),a,b)}var e={},f={},g=this.destroy,j=this,k=b.guid("webuploader_");c.apply(j,arguments),j.type=h,j.exec=function(a,c){var d,g=this,h=g.uid,k=b.slice(arguments,2);return f[h]=g,i[a]&&(e[h]||(e[h]=new i[a](g,j)),d=e[h],d[c])?d[c].apply(d,k):j.flashExec.apply(g,arguments)},a[k]=function(){var a=arguments;setTimeout(function(){d.apply(null,a)},1)},this.jsreciver=k,this.destroy=function(){return g&&g.apply(this,arguments)},this.flashExec=function(a,c){var d=j.getFlash(),e=b.slice(arguments,2);return d.exec(this.uid,a,c,e)}}var g=b.$,h="flash",i={};return b.inherits(c,{constructor:f,init:function(){var a,c=this.getContainer(),d=this.options;c.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),a='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+d.swf+'" ',b.browser.ie&&(a+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),a+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+d.swf+'" /><param name="flashvars" value="uid='+this.uid+"&jsreciver="+this.jsreciver+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.flashExec("Blob","slice",a,c);return new b(d.uid,d)}})}),b("preset/withoutimage",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/transport","runtime/flash/filepicker","runtime/flash/transport","runtime/flash/blob"],function(a){return a}),b("webuploader",["preset/withoutimage"],function(a){return a}),c("webuploader")}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.js new file mode 100644 index 0000000..b6624e6 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.js @@ -0,0 +1,8012 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。 + * + * AMD API 内部的简单不完全实现,请忽略。只有当WebUploader被合并成一个文件的时候才会引入。 + */ +(function( root, factory ) { + var modules = {}, + + // 内部require, 简单不完全实现。 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 如果deps不是数组,则直接返回指定module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 内部define,暂时不支持不指定id. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 设置module, 兼容CommonJs写法。 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 根据id获取module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 将所有modules,将路径ids装换成对象。 + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 操作相关 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 使用jQuery的Promise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 基础类方法。 + */ + + /** + * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。 + * + * As you know, Web Uploader的每个文件都是用过[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)规范中的`define`组织起来的, 每个Module都会有个module id. + * 默认module id为该文件的路径,而此路径将会转化成名字空间存放在WebUploader中。如: + * + * * module `base`:WebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 以下文档中对类的使用可能省略掉了`WebUploader`前缀。 + * @module WebUploader + * @title WebUploader API文档 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 反科里化 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 基础类,提供一些简单常用的方法。 + * @class Base + */ + return { + + /** + * @property {String} version 当前版本号。 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 引用依赖的jQuery或者Zepto对象。 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 简单的浏览器检查结果。 + * + * * `webkit` webkit版本号,如果浏览器为非webkit内核,此属性为`undefined`。 + * * `chrome` chrome浏览器版本号,如果浏览器为chrome,此属性为`undefined`。 + * * `ie` ie浏览器版本号,如果浏览器为非ie,此属性为`undefined`。**暂不支持ie10+** + * * `firefox` firefox浏览器版本号,如果浏览器为非firefox,此属性为`undefined`。 + * * `safari` safari浏览器版本号,如果浏览器为非safari,此属性为`undefined`。 + * * `opera` opera浏览器版本号,如果浏览器为非opera,此属性为`undefined`。 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 操作系统检查结果。 + * + * * `android` 如果在android浏览器环境下,此值为对应的android版本号,否则为`undefined`。 + * * `ios` 如果在ios浏览器环境下,此值为对应的ios版本号,否则为`undefined`。 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 实现类与类之间的继承。 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 父类 + * @param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。 + * @param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。 + * @param {Object} [statics] 静态属性或方法。 + * @return {Class} 返回子类。 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 因为没有指定构造器,父类的构造器将会执行。 + * var instance = new Manager(); // => Super + * + * // 继承子父类的方法 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 子类的__super__属性指向父类 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 复制静态方法 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 让子类的__super__属性指向父类。 + child.__super__ = Super.prototype; + + // 构建原型,添加原型方法或属性。 + // 暂时用Object.create实现。 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 一个不做任何事情的方法。可以用来赋值给默认的callback. + * @method noop + */ + noop: noop, + + /** + * 返回一个新的方法,此方法将已指定的`context`来执行。 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 引用Console.log如果存在的话,否则引用一个[空函数noop](#WebUploader:Base.noop)。 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 当浏览器不在当前窗口时就停了。 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 被[uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)的数组slice方法。 + * 将用来将非数组对象转化成数组对象。 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 生成唯一的ID + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 格式化文件大小, 输出成带单位的字符串 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 文件大小 + * @param {Number} [pointLength=2] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 事件处理类,可以独立使用,也可以扩展给对象使用。 + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 根据条件过滤出事件handlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 不支持对象,只支持多个event用空格隔开 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 绑定事件。 + * + * `callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如 + * ```javascript + * var obj = {}; + * + * // 使得obj有事件行为 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。 + * 切会影响到`trigger`方法的返回值,为`false`。 + * + * `on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处, + * 就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 事件名,支持多个事件用空格隔开 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 绑定事件,且当handler执行完后,自动解除绑定。 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 事件名 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 解除事件绑定 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 事件名 + * @param {Function} [callback] 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 触发事件 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 事件名 + * @param {*} [...] 任意参数 + * @return {Boolean} 如果handler中return false了,则返回false, 否则返回true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 中介者,它本身是个单例,但可以通过[installTo](#WebUploader:Mediator:installTo)方法,使任何对象具备事件行为。 + * 主要目的是负责模块与模块之间的合作,降低耦合度。 + * + * @class Mediator + */ + return $.extend({ + + /** + * 可以通过这个接口,使任何对象具备事件功能。 + * @method installTo + * @param {Object} obj 需要具备事件行为的对象。 + * @return {Object} 返回obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader上传类 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 上传入口类。 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 开起分片上传。 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets中有相应扩展 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 批量添加纯命令式方法。 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 获取或者设置Uploader配置项。 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 初始状态图片上传前不会压缩 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 修改后图片上传前,尝试将图片压缩到1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 获取文件统计信息。返回一个包含一下信息的对象。 + * * `successNum` 上传成功的文件数 + * * `progressNum` 上传中的文件数 + * * `cancelNum` 被删除的文件数 + * * `invalidNum` 无效的文件数 + * * `uploadFailNum` 上传失败的文件数 + * * `queueNum` 还在队列中的文件数 + * * `interruptNum` 被暂停的文件数 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 调用通过on方法注册的handler. + Mediator.trigger.apply( this, arguments ) === false || + + // 调用opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 调用this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 广播所有uploader的事件。 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 销毁 webuploader 实例 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js将补充此方法的详细文档。 + request: Base.noop + }); + + /** + * 创建Uploader实例,等同于new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 暴露Uploader,可以通过它来扩展业务逻辑。 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 获取对象的第一个key + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 接口类。 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 添加Runtime实现。 + * @param {String} type 类型 + * @param {Runtime} factory 具体Runtime实现。 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 有些类型不能重用,比如filepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 允许runtime没有初始化之前,注册一些方法在初始化后执行。 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 像filePicker只能独立存在,不能公用。 + runtime = runtime || cache.get( null, standalone ); + + // 需要创建 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 来自cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 错误信息 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 类Backbone的事件监听声明,监听uploader实例上的事件 + // widget直接无法监听事件,事件只能通过uploader来传递 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 如果无API响应声明则忽略 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 发送命令。当传入`callback`或者`handler`中返回`promise`时。返回一个当所有`handler`中的promise都完成后完成的新`promise`。 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 扩展Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 默认所有 Uploader.register 了的 widget 都会被加载,如果禁用某一部分,请通过此 option 指定黑名单。 + */ + + // 覆写_init用来初始化widgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred对象 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 如果有callback,则用异步方式。 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 很重要不能删除。删除了会死循环。 + // 保证执行顺序。让callback总是在下一个 tick 中执行。 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 添加组件 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 名称与函数实现的映射 + * @param {object} proto 组件原型,构造函数通过 constructor 属性定义 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 自动生成 map 表。 + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 删除插件,只有在注册时指定了名字的才能被删除。 + * @grammar Uploader.unRegister(name); + * @param {string} name 组件名字 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 删除指定的插件。 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget。 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 指定Drag And Drop拖拽的容器,如果不指定,则不启动。 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 是否禁掉整个页面的拖拽功能,如果不禁用,图片拖进来的时候会默认被浏览器打开。 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 阻止此事件可以拒绝某些类型的文件拖入进来。目前只有 chrome 提供这样的 API,且只能通过 mime-type 验证。 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 检测文件是否全部允许添加。 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 指定监听paste事件的容器,如果不指定,不启用此功能。此功能为通过粘贴来添加截屏的图片。建议设置为`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 如果没有指定 mimetype, 但是知道文件后缀。 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 为了统一化Flash的File和HTML5的File而存在。 + * 以至于要调用Flash里面的File,也可以像调用HTML5版本的File一下。 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 支持其他类型文件的转换。 + // 如果有 mimetype, 但是文件名里面没有找出后缀规律 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('按钮指定错误'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 记录来源。 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 文件选择相关 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 指定选择文件的按钮容器,不指定则不创建按钮。 + * + * * `id` {Seletor|dom} 指定选择文件的按钮容器,不指定则不创建按钮。**注意** 这里虽然写的是 id, 但是不是只支持 id, 还支持 class, 或者 dom 节点。 + * * `label` {String} 请采用 `innerHTML` 代替 + * * `innerHTML` {String} 指定按钮文字。不指定时优先从指定的容器中看是否自带文字。 + * * `multiple` {Boolean} 是否开起同时选择多个文件能力。 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 指定接受哪些类型的文件。 由于目前还有ext转mimeType表,所以这里需要分开指定。 + * + * * `title` {String} 文字描述 + * * `extensions` {String} 允许的文件后缀,不带点,多个用逗号分割。 + * * `mimeTypes` {String} 多个用逗号分割。 + * + * 如: + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 添加文件选择按钮,如果一个按钮不够,需要调用此方法来添加。参数跟[options.pick](#WebUploader:Uploader:options)一致。 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '选择文件' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 构造器。 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 默认选项。 + Image.options = { + + // 默认的图片处理质量 + quality: 90, + + // 是否裁剪 + crop: false, + + // 是否保留头部信息 + preserveHeaders: false, + + // 是否允许放大。 + allowMagnify: false + }; + + // 继承RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 根据要处理的文件大小来节流,一次不能处理太多,会卡。 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 配置生成缩略图的选项。 + * + * 默认为: + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 70, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: true, + * + * // 是否允许裁剪。 + * crop: true, + * + * // 为空的话则保留原有图片格式。 + * // 否则强制转换成指定的类型。 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 为空的话则保留原有图片格式。 + // 否则强制转换成指定的类型。 + // IE 8下面 base64 大小不能超过 32K 否则预览失败,而非 jpeg 编码的图片很可 + // 能会超过 32k, 所以这里设置成预览的时候都是 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 配置压缩的图片的选项。如果此选项为`false`, 则图片在上传前不进行压缩。 + * + * 默认为: + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 图片质量,只有type为`image/jpeg`的时候才有效。 + * quality: 90, + * + * // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. + * allowMagnify: false, + * + * // 是否允许裁剪。 + * crop: false, + * + * // 是否保留头部meta信息。 + * preserveHeaders: true, + * + * // 如果发现压缩后文件大小比原来还大,则使用原来图片 + * // 此属性可能会影响图片自动纠正功能 + * noCompressIfLarger: false, + * + * // 单位字节,如果图片大小小于此值,不会采用压缩。 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 生成缩略图,此过程为异步,所以需要传入`callback`。 + * 通常情况在图片加入队里后调用此方法来生成预览图以增强交互效果。 + * + * 当 width 或者 height 的值介于 0 - 1 时,被当成百分比使用。 + * + * `callback`中可以接收到两个参数。 + * * 第一个为error,如果生成缩略图有错误,此error将为真。 + * * 第二个为ret, 缩略图的Data URL值。 + * + * **注意** + * Date URL在IE6/7中不支持,所以不用调用此方法了,直接显示一张暂不支持预览图片好了。 + * 也可以借助服务端,将 base64 数据传给服务端,生成一个临时文件供预览。 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('预览错误'); + * } else { + * $li.append('<img alt="" src="' + ret + '" />'); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 只预览图片格式。 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 如果传入的是object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 当 resize 完后 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 只压缩 jpeg 图片格式。 + // gif 可能会丢失针 + // bmp png 基本上尺寸都不大,且压缩比比较小。 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 如果 width 的值介于 0 - 1 + // 说明设置的是百分比。 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 同样的规则应用于 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 移动端 UC / qq 浏览器的无图模式下 + // ctx.getImageData 处理大图的时候会报 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 如果压缩后,比原来还大则不用压缩后的。 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 标记,避免重复压缩。 + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 出错了直接继续,让其上传原始图片 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 文件属性封装 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 文件类 + * @class File + * @constructor 构造函数 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 + */ + function WUFile( source ) { + + /** + * 文件名,包括扩展名(后缀) + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 文件体积(字节) + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 文件最后修改日期 + * @property lastModifiedDate + * @type {int} + * @default 当前时间戳 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 文件ID,每个对象具有唯一ID,与文件名无关 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 文件扩展名,通过文件名获取,例如test.png的扩展名为png + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 状态文字说明。在不同的status语境下有不同的用途。 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 存储文件状态,防止通过属性直接修改 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 设置状态,状态变化时会触发`change`事件。 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status) + * @param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 文件状态变化 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 获取文件状态 + * @return {File.Status} + * @example + 文件状态具体包括以下几种类型: + { + // 初始化 + INITED: 0, + // 已入队列 + QUEUED: 1, + // 正在上传 + PROGRESS: 2, + // 上传出错 + ERROR: 3, + // 上传成功 + COMPLETE: 4, + // 上传取消 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 获取文件原始信息。 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 文件状态值,具体包括以下几种类型: + * * `inited` 初始状态 + * * `queued` 已经进入队列, 等待上传 + * * `progress` 上传中 + * * `complete` 上传完成。 + * * `error` 上传出错,可重试 + * * `interrupt` 上传中断,可续传。 + * * `invalid` 文件不合格,不能重试上传。会自动从队列中移除。 + * * `cancelled` 文件被移除。 + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 初始状态 + QUEUED: 'queued', // 已经进入队列, 等待上传 + PROGRESS: 'progress', // 上传中 + ERROR: 'error', // 上传出错,可重试 + COMPLETE: 'complete', // 上传完成。 + CANCELLED: 'cancelled', // 上传取消。 + INTERRUPT: 'interrupt', // 上传中断,可续传。 + INVALID: 'invalid' // 文件不合格,不能重试上传。 + }; + + return WUFile; + }); + + /** + * @fileOverview 文件队列 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 文件队列, 用来存储各个状态中的文件。 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 统计文件数。 + * * `numOfQueue` 队列中的文件数。 + * * `numOfSuccess` 上传成功的文件数 + * * `numOfCancel` 被取消的文件数 + * * `numOfProgress` 正在上传中的文件数 + * * `numOfUploadFailed` 上传错误的文件数。 + * * `numOfInvalid` 无效的文件数。 + * * `numofDeleted` 被移除的文件数。 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 上传队列,仅包括等待上传的文件 + this._queue = []; + + // 存储所有文件 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 将新文件加入对队列尾部 + * + * @method append + * @param {File} file 文件对象 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 将新文件加入对队列头部 + * + * @method prepend + * @param {File} file 文件对象 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 获取文件对象 + * + * @method getFile + * @param {String} fileId 文件ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 从队列中取出一个指定状态的文件。 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [文件状态值](#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 对队列进行排序,能够控制文件上传顺序。 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 排序方法 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [文件状态值](#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 在队列中删除文件。 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 文件对象。 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 队列 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept中的中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 如果当前不是html5运行时,那就算了。 + // 不执行后续操作 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 创建一个 html5 运行时的 placeholder + // 以至于外部添加原生 File 对象的时候能正确包裹一下供 webuploader 使用。 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 为了支持外部直接添加一个原生File对象。 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 判断文件是否可以被加入队列 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 如果名字中有后缀,才做后缀白名单处理。 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File对象 + * @description 当文件被加入队列之前触发,此事件的handler返回值为`false`,则此文件不会被添加进入队列。 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File对象 + * @description 当文件被加入队列以后触发。 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 不过类型判断允许不允许,先派送 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 类型不匹配,则派送错误事件,并返回。 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 数组,内容为原始File(lib/File)对象。 + * @description 当一批文件添加进队列以后触发。 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 对象 数组 + * @description 添加文件到队列 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File对象 + * @description 当文件被移除队列后触发。 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 返回指定状态的文件集合,不传参数将返回所有状态的文件。 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 重试上传,重试指定文件,或者从出错的文件开始重新上传。 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 排序队列中的文件,在上传之前调整可以控制上传顺序。 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 当 uploader 被重置的时候触发。 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 重置uploader。目前只重置了队列。 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 添加获取Runtime相关信息的方法。 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 指定运行时启动顺序。默认会想尝试 html5 是否支持,如果支持则使用 html5, 否则则使用 flash. + * + * 可以将此值设置成 `flash`,来强制使用 flash 运行时。 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 预测Uploader将采用哪个`Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 跨域时,是否允许携带cookie, 只有html5 runtime才有效 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2分钟 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 添加Blob, 只能添加一次,最后一次有效。 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 添加其他字段 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 让Transport具备事件功能。 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 负责文件上传相关。 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 添加默认配置项 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 是否允许在文件传输时提前把下一个文件准备好。 + * 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 + * 如果能提前在当前文件传输期处理,可以节省总体耗时。 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 是否要分片处理大文件上传。 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 如果要分片,分多大一片? 默认大小为5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 如果某个分片由于网络问题出错,允许自动重传多少次? + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 上传并发数。允许同时最大上传进程数。 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 文件上传请求的参数表,每次发送都会发送此对象中的参数。 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 设置文件上传域的name。 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 文件上传方式,`POST`或者`GET`。 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 是否已二进制的流的方式发送文件,这样整个上传内容`php://input`都为文件内容, + * 其他参数在$_GET数组中。 + */ + }); + + // 负责将文件切片。 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 记录当前正在传的数据,跟threads相关 + this.pool = []; + + // 缓存分好片的文件。 + this.stack = []; + + // 缓存即将上传的文件。 + this.pending = []; + + // 跟踪还有多少分片在上传中但是没有完成上传。 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 把其他块取消了。 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 当开始上传流程时触发。 + * @for Uploader + */ + + /** + * 开始上传。此方法可以从初始状态调用开始上传流程,也可以从暂停状态调用,继续上传流程。 + * + * 可以指定开始某一个文件。 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 移出invalid的文件 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 如果指定了开始某个文件,则只开始指定文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 之前暂停过。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 如果有暂停的,则续传 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 当开始上传流程暂停时触发。 + * @for Uploader + */ + + /** + * 暂停上传。第一个参数为是否中断上传当前正在上传的文件。 + * + * 如果第一个参数是文件,则只暂停指定文件。 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 如果只是暂停某个文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 只 abort 指定的文件。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 标记文件状态为已取消, 同时将中断文件传输。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 判断`Uplaode`r是否正在上传中。 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 掉过一个文件上传,直接标记指定文件为已上传状态。 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 当所有文件上传结束时触发。 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 上一个promise还没有结束,则等待完成后再执行。 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 还有位置,且还有文件要处理的话。 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 有可能是reject过来的,所以要检测val的类型。 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 没有要上传的了,且没有正在传输的了。 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 把已经处理完了的,或者,状态为非 progress(上传中)、 + // interupt(暂停中) 的移除。 + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 如果当前文件还有没有需要传输的,则直接返回剩下的。 + if ( (act = this._getStack()) ) { + + // 是否提前准备下一个文件 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 否则,如果正在运行,则准备下一个文件,并等待完成后返回下个分片。 + } else if ( me.runing ) { + + // 如果缓存中有,则直接在缓存中取,没有则去queue中取。 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 文件可能还在prepare中,也有可能已经完全准备好了。 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File对象 + * @description 某个文件开始上传前触发,一个文件只会触发一次。 + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 有可能文件被skip掉了。文件被skip掉后,状态坑定不是Queued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 如果还在pending中,则替换成文件本身。 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file的钩子就有错误发生。 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 让出位置了,可以让其他分片开始上传 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 有可能在 before-send-file 的 promise 期间改变了文件状态。 + // 如:暂停,取消 + // 我们不能中断 promise, 但是可以在 promise 完后,不做上传操作。 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 如果是中断,则还需要放回去。 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 如果没有分片,则直接使用原始的。 + // 不会丢失content-type信息。 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 每个分片发送之前可能要做些异步的事情。 + promise = me.request( 'before-send', block, function() { + + // 有可能文件已经上传出错了,所以不需要再传输了。 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 如果为fail了,则跳过此分片。 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 默认的上传参数,可以扩展此对象来控制上传参数。 + * @param {Object} headers 可以扩展此对象来控制上传头部。 + * @description 当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。 + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 服务端的返回数据,json格式,如果服务端不是json格式,从ret._raw中取数据,自行解析。 + * @description 当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为`false`, 则此文件将派送`server`类型的`uploadError`事件。 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File对象 + * @param {Number} percentage 上传进度 + * @description 上传过程中触发,携带上传进度。 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File对象 + * @param {String} reason 出错的code + * @description 当文件上传出错时触发。 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File对象 + * @param {Object} response 服务端返回的数据 + * @description 当文件上传成功时触发。 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File对象 + * @description 不管成功或者失败,文件上传完成时触发。 + * @for Uploader + */ + + // 做上传操作。 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 广播上传进度。以文件为单位。 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 用来询问,是否返回的结果是有错误的。 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 服务端响应了,不代表成功了,询问是否响应正确。 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 尝试重试,然后广播文件上传出错。 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 自动重试 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 上传成功 + tr.on( 'load', function() { + var reason; + + // 如果非预期,转向上传出错。 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 全部上传完成。 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 配置默认的上传字段。 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 在发送之间可以添加字段什么的。。。 + // 如果默认的字段不够使用,可以通过监听此事件来扩展 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 开始发送。 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 完成上传。 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 如果外部已经标记为invalid什么的,不再改状态。 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 各种验证,包括文件总大小是否超出、单文件是否超出和文件是否重复。 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 错误类型。 + * @description 当validate不通过时,会以派送错误事件的形式通知调用者。通过`upload.on('error', handler)`可以捕获到此类错误,目前有以下错误会在特定的情况下派送错来。 + * + * * `Q_EXCEED_NUM_LIMIT` 在设置了`fileNumLimit`且尝试给`uploader`添加的文件数量超出这个值时派送。 + * * `Q_EXCEED_SIZE_LIMIT` 在设置了`Q_EXCEED_SIZE_LIMIT`且尝试给`uploader`添加的文件总大小超出这个值时派送。 + * * `Q_TYPE_DENIED` 当文件类型不满足时触发。。 + * @for Uploader + */ + + // 暴露给外面的api + api = { + + // 添加验证器 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 移除验证器 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 在Uploader初始化的时候启动Validators的初始化 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总数量, 超出则不允许加入队列。 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证单个文件大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 去重, 根据文件名字、文件大小和最后修改时间来生成hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 已经重复了 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Md5 + */ + define('lib/md5',[ + 'runtime/client', + 'mediator' + ], function( RuntimeClient, Mediator ) { + + function Md5() { + RuntimeClient.call( this, 'Md5' ); + } + + // 让 Md5 具备事件功能。 + Mediator.installTo( Md5.prototype ); + + Md5.prototype.loadFromBlob = function( blob ) { + var me = this; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + me.exec( 'loadFromBlob', blob ); + }); + }; + + Md5.prototype.getResult = function() { + return this.exec('getResult'); + }; + + return Md5; + }); + /** + * @fileOverview 图片操作, 负责预览图片和上传前压缩图片 + */ + define('widgets/md5',[ + 'base', + 'uploader', + 'lib/md5', + 'lib/blob', + 'widgets/widget' + ], function( Base, Uploader, Md5, Blob ) { + + return Uploader.register({ + name: 'md5', + + + /** + * 计算文件 md5 值,返回一个 promise 对象,可以监听 progress 进度。 + * + * + * @method md5File + * @grammar md5File( file[, start[, end]] ) => promise + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.md5File( file ) + * + * // 及时显示进度 + * .progress(function(percentage) { + * console.log('Percentage:', percentage); + * }) + * + * // 完成 + * .then(function(val) { + * console.log('md5 result:', val); + * }); + * + * }); + */ + md5File: function( file, start, end ) { + var md5 = new Md5(), + deferred = Base.Deferred(), + blob = (file instanceof Blob) ? file : + this.request( 'get-file', file ).source; + + md5.on( 'progress load', function( e ) { + e = e || {}; + deferred.notify( e.total ? e.loaded / e.total : 1 ); + }); + + md5.on( 'complete', function() { + deferred.resolve( md5.getResult() ); + }); + + md5.on( 'error', function( reason ) { + deferred.reject( reason ); + }); + + if ( arguments.length > 1 ) { + start = start || 0; + end = end || 0; + start < 0 && (start = blob.size + start); + end < 0 && (end = blob.size + end); + end = Math.min( end, blob.size ); + blob = blob.slice( start, end ); + } + + md5.loadFromBlob( blob ); + + return deferred.promise(); + } + }); + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 不需要连接其他程序,直接执行callback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 注册Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 注册html5运行时。 + // 只有在支持的前提下注册。 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 注意只有 chrome 支持。 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 只处理框内的。 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 只处理框内的。 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 如果是页面内拖拽,还不能处理,不阻止事件。 + // 此处 ie11 下会报参数错误, + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 如果传入 callback 则去查看文件夹,否则只管当前文件夹。 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 为了保证顺序。 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 还没 init 就调用 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp的mimeTypes中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 不阻止非文件粘贴(文字粘贴)的事件冒泡 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox不支持单独指定后缀 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 更安全的方式调用,比如android里面就能把context改成其他的对象。 + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android不支持直接new Blob, 只能借助blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 抽出来主要是为了解决android下面canvas.toDataUrl不支持jpeg. + // 你得到的结果是png. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat会复写这个方法,如果用户选择加载那个文件了的话。 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image控件 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 代码来自于:https://github.com/blueimp/JavaScript-Load-Image + * 暂时项目中只用了orientation. + * + * 去除了 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF解析 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 尝试读取缩略图 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * 这个方式性能不行,但是可以解决android里面的toDataUrl的bug + * android里面toDataUrl('image/jpege')得到的结果却是png. + * + * 所以这里没辙,只能借助这个工具 + * @fileOverview jpeg encoder + */ + define('runtime/html5/jpegencoder',[], function( require, exports, module ) { + + /* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /* + JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + + Basic GUI blocking jpeg encoder + */ + + function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr<nrupper; nr++) { + category[32767+nr] = cat; + bitcode[32767+nr] = []; + bitcode[32767+nr][1] = cat; + bitcode[32767+nr][0] = nr; + } + //Negative numbers + for (var nrneg =-(nrupper-1); nrneg<=-nrlower; nrneg++) { + category[32767+nrneg] = cat; + bitcode[32767+nrneg] = []; + bitcode[32767+nrneg][1] = cat; + bitcode[32767+nrneg][0] = nrupper-1+nrneg; + } + nrlower <<= 1; + nrupper <<= 1; + } + } + + function initRGBYUVTable() { + for(var i = 0; i < 256;i++) { + RGB_YUV_TABLE[i] = 19595 * i; + RGB_YUV_TABLE[(i+ 256)>>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + byteout.push(clt[value]); // write char directly instead of converting later + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i<I8; ++i) + { + d0 = data[dataOff]; + d1 = data[dataOff+1]; + d2 = data[dataOff+2]; + d3 = data[dataOff+3]; + d4 = data[dataOff+4]; + d5 = data[dataOff+5]; + d6 = data[dataOff+6]; + d7 = data[dataOff+7]; + + var tmp0 = d0 + d7; + var tmp7 = d0 - d7; + var tmp1 = d1 + d6; + var tmp6 = d1 - d6; + var tmp2 = d2 + d5; + var tmp5 = d2 - d5; + var tmp3 = d3 + d4; + var tmp4 = d3 - d4; + + /* Even part */ + var tmp10 = tmp0 + tmp3; /* phase 2 */ + var tmp13 = tmp0 - tmp3; + var tmp11 = tmp1 + tmp2; + var tmp12 = tmp1 - tmp2; + + data[dataOff] = tmp10 + tmp11; /* phase 3 */ + data[dataOff+4] = tmp10 - tmp11; + + var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */ + data[dataOff+2] = tmp13 + z1; /* phase 5 */ + data[dataOff+6] = tmp13 - z1; + + /* Odd part */ + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */ + var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */ + var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */ + var z3 = tmp11 * 0.707106781; /* c4 */ + + var z11 = tmp7 + z3; /* phase 5 */ + var z13 = tmp7 - z3; + + data[dataOff+5] = z13 + z2; /* phase 6 */ + data[dataOff+3] = z13 - z2; + data[dataOff+1] = z11 + z4; + data[dataOff+7] = z11 - z4; + + dataOff += 8; /* advance pointer to next row */ + } + + /* Pass 2: process columns. */ + dataOff = 0; + for (i=0; i<I8; ++i) + { + d0 = data[dataOff]; + d1 = data[dataOff + 8]; + d2 = data[dataOff + 16]; + d3 = data[dataOff + 24]; + d4 = data[dataOff + 32]; + d5 = data[dataOff + 40]; + d6 = data[dataOff + 48]; + d7 = data[dataOff + 56]; + + var tmp0p2 = d0 + d7; + var tmp7p2 = d0 - d7; + var tmp1p2 = d1 + d6; + var tmp6p2 = d1 - d6; + var tmp2p2 = d2 + d5; + var tmp5p2 = d2 - d5; + var tmp3p2 = d3 + d4; + var tmp4p2 = d3 - d4; + + /* Even part */ + var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */ + var tmp13p2 = tmp0p2 - tmp3p2; + var tmp11p2 = tmp1p2 + tmp2p2; + var tmp12p2 = tmp1p2 - tmp2p2; + + data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */ + data[dataOff+32] = tmp10p2 - tmp11p2; + + var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */ + data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */ + data[dataOff+48] = tmp13p2 - z1p2; + + /* Odd part */ + tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */ + tmp11p2 = tmp5p2 + tmp6p2; + tmp12p2 = tmp6p2 + tmp7p2; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */ + var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */ + var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */ + var z3p2 = tmp11p2 * 0.707106781; /* c4 */ + + var z11p2 = tmp7p2 + z3p2; /* phase 5 */ + var z13p2 = tmp7p2 - z3p2; + + data[dataOff+40] = z13p2 + z2p2; /* phase 6 */ + data[dataOff+24] = z13p2 - z2p2; + data[dataOff+ 8] = z11p2 + z4p2; + data[dataOff+56] = z11p2 - z4p2; + + dataOff++; /* advance pointer to next column */ + } + + // Quantize/descale the coefficients + var fDCTQuant; + for (i=0; i<I64; ++i) + { + // Apply the quantization and scaling factor & Round to nearest integer + fDCTQuant = data[i]*fdtbl[i]; + outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j<I64;++j) { + DU[ZigZag[j]]=DU_DCT[j]; + } + var Diff = DU[0] - DC; DC = DU[0]; + //Encode DC + if (Diff==0) { + writeBits(HTDC[0]); // Diff might be 0 + } else { + pos = 32767+Diff; + writeBits(HTDC[category[pos]]); + writeBits(bitcode[pos]); + } + //Encode ACs + var end0pos = 63; // was const... which is crazy + for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + // var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + // var duration = new Date().getTime() - time_start; + // console.log('Encoding time: '+ currentQuality + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + // console.log('Quality set to: '+quality +'%'); + } + + function init(){ + // var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + // var duration = new Date().getTime() - time_start; + // console.log('Initialization '+ duration + 'ms'); + } + + init(); + + }; + + JPEGEncoder.encode = function( data, quality ) { + var encoder = new JPEGEncoder( quality ); + + return encoder.encode( data ); + } + + return JPEGEncoder; + }); + /** + * @fileOverview Fix android canvas.toDataUrl bug. + */ + define('runtime/html5/androidpatch',[ + 'runtime/html5/util', + 'runtime/html5/jpegencoder', + 'base' + ], function( Util, encoder, Base ) { + var origin = Util.canvasToDataUrl, + supportJpeg; + + Util.canvasToDataUrl = function( canvas, type, quality ) { + var ctx, w, h, fragement, parts; + + // 非android手机直接跳过。 + if ( !Base.os.android ) { + return origin.apply( null, arguments ); + } + + // 检测是否canvas支持jpeg导出,根据数据格式来判断。 + // JPEG 前两位分别是:255, 216 + if ( type === 'image/jpeg' && typeof supportJpeg === 'undefined' ) { + fragement = origin.apply( null, arguments ); + + parts = fragement.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + fragement = atob( parts[ 1 ] ); + } else { + fragement = decodeURIComponent( parts[ 1 ] ); + } + + fragement = fragement.substring( 0, 2 ); + + supportJpeg = fragement.charCodeAt( 0 ) === 255 && + fragement.charCodeAt( 1 ) === 216; + } + + // 只有在android环境下才修复 + if ( type === 'image/jpeg' && !supportJpeg ) { + w = canvas.width; + h = canvas.height; + ctx = canvas.getContext('2d'); + + return encoder.encode( ctx.getImageData( 0, 0, w, h ), quality ); + } + + return origin.apply( null, arguments ); + }; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 标记是否被修改过。 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 读取meta信息。 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 解决 orientation 的问题。 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 没用了,可以删掉了。 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob需要重新生成。 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 释放内存。非常重要,否则释放不了image的内存。 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 交换width, height的值。 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 不允许放大。 + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 如果不是ios, 不需要这么复杂! + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * @fileOverview Transport + * @todo 支持chunked传输,优势: + * 可以将大文件分成小块,挨个传输,可以提高大文件成功率,当失败的时候,也只需要重传那小部分, + * 而不需要重头再传一次。另外断点续传也需要用chunked方式。 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 强制设置成 content-type 为文件流。 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android直接发送blob会导致服务端接收到的是空文件。 + // bug详情。 + // https://code.google.com/p/android/issues/detail?id=39882 + // 所以先用fileReader读取出来再通过arraybuffer的方式发送。 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/html5/md5',[ + 'runtime/html5/runtime' + ], function( FlashRuntime ) { + + /* + * Fastest md5 implementation around (JKM md5) + * Credits: Joseph Myers + * + * @see http://www.myersdaily.org/joseph/javascript/md5-text.html + * @see http://jsperf.com/md5-shootout/7 + */ + + /* this function is much faster, + so if possible we use it. Some IEs + are the only ones I know of that + need the idiotic second function, + generated by an if clause. */ + var add32 = function (a, b) { + return (a + b) & 0xFFFFFFFF; + }, + + cmn = function (q, a, b, x, s, t) { + a = add32(add32(a, q), add32(x, t)); + return add32((a << s) | (a >>> (32 - s)), b); + }, + + ff = function (a, b, c, d, x, s, t) { + return cmn((b & c) | ((~b) & d), a, b, x, s, t); + }, + + gg = function (a, b, c, d, x, s, t) { + return cmn((b & d) | (c & (~d)), a, b, x, s, t); + }, + + hh = function (a, b, c, d, x, s, t) { + return cmn(b ^ c ^ d, a, b, x, s, t); + }, + + ii = function (a, b, c, d, x, s, t) { + return cmn(c ^ (b | (~d)), a, b, x, s, t); + }, + + md5cycle = function (x, k) { + var a = x[0], + b = x[1], + c = x[2], + d = x[3]; + + a = ff(a, b, c, d, k[0], 7, -680876936); + d = ff(d, a, b, c, k[1], 12, -389564586); + c = ff(c, d, a, b, k[2], 17, 606105819); + b = ff(b, c, d, a, k[3], 22, -1044525330); + a = ff(a, b, c, d, k[4], 7, -176418897); + d = ff(d, a, b, c, k[5], 12, 1200080426); + c = ff(c, d, a, b, k[6], 17, -1473231341); + b = ff(b, c, d, a, k[7], 22, -45705983); + a = ff(a, b, c, d, k[8], 7, 1770035416); + d = ff(d, a, b, c, k[9], 12, -1958414417); + c = ff(c, d, a, b, k[10], 17, -42063); + b = ff(b, c, d, a, k[11], 22, -1990404162); + a = ff(a, b, c, d, k[12], 7, 1804603682); + d = ff(d, a, b, c, k[13], 12, -40341101); + c = ff(c, d, a, b, k[14], 17, -1502002290); + b = ff(b, c, d, a, k[15], 22, 1236535329); + + a = gg(a, b, c, d, k[1], 5, -165796510); + d = gg(d, a, b, c, k[6], 9, -1069501632); + c = gg(c, d, a, b, k[11], 14, 643717713); + b = gg(b, c, d, a, k[0], 20, -373897302); + a = gg(a, b, c, d, k[5], 5, -701558691); + d = gg(d, a, b, c, k[10], 9, 38016083); + c = gg(c, d, a, b, k[15], 14, -660478335); + b = gg(b, c, d, a, k[4], 20, -405537848); + a = gg(a, b, c, d, k[9], 5, 568446438); + d = gg(d, a, b, c, k[14], 9, -1019803690); + c = gg(c, d, a, b, k[3], 14, -187363961); + b = gg(b, c, d, a, k[8], 20, 1163531501); + a = gg(a, b, c, d, k[13], 5, -1444681467); + d = gg(d, a, b, c, k[2], 9, -51403784); + c = gg(c, d, a, b, k[7], 14, 1735328473); + b = gg(b, c, d, a, k[12], 20, -1926607734); + + a = hh(a, b, c, d, k[5], 4, -378558); + d = hh(d, a, b, c, k[8], 11, -2022574463); + c = hh(c, d, a, b, k[11], 16, 1839030562); + b = hh(b, c, d, a, k[14], 23, -35309556); + a = hh(a, b, c, d, k[1], 4, -1530992060); + d = hh(d, a, b, c, k[4], 11, 1272893353); + c = hh(c, d, a, b, k[7], 16, -155497632); + b = hh(b, c, d, a, k[10], 23, -1094730640); + a = hh(a, b, c, d, k[13], 4, 681279174); + d = hh(d, a, b, c, k[0], 11, -358537222); + c = hh(c, d, a, b, k[3], 16, -722521979); + b = hh(b, c, d, a, k[6], 23, 76029189); + a = hh(a, b, c, d, k[9], 4, -640364487); + d = hh(d, a, b, c, k[12], 11, -421815835); + c = hh(c, d, a, b, k[15], 16, 530742520); + b = hh(b, c, d, a, k[2], 23, -995338651); + + a = ii(a, b, c, d, k[0], 6, -198630844); + d = ii(d, a, b, c, k[7], 10, 1126891415); + c = ii(c, d, a, b, k[14], 15, -1416354905); + b = ii(b, c, d, a, k[5], 21, -57434055); + a = ii(a, b, c, d, k[12], 6, 1700485571); + d = ii(d, a, b, c, k[3], 10, -1894986606); + c = ii(c, d, a, b, k[10], 15, -1051523); + b = ii(b, c, d, a, k[1], 21, -2054922799); + a = ii(a, b, c, d, k[8], 6, 1873313359); + d = ii(d, a, b, c, k[15], 10, -30611744); + c = ii(c, d, a, b, k[6], 15, -1560198380); + b = ii(b, c, d, a, k[13], 21, 1309151649); + a = ii(a, b, c, d, k[4], 6, -145523070); + d = ii(d, a, b, c, k[11], 10, -1120210379); + c = ii(c, d, a, b, k[2], 15, 718787259); + b = ii(b, c, d, a, k[9], 21, -343485551); + + x[0] = add32(a, x[0]); + x[1] = add32(b, x[1]); + x[2] = add32(c, x[2]); + x[3] = add32(d, x[3]); + }, + + /* there needs to be support for Unicode here, + * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps + * by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise + * I suggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then + * how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something + * like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard + * itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 + * 8-bit unsigned value arrays. + */ + md5blk = function (s) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + }, + + md5blk_array = function (a) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24); + } + return md5blks; + }, + + md51 = function (s) { + var n = s.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + length = s.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); + } + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + return state; + }, + + md51_array = function (a) { + var n = a.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk_array(a.subarray(i - 64, i))); + } + + // Not sure if it is a bug, however IE10 will always produce a sub array of length 1 + // containing the last element of the parent array if the sub array specified starts + // beyond the length of the parent array - weird. + // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue + a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0); + + length = a.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= a[i] << ((i % 4) << 3); + } + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + + return state; + }, + + hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'], + + rhex = function (n) { + var s = '', + j; + for (j = 0; j < 4; j += 1) { + s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; + } + return s; + }, + + hex = function (x) { + var i; + for (i = 0; i < x.length; i += 1) { + x[i] = rhex(x[i]); + } + return x.join(''); + }, + + md5 = function (s) { + return hex(md51(s)); + }, + + + + //////////////////////////////////////////////////////////////////////////// + + /** + * SparkMD5 OOP implementation. + * + * Use this class to perform an incremental md5, otherwise use the + * static methods instead. + */ + SparkMD5 = function () { + // call reset to init the instance + this.reset(); + }; + + + // In some cases the fast add32 function cannot be used.. + if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') { + add32 = function (x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF), + msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); + }; + } + + + /** + * Appends a string. + * A conversion will be applied if an utf8 string is detected. + * + * @param {String} str The string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.append = function (str) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + // then append as binary + this.appendBinary(str); + + return this; + }; + + /** + * Appends a binary string. + * + * @param {String} contents The binary string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.appendBinary = function (contents) { + this._buff += contents; + this._length += contents.length; + + var length = this._buff.length, + i; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk(this._buff.substring(i - 64, i))); + } + + this._buff = this._buff.substr(i - 64); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + i, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + /** + * Finish the final calculation based on the tail. + * + * @param {Array} tail The tail (will be modified) + * @param {Number} length The length of the remaining buffer + */ + SparkMD5.prototype._finish = function (tail, length) { + var i = length, + tmp, + lo, + hi; + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(this._state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + tmp = this._length * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + md5cycle(this._state, tail); + }; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.reset = function () { + this._buff = ""; + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.prototype.destroy = function () { + delete this._state; + delete this._buff; + delete this._length; + }; + + + /** + * Performs the md5 hash on a string. + * A conversion will be applied if utf8 string is detected. + * + * @param {String} str The string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hash = function (str, raw) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + var hash = md51(str); + + return !!raw ? hash : hex(hash); + }; + + /** + * Performs the md5 hash on a binary string. + * + * @param {String} content The binary string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hashBinary = function (content, raw) { + var hash = md51(content); + + return !!raw ? hash : hex(hash); + }; + + /** + * SparkMD5 OOP implementation for array buffers. + * + * Use this class to perform an incremental md5 ONLY for array buffers. + */ + SparkMD5.ArrayBuffer = function () { + // call reset to init the instance + this.reset(); + }; + + //////////////////////////////////////////////////////////////////////////// + + /** + * Appends an array buffer. + * + * @param {ArrayBuffer} arr The array to be appended + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.append = function (arr) { + // TODO: we could avoid the concatenation here but the algorithm would be more complex + // if you find yourself needing extra performance, please make a PR. + var buff = this._concatArrayBuffer(this._buff, arr), + length = buff.length, + i; + + this._length += arr.byteLength; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i))); + } + + // Avoids IE10 weirdness (documented above) + this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + i, + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff[i] << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.reset = function () { + this._buff = new Uint8Array(0); + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy; + + /** + * Concats two array buffers, returning a new one. + * + * @param {ArrayBuffer} first The first array buffer + * @param {ArrayBuffer} second The second array buffer + * + * @return {ArrayBuffer} The new array buffer + */ + SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) { + var firstLength = first.length, + result = new Uint8Array(firstLength + second.byteLength); + + result.set(first); + result.set(new Uint8Array(second), firstLength); + + return result; + }; + + /** + * Performs the md5 hash on an array buffer. + * + * @param {ArrayBuffer} arr The array buffer + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.hash = function (arr, raw) { + var hash = md51_array(new Uint8Array(arr)); + + return !!raw ? hash : hex(hash); + }; + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( file ) { + var blob = file.getSource(), + chunkSize = 2 * 1024 * 1024, + chunks = Math.ceil( blob.size / chunkSize ), + chunk = 0, + owner = this.owner, + spark = new SparkMD5.ArrayBuffer(), + me = this, + blobSlice = blob.mozSlice || blob.webkitSlice || blob.slice, + loadNext, fr; + + fr = new FileReader(); + + loadNext = function() { + var start, end; + + start = chunk * chunkSize; + end = Math.min( start + chunkSize, blob.size ); + + fr.onload = function( e ) { + spark.append( e.target.result ); + owner.trigger( 'progress', { + total: file.size, + loaded: end + }); + }; + + fr.onloadend = function() { + fr.onloadend = fr.onload = null; + + if ( ++chunk < chunks ) { + setTimeout( loadNext, 1 ); + } else { + setTimeout(function(){ + owner.trigger('load'); + me.result = spark.end(); + loadNext = file = blob = spark = null; + owner.trigger('complete'); + }, 50 ); + } + }; + + fr.readAsArrayBuffer( blobSlice.call( blob, start, end ) ); + }; + + loadNext(); + }, + + getResult: function() { + return this.result; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash的接受器。 + window[ jsreciver ] = function() { + var args = arguments; + + // 为了能捕获得到。 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '<object id="' + this.uid + '" type="application/' + + 'x-shockwave-flash" data="' + opts.swf + '" '; + + if ( Base.browser.ie ) { + html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; + } + + html += 'width="100%" height="100%" style="outline:0">' + + '<param name="movie" value="' + opts.swf + '" />' + + '<param name="flashvars" value="uid=' + this.uid + + '&jsreciver=' + this.jsreciver + '" />' + + '<param name="wmode" value="transparent" />' + + '<param name="allowscriptaccess" value="always" />' + + '</object>'; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 修复Flash再没有设置title的情况下无法弹出flash文件选择框的bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview 图片压缩 + */ + define('runtime/flash/image',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Image', { + // init: function( options ) { + // var owner = this.owner; + + // this.flashExec( 'Image', 'init', options ); + // owner.on( 'load', function() { + // debugger; + // }); + // }, + + loadFromBlob: function( blob ) { + var owner = this.owner; + + owner.info() && this.flashExec( 'Image', 'info', owner.info() ); + owner.meta() && this.flashExec( 'Image', 'meta', owner.meta() ); + + this.flashExec( 'Image', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 处理可能存在 bug, 没辙只能靠 js 了 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview Md5 flash实现 + */ + define('runtime/flash/md5',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( blob ) { + return this.flashExec( 'Md5', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview 完全版本。 + */ + define('preset/all',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + 'widgets/md5', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/androidpatch', + 'runtime/html5/image', + 'runtime/html5/transport', + 'runtime/html5/md5', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/image', + 'runtime/flash/transport', + 'runtime/flash/blob', + 'runtime/flash/md5' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/all' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.min.js new file mode 100644 index 0000000..990b2ab --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.min.js @@ -0,0 +1,3 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e<f;)if(c=a[e],c.cb.apply(c.ctx2,b)===!1){d=!0;break}return!d}var e,f=a.$,g=[].slice,h=/\s+/;return e={on:function(a,b,d){var e,f=this;return b?(e=this._events||(this._events=[]),c(a,b,function(a,b){var c={e:a};c.cb=b,c.ctx=d,c.ctx2=d||f,c.id=e.length,e.push(c)}),this):this},once:function(a,b,d){var e=this;return b?(c(a,b,function(a,b){var c=function(){return e.off(a,c),b.apply(d||e,arguments)};c._cb=b,e.on(a,c,d)}),e):e},off:function(a,d,e){var g=this._events;return g?a||d||e?(c(a,d,function(a,c){f.each(b(g,a,c,e),function(){delete g[this.id]})}),this):(this._events=[],this):this},trigger:function(a){var c,e,f;return this._events&&a?(c=g.call(arguments,1),e=b(this._events,a),f=b(this._events,"all"),d(e,c)&&d(f,arguments)):this}},f.extend({installTo:function(a){return f.extend(a,e)}},e)}),b("uploader",["base","mediator"],function(a,b){function c(a){this.options=d.extend(!0,{},c.options,a),this._init(this.options)}var d=a.$;return c.options={},b.installTo(c.prototype),d.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",sort:"sort-files",removeFile:"remove-file",cancelFile:"cancel-file",skipFile:"skip-file",retry:"retry",isInProgress:"is-in-progress",makeThumb:"make-thumb",md5File:"md5-file",getDimension:"get-dimension",addButton:"add-btn",predictRuntimeType:"predict-runtime-type",refresh:"refresh",disable:"disable",enable:"enable",reset:"reset"},function(a,b){c.prototype[a]=function(){return this.request(b,arguments)}}),d.extend(c.prototype,{state:"pending",_init:function(a){var b=this;b.request("init",a,function(){b.state="ready",b.trigger("ready")})},option:function(a,b){var c=this.options;return arguments.length>1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("按钮指定错误");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size<h||b._compressed?void 0:(g=e.extend({},g),f=a.Deferred(),d=new c(g),f.always(function(){d.destroy(),d=null}),d.once("error",f.reject),d.once("load",function(){var a=g.width,c=g.height;b._info=b._info||d.info(),b._meta=b._meta||d.meta(),1>=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.size<c)&&(b.source=a,b.size=a.size,b.trigger("resize",a.size,c)),b._compressed=!0,f.resolve()}catch(e){f.resolve()}}),b._info&&d.info(b._info),b._meta&&d.meta(b._meta),d.loadFromBlob(b.source),f.promise())}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length<e.threads&&(c=d._nextBlock())?(d._trigged=!1,b=function(b){d._promise=null,b&&b.file&&d._startSend(b),a.nextTick(d.__tick)},d._promise=g(c)?c.always(b):b(c)):d.remaning||d._getStats().numOfQueue||d._getStats().numofInterrupt||(d.runing=!1,d._trigged||a.nextTick(function(){d.owner.trigger("uploadFinished")}),d._trigged=!0))},_putback:function(a){var b;a.cuted.unshift(a),b=this.stack.indexOf(a.cuted),~b||this.stack.unshift(a.cuted)},_getStack:function(){for(var a,b=0;a=this.stack[b++];){if(a.has()&&a.file.getStatus()===h.PROGRESS)return a;(!a.has()||a.file.getStatus()!==h.PROGRESS&&a.file.getStatus()!==h.INTERRUPT)&&this.stack.splice(--b,1)}return null},_nextBlock:function(){var a,b,c,d,f=this,h=f.options;return(a=this._getStack())?(h.prepareNextFile&&!f.pending.length&&f._prepareNextFile(),a.shift()):f.runing?(!f.pending.length&&f._getStats().numOfQueue&&f._prepareNextFile(),b=f.pending.shift(),c=function(b){return b?(a=e(b,h.chunked?h.chunkSize:0),f.stack.push(a),a.shift()):null},g(b)?(d=b.file,b=b[b.pipe?"pipe":"then"](c),b.file=d,b):c(b)):void 0},_prepareNextFile:function(){var a,b=this,c=b.request("fetch-file"),d=b.pending;c&&(a=b.request("before-send-file",c,function(){return c.getStatus()===h.PROGRESS||c.getStatus()===h.INTERRUPT?c:b._finishFile(c)}),b.owner.trigger("uploadStart",c),c.setStatus(h.PROGRESS),a.file=c,a.done(function(){var b=f.inArray(a,d);~b&&d.splice(b,1,c)}),a.fail(function(a){c.setStatus(h.ERROR,a),b.owner.trigger("uploadError",c,a),b.owner.trigger("uploadComplete",c)}),d.push(a))},_popBlock:function(a){var b=f.inArray(a,this.pool);this.pool.splice(b,1),a.file.remaning--,this.remaning--},_startSend:function(b){var c,d=this,e=b.file;return e.getStatus()!==h.PROGRESS?void(e.getStatus()===h.INTERRUPT&&d._putback(b)):(d.pool.push(b),d.remaning++,b.blob=1===b.chunks?e.source:e.source.slice(b.start,b.end),c=d.request("before-send",b,function(){e.getStatus()===h.PROGRESS?d._doSend(b):(d._popBlock(b),a.nextTick(d.__tick))}),void c.fail(function(){1===e.remaning?d._finishFile(e).always(function(){b.percentage=1,d._popBlock(b),d.owner.trigger("uploadComplete",e),a.nextTick(d.__tick)}):(b.percentage=1,d.updateFileProgress(e),d._popBlock(b),a.nextTick(d.__tick))}))},_doSend:function(b){var c,e,g=this,i=g.owner,j=g.options,k=b.file,l=new d(j),m=f.extend({},j.formData),n=f.extend({},j.headers);b.transport=l,l.on("destroy",function(){delete b.transport,g._popBlock(b),a.nextTick(g.__tick)}),l.on("progress",function(a){b.percentage=a,g.updateFileProgress(k)}),c=function(a){var c;return e=l.getResponseAsJson()||{},e._raw=l.getResponse(),c=function(b){a=b},i.trigger("uploadAccept",b,e,c)||(a=a||"server"),a},l.on("error",function(a,d){b.retried=b.retried||0,b.chunks>1&&~"http,abort".indexOf(a)&&b.retried<j.chunkRetry?(b.retried++,l.send()):(d||"server"!==a||(a=c(a)),k.setStatus(h.ERROR,a),i.trigger("uploadError",k,a),i.trigger("uploadComplete",k))}),l.on("load",function(){var a;return(a=c())?void l.trigger("error",a,!0):void(1===k.remaning?g._finishFile(k,e):l.destroy())}),m=f.extend(m,{id:k.id,name:k.name,type:k.type,lastModifiedDate:k.lastModifiedDate,size:k.size}),b.chunks>1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b) +}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("lib/md5",["runtime/client","mediator"],function(a,b){function c(){a.call(this,"Md5")}return b.installTo(c.prototype),c.prototype.loadFromBlob=function(a){var b=this;b.getRuid()&&b.disconnectRuntime(),b.connectRuntime(a.ruid,function(){b.exec("init"),b.exec("loadFromBlob",a)})},c.prototype.getResult=function(){return this.exec("getResult")},c}),b("widgets/md5",["base","uploader","lib/md5","lib/blob","widgets/widget"],function(a,b,c,d){return b.register({name:"md5",md5File:function(b,e,f){var g=new c,h=a.Deferred(),i=b instanceof d?b:this.request("get-file",b).source;return g.on("progress load",function(a){a=a||{},h.notify(a.total?a.loaded/a.total:1)}),g.on("complete",function(){h.resolve(g.getResult())}),g.on("error",function(a){h.reject(a)}),arguments.length>1&&(e=e||0,f=f||0,0>e&&(e=i.size+e),0>f&&(f=i.size+f),f=Math.min(f,i.size),i=i.slice(e,f)),g.loadFromBlob(i),h.promise()}})}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice;return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/util",["base"],function(b){var c=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL,d=b.noop,e=d;return c&&(d=function(){return c.createObjectURL.apply(c,arguments)},e=function(){return c.revokeObjectURL.apply(c,arguments)}),{createObjectURL:d,revokeObjectURL:e,dataURL2Blob:function(a){var b,c,d,e,f,g;for(g=a.split(","),b=~g[0].indexOf("base64")?atob(g[1]):decodeURIComponent(g[1]),d=new ArrayBuffer(b.length),c=new Uint8Array(d),e=0;e<b.length;e++)c[e]=b.charCodeAt(e);return f=g[0].split(":")[1].split(";")[0],this.arrayBufferToBlob(d,f)},dataURL2ArrayBuffer:function(a){var b,c,d,e;for(e=a.split(","),b=~e[0].indexOf("base64")?atob(e[1]):decodeURIComponent(e[1]),c=new Uint8Array(b.length),d=0;d<b.length;d++)c[d]=b.charCodeAt(d);return c.buffer},arrayBufferToBlob:function(b,c){var d,e=a.BlobBuilder||a.WebKitBlobBuilder;return e?(d=new e,d.append(b),d.getBlob(c)):new Blob([b],c?{type:c}:{})},canvasToDataUrl:function(a,b,c){return a.toDataURL(b,c/100)},parseMeta:function(a,b){b(!1,{})},updateImageHead:function(a){return a}}}),b("runtime/html5/imagemeta",["runtime/html5/util"],function(a){var b;return b={parsers:{65505:[]},maxMetaDataSize:262144,parse:function(a,b){var c=this,d=new FileReader;d.onload=function(){b(!1,c._parse(this.result)),d=d.onload=d.onerror=null},d.onerror=function(a){b(a.message),d=d.onload=d.onerror=null},a=a.slice(0,c.maxMetaDataSize),d.readAsArrayBuffer(a.getSource())},_parse:function(a,c){if(!(a.byteLength<6)){var d,e,f,g,h=new DataView(a),i=2,j=h.byteLength-4,k=i,l={};if(65496===h.getUint16(0)){for(;j>i&&(d=h.getUint16(i),d>=65504&&65519>=d||65534===d)&&(e=h.getUint16(i+2)+2,!(i+e>h.byteLength));){if(f=b.parsers[d],!c&&f)for(g=0;g<f.length;g+=1)f[g].call(b,h,i,e,l);i+=e,k=i}k>6&&(l.imageHead=a.slice?a.slice(2,k):new Uint8Array(a).subarray(2,k))}return l}},updateImageHead:function(a,b){var c,d,e,f=this._parse(a,!0);return e=2,f.imageHead&&(e=2+f.imageHead.byteLength),d=a.slice?a.slice(e):new Uint8Array(a).subarray(e),c=new Uint8Array(b.byteLength+2+d.byteLength),c[0]=255,c[1]=216,c.set(new Uint8Array(b),2),c.set(new Uint8Array(d),b.byteLength+2),c.buffer}},a.parseMeta=function(){return b.parse.apply(b,arguments)},a.updateImageHead=function(){return b.updateImageHead.apply(b,arguments)},b}),b("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(a,b){var c={};return c.ExifMap=function(){return this},c.ExifMap.prototype.map={Orientation:274},c.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},c.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},c.exifTagTypes[7]=c.exifTagTypes[1],c.getExifValue=function(b,d,e,f,g,h){var i,j,k,l,m,n,o=c.exifTagTypes[f];if(!o)return void a.log("Invalid Exif data: Invalid tag type.");if(i=o.size*g,j=i>4?d+b.getUint32(e+8,h):e+8,j+i>b.byteLength)return void a.log("Invalid Exif data: Invalid data offset.");if(1===g)return o.getValue(b,j,h);for(k=[],l=0;g>l;l+=1)k[l]=o.getValue(b,j+l*o.size,h);if(o.ascii){for(m="",l=0;l<k.length&&(n=k[l],"\x00"!==n);l+=1)m+=n;return m}return k},c.parseExifTag=function(a,b,d,e,f){var g=a.getUint16(d,e);f.exif[g]=c.getExifValue(a,b,d,a.getUint16(d+2,e),a.getUint32(d+4,e),e)},c.parseExifTags=function(b,c,d,e,f){var g,h,i;if(d+6>b.byteLength)return void a.log("Invalid Exif data: Invalid directory offset.");if(g=b.getUint16(d,e),h=d+2+12*g,h+4>b.byteLength)return void a.log("Invalid Exif data: Invalid directory size.");for(i=0;g>i;i+=1)this.parseExifTag(b,c,d+2+12*i,e,f);return b.getUint32(h,e)},c.parseExifData=function(b,d,e,f){var g,h,i=d+10;if(1165519206===b.getUint32(d+4)){if(i+8>b.byteLength)return void a.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(d+8))return void a.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(i)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void a.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(i+2,g))return void a.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(i+4,g),f.exif=new c.ExifMap,h=c.parseExifTags(b,i,i+h,g,f)}},b.parsers[65505].push(c.parseExifData),c}),b("runtime/html5/jpegencoder",[],function(){function a(a){function b(a){for(var b=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],c=0;64>c;c++){var d=y((b[c]*a+50)/100);1>d?d=1:d>255&&(d=255),z[P[c]]=d}for(var e=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],f=0;64>f;f++){var g=y((e[f]*a+50)/100);1>g?g=1:g>255&&(g=255),A[P[f]]=g}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],i=0,j=0;8>j;j++)for(var k=0;8>k;k++)B[i]=1/(z[P[i]]*h[j]*h[k]*8),C[i]=1/(A[P[i]]*h[j]*h[k]*8),i++}function c(a,b){for(var c=0,d=0,e=new Array,f=1;16>=f;f++){for(var g=1;g<=a[f];g++)e[b[d]]=[],e[b[d]][0]=c,e[b[d]][1]=f,d++,c++;c*=2}return e}function d(){t=c(Q,R),u=c(U,V),v=c(S,T),w=c(W,X)}function e(){for(var a=1,b=2,c=1;15>=c;c++){for(var d=a;b>d;d++)E[32767+d]=c,D[32767+d]=[],D[32767+d][1]=c,D[32767+d][0]=d;for(var e=-(b-1);-a>=e;e++)E[32767+e]=c,D[32767+e]=[],D[32767+e][1]=c,D[32767+e][0]=b-1+e;a<<=1,b<<=1}}function f(){for(var a=0;256>a;a++)O[a]=19595*a,O[a+256>>0]=38470*a,O[a+512>>0]=7471*a+32768,O[a+768>>0]=-11059*a,O[a+1024>>0]=-21709*a,O[a+1280>>0]=32768*a+8421375,O[a+1536>>0]=-27439*a,O[a+1792>>0]=-5329*a}function g(a){for(var b=a[0],c=a[1]-1;c>=0;)b&1<<c&&(I|=1<<J),c--,J--,0>J&&(255==I?(h(255),h(0)):h(I),J=7,I=0)}function h(a){H.push(N[a])}function i(a){h(a>>8&255),h(255&a)}function j(a,b){var c,d,e,f,g,h,i,j,k,l=0,m=8,n=64;for(k=0;m>k;++k){c=a[l],d=a[l+1],e=a[l+2],f=a[l+3],g=a[l+4],h=a[l+5],i=a[l+6],j=a[l+7];var o=c+j,p=c-j,q=d+i,r=d-i,s=e+h,t=e-h,u=f+g,v=f-g,w=o+u,x=o-u,y=q+s,z=q-s;a[l]=w+y,a[l+4]=w-y;var A=.707106781*(z+x);a[l+2]=x+A,a[l+6]=x-A,w=v+t,y=t+r,z=r+p;var B=.382683433*(w-z),C=.5411961*w+B,D=1.306562965*z+B,E=.707106781*y,G=p+E,H=p-E;a[l+5]=H+C,a[l+3]=H-C,a[l+1]=G+D,a[l+7]=G-D,l+=8}for(l=0,k=0;m>k;++k){c=a[l],d=a[l+8],e=a[l+16],f=a[l+24],g=a[l+32],h=a[l+40],i=a[l+48],j=a[l+56];var I=c+j,J=c-j,K=d+i,L=d-i,M=e+h,N=e-h,O=f+g,P=f-g,Q=I+O,R=I-O,S=K+M,T=K-M;a[l]=Q+S,a[l+32]=Q-S;var U=.707106781*(T+R);a[l+16]=R+U,a[l+48]=R-U,Q=P+N,S=N+L,T=L+J;var V=.382683433*(Q-T),W=.5411961*Q+V,X=1.306562965*T+V,Y=.707106781*S,Z=J+Y,$=J-Y;a[l+40]=$+W,a[l+24]=$-W,a[l+8]=Z+X,a[l+56]=Z-X,l++}var _;for(k=0;n>k;++k)_=a[k]*b[k],F[k]=_>0?_+.5|0:_-.5|0;return F}function k(){i(65504),i(16),h(74),h(70),h(73),h(70),h(0),h(1),h(1),h(0),i(1),i(1),h(0),h(0)}function l(a,b){i(65472),i(17),h(8),i(b),i(a),h(3),h(1),h(17),h(0),h(2),h(17),h(1),h(3),h(17),h(1)}function m(){i(65499),i(132),h(0);for(var a=0;64>a;a++)h(z[a]);h(1);for(var b=0;64>b;b++)h(A[b])}function n(){i(65476),i(418),h(0);for(var a=0;16>a;a++)h(Q[a+1]);for(var b=0;11>=b;b++)h(R[b]);h(16);for(var c=0;16>c;c++)h(S[c+1]);for(var d=0;161>=d;d++)h(T[d]);h(1);for(var e=0;16>e;e++)h(U[e+1]);for(var f=0;11>=f;f++)h(V[f]);h(17);for(var g=0;16>g;g++)h(W[g+1]);for(var j=0;161>=j;j++)h(X[j])}function o(){i(65498),i(12),h(3),h(1),h(0),h(2),h(17),h(3),h(17),h(0),h(63),h(0)}function p(a,b,c,d,e){for(var f,h=e[0],i=e[240],k=16,l=63,m=64,n=j(a,b),o=0;m>o;++o)G[P[o]]=n[o];var p=G[0]-c;c=G[0],0==p?g(d[0]):(f=32767+p,g(d[E[f]]),g(D[f]));for(var q=63;q>0&&0==G[q];q--);if(0==q)return g(h),c;for(var r,s=1;q>=s;){for(var t=s;0==G[s]&&q>=s;++s);var u=s-t;if(u>=k){r=u>>4;for(var v=1;r>=v;++v)g(i);u=15&u}f=32767+G[s],g(e[(u<<4)+E[f]]),g(D[f]),s++}return q!=l&&g(h),c}function q(){for(var a=String.fromCharCode,b=0;256>b;b++)N[b]=a(b)}function r(a){if(0>=a&&(a=1),a>100&&(a=100),x!=a){var c=0;c=Math.floor(50>a?5e3/a:200-2*a),b(c),x=a}}function s(){a||(a=50),q(),d(),e(),f(),r(a)}var t,u,v,w,x,y=(Math.round,Math.floor),z=new Array(64),A=new Array(64),B=new Array(64),C=new Array(64),D=new Array(65535),E=new Array(65535),F=new Array(64),G=new Array(64),H=[],I=0,J=7,K=new Array(64),L=new Array(64),M=new Array(64),N=new Array(256),O=new Array(2048),P=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],Q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],S=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],T=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=[0,1,2,3,4,5,6,7,8,9,10,11],W=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],X=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];this.encode=function(a,b){b&&r(b),H=new Array,I=0,J=7,i(65496),k(),m(),l(a.width,a.height),n(),o();var c=0,d=0,e=0;I=0,J=7,this.encode.displayName="_encode_";for(var f,h,j,q,s,x,y,z,A,D=a.data,E=a.width,F=a.height,G=4*E,N=0;F>N;){for(f=0;G>f;){for(s=G*N+f,x=s,y=-1,z=0,A=0;64>A;A++)z=A>>3,y=4*(7&A),x=s+z*G+y,N+z>=F&&(x-=G*(N+1+z-F)),f+y>=G&&(x-=f+y-G+4),h=D[x++],j=D[x++],q=D[x++],K[A]=(O[h]+O[j+256>>0]+O[q+512>>0]>>16)-128,L[A]=(O[h+768>>0]+O[j+1024>>0]+O[q+1280>>0]>>16)-128,M[A]=(O[h+1280>>0]+O[j+1536>>0]+O[q+1792>>0]>>16)-128;c=p(K,B,c,t,v),d=p(L,C,d,u,w),e=p(M,C,e,u,w),f+=32}N+=8}if(J>=0){var P=[];P[1]=J+1,P[0]=(1<<J+1)-1,g(P)}i(65497);var Q="data:image/jpeg;base64,"+btoa(H.join(""));return H=[],Q},s()}return a.encode=function(b,c){var d=new a(c);return d.encode(b)},a}),b("runtime/html5/androidpatch",["runtime/html5/util","runtime/html5/jpegencoder","base"],function(a,b,c){var d,e=a.canvasToDataUrl;a.canvasToDataUrl=function(a,f,g){var h,i,j,k,l;return c.os.android?("image/jpeg"===f&&"undefined"==typeof d&&(k=e.apply(null,arguments),l=k.split(","),k=~l[0].indexOf("base64")?atob(l[1]):decodeURIComponent(l[1]),k=k.substring(0,2),d=255===k.charCodeAt(0)&&216===k.charCodeAt(1)),"image/jpeg"!==f||d?e.apply(null,arguments):(i=a.width,j=a.height,h=a.getContext("2d"),b.encode(h.getImageData(0,0,i,j),g))):e.apply(null,arguments)}}),b("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(a,b,c){var d="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D";return b.register("Image",{modified:!1,init:function(){var a=this,b=new Image;b.onload=function(){a._info={type:a.type,width:this.width,height:this.height},a._metas||"image/jpeg"!==a.type?a.owner.trigger("load"):c.parseMeta(a._blob,function(b,c){a._metas=c,a.owner.trigger("load")})},b.onerror=function(){a.owner.trigger("error")},a._img=b},loadFromBlob:function(a){var b=this,d=b._img;b._blob=a,b.type=a.type,d.src=c.createObjectURL(a.getSource()),b.owner.once("load",function(){c.revokeObjectURL(d.src)})},resize:function(a,b){var c=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,c,a,b),this._blob=null,this.modified=!0,this.owner.trigger("complete","resize")},crop:function(a,b,c,d,e){var f=this._canvas||(this._canvas=document.createElement("canvas")),g=this.options,h=this._img,i=h.naturalWidth,j=h.naturalHeight,k=this.getOrientation();e=e||1,f.width=c,f.height=d,g.preserveHeaders||this._rotate2Orientaion(f,k),this._renderImageToCanvas(f,h,-a,-b,i*e,j*e),this._blob=null,this.modified=!0,this.owner.trigger("complete","crop")},getAsBlob:function(a){var b,d=this._blob,e=this.options;if(a=a||this.type,this.modified||this.type!==a){if(b=this._canvas,"image/jpeg"===a){if(d=c.canvasToDataUrl(b,a,e.quality),e.preserveHeaders&&this._metas&&this._metas.imageHead)return d=c.dataURL2ArrayBuffer(d),d=c.updateImageHead(d,this._metas.imageHead),d=c.arrayBufferToBlob(d,a)}else d=c.canvasToDataUrl(b,a);d=c.dataURL2Blob(d)}return d},getAsDataUrl:function(a){var b=this.options;return a=a||this.type,"image/jpeg"===a?c.canvasToDataUrl(this._canvas,a,b.quality):this._canvas.toDataURL(a)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},destroy:function(){var a=this._canvas;this._img.onload=null,a&&(a.getContext("2d").clearRect(0,0,a.width,a.height),a.width=a.height=0,this._canvas=null),this._img.src=d,this._img=this._blob=null},_resize:function(a,b,c,d){var e,f,g,h,i,j=this.options,k=a.width,l=a.height,m=this.getOrientation();~[5,6,7,8].indexOf(m)&&(c^=d,d^=c,c^=d),e=Math[j.crop?"max":"min"](c/k,d/l),j.allowMagnify||(e=Math.min(1,e)),f=k*e,g=l*e,j.crop?(b.width=c,b.height=d):(b.width=f,b.height=g),h=(b.width-f)/2,i=(b.height-g)/2,j.preserveHeaders||this._rotate2Orientaion(b,m),this._renderImageToCanvas(b,a,h,i,f,g)},_rotate2Orientaion:function(a,b){var c=a.width,d=a.height,e=a.getContext("2d");switch(b){case 5:case 6:case 7:case 8:a.width=d,a.height=c}switch(b){case 2:e.translate(c,0),e.scale(-1,1);break;case 3:e.translate(c,d),e.rotate(Math.PI);break;case 4:e.translate(0,d),e.scale(1,-1);break;case 5:e.rotate(.5*Math.PI),e.scale(1,-1);break;case 6:e.rotate(.5*Math.PI),e.translate(0,-d);break;case 7:e.rotate(.5*Math.PI),e.translate(c,-d),e.scale(-1,1);break;case 8:e.rotate(-.5*Math.PI),e.translate(-c,0)}},_renderImageToCanvas:function(){function b(a,b,c){var d,e,f,g=document.createElement("canvas"),h=g.getContext("2d"),i=0,j=c,k=c;for(g.width=1,g.height=c,h.drawImage(a,0,0),d=h.getImageData(0,0,1,c).data;k>i;)e=d[4*(k-1)+3],0===e?j=k:i=k,k=j+i>>1;return f=k/c,0===f?1:f}function c(a){var b,c,d=a.naturalWidth,e=a.naturalHeight;return d*e>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-d+1,0),0===c.getImageData(0,0,1,1).data[3]):!1}return a.os.ios?a.os.ios>=7?function(a,c,d,e,f,g){var h=c.naturalWidth,i=c.naturalHeight,j=b(c,h,i);return a.getContext("2d").drawImage(c,0,0,h*j,i*j,d,e,f,g)}:function(a,d,e,f,g,h){var i,j,k,l,m,n,o,p=d.naturalWidth,q=d.naturalHeight,r=a.getContext("2d"),s=c(d),t="image/jpeg"===this.type,u=1024,v=0,w=0;for(s&&(p/=2,q/=2),r.save(),i=document.createElement("canvas"),i.width=i.height=u,j=i.getContext("2d"),k=t?b(d,p,q):1,l=Math.ceil(u*g/p),m=Math.ceil(u*h/q/k);q>v;){for(n=0,o=0;p>n;)j.clearRect(0,0,u,u),j.drawImage(d,-n,-v),r.drawImage(i,0,0,u,u,e+o,f+w,l,m),n+=u,o+=l;v+=u,w+=m}r.restore(),i=j=null}:function(b){var c=a.slice(arguments,1),d=b.getContext("2d");d.drawImage.apply(d,c)}}()})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("runtime/html5/md5",["runtime/html5/runtime"],function(a){var b=function(a,b){return a+b&4294967295},c=function(a,c,d,e,f,g){return c=b(b(c,a),b(e,g)),b(c<<f|c>>>32-f,d)},d=function(a,b,d,e,f,g,h){return c(b&d|~b&e,a,b,f,g,h)},e=function(a,b,d,e,f,g,h){return c(b&e|d&~e,a,b,f,g,h)},f=function(a,b,d,e,f,g,h){return c(b^d^e,a,b,f,g,h)},g=function(a,b,d,e,f,g,h){return c(d^(b|~e),a,b,f,g,h)},h=function(a,c){var h=a[0],i=a[1],j=a[2],k=a[3];h=d(h,i,j,k,c[0],7,-680876936),k=d(k,h,i,j,c[1],12,-389564586),j=d(j,k,h,i,c[2],17,606105819),i=d(i,j,k,h,c[3],22,-1044525330),h=d(h,i,j,k,c[4],7,-176418897),k=d(k,h,i,j,c[5],12,1200080426),j=d(j,k,h,i,c[6],17,-1473231341),i=d(i,j,k,h,c[7],22,-45705983),h=d(h,i,j,k,c[8],7,1770035416),k=d(k,h,i,j,c[9],12,-1958414417),j=d(j,k,h,i,c[10],17,-42063),i=d(i,j,k,h,c[11],22,-1990404162),h=d(h,i,j,k,c[12],7,1804603682),k=d(k,h,i,j,c[13],12,-40341101),j=d(j,k,h,i,c[14],17,-1502002290),i=d(i,j,k,h,c[15],22,1236535329),h=e(h,i,j,k,c[1],5,-165796510),k=e(k,h,i,j,c[6],9,-1069501632),j=e(j,k,h,i,c[11],14,643717713),i=e(i,j,k,h,c[0],20,-373897302),h=e(h,i,j,k,c[5],5,-701558691),k=e(k,h,i,j,c[10],9,38016083),j=e(j,k,h,i,c[15],14,-660478335),i=e(i,j,k,h,c[4],20,-405537848),h=e(h,i,j,k,c[9],5,568446438),k=e(k,h,i,j,c[14],9,-1019803690),j=e(j,k,h,i,c[3],14,-187363961),i=e(i,j,k,h,c[8],20,1163531501),h=e(h,i,j,k,c[13],5,-1444681467),k=e(k,h,i,j,c[2],9,-51403784),j=e(j,k,h,i,c[7],14,1735328473),i=e(i,j,k,h,c[12],20,-1926607734),h=f(h,i,j,k,c[5],4,-378558),k=f(k,h,i,j,c[8],11,-2022574463),j=f(j,k,h,i,c[11],16,1839030562),i=f(i,j,k,h,c[14],23,-35309556),h=f(h,i,j,k,c[1],4,-1530992060),k=f(k,h,i,j,c[4],11,1272893353),j=f(j,k,h,i,c[7],16,-155497632),i=f(i,j,k,h,c[10],23,-1094730640),h=f(h,i,j,k,c[13],4,681279174),k=f(k,h,i,j,c[0],11,-358537222),j=f(j,k,h,i,c[3],16,-722521979),i=f(i,j,k,h,c[6],23,76029189),h=f(h,i,j,k,c[9],4,-640364487),k=f(k,h,i,j,c[12],11,-421815835),j=f(j,k,h,i,c[15],16,530742520),i=f(i,j,k,h,c[2],23,-995338651),h=g(h,i,j,k,c[0],6,-198630844),k=g(k,h,i,j,c[7],10,1126891415),j=g(j,k,h,i,c[14],15,-1416354905),i=g(i,j,k,h,c[5],21,-57434055),h=g(h,i,j,k,c[12],6,1700485571),k=g(k,h,i,j,c[3],10,-1894986606),j=g(j,k,h,i,c[10],15,-1051523),i=g(i,j,k,h,c[1],21,-2054922799),h=g(h,i,j,k,c[8],6,1873313359),k=g(k,h,i,j,c[15],10,-30611744),j=g(j,k,h,i,c[6],15,-1560198380),i=g(i,j,k,h,c[13],21,1309151649),h=g(h,i,j,k,c[4],6,-145523070),k=g(k,h,i,j,c[11],10,-1120210379),j=g(j,k,h,i,c[2],15,718787259),i=g(i,j,k,h,c[9],21,-343485551),a[0]=b(h,a[0]),a[1]=b(i,a[1]),a[2]=b(j,a[2]),a[3]=b(k,a[3])},i=function(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a.charCodeAt(b)+(a.charCodeAt(b+1)<<8)+(a.charCodeAt(b+2)<<16)+(a.charCodeAt(b+3)<<24);return c},j=function(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a[b]+(a[b+1]<<8)+(a[b+2]<<16)+(a[b+3]<<24);return c},k=function(a){var b,c,d,e,f,g,j=a.length,k=[1732584193,-271733879,-1732584194,271733878];for(b=64;j>=b;b+=64)h(k,i(a.substring(b-64,b)));for(a=a.substring(b-64),c=a.length,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=0;c>b;b+=1)d[b>>2]|=a.charCodeAt(b)<<(b%4<<3);if(d[b>>2]|=128<<(b%4<<3),b>55)for(h(k,d),b=0;16>b;b+=1)d[b]=0;return e=8*j,e=e.toString(16).match(/(.*?)(.{0,8})$/),f=parseInt(e[2],16),g=parseInt(e[1],16)||0,d[14]=f,d[15]=g,h(k,d),k},l=function(a){var b,c,d,e,f,g,i=a.length,k=[1732584193,-271733879,-1732584194,271733878];for(b=64;i>=b;b+=64)h(k,j(a.subarray(b-64,b)));for(a=i>b-64?a.subarray(b-64):new Uint8Array(0),c=a.length,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=0;c>b;b+=1)d[b>>2]|=a[b]<<(b%4<<3);if(d[b>>2]|=128<<(b%4<<3),b>55)for(h(k,d),b=0;16>b;b+=1)d[b]=0;return e=8*i,e=e.toString(16).match(/(.*?)(.{0,8})$/),f=parseInt(e[2],16),g=parseInt(e[1],16)||0,d[14]=f,d[15]=g,h(k,d),k},m=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n=function(a){var b,c="";for(b=0;4>b;b+=1)c+=m[a>>8*b+4&15]+m[a>>8*b&15];return c},o=function(a){var b;for(b=0;b<a.length;b+=1)a[b]=n(a[b]);return a.join("")},p=function(a){return o(k(a))},q=function(){this.reset()};return"5d41402abc4b2a76b9719d911017c592"!==p("hello")&&(b=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}),q.prototype.append=function(a){return/[\u0080-\uFFFF]/.test(a)&&(a=unescape(encodeURIComponent(a))),this.appendBinary(a),this},q.prototype.appendBinary=function(a){this._buff+=a,this._length+=a.length;var b,c=this._buff.length;for(b=64;c>=b;b+=64)h(this._state,i(this._buff.substring(b-64,b)));return this._buff=this._buff.substr(b-64),this},q.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(b=0;e>b;b+=1)f[b>>2]|=d.charCodeAt(b)<<(b%4<<3);return this._finish(f,e),c=a?this._state:o(this._state),this.reset(),c},q.prototype._finish=function(a,b){var c,d,e,f=b;if(a[f>>2]|=128<<(f%4<<3),f>55)for(h(this._state,a),f=0;16>f;f+=1)a[f]=0;c=8*this._length,c=c.toString(16).match(/(.*?)(.{0,8})$/),d=parseInt(c[2],16),e=parseInt(c[1],16)||0,a[14]=d,a[15]=e,h(this._state,a)},q.prototype.reset=function(){return this._buff="",this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},q.prototype.destroy=function(){delete this._state,delete this._buff,delete this._length},q.hash=function(a,b){/[\u0080-\uFFFF]/.test(a)&&(a=unescape(encodeURIComponent(a)));var c=k(a);return b?c:o(c)},q.hashBinary=function(a,b){var c=k(a);return b?c:o(c)},q.ArrayBuffer=function(){this.reset()},q.ArrayBuffer.prototype.append=function(a){var b,c=this._concatArrayBuffer(this._buff,a),d=c.length;for(this._length+=a.byteLength,b=64;d>=b;b+=64)h(this._state,j(c.subarray(b-64,b)));return this._buff=d>b-64?c.subarray(b-64):new Uint8Array(0),this},q.ArrayBuffer.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; +for(b=0;e>b;b+=1)f[b>>2]|=d[b]<<(b%4<<3);return this._finish(f,e),c=a?this._state:o(this._state),this.reset(),c},q.ArrayBuffer.prototype._finish=q.prototype._finish,q.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},q.ArrayBuffer.prototype.destroy=q.prototype.destroy,q.ArrayBuffer.prototype._concatArrayBuffer=function(a,b){var c=a.length,d=new Uint8Array(c+b.byteLength);return d.set(a),d.set(new Uint8Array(b),c),d},q.ArrayBuffer.hash=function(a,b){var c=l(new Uint8Array(a));return b?c:o(c)},a.register("Md5",{init:function(){},loadFromBlob:function(a){var b,c,d=a.getSource(),e=2097152,f=Math.ceil(d.size/e),g=0,h=this.owner,i=new q.ArrayBuffer,j=this,k=d.mozSlice||d.webkitSlice||d.slice;c=new FileReader,(b=function(){var l,m;l=g*e,m=Math.min(l+e,d.size),c.onload=function(b){i.append(b.target.result),h.trigger("progress",{total:a.size,loaded:m})},c.onloadend=function(){c.onloadend=c.onload=null,++g<f?setTimeout(b,1):setTimeout(function(){h.trigger("load"),j.result=i.end(),b=a=d=i=null,h.trigger("complete")},50)},c.readAsArrayBuffer(k.call(d,l,m))})()},getResult:function(){return this.result}})}),b("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1],10)}function f(){function d(a,b){var c,d,e=a.type||a;c=e.split("::"),d=c[0],e=c[1],"Ready"===e&&d===j.uid?j.trigger("ready"):f[d]&&f[d].trigger(e.toLowerCase(),a,b)}var e={},f={},g=this.destroy,j=this,k=b.guid("webuploader_");c.apply(j,arguments),j.type=h,j.exec=function(a,c){var d,g=this,h=g.uid,k=b.slice(arguments,2);return f[h]=g,i[a]&&(e[h]||(e[h]=new i[a](g,j)),d=e[h],d[c])?d[c].apply(d,k):j.flashExec.apply(g,arguments)},a[k]=function(){var a=arguments;setTimeout(function(){d.apply(null,a)},1)},this.jsreciver=k,this.destroy=function(){return g&&g.apply(this,arguments)},this.flashExec=function(a,c){var d=j.getFlash(),e=b.slice(arguments,2);return d.exec(this.uid,a,c,e)}}var g=b.$,h="flash",i={};return b.inherits(c,{constructor:f,init:function(){var a,c=this.getContainer(),d=this.options;c.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),a='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+d.swf+'" ',b.browser.ie&&(a+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),a+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+d.swf+'" /><param name="flashvars" value="uid='+this.uid+"&jsreciver="+this.jsreciver+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/image",["runtime/flash/runtime"],function(a){return a.register("Image",{loadFromBlob:function(a){var b=this.owner;b.info()&&this.flashExec("Image","info",b.info()),b.meta()&&this.flashExec("Image","meta",b.meta()),this.flashExec("Image","loadFromBlob",a.uid)}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.flashExec("Blob","slice",a,c);return new b(d.uid,d)}})}),b("runtime/flash/md5",["runtime/flash/runtime"],function(a){return a.register("Md5",{init:function(){},loadFromBlob:function(a){return this.flashExec("Md5","loadFromBlob",a.uid)}})}),b("preset/all",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","widgets/md5","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/androidpatch","runtime/html5/image","runtime/html5/transport","runtime/html5/md5","runtime/flash/filepicker","runtime/flash/image","runtime/flash/transport","runtime/flash/blob","runtime/flash/md5"],function(a){return a}),b("webuploader",["preset/all"],function(a){return a}),c("webuploader")}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.js new file mode 100644 index 0000000..08f4976 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.js @@ -0,0 +1,4993 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。 + * + * AMD API 内部的简单不完全实现,请忽略。只有当WebUploader被合并成一个文件的时候才会引入。 + */ +(function( root, factory ) { + var modules = {}, + + // 内部require, 简单不完全实现。 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 如果deps不是数组,则直接返回指定module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 内部define,暂时不支持不指定id. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 设置module, 兼容CommonJs写法。 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 根据id获取module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 将所有modules,将路径ids装换成对象。 + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 操作相关 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 使用jQuery的Promise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 基础类方法。 + */ + + /** + * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。 + * + * As you know, Web Uploader的每个文件都是用过[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)规范中的`define`组织起来的, 每个Module都会有个module id. + * 默认module id为该文件的路径,而此路径将会转化成名字空间存放在WebUploader中。如: + * + * * module `base`:WebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 以下文档中对类的使用可能省略掉了`WebUploader`前缀。 + * @module WebUploader + * @title WebUploader API文档 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 反科里化 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 基础类,提供一些简单常用的方法。 + * @class Base + */ + return { + + /** + * @property {String} version 当前版本号。 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 引用依赖的jQuery或者Zepto对象。 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 简单的浏览器检查结果。 + * + * * `webkit` webkit版本号,如果浏览器为非webkit内核,此属性为`undefined`。 + * * `chrome` chrome浏览器版本号,如果浏览器为chrome,此属性为`undefined`。 + * * `ie` ie浏览器版本号,如果浏览器为非ie,此属性为`undefined`。**暂不支持ie10+** + * * `firefox` firefox浏览器版本号,如果浏览器为非firefox,此属性为`undefined`。 + * * `safari` safari浏览器版本号,如果浏览器为非safari,此属性为`undefined`。 + * * `opera` opera浏览器版本号,如果浏览器为非opera,此属性为`undefined`。 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 操作系统检查结果。 + * + * * `android` 如果在android浏览器环境下,此值为对应的android版本号,否则为`undefined`。 + * * `ios` 如果在ios浏览器环境下,此值为对应的ios版本号,否则为`undefined`。 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 实现类与类之间的继承。 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 父类 + * @param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。 + * @param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。 + * @param {Object} [statics] 静态属性或方法。 + * @return {Class} 返回子类。 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 因为没有指定构造器,父类的构造器将会执行。 + * var instance = new Manager(); // => Super + * + * // 继承子父类的方法 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 子类的__super__属性指向父类 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 复制静态方法 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 让子类的__super__属性指向父类。 + child.__super__ = Super.prototype; + + // 构建原型,添加原型方法或属性。 + // 暂时用Object.create实现。 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 一个不做任何事情的方法。可以用来赋值给默认的callback. + * @method noop + */ + noop: noop, + + /** + * 返回一个新的方法,此方法将已指定的`context`来执行。 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 引用Console.log如果存在的话,否则引用一个[空函数noop](#WebUploader:Base.noop)。 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 当浏览器不在当前窗口时就停了。 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 被[uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)的数组slice方法。 + * 将用来将非数组对象转化成数组对象。 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 生成唯一的ID + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 格式化文件大小, 输出成带单位的字符串 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 文件大小 + * @param {Number} [pointLength=2] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 事件处理类,可以独立使用,也可以扩展给对象使用。 + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 根据条件过滤出事件handlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 不支持对象,只支持多个event用空格隔开 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 绑定事件。 + * + * `callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如 + * ```javascript + * var obj = {}; + * + * // 使得obj有事件行为 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。 + * 切会影响到`trigger`方法的返回值,为`false`。 + * + * `on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处, + * 就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 事件名,支持多个事件用空格隔开 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 绑定事件,且当handler执行完后,自动解除绑定。 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 事件名 + * @param {Function} callback 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 解除事件绑定 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 事件名 + * @param {Function} [callback] 事件处理器 + * @param {Object} [context] 事件处理器的上下文。 + * @return {self} 返回自身,方便链式 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 触发事件 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 事件名 + * @param {*} [...] 任意参数 + * @return {Boolean} 如果handler中return false了,则返回false, 否则返回true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 中介者,它本身是个单例,但可以通过[installTo](#WebUploader:Mediator:installTo)方法,使任何对象具备事件行为。 + * 主要目的是负责模块与模块之间的合作,降低耦合度。 + * + * @class Mediator + */ + return $.extend({ + + /** + * 可以通过这个接口,使任何对象具备事件功能。 + * @method installTo + * @param {Object} obj 需要具备事件行为的对象。 + * @return {Object} 返回obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader上传类 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 上传入口类。 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 开起分片上传。 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets中有相应扩展 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 批量添加纯命令式方法。 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 获取或者设置Uploader配置项。 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 初始状态图片上传前不会压缩 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 修改后图片上传前,尝试将图片压缩到1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 获取文件统计信息。返回一个包含一下信息的对象。 + * * `successNum` 上传成功的文件数 + * * `progressNum` 上传中的文件数 + * * `cancelNum` 被删除的文件数 + * * `invalidNum` 无效的文件数 + * * `uploadFailNum` 上传失败的文件数 + * * `queueNum` 还在队列中的文件数 + * * `interruptNum` 被暂停的文件数 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 调用通过on方法注册的handler. + Mediator.trigger.apply( this, arguments ) === false || + + // 调用opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 调用this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 广播所有uploader的事件。 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 销毁 webuploader 实例 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js将补充此方法的详细文档。 + request: Base.noop + }); + + /** + * 创建Uploader实例,等同于new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 暴露Uploader,可以通过它来扩展业务逻辑。 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 获取对象的第一个key + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 接口类。 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 添加Runtime实现。 + * @param {String} type 类型 + * @param {Runtime} factory 具体Runtime实现。 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 有些类型不能重用,比如filepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 允许runtime没有初始化之前,注册一些方法在初始化后执行。 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 像filePicker只能独立存在,不能公用。 + runtime = runtime || cache.get( null, standalone ); + + // 需要创建 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 来自cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 错误信息 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 类Backbone的事件监听声明,监听uploader实例上的事件 + // widget直接无法监听事件,事件只能通过uploader来传递 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 如果无API响应声明则忽略 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 发送命令。当传入`callback`或者`handler`中返回`promise`时。返回一个当所有`handler`中的promise都完成后完成的新`promise`。 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 扩展Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 默认所有 Uploader.register 了的 widget 都会被加载,如果禁用某一部分,请通过此 option 指定黑名单。 + */ + + // 覆写_init用来初始化widgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred对象 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 如果有callback,则用异步方式。 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 很重要不能删除。删除了会死循环。 + // 保证执行顺序。让callback总是在下一个 tick 中执行。 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 添加组件 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 名称与函数实现的映射 + * @param {object} proto 组件原型,构造函数通过 constructor 属性定义 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 自动生成 map 表。 + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 删除插件,只有在注册时指定了名字的才能被删除。 + * @grammar Uploader.unRegister(name); + * @param {string} name 组件名字 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 删除指定的插件。 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget。 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 指定Drag And Drop拖拽的容器,如果不指定,则不启动。 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 是否禁掉整个页面的拖拽功能,如果不禁用,图片拖进来的时候会默认被浏览器打开。 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 阻止此事件可以拒绝某些类型的文件拖入进来。目前只有 chrome 提供这样的 API,且只能通过 mime-type 验证。 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 检测文件是否全部允许添加。 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 组件基类。 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 指定监听paste事件的容器,如果不指定,不启用此功能。此功能为通过粘贴来添加截屏的图片。建议设置为`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 如果没有指定 mimetype, 但是知道文件后缀。 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 为了统一化Flash的File和HTML5的File而存在。 + * 以至于要调用Flash里面的File,也可以像调用HTML5版本的File一下。 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 支持其他类型文件的转换。 + // 如果有 mimetype, 但是文件名里面没有找出后缀规律 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 错误信息 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('按钮指定错误'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 记录来源。 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 文件选择相关 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 指定选择文件的按钮容器,不指定则不创建按钮。 + * + * * `id` {Seletor} 指定选择文件的按钮容器,不指定则不创建按钮。 + * * `label` {String} 请采用 `innerHTML` 代替 + * * `innerHTML` {String} 指定按钮文字。不指定时优先从指定的容器中看是否自带文字。 + * * `multiple` {Boolean} 是否开起同时选择多个文件能力。 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 指定接受哪些类型的文件。 由于目前还有ext转mimeType表,所以这里需要分开指定。 + * + * * `title` {String} 文字描述 + * * `extensions` {String} 允许的文件后缀,不带点,多个用逗号分割。 + * * `mimeTypes` {String} 多个用逗号分割。 + * + * 如: + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 添加文件选择按钮,如果一个按钮不够,需要调用此方法来添加。参数跟[options.pick](#WebUploader:Uploader:options)一致。 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '选择文件' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview 文件属性封装 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 文件类 + * @class File + * @constructor 构造函数 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 + */ + function WUFile( source ) { + + /** + * 文件名,包括扩展名(后缀) + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 文件体积(字节) + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 文件最后修改日期 + * @property lastModifiedDate + * @type {int} + * @default 当前时间戳 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 文件ID,每个对象具有唯一ID,与文件名无关 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 文件扩展名,通过文件名获取,例如test.png的扩展名为png + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 状态文字说明。在不同的status语境下有不同的用途。 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 存储文件状态,防止通过属性直接修改 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 设置状态,状态变化时会触发`change`事件。 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status) + * @param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 文件状态变化 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 获取文件状态 + * @return {File.Status} + * @example + 文件状态具体包括以下几种类型: + { + // 初始化 + INITED: 0, + // 已入队列 + QUEUED: 1, + // 正在上传 + PROGRESS: 2, + // 上传出错 + ERROR: 3, + // 上传成功 + COMPLETE: 4, + // 上传取消 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 获取文件原始信息。 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 文件状态值,具体包括以下几种类型: + * * `inited` 初始状态 + * * `queued` 已经进入队列, 等待上传 + * * `progress` 上传中 + * * `complete` 上传完成。 + * * `error` 上传出错,可重试 + * * `interrupt` 上传中断,可续传。 + * * `invalid` 文件不合格,不能重试上传。会自动从队列中移除。 + * * `cancelled` 文件被移除。 + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 初始状态 + QUEUED: 'queued', // 已经进入队列, 等待上传 + PROGRESS: 'progress', // 上传中 + ERROR: 'error', // 上传出错,可重试 + COMPLETE: 'complete', // 上传完成。 + CANCELLED: 'cancelled', // 上传取消。 + INTERRUPT: 'interrupt', // 上传中断,可续传。 + INVALID: 'invalid' // 文件不合格,不能重试上传。 + }; + + return WUFile; + }); + + /** + * @fileOverview 文件队列 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 文件队列, 用来存储各个状态中的文件。 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 统计文件数。 + * * `numOfQueue` 队列中的文件数。 + * * `numOfSuccess` 上传成功的文件数 + * * `numOfCancel` 被取消的文件数 + * * `numOfProgress` 正在上传中的文件数 + * * `numOfUploadFailed` 上传错误的文件数。 + * * `numOfInvalid` 无效的文件数。 + * * `numofDeleted` 被移除的文件数。 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0, + }; + + // 上传队列,仅包括等待上传的文件 + this._queue = []; + + // 存储所有文件 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 将新文件加入对队列尾部 + * + * @method append + * @param {File} file 文件对象 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 将新文件加入对队列头部 + * + * @method prepend + * @param {File} file 文件对象 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 获取文件对象 + * + * @method getFile + * @param {String} fileId 文件ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 从队列中取出一个指定状态的文件。 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [文件状态值](#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 对队列进行排序,能够控制文件上传顺序。 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 排序方法 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [文件状态值](#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 在队列中删除文件。 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 文件对象。 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 队列 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept中的中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 如果当前不是html5运行时,那就算了。 + // 不执行后续操作 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 创建一个 html5 运行时的 placeholder + // 以至于外部添加原生 File 对象的时候能正确包裹一下供 webuploader 使用。 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 为了支持外部直接添加一个原生File对象。 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 判断文件是否可以被加入队列 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 如果名字中有后缀,才做后缀白名单处理。 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File对象 + * @description 当文件被加入队列之前触发,此事件的handler返回值为`false`,则此文件不会被添加进入队列。 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File对象 + * @description 当文件被加入队列以后触发。 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 不过类型判断允许不允许,先派送 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 类型不匹配,则派送错误事件,并返回。 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 数组,内容为原始File(lib/File)对象。 + * @description 当一批文件添加进队列以后触发。 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 对象 数组 + * @description 添加文件到队列 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File对象 + * @description 当文件被移除队列后触发。 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 返回指定状态的文件集合,不传参数将返回所有状态的文件。 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 重试上传,重试指定文件,或者从出错的文件开始重新上传。 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 排序队列中的文件,在上传之前调整可以控制上传顺序。 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 当 uploader 被重置的时候触发。 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 重置uploader。目前只重置了队列。 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 添加获取Runtime相关信息的方法。 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 预测Uploader将采用哪个`Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 跨域时,是否允许携带cookie, 只有html5 runtime才有效 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2分钟 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 添加Blob, 只能添加一次,最后一次有效。 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 连接到blob归属的同一个runtime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 添加其他字段 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 让Transport具备事件功能。 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 负责文件上传相关。 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 添加默认配置项 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 是否允许在文件传输时提前把下一个文件准备好。 + * 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 + * 如果能提前在当前文件传输期处理,可以节省总体耗时。 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 是否要分片处理大文件上传。 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 如果要分片,分多大一片? 默认大小为5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 如果某个分片由于网络问题出错,允许自动重传多少次? + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 上传并发数。允许同时最大上传进程数。 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 文件上传请求的参数表,每次发送都会发送此对象中的参数。 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 设置文件上传域的name。 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 文件上传方式,`POST`或者`GET`。 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 是否已二进制的流的方式发送文件,这样整个上传内容`php://input`都为文件内容, + * 其他参数在$_GET数组中。 + */ + }); + + // 负责将文件切片。 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 记录当前正在传的数据,跟threads相关 + this.pool = []; + + // 缓存分好片的文件。 + this.stack = []; + + // 缓存即将上传的文件。 + this.pending = []; + + // 跟踪还有多少分片在上传中但是没有完成上传。 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 把其他块取消了。 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 当开始上传流程时触发。 + * @for Uploader + */ + + /** + * 开始上传。此方法可以从初始状态调用开始上传流程,也可以从暂停状态调用,继续上传流程。 + * + * 可以指定开始某一个文件。 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 移出invalid的文件 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 如果指定了开始某个文件,则只开始指定文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 之前暂停过。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + // 如果有暂停的,则续传 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + file.setStatus( Status.PROGRESS ); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 当开始上传流程暂停时触发。 + * @for Uploader + */ + + /** + * 暂停上传。第一个参数为是否中断上传当前正在上传的文件。 + * + * 如果第一个参数是文件,则只暂停指定文件。 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 如果只是暂停某个文件。 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 只 abort 指定的文件。 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File对象或这File对象的id + * @description 标记文件状态为已取消, 同时将中断文件传输。 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 判断`Uplaode`r是否正在上传中。 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 掉过一个文件上传,直接标记指定文件为已上传状态。 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 如果正在上传。 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 当所有文件上传结束时触发。 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 上一个promise还没有结束,则等待完成后再执行。 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 还有位置,且还有文件要处理的话。 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 有可能是reject过来的,所以要检测val的类型。 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 没有要上传的了,且没有正在传输的了。 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 把已经处理完了的,或者,状态为非 progress(上传中)、 + // interupt(暂停中) 的移除。 + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 如果当前文件还有没有需要传输的,则直接返回剩下的。 + if ( (act = this._getStack()) ) { + + // 是否提前准备下一个文件 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 否则,如果正在运行,则准备下一个文件,并等待完成后返回下个分片。 + } else if ( me.runing ) { + + // 如果缓存中有,则直接在缓存中取,没有则去queue中取。 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 文件可能还在prepare中,也有可能已经完全准备好了。 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File对象 + * @description 某个文件开始上传前触发,一个文件只会触发一次。 + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 有可能文件被skip掉了。文件被skip掉后,状态坑定不是Queued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 如果还在pending中,则替换成文件本身。 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file的钩子就有错误发生。 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 让出位置了,可以让其他分片开始上传 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 有可能在 before-send-file 的 promise 期间改变了文件状态。 + // 如:暂停,取消 + // 我们不能中断 promise, 但是可以在 promise 完后,不做上传操作。 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 如果是中断,则还需要放回去。 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 如果没有分片,则直接使用原始的。 + // 不会丢失content-type信息。 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 每个分片发送之前可能要做些异步的事情。 + promise = me.request( 'before-send', block, function() { + + // 有可能文件已经上传出错了,所以不需要再传输了。 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 如果为fail了,则跳过此分片。 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 默认的上传参数,可以扩展此对象来控制上传参数。 + * @param {Object} headers 可以扩展此对象来控制上传头部。 + * @description 当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。 + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 服务端的返回数据,json格式,如果服务端不是json格式,从ret._raw中取数据,自行解析。 + * @description 当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为`false`, 则此文件将派送`server`类型的`uploadError`事件。 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File对象 + * @param {Number} percentage 上传进度 + * @description 上传过程中触发,携带上传进度。 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File对象 + * @param {String} reason 出错的code + * @description 当文件上传出错时触发。 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File对象 + * @param {Object} response 服务端返回的数据 + * @description 当文件上传成功时触发。 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File对象 + * @description 不管成功或者失败,文件上传完成时触发。 + * @for Uploader + */ + + // 做上传操作。 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 广播上传进度。以文件为单位。 + tr.on( 'progress', function( percentage ) { + var totalPercent = 0, + uploaded = 0; + + // 可能没有abort掉,progress还是执行进来了。 + // if ( !file.blocks ) { + // return; + // } + + totalPercent = block.percentage = percentage; + + if ( block.chunks > 1 ) { // 计算文件的整体速度。 + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + } + + owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + }); + + // 用来询问,是否返回的结果是有错误的。 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 服务端响应了,不代表成功了,询问是否响应正确。 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 尝试重试,然后广播文件上传出错。 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 自动重试 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 上传成功 + tr.on( 'load', function() { + var reason; + + // 如果非预期,转向上传出错。 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 全部上传完成。 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 配置默认的上传字段。 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 在发送之间可以添加字段什么的。。。 + // 如果默认的字段不够使用,可以通过监听此事件来扩展 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 开始发送。 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 完成上传。 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 如果外部已经标记为invalid什么的,不再改状态。 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + } + + }); + }); + /** + * @fileOverview 各种验证,包括文件总大小是否超出、单文件是否超出和文件是否重复。 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 错误类型。 + * @description 当validate不通过时,会以派送错误事件的形式通知调用者。通过`upload.on('error', handler)`可以捕获到此类错误,目前有以下错误会在特定的情况下派送错来。 + * + * * `Q_EXCEED_NUM_LIMIT` 在设置了`fileNumLimit`且尝试给`uploader`添加的文件数量超出这个值时派送。 + * * `Q_EXCEED_SIZE_LIMIT` 在设置了`Q_EXCEED_SIZE_LIMIT`且尝试给`uploader`添加的文件总大小超出这个值时派送。 + * * `Q_TYPE_DENIED` 当文件类型不满足时触发。。 + * @for Uploader + */ + + // 暴露给外面的api + api = { + + // 添加验证器 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 移除验证器 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 在Uploader初始化的时候启动Validators的初始化 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总数量, 超出则不允许加入队列。 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证文件总大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 验证单个文件大小是否超出限制, 超出则不允许加入队列。 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 去重, 根据文件名字、文件大小和最后修改时间来生成hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 已经重复了 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Runtime管理器,负责Runtime的选择, 连接 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 不需要连接其他程序,直接执行callback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 注册Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 注册html5运行时。 + // 只有在支持的前提下注册。 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html实现 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 注意只有 chrome 支持。 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 只处理框内的。 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 只处理框内的。 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 如果是页面内拖拽,还不能处理,不阻止事件。 + // 此处 ie11 下会报参数错误, + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 如果传入 callback 则去查看文件夹,否则只管当前文件夹。 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 为了保证顺序。 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 还没 init 就调用 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp的mimeTypes中生成匹配正则。 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 不阻止非文件粘贴(文字粘贴)的事件冒泡 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox不支持单独指定后缀 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * @fileOverview Transport + * @todo 支持chunked传输,优势: + * 可以将大文件分成小块,挨个传输,可以提高大文件成功率,当失败的时候,也只需要重传那小部分, + * 而不需要重头再传一次。另外断点续传也需要用chunked方式。 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 强制设置成 content-type 为文件流。 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android直接发送blob会导致服务端接收到的是空文件。 + // bug详情。 + // https://code.google.com/p/android/issues/detail?id=39882 + // 所以先用fileReader读取出来再通过arraybuffer的方式发送。 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 这个方法的调用者,实际上是RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash的接受器。 + window[ jsreciver ] = function() { + var args = arguments; + + // 为了能捕获得到。 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 删除池子中的所有实例 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '<object id="' + this.uid + '" type="application/' + + 'x-shockwave-flash" data="' + opts.swf + '" '; + + if ( Base.browser.ie ) { + html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; + } + + html += 'width="100%" height="100%" style="outline:0">' + + '<param name="movie" value="' + opts.swf + '" />' + + '<param name="flashvars" value="uid=' + this.uid + + '&jsreciver=' + this.jsreciver + '" />' + + '<param name="wmode" value="transparent" />' + + '<param name="allowscriptaccess" value="always" />' + + '</object>'; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 修复Flash再没有设置title的情况下无法弹出flash文件选择框的bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview Transport flash实现 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 处理可能存在 bug, 没辙只能靠 js 了 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview 没有图像处理的版本。 + */ + define('preset/withoutimage',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/transport', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/transport' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/withoutimage' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.min.js new file mode 100644 index 0000000..349be36 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e<f;)if(c=a[e],c.cb.apply(c.ctx2,b)===!1){d=!0;break}return!d}var e,f=a.$,g=[].slice,h=/\s+/;return e={on:function(a,b,d){var e,f=this;return b?(e=this._events||(this._events=[]),c(a,b,function(a,b){var c={e:a};c.cb=b,c.ctx=d,c.ctx2=d||f,c.id=e.length,e.push(c)}),this):this},once:function(a,b,d){var e=this;return b?(c(a,b,function(a,b){var c=function(){return e.off(a,c),b.apply(d||e,arguments)};c._cb=b,e.on(a,c,d)}),e):e},off:function(a,d,e){var g=this._events;return g?a||d||e?(c(a,d,function(a,c){f.each(b(g,a,c,e),function(){delete g[this.id]})}),this):(this._events=[],this):this},trigger:function(a){var c,e,f;return this._events&&a?(c=g.call(arguments,1),e=b(this._events,a),f=b(this._events,"all"),d(e,c)&&d(f,arguments)):this}},f.extend({installTo:function(a){return f.extend(a,e)}},e)}),b("uploader",["base","mediator"],function(a,b){function c(a){this.options=d.extend(!0,{},c.options,a),this._init(this.options)}var d=a.$;return c.options={},b.installTo(c.prototype),d.each({upload:"start-upload",stop:"stop-upload",getFile:"get-file",getFiles:"get-files",addFile:"add-file",addFiles:"add-file",sort:"sort-files",removeFile:"remove-file",cancelFile:"cancel-file",skipFile:"skip-file",retry:"retry",isInProgress:"is-in-progress",makeThumb:"make-thumb",md5File:"md5-file",getDimension:"get-dimension",addButton:"add-btn",predictRuntimeType:"predict-runtime-type",refresh:"refresh",disable:"disable",enable:"enable",reset:"reset"},function(a,b){c.prototype[a]=function(){return this.request(b,arguments)}}),d.extend(c.prototype,{state:"pending",_init:function(a){var b=this;b.request("init",a,function(){b.state="ready",b.trigger("ready")})},option:function(a,b){var c=this.options;return arguments.length>1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("按钮指定错误");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});c.runing||(c.runing=!0,f.each(c.pool,function(a,b){var d=b.file;d.getStatus()===h.INTERRUPT&&(d.setStatus(h.PROGRESS),c._trigged=!1,b.transport&&b.transport.send())}),b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload"))},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length<e.threads&&(c=d._nextBlock())?(d._trigged=!1,b=function(b){d._promise=null,b&&b.file&&d._startSend(b),a.nextTick(d.__tick)},d._promise=g(c)?c.always(b):b(c)):d.remaning||d._getStats().numOfQueue||d._getStats().numofInterrupt||(d.runing=!1,d._trigged||a.nextTick(function(){d.owner.trigger("uploadFinished")}),d._trigged=!0))},_putback:function(a){var b;a.cuted.unshift(a),b=this.stack.indexOf(a.cuted),~b||this.stack.unshift(a.cuted)},_getStack:function(){for(var a,b=0;a=this.stack[b++];){if(a.has()&&a.file.getStatus()===h.PROGRESS)return a;(!a.has()||a.file.getStatus()!==h.PROGRESS&&a.file.getStatus()!==h.INTERRUPT)&&this.stack.splice(--b,1)}return null},_nextBlock:function(){var a,b,c,d,f=this,h=f.options;return(a=this._getStack())?(h.prepareNextFile&&!f.pending.length&&f._prepareNextFile(),a.shift()):f.runing?(!f.pending.length&&f._getStats().numOfQueue&&f._prepareNextFile(),b=f.pending.shift(),c=function(b){return b?(a=e(b,h.chunked?h.chunkSize:0),f.stack.push(a),a.shift()):null},g(b)?(d=b.file,b=b[b.pipe?"pipe":"then"](c),b.file=d,b):c(b)):void 0},_prepareNextFile:function(){var a,b=this,c=b.request("fetch-file"),d=b.pending;c&&(a=b.request("before-send-file",c,function(){return c.getStatus()===h.PROGRESS||c.getStatus()===h.INTERRUPT?c:b._finishFile(c)}),b.owner.trigger("uploadStart",c),c.setStatus(h.PROGRESS),a.file=c,a.done(function(){var b=f.inArray(a,d);~b&&d.splice(b,1,c)}),a.fail(function(a){c.setStatus(h.ERROR,a),b.owner.trigger("uploadError",c,a),b.owner.trigger("uploadComplete",c)}),d.push(a))},_popBlock:function(a){var b=f.inArray(a,this.pool);this.pool.splice(b,1),a.file.remaning--,this.remaning--},_startSend:function(b){var c,d=this,e=b.file;return e.getStatus()!==h.PROGRESS?void(e.getStatus()===h.INTERRUPT&&d._putback(b)):(d.pool.push(b),d.remaning++,b.blob=1===b.chunks?e.source:e.source.slice(b.start,b.end),c=d.request("before-send",b,function(){e.getStatus()===h.PROGRESS?d._doSend(b):(d._popBlock(b),a.nextTick(d.__tick))}),void c.fail(function(){1===e.remaning?d._finishFile(e).always(function(){b.percentage=1,d._popBlock(b),d.owner.trigger("uploadComplete",e),a.nextTick(d.__tick)}):(b.percentage=1,d._popBlock(b),a.nextTick(d.__tick))}))},_doSend:function(b){var c,e,g=this,i=g.owner,j=g.options,k=b.file,l=new d(j),m=f.extend({},j.formData),n=f.extend({},j.headers);b.transport=l,l.on("destroy",function(){delete b.transport,g._popBlock(b),a.nextTick(g.__tick)}),l.on("progress",function(a){var c=0,d=0;c=b.percentage=a,b.chunks>1&&(f.each(k.blocks,function(a,b){d+=(b.percentage||0)*(b.end-b.start)}),c=d/k.size),i.trigger("uploadProgress",k,c||0)}),c=function(a){var c;return e=l.getResponseAsJson()||{},e._raw=l.getResponse(),c=function(b){a=b},i.trigger("uploadAccept",b,e,c)||(a=a||"server"),a},l.on("error",function(a,d){b.retried=b.retried||0,b.chunks>1&&~"http,abort".indexOf(a)&&b.retried<j.chunkRetry?(b.retried++,l.send()):(d||"server"!==a||(a=c(a)),k.setStatus(h.ERROR,a),i.trigger("uploadError",k,a),i.trigger("uploadComplete",k))}),l.on("load",function(){var a;return(a=c())?void l.trigger("error",a,!0):void(1===k.remaning?g._finishFile(k,e):l.destroy())}),m=f.extend(m,{id:k.id,name:k.name,type:k.type,lastModifiedDate:k.lastModifiedDate,size:k.size}),b.chunks>1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b)}).always(function(){d.trigger("uploadComplete",a)})}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice; +return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1],10)}function f(){function d(a,b){var c,d,e=a.type||a;c=e.split("::"),d=c[0],e=c[1],"Ready"===e&&d===j.uid?j.trigger("ready"):f[d]&&f[d].trigger(e.toLowerCase(),a,b)}var e={},f={},g=this.destroy,j=this,k=b.guid("webuploader_");c.apply(j,arguments),j.type=h,j.exec=function(a,c){var d,g=this,h=g.uid,k=b.slice(arguments,2);return f[h]=g,i[a]&&(e[h]||(e[h]=new i[a](g,j)),d=e[h],d[c])?d[c].apply(d,k):j.flashExec.apply(g,arguments)},a[k]=function(){var a=arguments;setTimeout(function(){d.apply(null,a)},1)},this.jsreciver=k,this.destroy=function(){return g&&g.apply(this,arguments)},this.flashExec=function(a,c){var d=j.getFlash(),e=b.slice(arguments,2);return d.exec(this.uid,a,c,e)}}var g=b.$,h="flash",i={};return b.inherits(c,{constructor:f,init:function(){var a,c=this.getContainer(),d=this.options;c.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),a='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+d.swf+'" ',b.browser.ie&&(a+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),a+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+d.swf+'" /><param name="flashvars" value="uid='+this.uid+"&jsreciver="+this.jsreciver+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("preset/withoutimage",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/transport","runtime/flash/filepicker","runtime/flash/transport"],function(a){return a}),b("webuploader",["preset/withoutimage"],function(a){return a}),c("webuploader")}); diff --git a/user/guns-admin/src/main/webapp/static/js/plugins/ztree/jquery.ztree.all.min.js b/user/guns-admin/src/main/webapp/static/js/plugins/ztree/jquery.ztree.all.min.js new file mode 100644 index 0000000..390a5f8 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/js/plugins/ztree/jquery.ztree.all.min.js @@ -0,0 +1,165 @@ + +/* + * JQuery zTree core v3.5.28 + * http://treejs.cn/ + * + * Copyright (c) 2010 Hunter.z + * + * Licensed same as jquery - MIT License + * http://www.opensource.org/licenses/mit-license.php + * + * email: hunter.z@263.net + * Date: 2017-01-20 + */ +(function(q){var H,I,J,K,L,M,u,r={},v={},w={},N={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!0,showTitle:!0,txtSelectedEnable:!1},data:{key:{children:"children",name:"name",title:"",url:"url",icon:"icon"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text", +url:"",autoParam:[],otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},x=[function(b){var a=b.treeObj,c=f.event;a.bind(c.NODECREATED,function(a,c,g){j.apply(b.callback.onNodeCreated, +[a,c,g])});a.bind(c.CLICK,function(a,c,g,l,h){j.apply(b.callback.onClick,[c,g,l,h])});a.bind(c.EXPAND,function(a,c,g){j.apply(b.callback.onExpand,[a,c,g])});a.bind(c.COLLAPSE,function(a,c,g){j.apply(b.callback.onCollapse,[a,c,g])});a.bind(c.ASYNC_SUCCESS,function(a,c,g,l){j.apply(b.callback.onAsyncSuccess,[a,c,g,l])});a.bind(c.ASYNC_ERROR,function(a,c,g,l,h,f){j.apply(b.callback.onAsyncError,[a,c,g,l,h,f])});a.bind(c.REMOVE,function(a,c,g){j.apply(b.callback.onRemove,[a,c,g])});a.bind(c.SELECTED, +function(a,c,g){j.apply(b.callback.onSelected,[c,g])});a.bind(c.UNSELECTED,function(a,c,g){j.apply(b.callback.onUnSelected,[c,g])})}],y=[function(b){var a=f.event;b.treeObj.unbind(a.NODECREATED).unbind(a.CLICK).unbind(a.EXPAND).unbind(a.COLLAPSE).unbind(a.ASYNC_SUCCESS).unbind(a.ASYNC_ERROR).unbind(a.REMOVE).unbind(a.SELECTED).unbind(a.UNSELECTED)}],z=[function(b){var a=h.getCache(b);a||(a={},h.setCache(b,a));a.nodes=[];a.doms=[]}],A=[function(b,a,c,d,e,g){if(c){var l=h.getRoot(b),f=b.data.key.children; +c.level=a;c.tId=b.treeId+"_"+ ++l.zId;c.parentTId=d?d.tId:null;c.open=typeof c.open=="string"?j.eqs(c.open,"true"):!!c.open;c[f]&&c[f].length>0?(c.isParent=!0,c.zAsync=!0):(c.isParent=typeof c.isParent=="string"?j.eqs(c.isParent,"true"):!!c.isParent,c.open=c.isParent&&!b.async.enable?c.open:!1,c.zAsync=!c.isParent);c.isFirstNode=e;c.isLastNode=g;c.getParentNode=function(){return h.getNodeCache(b,c.parentTId)};c.getPreNode=function(){return h.getPreNode(b,c)};c.getNextNode=function(){return h.getNextNode(b, +c)};c.getIndex=function(){return h.getNodeIndex(b,c)};c.getPath=function(){return h.getNodePath(b,c)};c.isAjaxing=!1;h.fixPIdKeyValue(b,c)}}],t=[function(b){var a=b.target,c=h.getSetting(b.data.treeId),d="",e=null,g="",l="",i=null,n=null,k=null;if(j.eqs(b.type,"mousedown"))l="mousedown";else if(j.eqs(b.type,"mouseup"))l="mouseup";else if(j.eqs(b.type,"contextmenu"))l="contextmenu";else if(j.eqs(b.type,"click"))if(j.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+f.id.SWITCH)!==null)d=j.getNodeMainDom(a).id, +g="switchNode";else{if(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+f.id.A}]))d=j.getNodeMainDom(k).id,g="clickNode"}else if(j.eqs(b.type,"dblclick")&&(l="dblclick",k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+f.id.A}])))d=j.getNodeMainDom(k).id,g="switchNode";if(l.length>0&&d.length==0&&(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+f.id.A}])))d=j.getNodeMainDom(k).id;if(d.length>0)switch(e=h.getNodeCache(c,d),g){case "switchNode":e.isParent?j.eqs(b.type,"click")||j.eqs(b.type,"dblclick")&& +j.apply(c.view.dblClickExpand,[c.treeId,e],c.view.dblClickExpand)?i=H:g="":g="";break;case "clickNode":i=I}switch(l){case "mousedown":n=J;break;case "mouseup":n=K;break;case "dblclick":n=L;break;case "contextmenu":n=M}return{stop:!1,node:e,nodeEventType:g,nodeEventCallback:i,treeEventType:l,treeEventCallback:n}}],B=[function(b){var a=h.getRoot(b);a||(a={},h.setRoot(b,a));a[b.data.key.children]=[];a.expandTriggerFlag=!1;a.curSelectedList=[];a.noSelection=!0;a.createdNodes=[];a.zId=0;a._ver=(new Date).getTime()}], +C=[],D=[],E=[],F=[],G=[],h={addNodeCache:function(b,a){h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=a},getNodeCacheId:function(b){return b.substring(b.lastIndexOf("_")+1)},addAfterA:function(b){D.push(b)},addBeforeA:function(b){C.push(b)},addInnerAfterA:function(b){F.push(b)},addInnerBeforeA:function(b){E.push(b)},addInitBind:function(b){x.push(b)},addInitUnBind:function(b){y.push(b)},addInitCache:function(b){z.push(b)},addInitNode:function(b){A.push(b)},addInitProxy:function(b,a){a?t.splice(0,0, +b):t.push(b)},addInitRoot:function(b){B.push(b)},addNodesData:function(b,a,c,d){var e=b.data.key.children;a[e]?c>=a[e].length&&(c=-1):(a[e]=[],c=-1);if(a[e].length>0&&c===0)a[e][0].isFirstNode=!1,i.setNodeLineIcos(b,a[e][0]);else if(a[e].length>0&&c<0)a[e][a[e].length-1].isLastNode=!1,i.setNodeLineIcos(b,a[e][a[e].length-1]);a.isParent=!0;c<0?a[e]=a[e].concat(d):(b=[c,0].concat(d),a[e].splice.apply(a[e],b))},addSelectedNode:function(b,a){var c=h.getRoot(b);h.isSelectedNode(b,a)||c.curSelectedList.push(a)}, +addCreatedNode:function(b,a){(b.callback.onNodeCreated||b.view.addDiyDom)&&h.getRoot(b).createdNodes.push(a)},addZTreeTools:function(b){G.push(b)},exSetting:function(b){q.extend(!0,N,b)},fixPIdKeyValue:function(b,a){b.data.simpleData.enable&&(a[b.data.simpleData.pIdKey]=a.parentTId?a.getParentNode()[b.data.simpleData.idKey]:b.data.simpleData.rootPId)},getAfterA:function(b,a,c){for(var d=0,e=D.length;d<e;d++)D[d].apply(this,arguments)},getBeforeA:function(b,a,c){for(var d=0,e=C.length;d<e;d++)C[d].apply(this, +arguments)},getInnerAfterA:function(b,a,c){for(var d=0,e=F.length;d<e;d++)F[d].apply(this,arguments)},getInnerBeforeA:function(b,a,c){for(var d=0,e=E.length;d<e;d++)E[d].apply(this,arguments)},getCache:function(b){return w[b.treeId]},getNodeIndex:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),e=0,g=d[c].length-1;e<=g;e++)if(d[c][e]===a)return e;return-1},getNextNode:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId? +a.getParentNode():h.getRoot(b),e=0,g=d[c].length-1;e<=g;e++)if(d[c][e]===a)return e==g?null:d[c][e+1];return null},getNodeByParam:function(b,a,c,d){if(!a||!c)return null;for(var e=b.data.key.children,g=0,l=a.length;g<l;g++){if(a[g][c]==d)return a[g];var f=h.getNodeByParam(b,a[g][e],c,d);if(f)return f}return null},getNodeCache:function(b,a){if(!a)return null;var c=w[b.treeId].nodes[h.getNodeCacheId(a)];return c?c:null},getNodeName:function(b,a){return""+a[b.data.key.name]},getNodePath:function(b,a){if(!a)return null; +var c;(c=a.parentTId?a.getParentNode().getPath():[])&&c.push(a);return c},getNodeTitle:function(b,a){return""+a[b.data.key.title===""?b.data.key.name:b.data.key.title]},getNodes:function(b){return h.getRoot(b)[b.data.key.children]},getNodesByParam:function(b,a,c,d){if(!a||!c)return[];for(var e=b.data.key.children,g=[],l=0,f=a.length;l<f;l++)a[l][c]==d&&g.push(a[l]),g=g.concat(h.getNodesByParam(b,a[l][e],c,d));return g},getNodesByParamFuzzy:function(b,a,c,d){if(!a||!c)return[];for(var e=b.data.key.children, +g=[],d=d.toLowerCase(),l=0,f=a.length;l<f;l++)typeof a[l][c]=="string"&&a[l][c].toLowerCase().indexOf(d)>-1&&g.push(a[l]),g=g.concat(h.getNodesByParamFuzzy(b,a[l][e],c,d));return g},getNodesByFilter:function(b,a,c,d,e){if(!a)return d?null:[];for(var g=b.data.key.children,f=d?null:[],i=0,n=a.length;i<n;i++){if(j.apply(c,[a[i],e],!1)){if(d)return a[i];f.push(a[i])}var k=h.getNodesByFilter(b,a[i][g],c,d,e);if(d&&k)return k;f=d?k:f.concat(k)}return f},getPreNode:function(b,a){if(!a)return null;for(var c= +b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),e=0,g=d[c].length;e<g;e++)if(d[c][e]===a)return e==0?null:d[c][e-1];return null},getRoot:function(b){return b?v[b.treeId]:null},getRoots:function(){return v},getSetting:function(b){return r[b]},getSettings:function(){return r},getZTreeTools:function(b){return(b=this.getRoot(this.getSetting(b)))?b.treeTools:null},initCache:function(b){for(var a=0,c=z.length;a<c;a++)z[a].apply(this,arguments)},initNode:function(b,a,c,d,e,g){for(var f= +0,h=A.length;f<h;f++)A[f].apply(this,arguments)},initRoot:function(b){for(var a=0,c=B.length;a<c;a++)B[a].apply(this,arguments)},isSelectedNode:function(b,a){for(var c=h.getRoot(b),d=0,e=c.curSelectedList.length;d<e;d++)if(a===c.curSelectedList[d])return!0;return!1},removeNodeCache:function(b,a){var c=b.data.key.children;if(a[c])for(var d=0,e=a[c].length;d<e;d++)h.removeNodeCache(b,a[c][d]);h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=null},removeSelectedNode:function(b,a){for(var c=h.getRoot(b), +d=0,e=c.curSelectedList.length;d<e;d++)if(a===c.curSelectedList[d]||!h.getNodeCache(b,c.curSelectedList[d].tId))c.curSelectedList.splice(d,1),b.treeObj.trigger(f.event.UNSELECTED,[b.treeId,a]),d--,e--},setCache:function(b,a){w[b.treeId]=a},setRoot:function(b,a){v[b.treeId]=a},setZTreeTools:function(b,a){for(var c=0,d=G.length;c<d;c++)G[c].apply(this,arguments)},transformToArrayFormat:function(b,a){if(!a)return[];var c=b.data.key.children,d=[];if(j.isArray(a))for(var e=0,g=a.length;e<g;e++)d.push(a[e]), +a[e][c]&&(d=d.concat(h.transformToArrayFormat(b,a[e][c])));else d.push(a),a[c]&&(d=d.concat(h.transformToArrayFormat(b,a[c])));return d},transformTozTreeFormat:function(b,a){var c,d,e=b.data.simpleData.idKey,g=b.data.simpleData.pIdKey,f=b.data.key.children;if(!e||e==""||!a)return[];if(j.isArray(a)){var h=[],i={};for(c=0,d=a.length;c<d;c++)i[a[c][e]]=a[c];for(c=0,d=a.length;c<d;c++)i[a[c][g]]&&a[c][e]!=a[c][g]?(i[a[c][g]][f]||(i[a[c][g]][f]=[]),i[a[c][g]][f].push(a[c])):h.push(a[c]);return h}else return[a]}}, +m={bindEvent:function(b){for(var a=0,c=x.length;a<c;a++)x[a].apply(this,arguments)},unbindEvent:function(b){for(var a=0,c=y.length;a<c;a++)y[a].apply(this,arguments)},bindTree:function(b){var a={treeId:b.treeId},c=b.treeObj;b.view.txtSelectedEnable||c.bind("selectstart",u).css({"-moz-user-select":"-moz-none"});c.bind("click",a,m.proxy);c.bind("dblclick",a,m.proxy);c.bind("mouseover",a,m.proxy);c.bind("mouseout",a,m.proxy);c.bind("mousedown",a,m.proxy);c.bind("mouseup",a,m.proxy);c.bind("contextmenu", +a,m.proxy)},unbindTree:function(b){b.treeObj.unbind("selectstart",u).unbind("click",m.proxy).unbind("dblclick",m.proxy).unbind("mouseover",m.proxy).unbind("mouseout",m.proxy).unbind("mousedown",m.proxy).unbind("mouseup",m.proxy).unbind("contextmenu",m.proxy)},doProxy:function(b){for(var a=[],c=0,d=t.length;c<d;c++){var e=t[c].apply(this,arguments);a.push(e);if(e.stop)break}return a},proxy:function(b){var a=h.getSetting(b.data.treeId);if(!j.uCanDo(a,b))return!0;for(var a=m.doProxy(b),c=!0,d=0,e=a.length;d< +e;d++){var g=a[d];g.nodeEventCallback&&(c=g.nodeEventCallback.apply(g,[b,g.node])&&c);g.treeEventCallback&&(c=g.treeEventCallback.apply(g,[b,g.node])&&c)}return c}};H=function(b,a){var c=h.getSetting(b.data.treeId);if(a.open){if(j.apply(c.callback.beforeCollapse,[c.treeId,a],!0)==!1)return!0}else if(j.apply(c.callback.beforeExpand,[c.treeId,a],!0)==!1)return!0;h.getRoot(c).expandTriggerFlag=!0;i.switchNode(c,a);return!0};I=function(b,a){var c=h.getSetting(b.data.treeId),d=c.view.autoCancelSelected&& +(b.ctrlKey||b.metaKey)&&h.isSelectedNode(c,a)?0:c.view.autoCancelSelected&&(b.ctrlKey||b.metaKey)&&c.view.selectedMulti?2:1;if(j.apply(c.callback.beforeClick,[c.treeId,a,d],!0)==!1)return!0;d===0?i.cancelPreSelectedNode(c,a):i.selectNode(c,a,d===2);c.treeObj.trigger(f.event.CLICK,[b,c.treeId,a,d]);return!0};J=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeMouseDown,[c.treeId,a],!0)&&j.apply(c.callback.onMouseDown,[b,c.treeId,a]);return!0};K=function(b,a){var c=h.getSetting(b.data.treeId); +j.apply(c.callback.beforeMouseUp,[c.treeId,a],!0)&&j.apply(c.callback.onMouseUp,[b,c.treeId,a]);return!0};L=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeDblClick,[c.treeId,a],!0)&&j.apply(c.callback.onDblClick,[b,c.treeId,a]);return!0};M=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeRightClick,[c.treeId,a],!0)&&j.apply(c.callback.onRightClick,[b,c.treeId,a]);return typeof c.callback.onRightClick!="function"};u=function(b){b=b.originalEvent.srcElement.nodeName.toLowerCase(); +return b==="input"||b==="textarea"};var j={apply:function(b,a,c){return typeof b=="function"?b.apply(O,a?a:[]):c},canAsync:function(b,a){var c=b.data.key.children;return b.async.enable&&a&&a.isParent&&!(a.zAsync||a[c]&&a[c].length>0)},clone:function(b){if(b===null)return null;var a=j.isArray(b)?[]:{},c;for(c in b)a[c]=b[c]instanceof Date?new Date(b[c].getTime()):typeof b[c]==="object"?j.clone(b[c]):b[c];return a},eqs:function(b,a){return b.toLowerCase()===a.toLowerCase()},isArray:function(b){return Object.prototype.toString.apply(b)=== +"[object Array]"},isElement:function(b){return typeof HTMLElement==="object"?b instanceof HTMLElement:b&&typeof b==="object"&&b!==null&&b.nodeType===1&&typeof b.nodeName==="string"},$:function(b,a,c){a&&typeof a!="string"&&(c=a,a="");return typeof b=="string"?q(b,c?c.treeObj.get(0).ownerDocument:null):q("#"+b.tId+a,c?c.treeObj:null)},getMDom:function(b,a,c){if(!a)return null;for(;a&&a.id!==b.treeId;){for(var d=0,e=c.length;a.tagName&&d<e;d++)if(j.eqs(a.tagName,c[d].tagName)&&a.getAttribute(c[d].attrName)!== +null)return a;a=a.parentNode}return null},getNodeMainDom:function(b){return q(b).parent("li").get(0)||q(b).parentsUntil("li").parent().get(0)},isChildOrSelf:function(b,a){return q(b).closest("#"+a).length>0},uCanDo:function(){return!0}},i={addNodes:function(b,a,c,d,e){if(!b.data.keep.leaf||!a||a.isParent)if(j.isArray(d)||(d=[d]),b.data.simpleData.enable&&(d=h.transformTozTreeFormat(b,d)),a){var g=k(a,f.id.SWITCH,b),l=k(a,f.id.ICON,b),p=k(a,f.id.UL,b);if(!a.open)i.replaceSwitchClass(a,g,f.folder.CLOSE), +i.replaceIcoClass(a,l,f.folder.CLOSE),a.open=!1,p.css({display:"none"});h.addNodesData(b,a,c,d);i.createNodes(b,a.level+1,d,a,c);e||i.expandCollapseParentNode(b,a,!0)}else h.addNodesData(b,h.getRoot(b),c,d),i.createNodes(b,0,d,null,c)},appendNodes:function(b,a,c,d,e,g,f){if(!c)return[];var j=[],n=b.data.key.children,k=(d?d:h.getRoot(b))[n],m,Q;if(!k||e>=k.length-c.length)e=-1;for(var s=0,R=c.length;s<R;s++){var o=c[s];g&&(m=(e===0||k.length==c.length)&&s==0,Q=e<0&&s==c.length-1,h.initNode(b,a,o,d, +m,Q,f),h.addNodeCache(b,o));m=[];o[n]&&o[n].length>0&&(m=i.appendNodes(b,a+1,o[n],o,-1,g,f&&o.open));f&&(i.makeDOMNodeMainBefore(j,b,o),i.makeDOMNodeLine(j,b,o),h.getBeforeA(b,o,j),i.makeDOMNodeNameBefore(j,b,o),h.getInnerBeforeA(b,o,j),i.makeDOMNodeIcon(j,b,o),h.getInnerAfterA(b,o,j),i.makeDOMNodeNameAfter(j,b,o),h.getAfterA(b,o,j),o.isParent&&o.open&&i.makeUlHtml(b,o,j,m.join("")),i.makeDOMNodeMainAfter(j,b,o),h.addCreatedNode(b,o))}return j},appendParentULDom:function(b,a){var c=[],d=k(a,b);!d.get(0)&& +a.parentTId&&(i.appendParentULDom(b,a.getParentNode()),d=k(a,b));var e=k(a,f.id.UL,b);e.get(0)&&e.remove();e=i.appendNodes(b,a.level+1,a[b.data.key.children],a,-1,!1,!0);i.makeUlHtml(b,a,c,e.join(""));d.append(c.join(""))},asyncNode:function(b,a,c,d){var e,g;if(a&&!a.isParent)return j.apply(d),!1;else if(a&&a.isAjaxing)return!1;else if(j.apply(b.callback.beforeAsync,[b.treeId,a],!0)==!1)return j.apply(d),!1;if(a)a.isAjaxing=!0,k(a,f.id.ICON,b).attr({style:"","class":f.className.BUTTON+" "+f.className.ICO_LOADING}); +var l={};for(e=0,g=b.async.autoParam.length;a&&e<g;e++){var p=b.async.autoParam[e].split("="),n=p;p.length>1&&(n=p[1],p=p[0]);l[n]=a[p]}if(j.isArray(b.async.otherParam))for(e=0,g=b.async.otherParam.length;e<g;e+=2)l[b.async.otherParam[e]]=b.async.otherParam[e+1];else for(var m in b.async.otherParam)l[m]=b.async.otherParam[m];var P=h.getRoot(b)._ver;q.ajax({contentType:b.async.contentType,cache:!1,type:b.async.type,url:j.apply(b.async.url,[b.treeId,a],b.async.url),data:b.async.contentType.indexOf("application/json")> +-1?JSON.stringify(l):l,dataType:b.async.dataType,success:function(e){if(P==h.getRoot(b)._ver){var g=[];try{g=!e||e.length==0?[]:typeof e=="string"?eval("("+e+")"):e}catch(l){g=e}if(a)a.isAjaxing=null,a.zAsync=!0;i.setNodeLineIcos(b,a);g&&g!==""?(g=j.apply(b.async.dataFilter,[b.treeId,a,g],g),i.addNodes(b,a,-1,g?j.clone(g):[],!!c)):i.addNodes(b,a,-1,[],!!c);b.treeObj.trigger(f.event.ASYNC_SUCCESS,[b.treeId,a,e]);j.apply(d)}},error:function(c,d,e){if(P==h.getRoot(b)._ver){if(a)a.isAjaxing=null;i.setNodeLineIcos(b, +a);b.treeObj.trigger(f.event.ASYNC_ERROR,[b.treeId,a,c,d,e])}}});return!0},cancelPreSelectedNode:function(b,a,c){var d=h.getRoot(b).curSelectedList,e,g;for(e=d.length-1;e>=0;e--)if(g=d[e],a===g||!a&&(!c||c!==g))if(k(g,f.id.A,b).removeClass(f.node.CURSELECTED),a){h.removeSelectedNode(b,a);break}else d.splice(e,1),b.treeObj.trigger(f.event.UNSELECTED,[b.treeId,g])},createNodeCallback:function(b){if(b.callback.onNodeCreated||b.view.addDiyDom)for(var a=h.getRoot(b);a.createdNodes.length>0;){var c=a.createdNodes.shift(); +j.apply(b.view.addDiyDom,[b.treeId,c]);b.callback.onNodeCreated&&b.treeObj.trigger(f.event.NODECREATED,[b.treeId,c])}},createNodes:function(b,a,c,d,e){if(c&&c.length!=0){var g=h.getRoot(b),l=b.data.key.children,l=!d||d.open||!!k(d[l][0],b).get(0);g.createdNodes=[];var a=i.appendNodes(b,a,c,d,e,!0,l),j,n;d?(d=k(d,f.id.UL,b),d.get(0)&&(j=d)):j=b.treeObj;j&&(e>=0&&(n=j.children()[e]),e>=0&&n?q(n).before(a.join("")):j.append(a.join("")));i.createNodeCallback(b)}},destroy:function(b){b&&(h.initCache(b), +h.initRoot(b),m.unbindTree(b),m.unbindEvent(b),b.treeObj.empty(),delete r[b.treeId])},expandCollapseNode:function(b,a,c,d,e){var g=h.getRoot(b),l=b.data.key.children,p;if(a){if(g.expandTriggerFlag)p=e,e=function(){p&&p();a.open?b.treeObj.trigger(f.event.EXPAND,[b.treeId,a]):b.treeObj.trigger(f.event.COLLAPSE,[b.treeId,a])},g.expandTriggerFlag=!1;if(!a.open&&a.isParent&&(!k(a,f.id.UL,b).get(0)||a[l]&&a[l].length>0&&!k(a[l][0],b).get(0)))i.appendParentULDom(b,a),i.createNodeCallback(b);if(a.open==c)j.apply(e, +[]);else{var c=k(a,f.id.UL,b),g=k(a,f.id.SWITCH,b),n=k(a,f.id.ICON,b);a.isParent?(a.open=!a.open,a.iconOpen&&a.iconClose&&n.attr("style",i.makeNodeIcoStyle(b,a)),a.open?(i.replaceSwitchClass(a,g,f.folder.OPEN),i.replaceIcoClass(a,n,f.folder.OPEN),d==!1||b.view.expandSpeed==""?(c.show(),j.apply(e,[])):a[l]&&a[l].length>0?c.slideDown(b.view.expandSpeed,e):(c.show(),j.apply(e,[]))):(i.replaceSwitchClass(a,g,f.folder.CLOSE),i.replaceIcoClass(a,n,f.folder.CLOSE),d==!1||b.view.expandSpeed==""||!(a[l]&& +a[l].length>0)?(c.hide(),j.apply(e,[])):c.slideUp(b.view.expandSpeed,e))):j.apply(e,[])}}else j.apply(e,[])},expandCollapseParentNode:function(b,a,c,d,e){a&&(a.parentTId?(i.expandCollapseNode(b,a,c,d),a.parentTId&&i.expandCollapseParentNode(b,a.getParentNode(),c,d,e)):i.expandCollapseNode(b,a,c,d,e))},expandCollapseSonNode:function(b,a,c,d,e){var g=h.getRoot(b),f=b.data.key.children,g=a?a[f]:g[f],f=a?!1:d,j=h.getRoot(b).expandTriggerFlag;h.getRoot(b).expandTriggerFlag=!1;if(g)for(var k=0,m=g.length;k< +m;k++)g[k]&&i.expandCollapseSonNode(b,g[k],c,f);h.getRoot(b).expandTriggerFlag=j;i.expandCollapseNode(b,a,c,d,e)},isSelectedNode:function(b,a){if(!a)return!1;var c=h.getRoot(b).curSelectedList,d;for(d=c.length-1;d>=0;d--)if(a===c[d])return!0;return!1},makeDOMNodeIcon:function(b,a,c){var d=h.getNodeName(a,c),d=a.view.nameIsHTML?d:d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");b.push("<span id='",c.tId,f.id.ICON,"' title='' treeNode",f.id.ICON," class='",i.makeNodeIcoClass(a,c),"' style='", +i.makeNodeIcoStyle(a,c),"'></span><span id='",c.tId,f.id.SPAN,"' class='",f.className.NAME,"'>",d,"</span>")},makeDOMNodeLine:function(b,a,c){b.push("<span id='",c.tId,f.id.SWITCH,"' title='' class='",i.makeNodeLineClass(a,c),"' treeNode",f.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(b){b.push("</li>")},makeDOMNodeMainBefore:function(b,a,c){b.push("<li id='",c.tId,"' class='",f.className.LEVEL,c.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(b){b.push("</a>")}, +makeDOMNodeNameBefore:function(b,a,c){var d=h.getNodeTitle(a,c),e=i.makeNodeUrl(a,c),g=i.makeNodeFontCss(a,c),l=[],k;for(k in g)l.push(k,":",g[k],";");b.push("<a id='",c.tId,f.id.A,"' class='",f.className.LEVEL,c.level,"' treeNode",f.id.A,' onclick="',c.click||"",'" ',e!=null&&e.length>0?"href='"+e+"'":""," target='",i.makeNodeTarget(c),"' style='",l.join(""),"'");j.apply(a.view.showTitle,[a.treeId,c],a.view.showTitle)&&d&&b.push("title='",d.replace(/'/g,"'").replace(/</g,"<").replace(/>/g, +">"),"'");b.push(">")},makeNodeFontCss:function(b,a){var c=j.apply(b.view.fontCss,[b.treeId,a],b.view.fontCss);return c&&typeof c!="function"?c:{}},makeNodeIcoClass:function(b,a){var c=["ico"];a.isAjaxing||(c[0]=(a.iconSkin?a.iconSkin+"_":"")+c[0],a.isParent?c.push(a.open?f.folder.OPEN:f.folder.CLOSE):c.push(f.folder.DOCU));return f.className.BUTTON+" "+c.join("_")},makeNodeIcoStyle:function(b,a){var c=[];if(!a.isAjaxing){var d=a.isParent&&a.iconOpen&&a.iconClose?a.open?a.iconOpen:a.iconClose: +a[b.data.key.icon];d&&c.push("background:url(",d,") 0 0 no-repeat;");(b.view.showIcon==!1||!j.apply(b.view.showIcon,[b.treeId,a],!0))&&c.push("width:0px;height:0px;")}return c.join("")},makeNodeLineClass:function(b,a){var c=[];b.view.showLine?a.level==0&&a.isFirstNode&&a.isLastNode?c.push(f.line.ROOT):a.level==0&&a.isFirstNode?c.push(f.line.ROOTS):a.isLastNode?c.push(f.line.BOTTOM):c.push(f.line.CENTER):c.push(f.line.NOLINE);a.isParent?c.push(a.open?f.folder.OPEN:f.folder.CLOSE):c.push(f.folder.DOCU); +return i.makeNodeLineClassEx(a)+c.join("_")},makeNodeLineClassEx:function(b){return f.className.BUTTON+" "+f.className.LEVEL+b.level+" "+f.className.SWITCH+" "},makeNodeTarget:function(b){return b.target||"_blank"},makeNodeUrl:function(b,a){var c=b.data.key.url;return a[c]?a[c]:null},makeUlHtml:function(b,a,c,d){c.push("<ul id='",a.tId,f.id.UL,"' class='",f.className.LEVEL,a.level," ",i.makeUlLineClass(b,a),"' style='display:",a.open?"block":"none","'>");c.push(d);c.push("</ul>")},makeUlLineClass:function(b, +a){return b.view.showLine&&!a.isLastNode?f.line.LINE:""},removeChildNodes:function(b,a){if(a){var c=b.data.key.children,d=a[c];if(d){for(var e=0,g=d.length;e<g;e++)h.removeNodeCache(b,d[e]);h.removeSelectedNode(b);delete a[c];b.data.keep.parent?k(a,f.id.UL,b).empty():(a.isParent=!1,a.open=!1,c=k(a,f.id.SWITCH,b),d=k(a,f.id.ICON,b),i.replaceSwitchClass(a,c,f.folder.DOCU),i.replaceIcoClass(a,d,f.folder.DOCU),k(a,f.id.UL,b).remove())}}},scrollIntoView:function(b){if(b){if(!Element.prototype.scrollIntoViewIfNeeded)Element.prototype.scrollIntoViewIfNeeded= +function(a){function b(a,d,e,f){return{left:a,top:d,width:e,height:f,right:a+e,bottom:d+f,translate:function(g,h){return b(g+a,h+d,e,f)},relativeFromTo:function(h,i){var j=a,l=d,h=h.offsetParent,i=i.offsetParent;if(h===i)return g;for(;h;h=h.offsetParent)j+=h.offsetLeft+h.clientLeft,l+=h.offsetTop+h.clientTop;for(;i;i=i.offsetParent)j-=i.offsetLeft+i.clientLeft,l-=i.offsetTop+i.clientTop;return b(j,l,e,f)}}}for(var d,e=this,g=b(this.offsetLeft,this.offsetTop,this.offsetWidth,this.offsetHeight);j.isElement(d= +e.parentNode);){var f=d.offsetLeft+d.clientLeft,h=d.offsetTop+d.clientTop,g=g.relativeFromTo(e,d).translate(-f,-h);d.scrollLeft=!1===a||g.left<=d.scrollLeft+d.clientWidth&&d.scrollLeft<=g.right-d.clientWidth+d.clientWidth?Math.min(g.left,Math.max(g.right-d.clientWidth,d.scrollLeft)):(g.right-d.clientWidth+g.left)/2;d.scrollTop=!1===a||g.top<=d.scrollTop+d.clientHeight&&d.scrollTop<=g.bottom-d.clientHeight+d.clientHeight?Math.min(g.top,Math.max(g.bottom-d.clientHeight,d.scrollTop)):(g.bottom-d.clientHeight+ +g.top)/2;g=g.translate(f-d.scrollLeft,h-d.scrollTop);e=d}};b.scrollIntoViewIfNeeded()}},setFirstNode:function(b,a){var c=b.data.key.children;if(a[c].length>0)a[c][0].isFirstNode=!0},setLastNode:function(b,a){var c=b.data.key.children,d=a[c].length;if(d>0)a[c][d-1].isLastNode=!0},removeNode:function(b,a){var c=h.getRoot(b),d=b.data.key.children,e=a.parentTId?a.getParentNode():c;a.isFirstNode=!1;a.isLastNode=!1;a.getPreNode=function(){return null};a.getNextNode=function(){return null};if(h.getNodeCache(b, +a.tId)){k(a,b).remove();h.removeNodeCache(b,a);h.removeSelectedNode(b,a);for(var g=0,j=e[d].length;g<j;g++)if(e[d][g].tId==a.tId){e[d].splice(g,1);break}i.setFirstNode(b,e);i.setLastNode(b,e);var p,g=e[d].length;if(!b.data.keep.parent&&g==0)e.isParent=!1,e.open=!1,g=k(e,f.id.UL,b),j=k(e,f.id.SWITCH,b),p=k(e,f.id.ICON,b),i.replaceSwitchClass(e,j,f.folder.DOCU),i.replaceIcoClass(e,p,f.folder.DOCU),g.css("display","none");else if(b.view.showLine&&g>0){var n=e[d][g-1],g=k(n,f.id.UL,b),j=k(n,f.id.SWITCH, +b);p=k(n,f.id.ICON,b);e==c?e[d].length==1?i.replaceSwitchClass(n,j,f.line.ROOT):(c=k(e[d][0],f.id.SWITCH,b),i.replaceSwitchClass(e[d][0],c,f.line.ROOTS),i.replaceSwitchClass(n,j,f.line.BOTTOM)):i.replaceSwitchClass(n,j,f.line.BOTTOM);g.removeClass(f.line.LINE)}}},replaceIcoClass:function(b,a,c){if(a&&!b.isAjaxing&&(b=a.attr("class"),b!=void 0)){b=b.split("_");switch(c){case f.folder.OPEN:case f.folder.CLOSE:case f.folder.DOCU:b[b.length-1]=c}a.attr("class",b.join("_"))}},replaceSwitchClass:function(b, +a,c){if(a){var d=a.attr("class");if(d!=void 0){d=d.split("_");switch(c){case f.line.ROOT:case f.line.ROOTS:case f.line.CENTER:case f.line.BOTTOM:case f.line.NOLINE:d[0]=i.makeNodeLineClassEx(b)+c;break;case f.folder.OPEN:case f.folder.CLOSE:case f.folder.DOCU:d[1]=c}a.attr("class",d.join("_"));c!==f.folder.DOCU?a.removeAttr("disabled"):a.attr("disabled","disabled")}}},selectNode:function(b,a,c){c||i.cancelPreSelectedNode(b,null,a);k(a,f.id.A,b).addClass(f.node.CURSELECTED);h.addSelectedNode(b,a); +b.treeObj.trigger(f.event.SELECTED,[b.treeId,a])},setNodeFontCss:function(b,a){var c=k(a,f.id.A,b),d=i.makeNodeFontCss(b,a);d&&c.css(d)},setNodeLineIcos:function(b,a){if(a){var c=k(a,f.id.SWITCH,b),d=k(a,f.id.UL,b),e=k(a,f.id.ICON,b),g=i.makeUlLineClass(b,a);g.length==0?d.removeClass(f.line.LINE):d.addClass(g);c.attr("class",i.makeNodeLineClass(b,a));a.isParent?c.removeAttr("disabled"):c.attr("disabled","disabled");e.removeAttr("style");e.attr("style",i.makeNodeIcoStyle(b,a));e.attr("class",i.makeNodeIcoClass(b, +a))}},setNodeName:function(b,a){var c=h.getNodeTitle(b,a),d=k(a,f.id.SPAN,b);d.empty();b.view.nameIsHTML?d.html(h.getNodeName(b,a)):d.text(h.getNodeName(b,a));j.apply(b.view.showTitle,[b.treeId,a],b.view.showTitle)&&k(a,f.id.A,b).attr("title",!c?"":c)},setNodeTarget:function(b,a){k(a,f.id.A,b).attr("target",i.makeNodeTarget(a))},setNodeUrl:function(b,a){var c=k(a,f.id.A,b),d=i.makeNodeUrl(b,a);d==null||d.length==0?c.removeAttr("href"):c.attr("href",d)},switchNode:function(b,a){a.open||!j.canAsync(b, +a)?i.expandCollapseNode(b,a,!a.open):b.async.enable?i.asyncNode(b,a)||i.expandCollapseNode(b,a,!a.open):a&&i.expandCollapseNode(b,a,!a.open)}};q.fn.zTree={consts:{className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch",NAME:"node_name"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove",SELECTED:"ztree_selected",UNSELECTED:"ztree_unselected"}, +id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_z:{tools:j,view:i,event:m,data:h},getZTreeObj:function(b){return(b=h.getZTreeTools(b))?b:null},destroy:function(b){if(b&&b.length>0)i.destroy(h.getSetting(b));else for(var a in r)i.destroy(r[a])},init:function(b,a,c){var d=j.clone(N);q.extend(!0,d,a);d.treeId= +b.attr("id");d.treeObj=b;d.treeObj.empty();r[d.treeId]=d;if(typeof document.body.style.maxHeight==="undefined")d.view.expandSpeed="";h.initRoot(d);b=h.getRoot(d);a=d.data.key.children;c=c?j.clone(j.isArray(c)?c:[c]):[];b[a]=d.data.simpleData.enable?h.transformTozTreeFormat(d,c):c;h.initCache(d);m.unbindTree(d);m.bindTree(d);m.unbindEvent(d);m.bindEvent(d);c={setting:d,addNodes:function(a,b,c,f){function h(){i.addNodes(d,a,b,m,f==!0)}a||(a=null);if(a&&!a.isParent&&d.data.keep.leaf)return null;var k= +parseInt(b,10);isNaN(k)?(f=!!c,c=b,b=-1):b=k;if(!c)return null;var m=j.clone(j.isArray(c)?c:[c]);j.canAsync(d,a)?i.asyncNode(d,a,f,h):h();return m},cancelSelectedNode:function(a){i.cancelPreSelectedNode(d,a)},destroy:function(){i.destroy(d)},expandAll:function(a){a=!!a;i.expandCollapseSonNode(d,null,a,!0);return a},expandNode:function(a,b,c,f,n){function m(){var b=k(a,d).get(0);b&&f!==!1&&i.scrollIntoView(b)}if(!a||!a.isParent)return null;b!==!0&&b!==!1&&(b=!a.open);if((n=!!n)&&b&&j.apply(d.callback.beforeExpand, +[d.treeId,a],!0)==!1)return null;else if(n&&!b&&j.apply(d.callback.beforeCollapse,[d.treeId,a],!0)==!1)return null;b&&a.parentTId&&i.expandCollapseParentNode(d,a.getParentNode(),b,!1);if(b===a.open&&!c)return null;h.getRoot(d).expandTriggerFlag=n;!j.canAsync(d,a)&&c?i.expandCollapseSonNode(d,a,b,!0,m):(a.open=!b,i.switchNode(this.setting,a),m());return b},getNodes:function(){return h.getNodes(d)},getNodeByParam:function(a,b,c){return!a?null:h.getNodeByParam(d,c?c[d.data.key.children]:h.getNodes(d), +a,b)},getNodeByTId:function(a){return h.getNodeCache(d,a)},getNodesByParam:function(a,b,c){return!a?null:h.getNodesByParam(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodesByParamFuzzy:function(a,b,c){return!a?null:h.getNodesByParamFuzzy(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodesByFilter:function(a,b,c,f){b=!!b;return!a||typeof a!="function"?b?null:[]:h.getNodesByFilter(d,c?c[d.data.key.children]:h.getNodes(d),a,b,f)},getNodeIndex:function(a){if(!a)return null;for(var b=d.data.key.children, +c=a.parentTId?a.getParentNode():h.getRoot(d),f=0,i=c[b].length;f<i;f++)if(c[b][f]==a)return f;return-1},getSelectedNodes:function(){for(var a=[],b=h.getRoot(d).curSelectedList,c=0,f=b.length;c<f;c++)a.push(b[c]);return a},isSelectedNode:function(a){return h.isSelectedNode(d,a)},reAsyncChildNodes:function(a,b,c){if(this.setting.async.enable){var j=!a;j&&(a=h.getRoot(d));if(b=="refresh"){for(var b=this.setting.data.key.children,n=0,m=a[b]?a[b].length:0;n<m;n++)h.removeNodeCache(d,a[b][n]);h.removeSelectedNode(d); +a[b]=[];j?this.setting.treeObj.empty():k(a,f.id.UL,d).empty()}i.asyncNode(this.setting,j?null:a,!!c)}},refresh:function(){this.setting.treeObj.empty();var a=h.getRoot(d),b=a[d.data.key.children];h.initRoot(d);a[d.data.key.children]=b;h.initCache(d);i.createNodes(d,0,a[d.data.key.children],null,-1)},removeChildNodes:function(a){if(!a)return null;var b=a[d.data.key.children];i.removeChildNodes(d,a);return b?b:null},removeNode:function(a,b){a&&(b=!!b,b&&j.apply(d.callback.beforeRemove,[d.treeId,a],!0)== +!1||(i.removeNode(d,a),b&&this.setting.treeObj.trigger(f.event.REMOVE,[d.treeId,a])))},selectNode:function(a,b,c){function f(){if(!c){var b=k(a,d).get(0);i.scrollIntoView(b)}}if(a&&j.uCanDo(d)){b=d.view.selectedMulti&&b;if(a.parentTId)i.expandCollapseParentNode(d,a.getParentNode(),!0,!1,f);else if(!c)try{k(a,d).focus().blur()}catch(h){}i.selectNode(d,a,b)}},transformTozTreeNodes:function(a){return h.transformTozTreeFormat(d,a)},transformToArray:function(a){return h.transformToArrayFormat(d,a)},updateNode:function(a){a&& +k(a,d).get(0)&&j.uCanDo(d)&&(i.setNodeName(d,a),i.setNodeTarget(d,a),i.setNodeUrl(d,a),i.setNodeLineIcos(d,a),i.setNodeFontCss(d,a))}};b.treeTools=c;h.setZTreeTools(d,c);b[a]&&b[a].length>0?i.createNodes(d,0,b[a],null,-1):d.async.enable&&d.async.url&&d.async.url!==""&&i.asyncNode(d);return c}};var O=q.fn.zTree,k=j.$,f=O.consts})(jQuery); + +/* + * JQuery zTree excheck v3.5.28 + * http://treejs.cn/ + * + * Copyright (c) 2010 Hunter.z + * + * Licensed same as jquery - MIT License + * http://www.opensource.org/licenses/mit-license.php + * + * email: hunter.z@263.net + * Date: 2017-01-20 + */ +(function(m){var p,q,r,o={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},v={check:{enable:!1,autoCheckTrigger:!1,chkStyle:o.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:o.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}};p=function(c, +a){if(a.chkDisabled===!0)return!1;var b=g.getSetting(c.data.treeId),d=b.data.key.checked;if(k.apply(b.callback.beforeCheck,[b.treeId,a],!0)==!1)return!0;a[d]=!a[d];e.checkNodeRelation(b,a);d=n(a,j.id.CHECK,b);e.setChkClass(b,d,a);e.repairParentChkClassWithSelf(b,a);b.treeObj.trigger(j.event.CHECK,[c,b.treeId,a]);return!0};q=function(c,a){if(a.chkDisabled===!0)return!1;var b=g.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!0;e.setChkClass(b,d,a);return!0};r=function(c,a){if(a.chkDisabled=== +!0)return!1;var b=g.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!1;e.setChkClass(b,d,a);return!0};m.extend(!0,m.fn.zTree.consts,o);m.extend(!0,m.fn.zTree._z,{tools:{},view:{checkNodeRelation:function(c,a){var b,d,h,i=c.data.key.children,l=c.data.key.checked;b=j.radio;if(c.check.chkStyle==b.STYLE){var f=g.getRadioCheckedList(c);if(a[l])if(c.check.radioType==b.TYPE_ALL){for(d=f.length-1;d>=0;d--)b=f[d],b[l]&&b!=a&&(b[l]=!1,f.splice(d,1),e.setChkClass(c,n(b,j.id.CHECK,c),b),b.parentTId!= +a.parentTId&&e.repairParentChkClassWithSelf(c,b));f.push(a)}else{f=a.parentTId?a.getParentNode():g.getRoot(c);for(d=0,h=f[i].length;d<h;d++)b=f[i][d],b[l]&&b!=a&&(b[l]=!1,e.setChkClass(c,n(b,j.id.CHECK,c),b))}else if(c.check.radioType==b.TYPE_ALL)for(d=0,h=f.length;d<h;d++)if(a==f[d]){f.splice(d,1);break}}else a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.Y.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,a,!0),!a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.N.indexOf("s")>-1)&&e.setSonNodeCheckBox(c, +a,!1),a[l]&&c.check.chkboxType.Y.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!0),!a[l]&&c.check.chkboxType.N.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!1)},makeChkClass:function(c,a){var b=c.data.key.checked,d=j.checkbox,h=j.radio,i="",i=a.chkDisabled===!0?d.DISABLED:a.halfCheck?d.PART:c.check.chkStyle==h.STYLE?a.check_Child_State<1?d.FULL:d.PART:a[b]?a.check_Child_State===2||a.check_Child_State===-1?d.FULL:d.PART:a.check_Child_State<1?d.FULL:d.PART,b=c.check.chkStyle+"_"+(a[b]?d.TRUE:d.FALSE)+ +"_"+i,b=a.check_Focus&&a.chkDisabled!==!0?b+"_"+d.FOCUS:b;return j.className.BUTTON+" "+d.DEFAULT+" "+b},repairAllChk:function(c,a){if(c.check.enable&&c.check.chkStyle===j.checkbox.STYLE)for(var b=c.data.key.checked,d=c.data.key.children,h=g.getRoot(c),i=0,l=h[d].length;i<l;i++){var f=h[d][i];f.nocheck!==!0&&f.chkDisabled!==!0&&(f[b]=a);e.setSonNodeCheckBox(c,f,a)}},repairChkClass:function(c,a){if(a&&(g.makeChkFlag(c,a),a.nocheck!==!0)){var b=n(a,j.id.CHECK,c);e.setChkClass(c,b,a)}},repairParentChkClass:function(c, +a){if(a&&a.parentTId){var b=a.getParentNode();e.repairChkClass(c,b);e.repairParentChkClass(c,b)}},repairParentChkClassWithSelf:function(c,a){if(a){var b=c.data.key.children;a[b]&&a[b].length>0?e.repairParentChkClass(c,a[b][0]):e.repairParentChkClass(c,a)}},repairSonChkDisabled:function(c,a,b,d){if(a){var h=c.data.key.children;if(a.chkDisabled!=b)a.chkDisabled=b;e.repairChkClass(c,a);if(a[h]&&d)for(var i=0,l=a[h].length;i<l;i++)e.repairSonChkDisabled(c,a[h][i],b,d)}},repairParentChkDisabled:function(c, +a,b,d){if(a){if(a.chkDisabled!=b&&d)a.chkDisabled=b;e.repairChkClass(c,a);e.repairParentChkDisabled(c,a.getParentNode(),b,d)}},setChkClass:function(c,a,b){a&&(b.nocheck===!0?a.hide():a.show(),a.attr("class",e.makeChkClass(c,b)))},setParentNodeCheckBox:function(c,a,b,d){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);g.makeChkFlag(c,a);a.nocheck!==!0&&a.chkDisabled!==!0&&(a[i]=b,e.setChkClass(c,l,a),c.check.autoCheckTrigger&&a!=d&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId, +a]));if(a.parentTId){l=!0;if(!b)for(var h=a.getParentNode()[h],f=0,k=h.length;f<k;f++)if(h[f].nocheck!==!0&&h[f].chkDisabled!==!0&&h[f][i]||(h[f].nocheck===!0||h[f].chkDisabled===!0)&&h[f].check_Child_State>0){l=!1;break}l&&e.setParentNodeCheckBox(c,a.getParentNode(),b,d)}},setSonNodeCheckBox:function(c,a,b,d){if(a){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);var f=!1;if(a[h])for(var k=0,m=a[h].length;k<m;k++){var o=a[h][k];e.setSonNodeCheckBox(c,o,b,d);o.chkDisabled=== +!0&&(f=!0)}if(a!=g.getRoot(c)&&a.chkDisabled!==!0){f&&a.nocheck!==!0&&g.makeChkFlag(c,a);if(a.nocheck!==!0&&a.chkDisabled!==!0){if(a[i]=b,!f)a.check_Child_State=a[h]&&a[h].length>0?b?2:0:-1}else a.check_Child_State=-1;e.setChkClass(c,l,a);c.check.autoCheckTrigger&&a!=d&&a.nocheck!==!0&&a.chkDisabled!==!0&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId,a])}}}},event:{},data:{getRadioCheckedList:function(c){for(var a=g.getRoot(c).radioCheckedList,b=0,d=a.length;b<d;b++)g.getNodeCache(c,a[b].tId)||(a.splice(b, +1),b--,d--);return a},getCheckStatus:function(c,a){if(!c.check.enable||a.nocheck||a.chkDisabled)return null;var b=c.data.key.checked;return{checked:a[b],half:a.halfCheck?a.halfCheck:c.check.chkStyle==j.radio.STYLE?a.check_Child_State===2:a[b]?a.check_Child_State>-1&&a.check_Child_State<2:a.check_Child_State>0}},getTreeCheckedNodes:function(c,a,b,d){if(!a)return[];for(var h=c.data.key.children,i=c.data.key.checked,e=b&&c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL,d=!d?[]:d, +f=0,k=a.length;f<k;f++){if(a[f].nocheck!==!0&&a[f].chkDisabled!==!0&&a[f][i]==b&&(d.push(a[f]),e))break;g.getTreeCheckedNodes(c,a[f][h],b,d);if(e&&d.length>0)break}return d},getTreeChangeCheckedNodes:function(c,a,b){if(!a)return[];for(var d=c.data.key.children,h=c.data.key.checked,b=!b?[]:b,i=0,e=a.length;i<e;i++)a[i].nocheck!==!0&&a[i].chkDisabled!==!0&&a[i][h]!=a[i].checkedOld&&b.push(a[i]),g.getTreeChangeCheckedNodes(c,a[i][d],b);return b},makeChkFlag:function(c,a){if(a){var b=c.data.key.children, +d=c.data.key.checked,h=-1;if(a[b])for(var i=0,e=a[b].length;i<e;i++){var f=a[b][i],g=-1;if(c.check.chkStyle==j.radio.STYLE)if(g=f.nocheck===!0||f.chkDisabled===!0?f.check_Child_State:f.halfCheck===!0?2:f[d]?2:f.check_Child_State>0?2:0,g==2){h=2;break}else g==0&&(h=0);else if(c.check.chkStyle==j.checkbox.STYLE)if(g=f.nocheck===!0||f.chkDisabled===!0?f.check_Child_State:f.halfCheck===!0?1:f[d]?f.check_Child_State===-1||f.check_Child_State===2?2:1:f.check_Child_State>0?1:0,g===1){h=1;break}else if(g=== +2&&h>-1&&i>0&&g!==h){h=1;break}else if(h===2&&g>-1&&g<2){h=1;break}else g>-1&&(h=g)}a.check_Child_State=h}}}});var m=m.fn.zTree,k=m._z.tools,j=m.consts,e=m._z.view,g=m._z.data,n=k.$;g.exSetting(v);g.addInitBind(function(c){c.treeObj.bind(j.event.CHECK,function(a,b,d,h){a.srcEvent=b;k.apply(c.callback.onCheck,[a,d,h])})});g.addInitUnBind(function(c){c.treeObj.unbind(j.event.CHECK)});g.addInitCache(function(){});g.addInitNode(function(c,a,b,d){if(b){a=c.data.key.checked;typeof b[a]=="string"&&(b[a]= +k.eqs(b[a],"true"));b[a]=!!b[a];b.checkedOld=b[a];if(typeof b.nocheck=="string")b.nocheck=k.eqs(b.nocheck,"true");b.nocheck=!!b.nocheck||c.check.nocheckInherit&&d&&!!d.nocheck;if(typeof b.chkDisabled=="string")b.chkDisabled=k.eqs(b.chkDisabled,"true");b.chkDisabled=!!b.chkDisabled||c.check.chkDisabledInherit&&d&&!!d.chkDisabled;if(typeof b.halfCheck=="string")b.halfCheck=k.eqs(b.halfCheck,"true");b.halfCheck=!!b.halfCheck;b.check_Child_State=-1;b.check_Focus=!1;b.getCheckStatus=function(){return g.getCheckStatus(c, +b)};c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL&&b[a]&&g.getRoot(c).radioCheckedList.push(b)}});g.addInitProxy(function(c){var a=c.target,b=g.getSetting(c.data.treeId),d="",h=null,e="",l=null;if(k.eqs(c.type,"mouseover")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="mouseoverCheck"}else if(k.eqs(c.type,"mouseout")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d= +k.getNodeMainDom(a).id,e="mouseoutCheck"}else if(k.eqs(c.type,"click")&&b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="checkNode";if(d.length>0)switch(h=g.getNodeCache(b,d),e){case "checkNode":l=p;break;case "mouseoverCheck":l=q;break;case "mouseoutCheck":l=r}return{stop:e==="checkNode",node:h,nodeEventType:e,nodeEventCallback:l,treeEventType:"",treeEventCallback:null}},!0);g.addInitRoot(function(c){g.getRoot(c).radioCheckedList=[]}); +g.addBeforeA(function(c,a,b){c.check.enable&&(g.makeChkFlag(c,a),b.push("<span ID='",a.tId,j.id.CHECK,"' class='",e.makeChkClass(c,a),"' treeNode",j.id.CHECK,a.nocheck===!0?" style='display:none;'":"","></span>"))});g.addZTreeTools(function(c,a){a.checkNode=function(a,b,c,g){var f=this.setting.data.key.checked;if(a.chkDisabled!==!0&&(b!==!0&&b!==!1&&(b=!a[f]),g=!!g,(a[f]!==b||c)&&!(g&&k.apply(this.setting.callback.beforeCheck,[this.setting.treeId,a],!0)==!1)&&k.uCanDo(this.setting)&&this.setting.check.enable&& +a.nocheck!==!0))a[f]=b,b=n(a,j.id.CHECK,this.setting),(c||this.setting.check.chkStyle===j.radio.STYLE)&&e.checkNodeRelation(this.setting,a),e.setChkClass(this.setting,b,a),e.repairParentChkClassWithSelf(this.setting,a),g&&this.setting.treeObj.trigger(j.event.CHECK,[null,this.setting.treeId,a])};a.checkAllNodes=function(a){e.repairAllChk(this.setting,!!a)};a.getCheckedNodes=function(a){var b=this.setting.data.key.children;return g.getTreeCheckedNodes(this.setting,g.getRoot(this.setting)[b],a!==!1)}; +a.getChangeCheckedNodes=function(){var a=this.setting.data.key.children;return g.getTreeChangeCheckedNodes(this.setting,g.getRoot(this.setting)[a])};a.setChkDisabled=function(a,b,c,g){b=!!b;c=!!c;e.repairSonChkDisabled(this.setting,a,b,!!g);e.repairParentChkDisabled(this.setting,a.getParentNode(),b,c)};var b=a.updateNode;a.updateNode=function(c,g){b&&b.apply(a,arguments);if(c&&this.setting.check.enable&&n(c,this.setting).get(0)&&k.uCanDo(this.setting)){var i=n(c,j.id.CHECK,this.setting);(g==!0||this.setting.check.chkStyle=== +j.radio.STYLE)&&e.checkNodeRelation(this.setting,c);e.setChkClass(this.setting,i,c);e.repairParentChkClassWithSelf(this.setting,c)}}});var s=e.createNodes;e.createNodes=function(c,a,b,d,g){s&&s.apply(e,arguments);b&&e.repairParentChkClassWithSelf(c,d)};var t=e.removeNode;e.removeNode=function(c,a){var b=a.getParentNode();t&&t.apply(e,arguments);a&&b&&(e.repairChkClass(c,b),e.repairParentChkClass(c,b))};var u=e.appendNodes;e.appendNodes=function(c,a,b,d,h,i,j){var f="";u&&(f=u.apply(e,arguments)); +d&&g.makeChkFlag(c,d);return f}})(jQuery); + +/* + * JQuery zTree exedit v3.5.28 + * http://treejs.cn/ + * + * Copyright (c) 2010 Hunter.z + * + * Licensed same as jquery - MIT License + * http://www.opensource.org/licenses/mit-license.php + * + * email: hunter.z@263.net + * Date: 2017-01-20 + */ +(function(v){var J={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},x={onHoverOverNode:function(b,a){var c=m.getSetting(b.data.treeId),d=m.getRoot(c);if(d.curHoverNode!=a)x.onHoverOutNode(b);d.curHoverNode=a;f.addHoverDom(c,a)},onHoverOutNode:function(b){var b= +m.getSetting(b.data.treeId),a=m.getRoot(b);if(a.curHoverNode&&!m.isSelectedNode(b,a.curHoverNode))f.removeTreeDom(b,a.curHoverNode),a.curHoverNode=null},onMousedownNode:function(b,a){function c(b){if(B.dragFlag==0&&Math.abs(O-b.clientX)<e.edit.drag.minMoveSize&&Math.abs(P-b.clientY)<e.edit.drag.minMoveSize)return!0;var a,c,n,k,i;i=e.data.key.children;M.css("cursor","pointer");if(B.dragFlag==0){if(g.apply(e.callback.beforeDrag,[e.treeId,l],!0)==!1)return r(b),!0;for(a=0,c=l.length;a<c;a++){if(a==0)B.dragNodeShowBefore= +[];n=l[a];n.isParent&&n.open?(f.expandCollapseNode(e,n,!n.open),B.dragNodeShowBefore[n.tId]=!0):B.dragNodeShowBefore[n.tId]=!1}B.dragFlag=1;t.showHoverDom=!1;g.showIfameMask(e,!0);n=!0;k=-1;if(l.length>1){var j=l[0].parentTId?l[0].getParentNode()[i]:m.getNodes(e);i=[];for(a=0,c=j.length;a<c;a++)if(B.dragNodeShowBefore[j[a].tId]!==void 0&&(n&&k>-1&&k+1!==a&&(n=!1),i.push(j[a]),k=a),l.length===i.length){l=i;break}}n&&(I=l[0].getPreNode(),R=l[l.length-1].getNextNode());D=o("<ul class='zTreeDragUL'></ul>", +e);for(a=0,c=l.length;a<c;a++)n=l[a],n.editNameFlag=!1,f.selectNode(e,n,a>0),f.removeTreeDom(e,n),a>e.edit.drag.maxShowNodeNum-1||(k=o("<li id='"+n.tId+"_tmp'></li>",e),k.append(o(n,d.id.A,e).clone()),k.css("padding","0"),k.children("#"+n.tId+d.id.A).removeClass(d.node.CURSELECTED),D.append(k),a==e.edit.drag.maxShowNodeNum-1&&(k=o("<li id='"+n.tId+"_moretmp'><a> ... </a></li>",e),D.append(k)));D.attr("id",l[0].tId+d.id.UL+"_tmp");D.addClass(e.treeObj.attr("class"));D.appendTo(M);A=o("<span class='tmpzTreeMove_arrow'></span>", +e);A.attr("id","zTreeMove_arrow_tmp");A.appendTo(M);e.treeObj.trigger(d.event.DRAG,[b,e.treeId,l])}if(B.dragFlag==1){s&&A.attr("id")==b.target.id&&u&&b.clientX+G.scrollLeft()+2>v("#"+u+d.id.A,s).offset().left?(n=v("#"+u+d.id.A,s),b.target=n.length>0?n.get(0):b.target):s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&v("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+J.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+J.move.TYPE_INNER)); +u=s=null;K=!1;h=e;n=m.getSettings();for(var y in n)if(n[y].treeId&&n[y].edit.enable&&n[y].treeId!=e.treeId&&(b.target.id==n[y].treeId||v(b.target).parents("#"+n[y].treeId).length>0))K=!0,h=n[y];y=G.scrollTop();k=G.scrollLeft();i=h.treeObj.offset();a=h.treeObj.get(0).scrollHeight;n=h.treeObj.get(0).scrollWidth;c=b.clientY+y-i.top;var p=h.treeObj.height()+i.top-b.clientY-y,q=b.clientX+k-i.left,H=h.treeObj.width()+i.left-b.clientX-k;i=c<e.edit.drag.borderMax&&c>e.edit.drag.borderMin;var j=p<e.edit.drag.borderMax&& +p>e.edit.drag.borderMin,F=q<e.edit.drag.borderMax&&q>e.edit.drag.borderMin,x=H<e.edit.drag.borderMax&&H>e.edit.drag.borderMin,p=c>e.edit.drag.borderMin&&p>e.edit.drag.borderMin&&q>e.edit.drag.borderMin&&H>e.edit.drag.borderMin,q=i&&h.treeObj.scrollTop()<=0,H=j&&h.treeObj.scrollTop()+h.treeObj.height()+10>=a,N=F&&h.treeObj.scrollLeft()<=0,Q=x&&h.treeObj.scrollLeft()+h.treeObj.width()+10>=n;if(b.target&&g.isChildOrSelf(b.target,h.treeId)){for(var E=b.target;E&&E.tagName&&!g.eqs(E.tagName,"li")&&E.id!= +h.treeId;)E=E.parentNode;var S=!0;for(a=0,c=l.length;a<c;a++)if(n=l[a],E.id===n.tId){S=!1;break}else if(o(n,e).find("#"+E.id).length>0){S=!1;break}if(S&&b.target&&g.isChildOrSelf(b.target,E.id+d.id.A))s=v(E),u=E.id}n=l[0];if(p&&g.isChildOrSelf(b.target,h.treeId)){if(!s&&(b.target.id==h.treeId||q||H||N||Q)&&(K||!K&&n.parentTId))s=h.treeObj;i?h.treeObj.scrollTop(h.treeObj.scrollTop()-10):j&&h.treeObj.scrollTop(h.treeObj.scrollTop()+10);F?h.treeObj.scrollLeft(h.treeObj.scrollLeft()-10):x&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+ +10);s&&s!=h.treeObj&&s.offset().left<h.treeObj.offset().left&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+s.offset().left-h.treeObj.offset().left)}D.css({top:b.clientY+y+3+"px",left:b.clientX+k+3+"px"});c=a=0;if(s&&s.attr("id")!=h.treeId){var z=u==null?null:m.getNodeCache(h,u);i=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;k=!!(I&&u===I.tId);F=!!(R&&u===R.tId);j=n.parentTId&&n.parentTId==u;n=(i||!F)&&g.apply(h.edit.drag.prev,[h.treeId,l,z], +!!h.edit.drag.prev);k=(i||!k)&&g.apply(h.edit.drag.next,[h.treeId,l,z],!!h.edit.drag.next);i=(i||!j)&&!(h.data.keep.leaf&&!z.isParent)&&g.apply(h.edit.drag.inner,[h.treeId,l,z],!!h.edit.drag.inner);j=function(){s=null;u="";w=d.move.TYPE_INNER;A.css({display:"none"});if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null};if(!n&&!k&&!i)j();else if(F=v("#"+u+d.id.A,s),x=z.isLastNode?null:v("#"+z.getNextNode().tId+d.id.A,s.next()),p=F.offset().top,q=F.offset().left, +H=n?i?0.25:k?0.5:1:-1,N=k?i?0.75:n?0.5:0:-1,y=(b.clientY+y-p)/F.height(),(H==1||y<=H&&y>=-0.2)&&n?(a=1-A.width(),c=p-A.height()/2,w=d.move.TYPE_PREV):(N==0||y>=N&&y<=1.2)&&k?(a=1-A.width(),c=x==null||z.isParent&&z.open?p+F.height()-A.height()/2:x.offset().top-A.height()/2,w=d.move.TYPE_NEXT):i?(a=5-A.width(),c=p,w=d.move.TYPE_INNER):j(),s){A.css({display:"block",top:c+"px",left:q+a+"px"});F.addClass(d.node.TMPTARGET_NODE+"_"+w);if(T!=u||U!=w)L=(new Date).getTime();if(z&&z.isParent&&w==d.move.TYPE_INNER&& +(y=!0,window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId!==z.tId?(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null):window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===z.tId&&(y=!1),y))window.zTreeMoveTimer=setTimeout(function(){w==d.move.TYPE_INNER&&z&&z.isParent&&!z.open&&(new Date).getTime()-L>h.edit.drag.autoOpenTime&&g.apply(h.callback.beforeDragOpen,[h.treeId,z],!0)&&(f.switchNode(h,z),h.edit.drag.autoExpandTrigger&&h.treeObj.trigger(d.event.EXPAND,[h.treeId,z]))}, +h.edit.drag.autoOpenTime+50),window.zTreeMoveTargetNodeTId=z.tId}}else if(w=d.move.TYPE_INNER,s&&g.apply(h.edit.drag.inner,[h.treeId,l,null],!!h.edit.drag.inner)?s.addClass(d.node.TMPTARGET_TREE):s=null,A.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;T=u;U=w;e.treeObj.trigger(d.event.DRAGMOVE,[b,e.treeId,l])}return!1}function r(b){if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;U=T= +null;G.unbind("mousemove",c);G.unbind("mouseup",r);G.unbind("selectstart",k);M.css("cursor","auto");s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&v("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+J.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+J.move.TYPE_INNER));g.showIfameMask(e,!1);t.showHoverDom=!0;if(B.dragFlag!=0){B.dragFlag=0;var a,i,j;for(a=0,i=l.length;a<i;a++)j=l[a],j.isParent&&B.dragNodeShowBefore[j.tId]&&!j.open&&(f.expandCollapseNode(e, +j,!j.open),delete B.dragNodeShowBefore[j.tId]);D&&D.remove();A&&A.remove();var p=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;!p&&s&&u&&l[0].parentTId&&u==l[0].parentTId&&w==d.move.TYPE_INNER&&(s=null);if(s){var q=u==null?null:m.getNodeCache(h,u);if(g.apply(e.callback.beforeDrop,[h.treeId,l,q,w,p],!0)==!1)f.selectNodes(x,l);else{var C=p?g.clone(l):l;a=function(){if(K){if(!p)for(var a=0,c=l.length;a<c;a++)f.removeNode(e,l[a]);w==d.move.TYPE_INNER? +f.addNodes(h,q,-1,C):f.addNodes(h,q.getParentNode(),w==d.move.TYPE_PREV?q.getIndex():q.getIndex()+1,C)}else if(p&&w==d.move.TYPE_INNER)f.addNodes(h,q,-1,C);else if(p)f.addNodes(h,q.getParentNode(),w==d.move.TYPE_PREV?q.getIndex():q.getIndex()+1,C);else if(w!=d.move.TYPE_NEXT)for(a=0,c=C.length;a<c;a++)f.moveNode(h,q,C[a],w,!1);else for(a=-1,c=C.length-1;a<c;c--)f.moveNode(h,q,C[c],w,!1);f.selectNodes(h,C);a=o(C[0],e).get(0);f.scrollIntoView(a);e.treeObj.trigger(d.event.DROP,[b,h.treeId,C,q,w,p])}; +w==d.move.TYPE_INNER&&g.canAsync(h,q)?f.asyncNode(h,q,!1,a):a()}}else f.selectNodes(x,l),e.treeObj.trigger(d.event.DROP,[b,e.treeId,l,null,null,null])}}function k(){return!1}var i,j,e=m.getSetting(b.data.treeId),B=m.getRoot(e),t=m.getRoots();if(b.button==2||!e.edit.enable||!e.edit.drag.isCopy&&!e.edit.drag.isMove)return!0;var p=b.target,q=m.getRoot(e).curSelectedList,l=[];if(m.isSelectedNode(e,a))for(i=0,j=q.length;i<j;i++){if(q[i].editNameFlag&&g.eqs(p.tagName,"input")&&p.getAttribute("treeNode"+ +d.id.INPUT)!==null)return!0;l.push(q[i]);if(l[0].parentTId!==q[i].parentTId){l=[a];break}}else l=[a];f.editNodeBlur=!0;f.cancelCurEditNode(e);var G=v(e.treeObj.get(0).ownerDocument),M=v(e.treeObj.get(0).ownerDocument.body),D,A,s,K=!1,h=e,x=e,I,R,T=null,U=null,u=null,w=d.move.TYPE_INNER,O=b.clientX,P=b.clientY,L=(new Date).getTime();g.uCanDo(e)&&G.bind("mousemove",c);G.bind("mouseup",r);G.bind("selectstart",k);b.preventDefault&&b.preventDefault();return!0}};v.extend(!0,v.fn.zTree.consts,J);v.extend(!0, +v.fn.zTree._z,{tools:{getAbs:function(b){b=b.getBoundingClientRect();return[b.left+(document.body.scrollLeft+document.documentElement.scrollLeft),b.top+(document.body.scrollTop+document.documentElement.scrollTop)]},inputFocus:function(b){b.get(0)&&(b.focus(),g.setCursorPosition(b.get(0),b.val().length))},inputSelect:function(b){b.get(0)&&(b.focus(),b.select())},setCursorPosition:function(b,a){if(b.setSelectionRange)b.focus(),b.setSelectionRange(a,a);else if(b.createTextRange){var c=b.createTextRange(); +c.collapse(!0);c.moveEnd("character",a);c.moveStart("character",a);c.select()}},showIfameMask:function(b,a){for(var c=m.getRoot(b);c.dragMaskList.length>0;)c.dragMaskList[0].remove(),c.dragMaskList.shift();if(a)for(var d=o("iframe",b),f=0,i=d.length;f<i;f++){var j=d.get(f),e=g.getAbs(j),j=o("<div id='zTreeMask_"+f+"' class='zTreeMask' style='top:"+e[1]+"px; left:"+e[0]+"px; width:"+j.offsetWidth+"px; height:"+j.offsetHeight+"px;'></div>",b);j.appendTo(o("body",b));c.dragMaskList.push(j)}}},view:{addEditBtn:function(b, +a){if(!(a.editNameFlag||o(a,d.id.EDIT,b).length>0)&&g.apply(b.edit.showRenameBtn,[b.treeId,a],b.edit.showRenameBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" edit' id='"+a.tId+d.id.EDIT+"' title='"+g.apply(b.edit.renameTitle,[b.treeId,a],b.edit.renameTitle)+"' treeNode"+d.id.EDIT+" style='display:none;'></span>";c.append(r);o(a,d.id.EDIT,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeEditName,[b.treeId,a],!0)==!1)return!1;f.editNode(b,a);return!1}).show()}}, +addRemoveBtn:function(b,a){if(!(a.editNameFlag||o(a,d.id.REMOVE,b).length>0)&&g.apply(b.edit.showRemoveBtn,[b.treeId,a],b.edit.showRemoveBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" remove' id='"+a.tId+d.id.REMOVE+"' title='"+g.apply(b.edit.removeTitle,[b.treeId,a],b.edit.removeTitle)+"' treeNode"+d.id.REMOVE+" style='display:none;'></span>";c.append(r);o(a,d.id.REMOVE,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeRemove,[b.treeId,a],!0)==!1)return!1;f.removeNode(b, +a);b.treeObj.trigger(d.event.REMOVE,[b.treeId,a]);return!1}).bind("mousedown",function(){return!0}).show()}},addHoverDom:function(b,a){if(m.getRoots().showHoverDom)a.isHover=!0,b.edit.enable&&(f.addEditBtn(b,a),f.addRemoveBtn(b,a)),g.apply(b.view.addHoverDom,[b.treeId,a])},cancelCurEditNode:function(b,a,c){var r=m.getRoot(b),k=b.data.key.name,i=r.curEditNode;if(i){var j=r.curEditInput,a=a?a:c?i[k]:j.val();if(g.apply(b.callback.beforeRename,[b.treeId,i,a,c],!0)===!1)return!1;i[k]=a;o(i,d.id.A,b).removeClass(d.node.CURSELECTED_EDIT); +j.unbind();f.setNodeName(b,i);i.editNameFlag=!1;r.curEditNode=null;r.curEditInput=null;f.selectNode(b,i,!1);b.treeObj.trigger(d.event.RENAME,[b.treeId,i,c])}return r.noSelection=!0},editNode:function(b,a){var c=m.getRoot(b);f.editNodeBlur=!1;if(m.isSelectedNode(b,a)&&c.curEditNode==a&&a.editNameFlag)setTimeout(function(){g.inputFocus(c.curEditInput)},0);else{var r=b.data.key.name;a.editNameFlag=!0;f.removeTreeDom(b,a);f.cancelCurEditNode(b);f.selectNode(b,a,!1);o(a,d.id.SPAN,b).html("<input type=text class='rename' id='"+ +a.tId+d.id.INPUT+"' treeNode"+d.id.INPUT+" >");var k=o(a,d.id.INPUT,b);k.attr("value",a[r]);b.edit.editNameSelectAll?g.inputSelect(k):g.inputFocus(k);k.bind("blur",function(){f.editNodeBlur||f.cancelCurEditNode(b)}).bind("keydown",function(a){a.keyCode=="13"?(f.editNodeBlur=!0,f.cancelCurEditNode(b)):a.keyCode=="27"&&f.cancelCurEditNode(b,null,!0)}).bind("click",function(){return!1}).bind("dblclick",function(){return!1});o(a,d.id.A,b).addClass(d.node.CURSELECTED_EDIT);c.curEditInput=k;c.noSelection= +!1;c.curEditNode=a}},moveNode:function(b,a,c,r,k,i){var j=m.getRoot(b),e=b.data.key.children;if(a!=c&&(!b.data.keep.leaf||!a||a.isParent||r!=d.move.TYPE_INNER)){var g=c.parentTId?c.getParentNode():j,t=a===null||a==j;t&&a===null&&(a=j);if(t)r=d.move.TYPE_INNER;j=a.parentTId?a.getParentNode():j;if(r!=d.move.TYPE_PREV&&r!=d.move.TYPE_NEXT)r=d.move.TYPE_INNER;if(r==d.move.TYPE_INNER)if(t)c.parentTId=null;else{if(!a.isParent)a.isParent=!0,a.open=!!a.open,f.setNodeLineIcos(b,a);c.parentTId=a.tId}var p; +t?p=t=b.treeObj:(!i&&r==d.move.TYPE_INNER?f.expandCollapseNode(b,a,!0,!1):i||f.expandCollapseNode(b,a.getParentNode(),!0,!1),t=o(a,b),p=o(a,d.id.UL,b),t.get(0)&&!p.get(0)&&(p=[],f.makeUlHtml(b,a,p,""),t.append(p.join(""))),p=o(a,d.id.UL,b));var q=o(c,b);q.get(0)?t.get(0)||q.remove():q=f.appendNodes(b,c.level,[c],null,-1,!1,!0).join("");p.get(0)&&r==d.move.TYPE_INNER?p.append(q):t.get(0)&&r==d.move.TYPE_PREV?t.before(q):t.get(0)&&r==d.move.TYPE_NEXT&&t.after(q);var l=-1,v=0,x=null,t=null,D=c.level; +if(c.isFirstNode){if(l=0,g[e].length>1)x=g[e][1],x.isFirstNode=!0}else if(c.isLastNode)l=g[e].length-1,x=g[e][l-1],x.isLastNode=!0;else for(p=0,q=g[e].length;p<q;p++)if(g[e][p].tId==c.tId){l=p;break}l>=0&&g[e].splice(l,1);if(r!=d.move.TYPE_INNER)for(p=0,q=j[e].length;p<q;p++)j[e][p].tId==a.tId&&(v=p);if(r==d.move.TYPE_INNER){a[e]||(a[e]=[]);if(a[e].length>0)t=a[e][a[e].length-1],t.isLastNode=!1;a[e].splice(a[e].length,0,c);c.isLastNode=!0;c.isFirstNode=a[e].length==1}else a.isFirstNode&&r==d.move.TYPE_PREV? +(j[e].splice(v,0,c),t=a,t.isFirstNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!0,c.isLastNode=!1):a.isLastNode&&r==d.move.TYPE_NEXT?(j[e].splice(v+1,0,c),t=a,t.isLastNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!0):(r==d.move.TYPE_PREV?j[e].splice(v,0,c):j[e].splice(v+1,0,c),c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!1);m.fixPIdKeyValue(b,c);m.setSonNodeLevel(b,c.getParentNode(),c);f.setNodeLineIcos(b,c);f.repairNodeLevelClass(b,c,D);!b.data.keep.parent&&g[e].length< +1?(g.isParent=!1,g.open=!1,a=o(g,d.id.UL,b),r=o(g,d.id.SWITCH,b),e=o(g,d.id.ICON,b),f.replaceSwitchClass(g,r,d.folder.DOCU),f.replaceIcoClass(g,e,d.folder.DOCU),a.css("display","none")):x&&f.setNodeLineIcos(b,x);t&&f.setNodeLineIcos(b,t);b.check&&b.check.enable&&f.repairChkClass&&(f.repairChkClass(b,g),f.repairParentChkClassWithSelf(b,g),g!=c.parent&&f.repairParentChkClassWithSelf(b,c));i||f.expandCollapseParentNode(b,c.getParentNode(),!0,k)}},removeEditBtn:function(b,a){o(a,d.id.EDIT,b).unbind().remove()}, +removeRemoveBtn:function(b,a){o(a,d.id.REMOVE,b).unbind().remove()},removeTreeDom:function(b,a){a.isHover=!1;f.removeEditBtn(b,a);f.removeRemoveBtn(b,a);g.apply(b.view.removeHoverDom,[b.treeId,a])},repairNodeLevelClass:function(b,a,c){if(c!==a.level){var f=o(a,b),g=o(a,d.id.A,b),b=o(a,d.id.UL,b),c=d.className.LEVEL+c,a=d.className.LEVEL+a.level;f.removeClass(c);f.addClass(a);g.removeClass(c);g.addClass(a);b.removeClass(c);b.addClass(a)}},selectNodes:function(b,a){for(var c=0,d=a.length;c<d;c++)f.selectNode(b, +a[c],c>0)}},event:{},data:{setSonNodeLevel:function(b,a,c){if(c){var d=b.data.key.children;c.level=a?a.level+1:0;if(c[d])for(var a=0,f=c[d].length;a<f;a++)c[d][a]&&m.setSonNodeLevel(b,c,c[d][a])}}}});var I=v.fn.zTree,g=I._z.tools,d=I.consts,f=I._z.view,m=I._z.data,o=g.$;m.exSetting({edit:{enable:!1,editNameSelectAll:!1,showRemoveBtn:!0,showRenameBtn:!0,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:!1,isCopy:!0,isMove:!0,prev:!0,next:!0,inner:!0,minMoveSize:5,borderMax:10,borderMin:-5, +maxShowNodeNum:5,autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDragMove:null,onDrop:null,onRename:null}});m.addInitBind(function(b){var a=b.treeObj,c=d.event;a.bind(c.RENAME,function(a,c,d,f){g.apply(b.callback.onRename,[a,c,d,f])});a.bind(c.DRAG,function(a,c,d,f){g.apply(b.callback.onDrag,[c,d,f])});a.bind(c.DRAGMOVE,function(a,c,d,f){g.apply(b.callback.onDragMove,[c, +d,f])});a.bind(c.DROP,function(a,c,d,f,e,m,o){g.apply(b.callback.onDrop,[c,d,f,e,m,o])})});m.addInitUnBind(function(b){var b=b.treeObj,a=d.event;b.unbind(a.RENAME);b.unbind(a.DRAG);b.unbind(a.DRAGMOVE);b.unbind(a.DROP)});m.addInitCache(function(){});m.addInitNode(function(b,a,c){if(c)c.isHover=!1,c.editNameFlag=!1});m.addInitProxy(function(b){var a=b.target,c=m.getSetting(b.data.treeId),f=b.relatedTarget,k="",i=null,j="",e=null,o=null;if(g.eqs(b.type,"mouseover")){if(o=g.getMDom(c,a,[{tagName:"a", +attrName:"treeNode"+d.id.A}]))k=g.getNodeMainDom(o).id,j="hoverOverNode"}else if(g.eqs(b.type,"mouseout"))o=g.getMDom(c,f,[{tagName:"a",attrName:"treeNode"+d.id.A}]),o||(k="remove",j="hoverOutNode");else if(g.eqs(b.type,"mousedown")&&(o=g.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}])))k=g.getNodeMainDom(o).id,j="mousedownNode";if(k.length>0)switch(i=m.getNodeCache(c,k),j){case "mousedownNode":e=x.onMousedownNode;break;case "hoverOverNode":e=x.onHoverOverNode;break;case "hoverOutNode":e= +x.onHoverOutNode}return{stop:!1,node:i,nodeEventType:j,nodeEventCallback:e,treeEventType:"",treeEventCallback:null}});m.addInitRoot(function(b){var b=m.getRoot(b),a=m.getRoots();b.curEditNode=null;b.curEditInput=null;b.curHoverNode=null;b.dragFlag=0;b.dragNodeShowBefore=[];b.dragMaskList=[];a.showHoverDom=!0});m.addZTreeTools(function(b,a){a.cancelEditName=function(a){m.getRoot(this.setting).curEditNode&&f.cancelCurEditNode(this.setting,a?a:null,!0)};a.copyNode=function(a,b,k,i){if(!b)return null; +if(a&&!a.isParent&&this.setting.data.keep.leaf&&k===d.move.TYPE_INNER)return null;var j=this,e=g.clone(b);if(!a)a=null,k=d.move.TYPE_INNER;k==d.move.TYPE_INNER?(b=function(){f.addNodes(j.setting,a,-1,[e],i)},g.canAsync(this.setting,a)?f.asyncNode(this.setting,a,i,b):b()):(f.addNodes(this.setting,a.parentNode,-1,[e],i),f.moveNode(this.setting,a,e,k,!1,i));return e};a.editName=function(a){a&&a.tId&&a===m.getNodeCache(this.setting,a.tId)&&(a.parentTId&&f.expandCollapseParentNode(this.setting,a.getParentNode(), +!0),f.editNode(this.setting,a))};a.moveNode=function(a,b,k,i){function j(){f.moveNode(e.setting,a,b,k,!1,i)}if(!b)return b;if(a&&!a.isParent&&this.setting.data.keep.leaf&&k===d.move.TYPE_INNER)return null;else if(a&&(b.parentTId==a.tId&&k==d.move.TYPE_INNER||o(b,this.setting).find("#"+a.tId).length>0))return null;else a||(a=null);var e=this;g.canAsync(this.setting,a)&&k===d.move.TYPE_INNER?f.asyncNode(this.setting,a,i,j):j();return b};a.setEditable=function(a){this.setting.edit.enable=a;return this.refresh()}}); +var O=f.cancelPreSelectedNode;f.cancelPreSelectedNode=function(b,a){for(var c=m.getRoot(b).curSelectedList,d=0,g=c.length;d<g;d++)if(!a||a===c[d])if(f.removeTreeDom(b,c[d]),a)break;O&&O.apply(f,arguments)};var P=f.createNodes;f.createNodes=function(b,a,c,d,g){P&&P.apply(f,arguments);c&&f.repairParentChkClassWithSelf&&f.repairParentChkClassWithSelf(b,d)};var W=f.makeNodeUrl;f.makeNodeUrl=function(b,a){return b.edit.enable?null:W.apply(f,arguments)};var L=f.removeNode;f.removeNode=function(b,a){var c= +m.getRoot(b);if(c.curEditNode===a)c.curEditNode=null;L&&L.apply(f,arguments)};var Q=f.selectNode;f.selectNode=function(b,a,c){var d=m.getRoot(b);if(m.isSelectedNode(b,a)&&d.curEditNode==a&&a.editNameFlag)return!1;Q&&Q.apply(f,arguments);f.addHoverDom(b,a);return!0};var V=g.uCanDo;g.uCanDo=function(b,a){var c=m.getRoot(b);if(a&&(g.eqs(a.type,"mouseover")||g.eqs(a.type,"mouseout")||g.eqs(a.type,"mousedown")||g.eqs(a.type,"mouseup")))return!0;if(c.curEditNode)f.editNodeBlur=!1,c.curEditInput.focus(); +return!c.curEditNode&&(V?V.apply(f,arguments):!0)}})(jQuery); + diff --git a/user/guns-admin/src/main/webapp/static/modular/code/gen.js b/user/guns-admin/src/main/webapp/static/modular/code/gen.js new file mode 100644 index 0000000..619d9b1 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/code/gen.js @@ -0,0 +1,93 @@ +/** + * 初始化 + */ +var Code = { + ztreeInstance: null, + tableName: "", + submitData: {}, + switchs: {} +}; + +/** + * 选择table的事件 + */ +Code.selectTable = function (tableName) { + + SelectList.clearSelect("templateList"); + Code.switchs = {}; + + if (SelectList.singelSelect("tableList", "tableName", tableName) == true) { + Code.tableName = tableName; + Code.setTableName(tableName); + } else { + Code.tableName = ""; + } +}; + +/** + * 选择模板的事件 + */ +Code.selectTemplate = function (templateKey) { + if (Code.tableName != "") { + if (SelectList.mutiSelect("templateList", "key", templateKey) == true) { + Code.switchs[templateKey] = true; + } else { + Code.switchs[templateKey] = false; + } + } else { + Feng.info("请先选择表"); + } +}; + +/** + * 点击生成 + */ +Code.generate = function () { + Code.submitData = {}; + Code.submitData.tableName = Code.tableName; + this.set('projectPath').set('author').set('projectPackage').set('corePackage').set('ignoreTabelPrefix').set('bizName').set('moduleName').set('parentMenuName'); + var baseAjax = Feng.baseAjax("/code/generate", "生成代码"); + + for (var item in Code.switchs) { + Code.submitData[item] = Code.switchs[item]; + } + + baseAjax.setData(Code.submitData); + baseAjax.start(); +}; + +/** + * 设置表名称 + */ +Code.setTableName = function (tableName) { + var preSize = $("#ignoreTabelPrefix").val().length; + $("#tableName").val(tableName); + $("#className").val(Feng.underLineToCamel(tableName.substring(preSize))); +}; + +/** + * 点击父级编号input框时 + */ +Code.onClickDept = function (e, treeId, treeNode) { + $("#parentMenuName").attr("value", Code.ztreeInstance.getSelectedVal()); +}; + +/** + * 显示父级菜单选择的树 + */ +Code.showMenuSelectTree = function () { + Feng.showInputTree("parentMenuName", "pcodeTreeDiv", 15, 34); +}; + +$(function () { + var ztree = new $ZTree("pcodeTree", "/menu/selectMenuTreeList"); + ztree.bindOnClick(Code.onClickDept); + ztree.init(); + Code.ztreeInstance = ztree; + $("#pcodeTree").css('width',$("#parentMenuName").css('width')); +}); + +Code.set = function (key, value) { + Code.submitData[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + return this; +}; \ No newline at end of file diff --git a/user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense.js b/user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense.js new file mode 100644 index 0000000..3749f2f --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense.js @@ -0,0 +1,93 @@ +/** + * 报销管理管理初始化 + */ +var Expense = { + id: "ExpenseTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +Expense.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + {title: '报销id', field: 'id', visible: true, align: 'center', valign: 'middle'}, + {title: '报销金额', field: 'money', visible: true, align: 'center', valign: 'middle'}, + {title: '描述', field: 'desc', visible: true, align: 'center', valign: 'middle'}, + {title: '状态', field: 'stateName', visible: true, align: 'center', valign: 'middle'}, + {title: '创建时间', field: 'createtime', visible: true, align: 'center', valign: 'middle'}, + { + title: '操作', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) { + if (row.state == 3) { + return '<button type="button" class="btn btn-danger button-margin" onclick="Expense.deleteRecord(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i> 删除</button>'; + } else { + return '<button type="button" class="btn btn-primary button-margin" onclick="Expense.findRecord(' + row.id + ')" id=""><i class="fa fa-edit"></i> 查看</button>' + + '<button type="button" class="btn btn-danger button-margin" onclick="Expense.deleteRecord(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i> 删除</button>'; + } + } + } + ]; +}; + +/** + * 流程详情 + */ +Expense.findRecord = function (id) { + var index = layer.open({ + type: 2, + title: '流程详情', + area: ['1000px', '500px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/expense/expense_update/' + id + }); + this.layerIndex = index; +}; + +/** + * 删除审核记录 + */ +Expense.deleteRecord = function (id) { + var ajax = new $ax(Feng.ctxPath + "/expense/delete", function (data) { + Feng.success("删除成功!"); + Expense.table.refresh(); + }, function (data) { + Feng.error("删除失败!" + data.responseJSON.message + "!"); + }); + ajax.set("expenseId", id); + ajax.start(); +}; + +/** + * 点击添加报销管理 + */ +Expense.openAddExpense = function () { + var index = layer.open({ + type: 2, + title: '添加报销管理', + area: ['600px', '350px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/expense/expense_add' + }); + this.layerIndex = index; +}; + +/** + * 查询报销管理列表 + */ +Expense.search = function () { + var queryData = {}; + queryData['condition'] = $("#condition").val(); + Expense.table.refresh({query: queryData}); +}; + +$(function () { + var defaultColunms = Expense.initColumn(); + var table = new BSTable(Expense.id, "/expense/list", defaultColunms); + table.setPaginationType("client"); + Expense.table = table.init(); +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense_info.js b/user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense_info.js new file mode 100644 index 0000000..481af18 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense_info.js @@ -0,0 +1,96 @@ +/** + * 初始化报销管理详情对话框 + */ +var ExpenseInfoDlg = { + expenseInfoData : {} +}; + +/** + * 清除数据 + */ +ExpenseInfoDlg.clearData = function() { + this.expenseInfoData = {}; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +ExpenseInfoDlg.set = function(key, val) { + this.expenseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; + return this; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +ExpenseInfoDlg.get = function(key) { + return $("#" + key).val(); +} + +/** + * 关闭此对话框 + */ +ExpenseInfoDlg.close = function() { + parent.layer.close(window.parent.Expense.layerIndex); +} + +/** + * 收集数据 + */ +ExpenseInfoDlg.collectData = function() { + this + .set('id') + .set('money') + .set('desc') + ; +} + +/** + * 提交添加 + */ +ExpenseInfoDlg.addSubmit = function() { + + this.clearData(); + this.collectData(); + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/expense/add", function(data){ + Feng.success("添加成功!"); + window.parent.Expense.table.refresh(); + ExpenseInfoDlg.close(); + },function(data){ + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.expenseInfoData); + ajax.start(); +} + +/** + * 提交修改 + */ +ExpenseInfoDlg.editSubmit = function() { + + this.clearData(); + this.collectData(); + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/expense/update", function(data){ + Feng.success("修改成功!"); + window.parent.Expense.table.refresh(); + ExpenseInfoDlg.close(); + },function(data){ + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.expenseInfoData); + ajax.start(); +} + +$(function() { + +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/flowable/process/process.js b/user/guns-admin/src/main/webapp/static/modular/flowable/process/process.js new file mode 100644 index 0000000..27c79c7 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/flowable/process/process.js @@ -0,0 +1,77 @@ +/** + * 报销管理管理初始化 + */ +var Process = { + id: "ProcessTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +Process.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + {title: '任务id', field: 'id', visible: true, align: 'center', valign: 'middle'}, + {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle'}, + {title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'}, + {title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'}, + {title: '申请人', field: 'assignee', visible: true, align: 'center', valign: 'middle'}, + { + title: '操作', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) { + if (row.selfFlag == true) { + return '<button type="button" class="btn btn-primary button-margin" onclick="Process.pass(' + row.id + ')" id=""><i class="fa fa-edit"></i> 通过</button>' + + '<button type="button" class="btn btn-danger button-margin" onclick="Process.unPass(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i> 不通过</button>'; + } else { + return '<button type="button" class="btn btn-primary button-margin" onclick="Process.pass(' + row.id + ')" id=""><i class="fa fa-edit"></i> 通过</button>'; + } + } + } + ]; +}; + +/** + * 通过审核 + */ +Process.pass = function (id) { + var ajax = new $ax(Feng.ctxPath + "/process/pass", function (data) { + Feng.success("审核成功!"); + Process.table.refresh(); + }, function (data) { + Feng.error("审核失败!" + data.responseJSON.message + "!"); + }); + ajax.set("taskId", id); + ajax.start(); +}; + +/** + * 未通过审核 + */ +Process.unPass = function (id) { + var ajax = new $ax(Feng.ctxPath + "/process/unPass", function (data) { + Feng.success("审核成功!"); + Process.table.refresh(); + }, function (data) { + Feng.error("审核失败!" + data.responseJSON.message + "!"); + }); + ajax.set("taskId", id); + ajax.start(); +}; + +/** + * 查询报销管理列表 + */ +Process.search = function () { + var queryData = {}; + queryData['condition'] = $("#condition").val(); + Process.table.refresh({query: queryData}); +}; + +$(function () { + var defaultColunms = Process.initColumn(); + var table = new BSTable(Process.id, "/process/list", defaultColunms); + table.setPaginationType("client"); + Process.table = table.init(); +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/flowable/process/process_info.js b/user/guns-admin/src/main/webapp/static/modular/flowable/process/process_info.js new file mode 100644 index 0000000..481af18 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/flowable/process/process_info.js @@ -0,0 +1,96 @@ +/** + * 初始化报销管理详情对话框 + */ +var ExpenseInfoDlg = { + expenseInfoData : {} +}; + +/** + * 清除数据 + */ +ExpenseInfoDlg.clearData = function() { + this.expenseInfoData = {}; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +ExpenseInfoDlg.set = function(key, val) { + this.expenseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; + return this; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +ExpenseInfoDlg.get = function(key) { + return $("#" + key).val(); +} + +/** + * 关闭此对话框 + */ +ExpenseInfoDlg.close = function() { + parent.layer.close(window.parent.Expense.layerIndex); +} + +/** + * 收集数据 + */ +ExpenseInfoDlg.collectData = function() { + this + .set('id') + .set('money') + .set('desc') + ; +} + +/** + * 提交添加 + */ +ExpenseInfoDlg.addSubmit = function() { + + this.clearData(); + this.collectData(); + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/expense/add", function(data){ + Feng.success("添加成功!"); + window.parent.Expense.table.refresh(); + ExpenseInfoDlg.close(); + },function(data){ + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.expenseInfoData); + ajax.start(); +} + +/** + * 提交修改 + */ +ExpenseInfoDlg.editSubmit = function() { + + this.clearData(); + this.collectData(); + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/expense/update", function(data){ + Feng.success("修改成功!"); + window.parent.Expense.table.refresh(); + ExpenseInfoDlg.close(); + },function(data){ + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.expenseInfoData); + ajax.start(); +} + +$(function() { + +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/code/code.js b/user/guns-admin/src/main/webapp/static/modular/system/code/code.js new file mode 100644 index 0000000..1f2fc4e --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/code/code.js @@ -0,0 +1,18 @@ +/** + * 代码生成管理初始化 + */ +var Code = { + +}; + +/** + * 提交代码生成 + */ +Code.generate = function () { + var baseAjax = Feng.baseAjax("/code/generate","生成代码"); + baseAjax.set("bizChName"); + baseAjax.set("bizEnName"); + baseAjax.set("path"); + baseAjax.set("moduleName"); + baseAjax.start(); +}; diff --git a/user/guns-admin/src/main/webapp/static/modular/system/dept/dept.js b/user/guns-admin/src/main/webapp/static/modular/system/dept/dept.js new file mode 100644 index 0000000..ccbba59 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/dept/dept.js @@ -0,0 +1,110 @@ +/** + * 部门管理初始化 + */ +var Dept = { + id: "DeptTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +Dept.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + {title: 'id', field: 'id', align: 'center', valign: 'middle',width:'50px'}, + {title: '部门简称', field: 'simplename', align: 'center', valign: 'middle', sortable: true}, + {title: '部门全称', field: 'fullname', align: 'center', valign: 'middle', sortable: true}, + {title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true}, + {title: '备注', field: 'tips', align: 'center', valign: 'middle', sortable: true}]; +}; + +/** + * 检查是否选中 + */ +Dept.check = function () { + var selected = $('#' + this.id).bootstrapTreeTable('getSelections'); + if(selected.length == 0){ + Feng.info("请先选中表格中的某一记录!"); + return false; + }else{ + Dept.seItem = selected[0]; + return true; + } +}; + +/** + * 点击添加部门 + */ +Dept.openAddDept = function () { + var index = layer.open({ + type: 2, + title: '添加部门', + area: ['800px', '420px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/dept/dept_add' + }); + this.layerIndex = index; +}; + +/** + * 打开查看部门详情 + */ +Dept.openDeptDetail = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '部门详情', + area: ['800px', '420px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/dept/dept_update/' + Dept.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 删除部门 + */ +Dept.delete = function () { + if (this.check()) { + + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/dept/delete", function () { + Feng.success("删除成功!"); + Dept.table.refresh(); + }, function (data) { + Feng.error("删除失败!" + data.responseJSON.message + "!"); + }); + ajax.set("deptId",Dept.seItem.id); + ajax.start(); + }; + + Feng.confirm("是否刪除该部门?", operation); + } +}; + +/** + * 查询部门列表 + */ +Dept.search = function () { + var queryData = {}; + queryData['condition'] = $("#condition").val(); + Dept.table.refresh({query: queryData}); +}; + +$(function () { + var defaultColunms = Dept.initColumn(); + var table = new BSTreeTable(Dept.id, "/dept/list", defaultColunms); + table.setExpandColumn(2); + table.setIdField("id"); + table.setCodeField("id"); + table.setParentCodeField("pid"); + table.setExpandAll(true); + table.init(); + Dept.table = table; +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/dept/dept_info.js b/user/guns-admin/src/main/webapp/static/modular/system/dept/dept_info.js new file mode 100644 index 0000000..139c1c9 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/dept/dept_info.js @@ -0,0 +1,182 @@ +/** + * 初始化部门详情对话框 + */ +var DeptInfoDlg = { + deptInfoData : {}, + zTreeInstance : null, + validateFields: { + simplename: { + validators: { + notEmpty: { + message: '部门名称不能为空' + } + } + }, + fullname: { + validators: { + notEmpty: { + message: '部门全称不能为空' + } + } + }, + pName: { + validators: { + notEmpty: { + message: '上级名称不能为空' + } + } + } + } +}; + +/** + * 清除数据 + */ +DeptInfoDlg.clearData = function() { + this.deptInfoData = {}; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +DeptInfoDlg.set = function(key, val) { + this.deptInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + return this; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +DeptInfoDlg.get = function(key) { + return $("#" + key).val(); +} + +/** + * 关闭此对话框 + */ +DeptInfoDlg.close = function() { + parent.layer.close(window.parent.Dept.layerIndex); +} + +/** + * 点击部门ztree列表的选项时 + * + * @param e + * @param treeId + * @param treeNode + * @returns + */ +DeptInfoDlg.onClickDept = function(e, treeId, treeNode) { + $("#pName").attr("value", DeptInfoDlg.zTreeInstance.getSelectedVal()); + $("#pid").attr("value", treeNode.id); +} + +/** + * 显示部门选择的树 + * + * @returns + */ +DeptInfoDlg.showDeptSelectTree = function() { + var pName = $("#pName"); + var pNameOffset = $("#pName").offset(); + $("#parentDeptMenu").css({ + left : pNameOffset.left + "px", + top : pNameOffset.top + pName.outerHeight() + "px" + }).slideDown("fast"); + + $("body").bind("mousedown", onBodyDown); +} + +/** + * 隐藏部门选择的树 + */ +DeptInfoDlg.hideDeptSelectTree = function() { + $("#parentDeptMenu").fadeOut("fast"); + $("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起 +} + +/** + * 收集数据 + */ +DeptInfoDlg.collectData = function() { + this.set('id').set('simplename').set('fullname').set('tips').set('num').set('pid'); +} + +/** + * 验证数据是否为空 + */ +DeptInfoDlg.validate = function () { + $('#deptInfoForm').data("bootstrapValidator").resetForm(); + $('#deptInfoForm').bootstrapValidator('validate'); + return $("#deptInfoForm").data('bootstrapValidator').isValid(); +} + +/** + * 提交添加部门 + */ +DeptInfoDlg.addSubmit = function() { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/dept/add", function(data){ + Feng.success("添加成功!"); + window.parent.Dept.table.refresh(); + DeptInfoDlg.close(); + },function(data){ + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.deptInfoData); + ajax.start(); +} + +/** + * 提交修改 + */ +DeptInfoDlg.editSubmit = function() { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/dept/update", function(data){ + Feng.success("修改成功!"); + window.parent.Dept.table.refresh(); + DeptInfoDlg.close(); + },function(data){ + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.deptInfoData); + ajax.start(); +} + +function onBodyDown(event) { + if (!(event.target.id == "menuBtn" || event.target.id == "parentDeptMenu" || $( + event.target).parents("#parentDeptMenu").length > 0)) { + DeptInfoDlg.hideDeptSelectTree(); + } +} + +$(function() { + Feng.initValidator("deptInfoForm", DeptInfoDlg.validateFields); + + var ztree = new $ZTree("parentDeptMenuTree", "/dept/tree"); + ztree.bindOnClick(DeptInfoDlg.onClickDept); + ztree.init(); + DeptInfoDlg.zTreeInstance = ztree; +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/dict/dict.js b/user/guns-admin/src/main/webapp/static/modular/system/dict/dict.js new file mode 100644 index 0000000..b4f87a2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/dict/dict.js @@ -0,0 +1,104 @@ +/** + * 字典管理初始化 + */ +var Dict = { + id: "DictTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +Dict.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '名称', field: 'name', align: 'center', valign: 'middle', sortable: true}, + {title: '详情', field: 'detail', align: 'center', valign: 'middle', sortable: true}, + {title: '备注', field: 'tips', align: 'center', valign: 'middle', sortable: true}]; +}; + +/** + * 检查是否选中 + */ +Dict.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if (selected.length == 0) { + Feng.info("请先选中表格中的某一记录!"); + return false; + } else { + Dict.seItem = selected[0]; + return true; + } +}; + +/** + * 点击添加字典 + */ +Dict.openAddDict = function () { + var index = layer.open({ + type: 2, + title: '添加字典', + area: ['800px', '420px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/dict/dict_add' + }); + this.layerIndex = index; +}; + +/** + * 打开查看字典详情 + */ +Dict.openDictDetail = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '字典详情', + area: ['800px', '420px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/dict/dict_edit/' + Dict.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 删除字典 + */ +Dict.delete = function () { + if (this.check()) { + + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/dict/delete", function (data) { + Feng.success("删除成功!"); + Dict.table.refresh(); + }, function (data) { + Feng.error("删除失败!" + data.responseJSON.message + "!"); + }); + ajax.set("dictId", Dict.seItem.id); + ajax.start(); + }; + + Feng.confirm("是否刪除字典 " + Dict.seItem.name + "?", operation); + } +}; + +/** + * 查询字典列表 + */ +Dict.search = function () { + var queryData = {}; + queryData['condition'] = $("#condition").val(); + Dict.table.refresh({query: queryData}); +}; + +$(function () { + var defaultColunms = Dict.initColumn(); + var table = new BSTable(Dict.id, "/dict/list", defaultColunms); + table.setPaginationType("client"); + Dict.table = table.init(); +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/dict/dict_info.js b/user/guns-admin/src/main/webapp/static/modular/system/dict/dict_info.js new file mode 100644 index 0000000..34ceb41 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/dict/dict_info.js @@ -0,0 +1,118 @@ +/** + * 初始化字典详情对话框 + */ +var DictInfoDlg = { + count: $("#itemSize").val(), + dictName: '', //字典的名称 + dictCode: '',//字典类型编码 + dictTips: '',//字典备注 + mutiString: '', //拼接字符串内容(拼接字典条目) + itemTemplate: $("#itemTemplate").html() +}; + +/** + * item获取新的id + */ +DictInfoDlg.newId = function () { + if(this.count == undefined){ + this.count = 0; + } + this.count = this.count + 1; + return "dictItem" + this.count; +}; + +/** + * 关闭此对话框 + */ +DictInfoDlg.close = function () { + parent.layer.close(window.parent.Dict.layerIndex); +}; + +/** + * 添加条目 + */ +DictInfoDlg.addItem = function () { + $("#itemsArea").append(this.itemTemplate); + $("#dictItem").attr("id", this.newId()); +}; + +/** + * 删除item + */ +DictInfoDlg.deleteItem = function (event) { + var obj = Feng.eventParseObject(event); + obj = obj.is('button') ? obj : obj.parent(); + obj.parent().parent().remove(); +}; + +/** + * 清除为空的item Dom + */ +DictInfoDlg.clearNullDom = function(){ + $("[name='dictItem']").each(function(){ + var num = $(this).find("[name='itemNum']").val(); + var name = $(this).find("[name='itemName']").val(); + if(num == '' || name == ''){ + $(this).remove(); + } + }); +}; + +/** + * 收集添加字典的数据 + */ +DictInfoDlg.collectData = function () { + this.clearNullDom(); + var mutiString = ""; + $("[name='dictItem']").each(function(){ + var code = $(this).find("[name='itemCode']").val(); + var name = $(this).find("[name='itemName']").val(); + var num = $(this).find("[name='itemNum']").val(); + mutiString = mutiString + (code + ":" + name + ":"+ num+";"); + }); + this.dictName = $("#dictName").val(); + this.dictCode = $("#dictCode").val(); + this.dictTips = $("#dictTips").val(); + this.mutiString = mutiString; +}; + + +/** + * 提交添加字典 + */ +DictInfoDlg.addSubmit = function () { + this.collectData(); + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/dict/add", function (data) { + Feng.success("添加成功!"); + window.parent.Dict.table.refresh(); + DictInfoDlg.close(); + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set('dictName',this.dictName); + ajax.set('dictCode',this.dictCode); + ajax.set('dictTips',this.dictTips); + ajax.set('dictValues',this.mutiString); + ajax.start(); +}; + +/** + * 提交修改 + */ +DictInfoDlg.editSubmit = function () { + this.collectData(); + var ajax = new $ax(Feng.ctxPath + "/dict/update", function (data) { + Feng.success("修改成功!"); + window.parent.Dict.table.refresh(); + DictInfoDlg.close(); + }, function (data) { + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set('dictId',$("#dictId").val()); + ajax.set('dictName',this.dictName); + ajax.set('dictCode',this.dictCode); + ajax.set('dictTips',this.dictTips); + ajax.set('dictValues',this.mutiString); + ajax.start(); +}; diff --git a/user/guns-admin/src/main/webapp/static/modular/system/log/log.js b/user/guns-admin/src/main/webapp/static/modular/system/log/log.js new file mode 100644 index 0000000..d58951f --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/log/log.js @@ -0,0 +1,97 @@ +/** + * 日志管理初始化 + */ +var OptLog = { + id: "OptLogTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +OptLog.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '日志类型', field: 'logtype', align: 'center', valign: 'middle', sortable: true}, + {title: '日志名称', field: 'logname', align: 'center', valign: 'middle', sortable: true}, + // {title: '用户名称', field: 'userName', align: 'center', valign: 'middle', sortable: true, sortName: 'userid'}, + {title: '用户名称', field: 'userName', align: 'center', valign: 'middle'}, + {title: '类名', field: 'classname', align: 'center', valign: 'middle', sortable: true}, + {title: '方法名', field: 'method', align: 'center', valign: 'middle', sortable: true}, + {title: '时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true}, + {title: '具体消息', field: 'message', align: 'center', valign: 'middle', sortable: true}]; +}; + +/** + * 检查是否选中 + */ +OptLog.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if(selected.length == 0){ + Feng.info("请先选中表格中的某一记录!"); + return false; + }else{ + OptLog.seItem = selected[0]; + return true; + } +}; + +/** + * 查看日志详情 + */ +OptLog.detail = function () { + if (this.check()) { + var ajax = new $ax(Feng.ctxPath + "/log/detail/" + this.seItem.id, function (data) { + Feng.infoDetail("日志详情", data.regularMessage); + }, function (data) { + Feng.error("获取详情失败!"); + }); + ajax.start(); + } +}; + + +/** + * 清空日志 + */ +OptLog.delLog = function () { + Feng.confirm("是否清空所有日志?",function(){ + var ajax = Feng.baseAjax("/log/delLog","清空日志"); + ajax.start(); + OptLog.table.refresh(); + }); +} + +/** + * 查询表单提交参数对象 + * @returns {{}} + */ +OptLog.formParams = function() { + var queryData = {}; + + queryData['logName'] = $("#logName").val(); + queryData['beginTime'] = $("#beginTime").val(); + queryData['endTime'] = $("#endTime").val(); + queryData['logType'] = $("#logType").val(); + + return queryData; +} + +/** + * 查询日志列表 + */ +OptLog.search = function () { + + OptLog.table.refresh({query: OptLog.formParams()}); +}; + +$(function () { + var defaultColunms = OptLog.initColumn(); + var table = new BSTable(OptLog.id, "/log/list", defaultColunms); + table.setPaginationType("server"); + table.setQueryParams(OptLog.formParams()); + OptLog.table = table.init(); +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/log/login_log.js b/user/guns-admin/src/main/webapp/static/modular/system/log/login_log.js new file mode 100644 index 0000000..1afeb35 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/log/login_log.js @@ -0,0 +1,113 @@ +/** + * 日志管理初始化 + */ +var LoginLog = { + id: "LoginLogTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +LoginLog.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '日志名称', field: 'logname', align: 'center', valign: 'middle', sortable: true}, + {title: '用户名称', field: 'userName', align: 'center', valign: 'middle'}, + {title: '时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true}, + {title: '具体消息', field: 'message', align: 'center', valign: 'middle', sortable: true}, + {title: 'ip', field: 'ip', align: 'center', valign: 'middle', sortable: true}]; +}; + +/** + * 检查是否选中 + */ +LoginLog.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if (selected.length == 0) { + Feng.info("请先选中表格中的某一记录!"); + return false; + } else { + LoginLog.seItem = selected[0]; + return true; + } +}; + + +/** + * 清空日志 + */ +LoginLog.delLog = function () { + Feng.confirm("是否清空所有日志?", function () { + var ajax = Feng.baseAjax("/loginLog/delLoginLog", "清空日志"); + ajax.start(); + LoginLog.table.refresh(); + }); +} + +/** + * 查询日志列表 + */ +LoginLog.search = function () { + var queryData = {}; + + queryData['logName'] = $("#logName").val(); + queryData['beginTime'] = $("#beginTime").val(); + queryData['endTime'] = $("#endTime").val(); + + LoginLog.table.refresh({query: queryData}); +}; + +$(function () { + + init(); + + var defaultColunms = LoginLog.initColumn(); + var table = new BSTable(LoginLog.id, "/loginLog/list", defaultColunms); + table.setPaginationType("server"); + LoginLog.table = table.init(); +}); + +function init() { + + var BootstrapTable = $.fn.bootstrapTable.Constructor; + BootstrapTable.prototype.onSort = function (event) { + var $this = event.type === "keypress" ? $(event.currentTarget) : $(event.currentTarget).parent(), + $this_ = this.$header.find('th').eq($this.index()), + sortName = this.header.sortNames[$this.index()]; + + this.$header.add(this.$header_).find('span.order').remove(); + + if (this.options.sortName === $this.data('field')) { + this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc'; + } else { + this.options.sortName = sortName || $this.data('field'); + this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc'; + } + this.trigger('sort', this.options.sortName, this.options.sortOrder); + + $this.add($this_).data('order', this.options.sortOrder); + + // Assign the correct sortable arrow + this.getCaret(); + + if (this.options.sidePagination === 'server') { + this.initServer(this.options.silentSort); + return; + } + + this.initSort(); + this.initBody(); + }; + BootstrapTable.prototype.getCaret = function () { + var that = this; + + $.each(this.$header.find('th'), function (i, th) { + var sortName = that.header.sortNames[i]; + $(th).find('.sortable').removeClass('desc asc').addClass((sortName || $(th).data('field')) === that.options.sortName ? that.options.sortOrder : 'both'); + }); + }; +} diff --git a/user/guns-admin/src/main/webapp/static/modular/system/menu/menu.js b/user/guns-admin/src/main/webapp/static/modular/system/menu/menu.js new file mode 100644 index 0000000..79e65a1 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/menu/menu.js @@ -0,0 +1,119 @@ +/** + * 角色管理的单例 + */ +var Menu = { + id: "menuTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +Menu.initColumn = function () { + var columns = [ + {field: 'selectItem', radio: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '菜单名称', field: 'name', align: 'center', valign: 'middle', sortable: true}, + {title: '菜单编号', field: 'code', align: 'center', valign: 'middle', sortable: true}, + {title: '菜单父编号', field: 'pcode', align: 'center', valign: 'middle', sortable: true}, + {title: '请求地址', field: 'url', align: 'center', valign: 'middle', sortable: true}, + {title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true}, + {title: '层级', field: 'levels', align: 'center', valign: 'middle', sortable: true}, + {title: '是否是菜单', field: 'isMenuName', align: 'center', valign: 'middle', sortable: true}, + {title: '状态', field: 'statusName', align: 'center', valign: 'middle', sortable: true}] + return columns; +}; + + +/** + * 检查是否选中 + */ +Menu.check = function () { + var selected = $('#' + this.id).bootstrapTreeTable('getSelections'); + if (selected.length == 0) { + Feng.info("请先选中表格中的某一记录!"); + return false; + } else { + Menu.seItem = selected[0]; + return true; + } +}; + +/** + * 点击添加菜单 + */ +Menu.openAddMenu = function () { + var index = layer.open({ + type: 2, + title: '添加菜单', + area: ['830px', '450px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/menu/menu_add' + }); + this.layerIndex = index; +}; + +/** + * 点击修改 + */ +Menu.openChangeMenu = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '修改菜单', + area: ['800px', '450px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/menu/menu_edit/' + this.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 删除 + */ +Menu.delMenu = function () { + if (this.check()) { + + var operation = function () { + var ajax = new $ax(Feng.ctxPath + "/menu/remove", function (data) { + Feng.success("删除成功!"); + Menu.table.refresh(); + }, function (data) { + Feng.error("删除失败!" + data.responseJSON.message + "!"); + }); + ajax.set("menuId", Menu.seItem.id); + ajax.start(); + }; + + Feng.confirm("是否刪除该菜单?", operation); + } +}; + +/** + * 搜索 + */ +Menu.search = function () { + var queryData = {}; + + queryData['menuName'] = $("#menuName").val(); + queryData['level'] = $("#level").val(); + + Menu.table.refresh({query: queryData}); +} + +$(function () { + var defaultColunms = Menu.initColumn(); + var table = new BSTreeTable(Menu.id, "/menu/list", defaultColunms); + table.setExpandColumn(2); + table.setIdField("id"); + table.setCodeField("code"); + table.setParentCodeField("pcode"); + table.setExpandAll(true); + table.init(); + Menu.table = table; +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/menu/menu_info.js b/user/guns-admin/src/main/webapp/static/modular/system/menu/menu_info.js new file mode 100644 index 0000000..8fca601 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/menu/menu_info.js @@ -0,0 +1,175 @@ +/** + * 菜单详情对话框 + */ +var MenuInfoDlg = { + menuInfoData: {}, + ztreeInstance: null, + validateFields: { + name: { + validators: { + notEmpty: { + message: '菜单名称不能为空' + } + } + }, + code: { + validators: { + notEmpty: { + message: '菜单编号不能为空' + } + } + }, + pcodeName: { + validators: { + notEmpty: { + message: '父菜单不能为空' + } + } + }, + url: { + validators: { + notEmpty: { + message: '请求地址不能为空' + } + } + }, + num: { + validators: { + notEmpty: { + message: '序号不能为空' + } + } + } + } +}; + +/** + * 清除数据 + */ +MenuInfoDlg.clearData = function () { + this.menuInfoData = {}; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +MenuInfoDlg.set = function (key, value) { + this.menuInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + return this; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +MenuInfoDlg.get = function (key) { + return $("#" + key).val(); +} + +/** + * 关闭此对话框 + */ +MenuInfoDlg.close = function () { + parent.layer.close(window.parent.Menu.layerIndex); +} + +/** + * 收集数据 + */ +MenuInfoDlg.collectData = function () { + this.set('id').set('name').set('code').set('pcode').set('url').set('num').set('levels').set('icon').set("ismenu"); +} + +/** + * 验证数据是否为空 + */ +MenuInfoDlg.validate = function () { + $('#menuInfoForm').data("bootstrapValidator").resetForm(); + $('#menuInfoForm').bootstrapValidator('validate'); + return $("#menuInfoForm").data('bootstrapValidator').isValid(); +} + +/** + * 提交添加用户 + */ +MenuInfoDlg.addSubmit = function () { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/menu/add", function (data) { + Feng.success("添加成功!"); + window.parent.Menu.table.refresh(); + MenuInfoDlg.close(); + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.menuInfoData); + ajax.start(); +} + +/** + * 提交修改 + */ +MenuInfoDlg.editSubmit = function () { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/menu/edit", function (data) { + Feng.success("修改成功!"); + window.parent.Menu.table.refresh(); + MenuInfoDlg.close(); + }, function (data) { + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.menuInfoData); + ajax.start(); +} + +/** + * 点击父级编号input框时 + */ +MenuInfoDlg.onClickDept = function (e, treeId, treeNode) { + $("#pcodeName").attr("value", MenuInfoDlg.ztreeInstance.getSelectedVal()); + $("#pcode").attr("value", treeNode.id); +}; + + +/** + * 显示父级菜单选择的树 + */ +MenuInfoDlg.showMenuSelectTree = function () { + Feng.showInputTree("pcodeName", "pcodeTreeDiv", 15, 34); +}; + +$(function () { + Feng.initValidator("menuInfoForm", MenuInfoDlg.validateFields); + + var ztree = new $ZTree("pcodeTree", "/menu/selectMenuTreeList"); + ztree.bindOnClick(MenuInfoDlg.onClickDept); + ztree.init(); + MenuInfoDlg.ztreeInstance = ztree; + + //初始化是否是菜单 + if($("#ismenuValue").val() == undefined){ + $("#ismenu").val(0); + }else{ + $("#ismenu").val($("#ismenuValue").val()); + } +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/notice/notice.js b/user/guns-admin/src/main/webapp/static/modular/system/notice/notice.js new file mode 100644 index 0000000..fc5f730 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/notice/notice.js @@ -0,0 +1,106 @@ +/** + * 通知管理初始化 + */ +var Notice = { + id: "NoticeTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +Notice.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '标题', field: 'title', align: 'center', valign: 'middle', sortable: true}, + {title: '内容', field: 'content', align: 'center', valign: 'middle', sortable: true}, + {title: '发布者', field: 'createrName', align: 'center', valign: 'middle', sortable: true}, + {title: '创建时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true} + ]; +}; + +/** + * 检查是否选中 + */ +Notice.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if (selected.length == 0) { + Feng.info("请先选中表格中的某一记录!"); + return false; + } else { + Notice.seItem = selected[0]; + return true; + } +}; + +/** + * 点击添加通知 + */ +Notice.openAddNotice = function () { + var index = layer.open({ + type: 2, + title: '添加通知', + area: ['800px', '500px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/notice/notice_add' + }); + this.layerIndex = index; +}; + +/** + * 打开查看通知详情 + */ +Notice.openNoticeDetail = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '通知详情', + area: ['800px', '420px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/notice/notice_update/' + Notice.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 删除通知 + */ +Notice.delete = function () { + if (this.check()) { + + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/notice/delete", function (data) { + Feng.success("删除成功!"); + Notice.table.refresh(); + }, function (data) { + Feng.error("删除失败!" + data.responseJSON.message + "!"); + }); + ajax.set("noticeId", Notice.seItem.id); + ajax.start(); + }; + + Feng.confirm("是否删除通知 " + Notice.seItem.title + "?", operation); + } +}; + +/** + * 查询通知列表 + */ +Notice.search = function () { + var queryData = {}; + queryData['condition'] = $("#condition").val(); + Notice.table.refresh({query: queryData}); +}; + +$(function () { + var defaultColunms = Notice.initColumn(); + var table = new BSTable(Notice.id, "/notice/list", defaultColunms); + table.setPaginationType("client"); + Notice.table = table.init(); +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/notice/notice_info.js b/user/guns-admin/src/main/webapp/static/modular/system/notice/notice_info.js new file mode 100644 index 0000000..a376d48 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/notice/notice_info.js @@ -0,0 +1,127 @@ +/** + * 初始化通知详情对话框 + */ +var NoticeInfoDlg = { + noticeInfoData: {}, + editor: null, + validateFields: { + title: { + validators: { + notEmpty: { + message: '标题不能为空' + } + } + } + } +}; + +/** + * 清除数据 + */ +NoticeInfoDlg.clearData = function () { + this.noticeInfoData = {}; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +NoticeInfoDlg.set = function (key, value) { + this.noticeInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + return this; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +NoticeInfoDlg.get = function (key) { + return $("#" + key).val(); +} + +/** + * 关闭此对话框 + */ +NoticeInfoDlg.close = function () { + parent.layer.close(window.parent.Notice.layerIndex); +} + +/** + * 收集数据 + */ +NoticeInfoDlg.collectData = function () { + this.noticeInfoData['content'] = NoticeInfoDlg.editor.txt.html(); + this.set('id').set('title'); +} + +/** + * 验证数据是否为空 + */ +NoticeInfoDlg.validate = function () { + $('#noticeInfoForm').data("bootstrapValidator").resetForm(); + $('#noticeInfoForm').bootstrapValidator('validate'); + return $("#noticeInfoForm").data('bootstrapValidator').isValid(); +}; + +/** + * 提交添加 + */ +NoticeInfoDlg.addSubmit = function () { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/notice/add", function (data) { + Feng.success("添加成功!"); + window.parent.Notice.table.refresh(); + NoticeInfoDlg.close(); + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.noticeInfoData); + ajax.start(); +} + +/** + * 提交修改 + */ +NoticeInfoDlg.editSubmit = function () { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/notice/update", function (data) { + Feng.success("修改成功!"); + window.parent.Notice.table.refresh(); + NoticeInfoDlg.close(); + }, function (data) { + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.noticeInfoData); + ajax.start(); +} + +$(function () { + Feng.initValidator("noticeInfoForm", NoticeInfoDlg.validateFields); + + //初始化编辑器 + var E = window.wangEditor; + var editor = new E('#editor'); + editor.create(); + editor.txt.html($("#contentVal").val()); + NoticeInfoDlg.editor = editor; +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/role/role.js b/user/guns-admin/src/main/webapp/static/modular/system/role/role.js new file mode 100644 index 0000000..53788f2 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/role/role.js @@ -0,0 +1,125 @@ +/** + * 角色管理的单例 + */ +var Role = { + id: "roleTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +Role.initColumn = function () { + var columns = [ + {field: 'selectItem', radio: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '名称', field: 'name', align: 'center', valign: 'middle', sortable: true}, + {title: '上级角色', field: 'pName', align: 'center', valign: 'middle', sortable: true}, + {title: '所在部门', field: 'deptName', align: 'center', valign: 'middle', sortable: true}, + {title: '别名', field: 'tips', align: 'center', valign: 'middle', sortable: true}] + return columns; +}; + + +/** + * 检查是否选中 + */ +Role.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if (selected.length == 0) { + Feng.info("请先选中表格中的某一记录!"); + return false; + } else { + Role.seItem = selected[0]; + return true; + } +}; + +/** + * 点击添加管理员 + */ +Role.openAddRole = function () { + var index = layer.open({ + type: 2, + title: '添加角色', + area: ['800px', '450px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/role/role_add' + }); + this.layerIndex = index; +}; + +/** + * 点击修改按钮时 + */ +Role.openChangeRole = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '修改角色', + area: ['800px', '450px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/role/role_edit/' + this.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 删除角色 + */ +Role.delRole = function () { + if (this.check()) { + + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/role/remove", function () { + Feng.success("删除成功!"); + Role.table.refresh(); + }, function (data) { + Feng.error("删除失败!" + data.responseJSON.message + "!"); + }); + ajax.set("roleId", Role.seItem.id); + ajax.start(); + }; + + Feng.confirm("是否删除角色 " + Role.seItem.name + "?",operation); + } +}; + +/** + * 权限配置 + */ +Role.assign = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '权限配置', + area: ['300px', '450px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/role/role_assign/' + this.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 搜索角色 + */ +Role.search = function () { + var queryData = {}; + queryData['roleName'] = $("#roleName").val(); + Role.table.refresh({query: queryData}); +} + +$(function () { + var defaultColunms = Role.initColumn(); + var table = new BSTable(Role.id, "/role/list", defaultColunms); + table.setPaginationType("client"); + table.init(); + Role.table = table; +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/role/role_info.js b/user/guns-admin/src/main/webapp/static/modular/system/role/role_info.js new file mode 100644 index 0000000..7041b3f --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/role/role_info.js @@ -0,0 +1,194 @@ +/** + * 角色详情对话框(可用于添加和修改对话框) + */ +var RolInfoDlg = { + roleInfoData: {}, + deptZtree: null, + pNameZtree: null, + validateFields: { + name: { + validators: { + notEmpty: { + message: '用户名不能为空' + } + } + }, + tips: { + validators: { + notEmpty: { + message: '别名不能为空' + } + } + }, + pName: { + validators: { + notEmpty: { + message: '父级名称不能为空' + } + } + } + } +}; + +/** + * 清除数据 + */ +RolInfoDlg.clearData = function () { + this.roleInfoData = {}; +}; + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +RolInfoDlg.set = function (key, value) { + this.roleInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + return this; +}; + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +RolInfoDlg.get = function (key) { + return $("#" + key).val(); +}; + +/** + * 关闭此对话框 + */ +RolInfoDlg.close = function () { + parent.layer.close(window.parent.Role.layerIndex); +}; + +/** + * 点击部门input框时 + * + * @param e + * @param treeId + * @param treeNode + * @returns + */ +RolInfoDlg.onClickDept = function (e, treeId, treeNode) { + $("#deptName").attr("value", RolInfoDlg.deptZtree.getSelectedVal()); + $("#deptid").attr("value", treeNode.id); +}; +RolInfoDlg.onDblClickDept = function (e, treeId, treeNode) { + $("#deptName").attr("value", RolInfoDlg.deptZtree.getSelectedVal()); + $("#deptid").attr("value", treeNode.id); + $("#deptContent").fadeOut("fast"); +}; + +/** + * 点击父级菜单input框时 + * + * @param e + * @param treeId + * @param treeNode + * @returns + */ +RolInfoDlg.onClickPName = function (e, treeId, treeNode) { + $("#pName").attr("value", RolInfoDlg.pNameZtree.getSelectedVal()); + $("#pid").attr("value", treeNode.id); +}; + +/** + * 显示部门选择的树 + * + * @returns + */ +RolInfoDlg.showDeptSelectTree = function () { + Feng.showInputTree("deptName", "deptContent"); +}; + +/** + * 显示父级菜单的树 + * + * @returns + */ +RolInfoDlg.showPNameSelectTree = function () { + Feng.showInputTree("pName", "pNameContent"); +}; + +/** + * 收集数据 + */ +RolInfoDlg.collectData = function () { + this.set('id').set('name').set('pid').set('deptid').set('tips').set('num'); +}; + +/** + * 验证数据是否为空 + */ +RolInfoDlg.validate = function () { + $('#roleInfoForm').data("bootstrapValidator").resetForm(); + $('#roleInfoForm').bootstrapValidator('validate'); + return $("#roleInfoForm").data('bootstrapValidator').isValid(); +}; + +/** + * 提交添加用户 + */ +RolInfoDlg.addSubmit = function () { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/role/add", function (data) { + Feng.success("添加成功!"); + window.parent.Role.table.refresh(); + RolInfoDlg.close(); + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.roleInfoData); + ajax.start(); +}; + +/** + * 提交修改 + */ +RolInfoDlg.editSubmit = function () { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/role/edit", function (data) { + Feng.success("修改成功!"); + window.parent.Role.table.refresh(); + RolInfoDlg.close(); + }, function (data) { + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.roleInfoData); + ajax.start(); +}; + +$(function () { + Feng.initValidator("roleInfoForm", RolInfoDlg.validateFields); + + var deptTree = new $ZTree("deptTree", "/dept/tree"); + deptTree.bindOnClick(RolInfoDlg.onClickDept); + deptTree.bindOnDblClick(RolInfoDlg.onDblClickDept) + deptTree.init(); + RolInfoDlg.deptZtree = deptTree; + + var pNameTree = new $ZTree("pNameTree", "/role/roleTreeList"); + pNameTree.bindOnClick(RolInfoDlg.onClickPName); + pNameTree.init(); + RolInfoDlg.pNameZtree = pNameTree; +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/user/user.js b/user/guns-admin/src/main/webapp/static/modular/system/user/user.js new file mode 100644 index 0000000..63f3ca0 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/user/user.js @@ -0,0 +1,207 @@ +/** + * 系统管理--用户管理的单例对象 + */ +var MgrUser = { + id: "managerTable",//表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1, + deptid:0 +}; + +/** + * 初始化表格的列 + */ +MgrUser.initColumn = function () { + var columns = [ + {field: 'selectItem', radio: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '账号', field: 'account', align: 'center', valign: 'middle', sortable: true}, + {title: '姓名', field: 'name', align: 'center', valign: 'middle', sortable: true}, + {title: '性别', field: 'sexName', align: 'center', valign: 'middle', sortable: true}, + {title: '角色', field: 'roleName', align: 'center', valign: 'middle', sortable: true}, + {title: '部门', field: 'deptName', align: 'center', valign: 'middle', sortable: true}, + {title: '邮箱', field: 'email', align: 'center', valign: 'middle', sortable: true}, + {title: '电话', field: 'phone', align: 'center', valign: 'middle', sortable: true}, + {title: '创建时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true}, + {title: '状态', field: 'statusName', align: 'center', valign: 'middle', sortable: true}]; + return columns; +}; + +/** + * 检查是否选中 + */ +MgrUser.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if (selected.length == 0) { + Feng.info("请先选中表格中的某一记录!"); + return false; + } else { + MgrUser.seItem = selected[0]; + return true; + } +}; + +/** + * 点击添加管理员 + */ +MgrUser.openAddMgr = function () { + var index = layer.open({ + type: 2, + title: '添加管理员', + area: ['800px', '560px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/mgr/user_add' + }); + this.layerIndex = index; +}; + +/** + * 点击修改按钮时 + * @param userId 管理员id + */ +MgrUser.openChangeUser = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '编辑管理员', + area: ['800px', '450px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/mgr/user_edit/' + this.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 点击角色分配 + * @param + */ +MgrUser.roleAssign = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '角色分配', + area: ['300px', '400px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/mgr/role_assign/' + this.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 删除用户 + */ +MgrUser.delMgrUser = function () { + if (this.check()) { + + var operation = function(){ + var userId = MgrUser.seItem.id; + var ajax = new $ax(Feng.ctxPath + "/mgr/delete", function () { + Feng.success("删除成功!"); + MgrUser.table.refresh(); + }, function (data) { + Feng.error("删除失败!" + data.responseJSON.message + "!"); + }); + ajax.set("userId", userId); + ajax.start(); + }; + + Feng.confirm("是否删除用户" + MgrUser.seItem.account + "?",operation); + } +}; + +/** + * 冻结用户账户 + * @param userId + */ +MgrUser.freezeAccount = function () { + if (this.check()) { + var userId = this.seItem.id; + var ajax = new $ax(Feng.ctxPath + "/mgr/freeze", function (data) { + Feng.success("冻结成功!"); + MgrUser.table.refresh(); + }, function (data) { + Feng.error("冻结失败!" + data.responseJSON.message + "!"); + }); + ajax.set("userId", userId); + ajax.start(); + } +}; + +/** + * 解除冻结用户账户 + * @param userId + */ +MgrUser.unfreeze = function () { + if (this.check()) { + var userId = this.seItem.id; + var ajax = new $ax(Feng.ctxPath + "/mgr/unfreeze", function (data) { + Feng.success("解除冻结成功!"); + MgrUser.table.refresh(); + }, function (data) { + Feng.error("解除冻结失败!"); + }); + ajax.set("userId", userId); + ajax.start(); + } +} + +/** + * 重置密码 + */ +MgrUser.resetPwd = function () { + if (this.check()) { + var userId = this.seItem.id; + parent.layer.confirm('是否重置密码为111111?', { + btn: ['确定', '取消'], + shade: false //不显示遮罩 + }, function () { + var ajax = new $ax(Feng.ctxPath + "/mgr/reset", function (data) { + Feng.success("重置密码成功!"); + }, function (data) { + Feng.error("重置密码失败!"); + }); + ajax.set("userId", userId); + ajax.start(); + }); + } +}; + +MgrUser.resetSearch = function () { + $("#name").val(""); + $("#beginTime").val(""); + $("#endTime").val(""); + + MgrUser.search(); +} + +MgrUser.search = function () { + var queryData = {}; + + queryData['deptid'] = MgrUser.deptid; + queryData['name'] = $("#name").val(); + queryData['beginTime'] = $("#beginTime").val(); + queryData['endTime'] = $("#endTime").val(); + + MgrUser.table.refresh({query: queryData}); +} + +MgrUser.onClickDept = function (e, treeId, treeNode) { + MgrUser.deptid = treeNode.id; + MgrUser.search(); +}; + +$(function () { + var defaultColunms = MgrUser.initColumn(); + var table = new BSTable("managerTable", "/mgr/list", defaultColunms); + table.setPaginationType("client"); + MgrUser.table = table.init(); + var ztree = new $ZTree("deptTree", "/dept/tree"); + ztree.bindOnClick(MgrUser.onClickDept); + ztree.init(); +}); diff --git a/user/guns-admin/src/main/webapp/static/modular/system/user/user_info.js b/user/guns-admin/src/main/webapp/static/modular/system/user/user_info.js new file mode 100644 index 0000000..673c755 --- /dev/null +++ b/user/guns-admin/src/main/webapp/static/modular/system/user/user_info.js @@ -0,0 +1,290 @@ +/** + * 用户详情对话框(可用于添加和修改对话框) + */ +var UserInfoDlg = { + userInfoData: {}, + validateFields: { + account: { + validators: { + notEmpty: { + message: '账户不能为空' + } + } + }, + name: { + validators: { + notEmpty: { + message: '姓名不能为空' + } + } + }, + citySel: { + validators: { + notEmpty: { + message: '部门不能为空' + } + } + }, + password: { + validators: { + notEmpty: { + message: '密码不能为空' + }, + identical: { + field: 'rePassword', + message: '两次密码不一致' + }, + } + }, + rePassword: { + validators: { + notEmpty: { + message: '密码不能为空' + }, + identical: { + field: 'password', + message: '两次密码不一致' + }, + } + } + } +}; + +/** + * 清除数据 + */ +UserInfoDlg.clearData = function () { + this.userInfoData = {}; +}; + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +UserInfoDlg.set = function (key, value) { + if(typeof value == "undefined"){ + if(typeof $("#" + key).val() =="undefined"){ + var str=""; + var ids=""; + $("input[name='"+key+"']:checkbox").each(function(){ + if(true == $(this).is(':checked')){ + str+=$(this).val()+","; + } + }); + if(str){ + if(str.substr(str.length-1)== ','){ + ids = str.substr(0,str.length-1); + } + }else{ + $("input[name='"+key+"']:radio").each(function(){ + if(true == $(this).is(':checked')){ + ids=$(this).val() + } + }); + } + this.userInfoData[key] = ids; + }else{ + this.userInfoData[key]= $("#" + key).val(); + } + } + + return this; +}; + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +UserInfoDlg.get = function (key) { + return $("#" + key).val(); +}; + +/** + * 关闭此对话框 + */ +UserInfoDlg.close = function () { + parent.layer.close(window.parent.MgrUser.layerIndex); +}; + +/** + * 点击部门input框时 + * + * @param e + * @param treeId + * @param treeNode + * @returns + */ +UserInfoDlg.onClickDept = function (e, treeId, treeNode) { + $("#citySel").attr("value", instance.getSelectedVal()); + $("#deptid").attr("value", treeNode.id); +}; + +/** + * 显示部门选择的树 + * + * @returns + */ +UserInfoDlg.showDeptSelectTree = function () { + var cityObj = $("#citySel"); + var cityOffset = $("#citySel").offset(); + $("#menuContent").css({ + left: cityOffset.left + "px", + top: cityOffset.top + cityObj.outerHeight() + "px" + }).slideDown("fast"); + + $("body").bind("mousedown", onBodyDown); +}; + +/** + * 显示用户详情部门选择的树 + * + * @returns + */ +UserInfoDlg.showInfoDeptSelectTree = function () { + var cityObj = $("#citySel"); + var cityPosition = $("#citySel").position(); + $("#menuContent").css({ + left: cityPosition.left + "px", + top: cityPosition.top + cityObj.outerHeight() + "px" + }).slideDown("fast"); + + $("body").bind("mousedown", onBodyDown); +}; + +/** + * 隐藏部门选择的树 + */ +UserInfoDlg.hideDeptSelectTree = function () { + $("#menuContent").fadeOut("fast"); + $("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起 +}; + +/** + * 收集数据 + */ +UserInfoDlg.collectData = function () { + this.set('id').set('account').set('sex').set('password').set('avatar') + .set('email').set('name').set('birthday').set('rePassword').set('deptid').set('phone'); +}; + +/** + * 验证两个密码是否一致 + */ +UserInfoDlg.validatePwd = function () { + var password = this.get("password"); + var rePassword = this.get("rePassword"); + if (password == rePassword) { + return true; + } else { + return false; + } +}; + +/** + * 验证数据是否为空 + */ +UserInfoDlg.validate = function () { + $('#userInfoForm').data("bootstrapValidator").resetForm(); + $('#userInfoForm').bootstrapValidator('validate'); + return $("#userInfoForm").data('bootstrapValidator').isValid(); +}; + +/** + * 提交添加用户 + */ +UserInfoDlg.addSubmit = function () { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + if (!this.validatePwd()) { + Feng.error("两次密码输入不一致"); + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/mgr/add", function (data) { + Feng.success("添加成功!"); + window.parent.MgrUser.table.refresh(); + UserInfoDlg.close(); + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.userInfoData); + ajax.start(); +}; + +/** + * 提交修改 + */ +UserInfoDlg.editSubmit = function () { + + this.clearData(); + this.collectData(); + + if (!this.validate()) { + return; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/mgr/edit", function (data) { + Feng.success("修改成功!"); + if (window.parent.MgrUser != undefined) { + window.parent.MgrUser.table.refresh(); + UserInfoDlg.close(); + } + }, function (data) { + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.userInfoData); + ajax.start(); +}; + +/** + * 修改密码 + */ +UserInfoDlg.chPwd = function () { + var ajax = new $ax(Feng.ctxPath + "/mgr/changePwd", function (data) { + Feng.success("修改成功!"); + }, function (data) { + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set("oldPwd"); + ajax.set("newPwd"); + ajax.set("rePwd"); + ajax.start(); + +}; + +function onBodyDown(event) { + if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $( + event.target).parents("#menuContent").length > 0)) { + UserInfoDlg.hideDeptSelectTree(); + } +} + +$(function () { + Feng.initValidator("userInfoForm", UserInfoDlg.validateFields); + + //初始化性别选项 + $("#sex").val($("#sexValue").val()); + + var ztree = new $ZTree("treeDemo", "/dept/tree"); + ztree.bindOnClick(UserInfoDlg.onClickDept); + ztree.init(); + instance = ztree; + + // 初始化头像上传 + var avatarUp = new $WebUpload("avatar"); + avatarUp.setUploadBarId("progressBar"); + avatarUp.init(); + +}); diff --git a/user/guns-admin/src/test/sql/test.sql b/user/guns-admin/src/test/sql/test.sql new file mode 100644 index 0000000..04b15ca --- /dev/null +++ b/user/guns-admin/src/test/sql/test.sql @@ -0,0 +1,35 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 50719 + Source Host : localhost:3306 + Source Schema : guns + + Target Server Type : MySQL + Target Server Version : 50719 + File Encoding : 65001 + + Date: 10/07/2018 14:09:19 +*/ + +DROP DATABASE IF EXISTS guns_test; +CREATE DATABASE IF NOT EXISTS guns_test DEFAULT CHARSET utf8 COLLATE utf8_general_ci; + +use guns_test; + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for test +-- ---------------------------- +DROP TABLE IF EXISTS `test`; +CREATE TABLE `test` ( + `aaa` int(11) NOT NULL AUTO_INCREMENT, + `bbb` varchar(255) DEFAULT NULL, + PRIMARY KEY (`aaa`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/user/guns-core/pom.xml b/user/guns-core/pom.xml new file mode 100644 index 0000000..5051270 --- /dev/null +++ b/user/guns-core/pom.xml @@ -0,0 +1,110 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>com.stylefeng</groupId> + <artifactId>guns-parent</artifactId> + <version>1.0.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>guns-core</artifactId> + <packaging>jar</packaging> + + <name>guns-core</name> + <url>http://maven.apache.org</url> + + <dependencies> + + <!--通用依赖--> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatisplus-spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatis-plus</artifactId> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + </dependency> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jdbc</artifactId> + </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>druid</artifactId> + </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>fastjson</artifactId> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + + <!--web--> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <scope>provided</scope> + </dependency> + + <!--aop--> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-aop</artifactId> + <scope>provided</scope> + </dependency> + + <!--二维码--> + <dependency> + <groupId>com.google.zxing</groupId> + <artifactId>core</artifactId> + <scope>provided</scope> + </dependency> + + <!--缓存--> + <dependency> + <groupId>org.ehcache</groupId> + <artifactId>ehcache</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-cache</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>net.sf.ehcache</groupId> + <artifactId>ehcache-core</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + <optional>true</optional> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + </resources> + </build> +</project> diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/CoreFlag.java b/user/guns-core/src/main/java/com/agentdriving/user/core/CoreFlag.java new file mode 100644 index 0000000..5c63e10 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/CoreFlag.java @@ -0,0 +1,11 @@ +package com.agentdriving.user.core; + +/** + * 此类用来获取core模块的包路径 + * + * @author fengshuonan + * @Date 2017/12/5 下午12:44 + */ +public class CoreFlag { + +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/aop/BaseControllerExceptionHandler.java b/user/guns-core/src/main/java/com/agentdriving/user/core/aop/BaseControllerExceptionHandler.java new file mode 100644 index 0000000..ca0f89a --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/aop/BaseControllerExceptionHandler.java @@ -0,0 +1,45 @@ +package com.agentdriving.user.core.aop; + +import com.agentdriving.user.core.base.tips.ErrorTip; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.exception.GunsExceptionEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +/** + * 全局的的异常拦截器(拦截所有的控制器)(带有@RequestMapping注解的方法上都会拦截) + * + * @author fengshuonan + * @date 2016年11月12日 下午3:19:56 + */ +public class BaseControllerExceptionHandler { + + private Logger log = LoggerFactory.getLogger(this.getClass()); + + /** + * 拦截业务异常 + */ + @ExceptionHandler(GunsException.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + @ResponseBody + public ErrorTip notFount(GunsException e) { + log.error("业务异常:", e); + return new ErrorTip(e.getCode(), e.getMessage()); + } + + /** + * 拦截未知的运行时异常 + */ + @ExceptionHandler(RuntimeException.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + @ResponseBody + public ErrorTip notFount(RuntimeException e) { + log.error("运行时异常:", e); + return new ErrorTip(GunsExceptionEnum.SERVER_ERROR.getCode(), GunsExceptionEnum.SERVER_ERROR.getMessage()); + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/BaseController.java b/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/BaseController.java new file mode 100644 index 0000000..306c415 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/BaseController.java @@ -0,0 +1,127 @@ +package com.agentdriving.user.core.base.controller; + +import com.agentdriving.user.core.base.tips.SuccessTip; +import com.agentdriving.user.core.base.warpper.BaseControllerWarpper; +import com.baomidou.mybatisplus.plugins.Page; +import com.agentdriving.user.core.page.PageInfoBT; +import com.agentdriving.user.core.support.HttpKit; +import com.agentdriving.user.core.util.FileUtil; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.UnsupportedEncodingException; + +public class BaseController { + + protected static String SUCCESS = "SUCCESS"; + protected static String ERROR = "ERROR"; + + protected static String REDIRECT = "redirect:"; + protected static String FORWARD = "forward:"; + + protected static SuccessTip SUCCESS_TIP = new SuccessTip(); + + protected HttpServletRequest getHttpServletRequest() { + return HttpKit.getRequest(); + } + + protected HttpServletResponse getHttpServletResponse() { + return HttpKit.getResponse(); + } + + protected HttpSession getSession() { + return HttpKit.getRequest().getSession(); + } + + protected HttpSession getSession(Boolean flag) { + return HttpKit.getRequest().getSession(flag); + } + + protected String getPara(String name) { + return HttpKit.getRequest().getParameter(name); + } + + protected void setAttr(String name, Object value) { + HttpKit.getRequest().setAttribute(name, value); + } + + protected Integer getSystemInvokCount() { + return (Integer) this.getHttpServletRequest().getServletContext().getAttribute("systemCount"); + } + + /** + * 把service层的分页信息,封装为bootstrap table通用的分页封装 + */ + protected <T> PageInfoBT<T> packForBT(Page<T> page) { + return new PageInfoBT<T>(page); + } + + /** + * 包装一个list,让list增加额外属性 + */ + protected Object warpObject(BaseControllerWarpper warpper) { + return warpper.warp(); + } + + /** + * 删除cookie + */ + protected void deleteCookieByName(String cookieName) { + Cookie[] cookies = this.getHttpServletRequest().getCookies(); + for (Cookie cookie : cookies) { + if (cookie.getName().equals(cookieName)) { + Cookie temp = new Cookie(cookie.getName(), ""); + temp.setMaxAge(0); + this.getHttpServletResponse().addCookie(temp); + } + } + } + + /** + * 删除所有cookie + */ + protected void deleteAllCookie() { + Cookie[] cookies = this.getHttpServletRequest().getCookies(); + for (Cookie cookie : cookies) { + Cookie temp = new Cookie(cookie.getName(), ""); + temp.setMaxAge(0); + this.getHttpServletResponse().addCookie(temp); + } + } + + /** + * 返回前台文件流 + * + * @author fengshuonan + * @date 2017年2月28日 下午2:53:19 + */ + protected ResponseEntity<byte[]> renderFile(String fileName, String filePath) { + byte[] bytes = FileUtil.toByteArray(filePath); + return renderFile(fileName, bytes); + } + + /** + * 返回前台文件流 + * + * @author fengshuonan + * @date 2017年2月28日 下午2:53:19 + */ + protected ResponseEntity<byte[]> renderFile(String fileName, byte[] fileBytes) { + String dfileName = null; + try { + dfileName = new String(fileName.getBytes("gb2312"), "iso8859-1"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); + headers.setContentDispositionFormData("attachment", dfileName); + return new ResponseEntity<byte[]>(fileBytes, headers, HttpStatus.CREATED); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GlobalController.java b/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GlobalController.java new file mode 100644 index 0000000..e0603d0 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GlobalController.java @@ -0,0 +1,37 @@ +package com.agentdriving.user.core.base.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 全局的控制器 + * + * @author fengshuonan + * @date 2016年11月13日 下午11:04:45 + */ +@Controller +@RequestMapping("/global") +public class GlobalController { + + /** + * 跳转到404页面 + * + * @author fengshuonan + */ + @RequestMapping(path = "/error") + public String errorPage() { + return "/404.html"; + } + + /** + * 跳转到session超时页面 + * + * @author fengshuonan + */ + @RequestMapping(path = "/sessionError") + public String errorPageInfo(Model model) { + model.addAttribute("tips", "session超时"); + return "/login.html"; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GunsErrorView.java b/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GunsErrorView.java new file mode 100644 index 0000000..4797126 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GunsErrorView.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.core.base.controller; + +import org.springframework.web.servlet.View; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +/** + * 错误页面的默认跳转(例如请求404的时候,默认走这个视图解析器) + * + * @author fengshuonan + * @date 2017-05-21 11:34 + */ +public class GunsErrorView implements View { + + @Override + public String getContentType() { + return "text/html"; + } + + @Override + public void render(Map<String, ?> map, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + httpServletRequest.getRequestDispatcher("/global/error").forward(httpServletRequest, httpServletResponse); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/ErrorTip.java b/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/ErrorTip.java new file mode 100644 index 0000000..0f85fc2 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/ErrorTip.java @@ -0,0 +1,16 @@ +package com.agentdriving.user.core.base.tips; + +/** + * 返回给前台的错误提示 + * + * @author fengshuonan + * @date 2016年11月12日 下午5:05:22 + */ +public class ErrorTip extends Tip { + + public ErrorTip(int code, String message) { + super(); + this.code = code; + this.message = message; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/SuccessTip.java b/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/SuccessTip.java new file mode 100644 index 0000000..810de70 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/SuccessTip.java @@ -0,0 +1,15 @@ +package com.agentdriving.user.core.base.tips; + +/** + * 返回给前台的成功提示 + * + * @author fengshuonan + * @date 2016年11月12日 下午5:05:22 + */ +public class SuccessTip extends Tip { + + public SuccessTip(){ + super.code = 200; + super.message = "操作成功"; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/Tip.java b/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/Tip.java new file mode 100644 index 0000000..581cc21 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/Tip.java @@ -0,0 +1,29 @@ +package com.agentdriving.user.core.base.tips; + +/** + * 返回给前台的提示(最终转化为json形式) + * + * @author fengshuonan + * @Date 2017年1月11日 下午11:58:00 + */ +public abstract class Tip { + + protected int code; + protected String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/base/warpper/BaseControllerWarpper.java b/user/guns-core/src/main/java/com/agentdriving/user/core/base/warpper/BaseControllerWarpper.java new file mode 100644 index 0000000..0502d16 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/base/warpper/BaseControllerWarpper.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.core.base.warpper; + +import java.util.List; +import java.util.Map; + +/** + * 控制器查询结果的包装类基类 + * + * @author fengshuonan + * @date 2017年2月13日 下午10:49:36 + */ +public abstract class BaseControllerWarpper { + + public Object obj = null; + + public BaseControllerWarpper(Object obj) { + this.obj = obj; + } + + @SuppressWarnings("unchecked") + public Object warp() { + if (this.obj instanceof List) { + List<Map<String, Object>> list = (List<Map<String, Object>>) this.obj; + for (Map<String, Object> map : list) { + warpTheMap(map); + } + return list; + } else if (this.obj instanceof Map) { + Map<String, Object> map = (Map<String, Object>) this.obj; + warpTheMap(map); + return map; + } else { + return this.obj; + } + } + + protected abstract void warpTheMap(Map<String, Object> map); +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/cache/BaseCacheFactory.java b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/BaseCacheFactory.java new file mode 100644 index 0000000..63e8b5e --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/BaseCacheFactory.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * + * 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. + */ +package com.agentdriving.user.core.cache; + + +/** + * 缓存工厂基类 + */ +public abstract class BaseCacheFactory implements ICache { + + @SuppressWarnings("unchecked") + public <T> T get(String cacheName, Object key, ILoader iLoader) { + Object data = get(cacheName, key); + if (data == null) { + data = iLoader.load(); + put(cacheName, key, data); + } + return (T) data; + } + + @SuppressWarnings("unchecked") + public <T> T get(String cacheName, Object key, Class<? extends ILoader> iLoaderClass) { + Object data = get(cacheName, key); + if (data == null) { + try { + ILoader dataLoader = iLoaderClass.newInstance(); + data = dataLoader.load(); + put(cacheName, key, data); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + return (T) data; + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/cache/CacheKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/CacheKit.java new file mode 100644 index 0000000..ef53f23 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/CacheKit.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * + * 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. + */ + +package com.agentdriving.user.core.cache; + +import java.util.List; + +/** + * 缓存工具类 + */ +public class CacheKit { + + private static ICache defaultCacheFactory = new EhcacheFactory(); + + public static void put(String cacheName, Object key, Object value) { + defaultCacheFactory.put(cacheName, key, value); + } + + public static <T> T get(String cacheName, Object key) { + return defaultCacheFactory.get(cacheName, key); + } + + @SuppressWarnings("rawtypes") + public static List getKeys(String cacheName) { + return defaultCacheFactory.getKeys(cacheName); + } + + public static void remove(String cacheName, Object key) { + defaultCacheFactory.remove(cacheName, key); + } + + public static void removeAll(String cacheName) { + defaultCacheFactory.removeAll(cacheName); + } + + public static <T> T get(String cacheName, Object key, ILoader iLoader) { + return defaultCacheFactory.get(cacheName, key, iLoader); + } + + public static <T> T get(String cacheName, Object key, Class<? extends ILoader> iLoaderClass) { + return defaultCacheFactory.get(cacheName, key, iLoaderClass); + } + +} + + diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/cache/EhcacheFactory.java b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/EhcacheFactory.java new file mode 100644 index 0000000..9fa4636 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/EhcacheFactory.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) 2011-2016, James Zhan 詹波 (jfinal@126.com). + * + * 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. + */ +package com.agentdriving.user.core.cache; + +import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; +import net.sf.ehcache.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +/** + * Ehcache缓存工厂 + */ +public class EhcacheFactory extends BaseCacheFactory { + + private static CacheManager cacheManager; + private static volatile Object locker = new Object(); + private static final Logger log = LoggerFactory.getLogger(EhcacheFactory.class); + + private static CacheManager getCacheManager() { + if (cacheManager == null) { + synchronized (EhcacheFactory.class) { + if (cacheManager == null) { + cacheManager = CacheManager.create(); + } + } + } + return cacheManager; + } + + static Cache getOrAddCache(String cacheName) { + CacheManager cacheManager = getCacheManager(); + Cache cache = cacheManager.getCache(cacheName); + if (cache == null) { + synchronized(locker) { + cache = cacheManager.getCache(cacheName); + if (cache == null) { + log.warn("无法找到缓存 [" + cacheName + "]的配置, 使用默认配置."); + cacheManager.addCacheIfAbsent(cacheName); + cache = cacheManager.getCache(cacheName); + log.debug("缓存 [" + cacheName + "] 启动."); + } + } + } + return cache; + } + + public void put(String cacheName, Object key, Object value) { + getOrAddCache(cacheName).put(new Element(key, value)); + } + + @SuppressWarnings("unchecked") + public <T> T get(String cacheName, Object key) { + Element element = getOrAddCache(cacheName).get(key); + return element != null ? (T)element.getObjectValue() : null; + } + + @SuppressWarnings("rawtypes") + public List getKeys(String cacheName) { + return getOrAddCache(cacheName).getKeys(); + } + + public void remove(String cacheName, Object key) { + getOrAddCache(cacheName).remove(key); + } + + public void removeAll(String cacheName) { + getOrAddCache(cacheName).removeAll(); + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/cache/ICache.java b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/ICache.java new file mode 100644 index 0000000..7a40aca --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/ICache.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * + * 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. + */ +package com.agentdriving.user.core.cache; + +import java.util.List; + +/** + * 通用缓存接口 + */ +public interface ICache { + + void put(String cacheName, Object key, Object value); + + <T> T get(String cacheName, Object key); + + @SuppressWarnings("rawtypes") + List getKeys(String cacheName); + + void remove(String cacheName, Object key); + + void removeAll(String cacheName); + + <T> T get(String cacheName, Object key, ILoader iLoader); + + <T> T get(String cacheName, Object key, Class<? extends ILoader> iLoaderClass); + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/cache/ILoader.java b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/ILoader.java new file mode 100644 index 0000000..f8baf89 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/cache/ILoader.java @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * + * 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. + */ +package com.agentdriving.user.core.cache; + +/** + * 数据重载 + */ +public interface ILoader { + Object load(); +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultFastjsonConfig.java b/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultFastjsonConfig.java new file mode 100644 index 0000000..65efc73 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultFastjsonConfig.java @@ -0,0 +1,81 @@ +package com.agentdriving.user.core.config; + +import com.alibaba.fastjson.serializer.SerializeConfig; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.alibaba.fastjson.serializer.ToStringSerializer; +import com.alibaba.fastjson.serializer.ValueFilter; +import com.alibaba.fastjson.support.config.FastJsonConfig; +import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; + +import java.math.BigInteger; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; + +/** + * fastjson配置类 + * + * @author fengshuonan + * @date 2017-05-23 22:56 + */ +@Configuration("defaultFastjsonConfig") +@ConditionalOnClass(com.alibaba.fastjson.JSON.class) +@ConditionalOnMissingBean(FastJsonHttpMessageConverter.class) +@ConditionalOnWebApplication +public class DefaultFastjsonConfig { + + @Bean + public FastJsonHttpMessageConverter fastJsonHttpMessageConverter() { + FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); + converter.setFastJsonConfig(fastjsonConfig()); + converter.setSupportedMediaTypes(getSupportedMediaType()); + return converter; + } + + /** + * fastjson的配置 + */ + public FastJsonConfig fastjsonConfig() { + FastJsonConfig fastJsonConfig = new FastJsonConfig(); + fastJsonConfig.setSerializerFeatures( + SerializerFeature.PrettyFormat, + SerializerFeature.WriteMapNullValue, + SerializerFeature.WriteEnumUsingToString + ); + fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss"); + ValueFilter valueFilter = new ValueFilter() { + public Object process(Object o, String s, Object o1) { + if (null == o1) { + o1 = ""; + } + return o1; + } + }; + fastJsonConfig.setCharset(Charset.forName("utf-8")); + fastJsonConfig.setSerializeFilters(valueFilter); + + //解决Long转json精度丢失的问题 + SerializeConfig serializeConfig = SerializeConfig.globalInstance; + serializeConfig.put(BigInteger.class, ToStringSerializer.instance); + serializeConfig.put(Long.class, ToStringSerializer.instance); + serializeConfig.put(Long.TYPE, ToStringSerializer.instance); + fastJsonConfig.setSerializeConfig(serializeConfig); + return fastJsonConfig; + } + + /** + * 支持的mediaType类型 + */ + public List<MediaType> getSupportedMediaType() { + ArrayList<MediaType> mediaTypes = new ArrayList<>(); + mediaTypes.add(MediaType.APPLICATION_JSON_UTF8); + return mediaTypes; + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultMultiConfig.java b/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultMultiConfig.java new file mode 100644 index 0000000..4fd894d --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultMultiConfig.java @@ -0,0 +1,22 @@ +package com.agentdriving.user.core.config; + +import com.agentdriving.user.core.mutidatasource.aop.MultiSourceExAop; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 多数据源配置 + * + * @author stylefeng + * @Date 2017/5/20 21:58 + */ +@Configuration +@ConditionalOnProperty(prefix = "guns", name = "muti-datasource-open", havingValue = "true") +public class DefaultMultiConfig { + + @Bean + public MultiSourceExAop multiSourceExAop() { + return new MultiSourceExAop(); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultProperties.java b/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultProperties.java new file mode 100644 index 0000000..d02187a --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultProperties.java @@ -0,0 +1,25 @@ +package com.agentdriving.user.core.config; + +import com.agentdriving.user.core.config.properties.DruidProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +/** + * 默认的配置 + * + * @author fengshuonan + * @date 2018-01-07 12:33 + */ +@Configuration +@PropertySource("classpath:/default-config.properties") +public class DefaultProperties { + + @Bean + @ConfigurationProperties(prefix = "spring.datasource") + public DruidProperties druidProperties() { + return new DruidProperties(); + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultWebConfig.java b/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultWebConfig.java new file mode 100644 index 0000000..fee9f94 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultWebConfig.java @@ -0,0 +1,65 @@ +package com.agentdriving.user.core.config; + +import com.agentdriving.user.core.base.controller.GunsErrorView; +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.exception.GunsExceptionEnum; +import com.agentdriving.user.core.util.DateUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.convert.support.GenericConversionService; +import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; + +import javax.annotation.PostConstruct; +import java.util.Date; +import java.util.regex.Pattern; + +@Configuration +public class DefaultWebConfig extends WebMvcConfigurationSupport { + + @Autowired + private RequestMappingHandlerAdapter handlerAdapter; + + @Bean("error") + public GunsErrorView error() { + return new GunsErrorView(); + } + + @PostConstruct + public void addConversionConfig() { + ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer) handlerAdapter.getWebBindingInitializer(); + GenericConversionService genericConversionService = (GenericConversionService) initializer.getConversionService(); + genericConversionService.addConverter(new StringToDateConverter()); + } + + public class StringToDateConverter implements Converter<String, Date> { + + @Override + public Date convert(String dateString) { + + String patternDate = "\\d{4}-\\d{1,2}-\\d{1,2}"; + String patternTimeMinutes = "\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}"; + String patternTimeSeconds = "\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}"; + + boolean dateFlag = Pattern.matches(patternDate, dateString); + boolean timeMinutesFlag = Pattern.matches(patternTimeMinutes, dateString); + boolean timeSecondsFlag = Pattern.matches(patternTimeSeconds, dateString); + + if (dateFlag) { + return DateUtil.parseDate(dateString); + } else if (timeMinutesFlag) { + return DateUtil.parseTimeMinutes(dateString); + } else if (timeSecondsFlag) { + return DateUtil.parseTime(dateString); + } else { + throw new GunsException(GunsExceptionEnum.INVLIDE_DATE_STRING); + } + + } + } +} + + diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/DruidProperties.java b/user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/DruidProperties.java new file mode 100644 index 0000000..847673b --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/DruidProperties.java @@ -0,0 +1,217 @@ +package com.agentdriving.user.core.config.properties; + +import com.alibaba.druid.pool.DruidDataSource; + +import java.sql.SQLException; + +/** + * <p>数据库数据源配置</p> + * <p>说明:这个类中包含了许多默认配置,若这些配置符合您的情况,您可以不用管,若不符合,建议不要修改本类,建议直接在"application.yml"中配置即可</p> + * @author stylefeng + * @date 2017-05-21 11:18 + */ +public class DruidProperties { + + private String url = "jdbc:mysql://127.0.0.1:3306/guns?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull"; + + private String username = "root"; + + private String password = "root"; + + private String driverClassName = "com.mysql.cj.jdbc.Driver"; + + private Integer initialSize = 2; + + private Integer minIdle = 1; + + private Integer maxActive = 20; + + private Integer maxWait = 60000; + + private Integer timeBetweenEvictionRunsMillis = 60000; + + private Integer minEvictableIdleTimeMillis = 300000; + + private String validationQuery = "SELECT 'x'"; + + private Boolean testWhileIdle = true; + + private Boolean testOnBorrow = false; + + private Boolean testOnReturn = false; + + private Boolean poolPreparedStatements = true; + + private Integer maxPoolPreparedStatementPerConnectionSize = 20; + + private String filters = "stat"; + + public void config(DruidDataSource dataSource) { + + dataSource.setUrl(url); + dataSource.setUsername(username); + dataSource.setPassword(password); + + dataSource.setDriverClassName(driverClassName); + dataSource.setInitialSize(initialSize); //定义初始连接数 + dataSource.setMinIdle(minIdle); //最小空闲 + dataSource.setMaxActive(maxActive); //定义最大连接数 + dataSource.setMaxWait(maxWait); //最长等待时间 + + // 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + dataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + + // 配置一个连接在池中最小生存的时间,单位是毫秒 + dataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); + dataSource.setValidationQuery(validationQuery); + dataSource.setTestWhileIdle(testWhileIdle); + dataSource.setTestOnBorrow(testOnBorrow); + dataSource.setTestOnReturn(testOnReturn); + + // 打开PSCache,并且指定每个连接上PSCache的大小 + dataSource.setPoolPreparedStatements(poolPreparedStatements); + dataSource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize); + + try { + dataSource.setFilters(filters); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getDriverClassName() { + return driverClassName; + } + + public void setDriverClassName(String driverClassName) { + this.driverClassName = driverClassName; + } + + public Integer getInitialSize() { + return initialSize; + } + + public void setInitialSize(Integer initialSize) { + this.initialSize = initialSize; + } + + public Integer getMinIdle() { + return minIdle; + } + + public void setMinIdle(Integer minIdle) { + this.minIdle = minIdle; + } + + public Integer getMaxActive() { + return maxActive; + } + + public void setMaxActive(Integer maxActive) { + this.maxActive = maxActive; + } + + public Integer getMaxWait() { + return maxWait; + } + + public void setMaxWait(Integer maxWait) { + this.maxWait = maxWait; + } + + public Integer getTimeBetweenEvictionRunsMillis() { + return timeBetweenEvictionRunsMillis; + } + + public void setTimeBetweenEvictionRunsMillis(Integer timeBetweenEvictionRunsMillis) { + this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; + } + + public Integer getMinEvictableIdleTimeMillis() { + return minEvictableIdleTimeMillis; + } + + public void setMinEvictableIdleTimeMillis(Integer minEvictableIdleTimeMillis) { + this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; + } + + public String getValidationQuery() { + return validationQuery; + } + + public void setValidationQuery(String validationQuery) { + this.validationQuery = validationQuery; + } + + public Boolean getTestWhileIdle() { + return testWhileIdle; + } + + public void setTestWhileIdle(Boolean testWhileIdle) { + this.testWhileIdle = testWhileIdle; + } + + public Boolean getTestOnBorrow() { + return testOnBorrow; + } + + public void setTestOnBorrow(Boolean testOnBorrow) { + this.testOnBorrow = testOnBorrow; + } + + public Boolean getTestOnReturn() { + return testOnReturn; + } + + public void setTestOnReturn(Boolean testOnReturn) { + this.testOnReturn = testOnReturn; + } + + public Boolean getPoolPreparedStatements() { + return poolPreparedStatements; + } + + public void setPoolPreparedStatements(Boolean poolPreparedStatements) { + this.poolPreparedStatements = poolPreparedStatements; + } + + public Integer getMaxPoolPreparedStatementPerConnectionSize() { + return maxPoolPreparedStatementPerConnectionSize; + } + + public void setMaxPoolPreparedStatementPerConnectionSize(Integer maxPoolPreparedStatementPerConnectionSize) { + this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize; + } + + public String getFilters() { + return filters; + } + + public void setFilters(String filters) { + this.filters = filters; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/MutiDataSourceProperties.java b/user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/MutiDataSourceProperties.java new file mode 100644 index 0000000..e8ce977 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/MutiDataSourceProperties.java @@ -0,0 +1,80 @@ +package com.agentdriving.user.core.config.properties; + +import com.alibaba.druid.pool.DruidDataSource; + +/** + * 默认多数据源配置 + * + * @author fengshuonan + * @date 2017-08-16 10:02 + */ +public class MutiDataSourceProperties { + + private String url = "jdbc:mysql://127.0.0.1:3306/biz?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull"; + + private String username = "root"; + + private String password = "root"; + + private String driverClassName = "com.mysql.cj.jdbc.Driver"; + + private String validationQuery = "SELECT 'x'"; + + private String[] dataSourceNames = {"dataSourceGuns", "dataSourceBiz"}; + + public void config(DruidDataSource dataSource) { + dataSource.setUrl(url); + dataSource.setUsername(username); + dataSource.setPassword(password); + dataSource.setDriverClassName(driverClassName); + dataSource.setValidationQuery(validationQuery); + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getDriverClassName() { + return driverClassName; + } + + public void setDriverClassName(String driverClassName) { + this.driverClassName = driverClassName; + } + + public String getValidationQuery() { + return validationQuery; + } + + public void setValidationQuery(String validationQuery) { + this.validationQuery = validationQuery; + } + + public String[] getDataSourceNames() { + return dataSourceNames; + } + + public void setDataSourceNames(String[] dataSourceNames) { + this.dataSourceNames = dataSourceNames; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/constant/IsMenu.java b/user/guns-core/src/main/java/com/agentdriving/user/core/constant/IsMenu.java new file mode 100644 index 0000000..6c7451c --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/constant/IsMenu.java @@ -0,0 +1,50 @@ +package com.agentdriving.user.core.constant; + +/** + * 是否是菜单的枚举 + * + * @author fengshuonan + * @date 2017年6月1日22:50:11 + */ +public enum IsMenu { + + YES(1, "是"), + NO(0, "不是"); //不是菜单的是按钮 + + int code; + String message; + + IsMenu(int code, String message) { + this.code = code; + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static String valueOf(Integer status) { + if (status == null) { + return ""; + } else { + for (IsMenu s : IsMenu.values()) { + if (s.getCode() == status) { + return s.getMessage(); + } + } + return ""; + } + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScope.java b/user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScope.java new file mode 100644 index 0000000..b9a6b45 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScope.java @@ -0,0 +1,50 @@ +package com.agentdriving.user.core.datascope; + +import java.util.List; + +/** + * 数据范围 + * + * @author fengshuonan + * @date 2017-07-23 22:19 + */ +public class DataScope { + + /** + * 限制范围的字段名称 + */ + private String scopeName = "deptid"; + + /** + * 具体的数据范围 + */ + private List<Integer> deptIds; + + public DataScope() { + } + + public DataScope(List<Integer> deptIds) { + this.deptIds = deptIds; + } + + public DataScope(String scopeName, List<Integer> deptIds) { + this.scopeName = scopeName; + this.deptIds = deptIds; + } + + public List<Integer> getDeptIds() { + return deptIds; + } + + public void setDeptIds(List<Integer> deptIds) { + this.deptIds = deptIds; + } + + public String getScopeName() { + return scopeName; + } + + public void setScopeName(String scopeName) { + this.scopeName = scopeName; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScopeInterceptor.java b/user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScopeInterceptor.java new file mode 100644 index 0000000..d17b5aa --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScopeInterceptor.java @@ -0,0 +1,82 @@ +package com.agentdriving.user.core.datascope; + + +import com.baomidou.mybatisplus.toolkit.PluginUtils; +import com.agentdriving.user.core.support.CollectionKit; +import org.apache.ibatis.executor.statement.StatementHandler; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.SqlCommandType; +import org.apache.ibatis.plugin.*; +import org.apache.ibatis.reflection.MetaObject; +import org.apache.ibatis.reflection.SystemMetaObject; + +import java.sql.Connection; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +/** + * 数据范围的拦截器 + * + * @author fengshuonan + * @date 2017-07-23 21:26 + */ +@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})}) +public class DataScopeInterceptor implements Interceptor { + + @Override + public Object intercept(Invocation invocation) throws Throwable { + StatementHandler statementHandler = (StatementHandler) PluginUtils.realTarget(invocation.getTarget()); + MetaObject metaStatementHandler = SystemMetaObject.forObject(statementHandler); + MappedStatement mappedStatement = (MappedStatement) metaStatementHandler.getValue("delegate.mappedStatement"); + + if (!SqlCommandType.SELECT.equals(mappedStatement.getSqlCommandType())) { + return invocation.proceed(); + } + + BoundSql boundSql = (BoundSql) metaStatementHandler.getValue("delegate.boundSql"); + String originalSql = boundSql.getSql(); + Object parameterObject = boundSql.getParameterObject(); + + //查找参数中包含DataScope类型的参数 + DataScope dataScope = findDataScopeObject(parameterObject); + + if (dataScope == null) { + return invocation.proceed(); + } else { + String scopeName = dataScope.getScopeName(); + List<Integer> deptIds = dataScope.getDeptIds(); + String join = CollectionKit.join(deptIds, ","); + originalSql = "select * from (" + originalSql + ") temp_data_scope where temp_data_scope." + scopeName + " in (" + join + ")"; + metaStatementHandler.setValue("delegate.boundSql.sql", originalSql); + return invocation.proceed(); + } + } + + /** + * 查找参数是否包括DataScope对象 + */ + public DataScope findDataScopeObject(Object parameterObj) { + if (parameterObj instanceof DataScope) { + return (DataScope) parameterObj; + } else if (parameterObj instanceof Map) { + for (Object val : ((Map<?, ?>) parameterObj).values()) { + if (val instanceof DataScope) { + return (DataScope) val; + } + } + } + return null; + } + + @Override + public Object plugin(Object target) { + return Plugin.wrap(target, this); + } + + @Override + public void setProperties(Properties properties) { + + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/db/Db.java b/user/guns-core/src/main/java/com/agentdriving/user/core/db/Db.java new file mode 100644 index 0000000..9218767 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/db/Db.java @@ -0,0 +1,108 @@ +package com.agentdriving.user.core.db; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.agentdriving.user.core.util.SpringContextHolder; + +import java.util.HashMap; +import java.util.List; + +/** + * <p> + * 便捷数据库操作类 + * <p> + * <p> + * 本类的使用情景: + * <p> + * 1.单纯想创建现有的Mapper + * <p>例如: + * Db.getMapper(UserLoginMapper.class).selectById("14779707158513204");<br> + * <p> + * + * @author fengshuonan + * @date 2017年2月22日 下午8:07:17 + */ +@SuppressWarnings("all") +public class Db<T> { + + /** + * 每个Db类,包装一个Mapper接口,这个clazz就是接口的类类型,例如UserMapper.class + */ + private Class<T> clazz; + + /** + * Mapper的父类接口 + */ + private BaseMapper<?> baseMapper; + + /** + * 私有构造方法,不允许自己创建 + */ + private Db(Class clazz) { + this.clazz = clazz; + this.baseMapper = (BaseMapper<?>) SpringContextHolder.getBean(clazz); + } + + /** + * <p> + * 创建包含指定mapper的Db工具类,使用本类的第一种用法 + * + * @param clazz mapper的类类型 + * @date 2017年2月22日 下午10:09:31 + */ + public static <T> Db<T> create(Class<T> clazz) { + return new Db<T>(clazz); + } + + /** + * <p> + * 获取一个mapper的快捷方法 + * + * @param clazz mapper类的类对象 + * @date 2017年2月22日 下午10:31:35 + */ + public BaseMapper<?> getMapper() { + return this.baseMapper; + } + + /** + * <p> + * 获取一个mapper的快捷方法 + * + * @param clazz mapper类的类对象 + * @date 2017年2月22日 下午10:31:35 + */ + public static <T> T getMapper(Class<T> clazz) { + return SpringContextHolder.getBean(clazz); + } + + /** + * 通过一个条件获取数据库中的一条记录(会返回null) + * + * @date 2017年2月22日 下午10:45:51 + */ + public <E> E selectOneByCon(String condition, Object value) { + List<?> results = selectOneByConList(condition, value); + if (results != null && results.size() > 0) { + return (E) results.get(0); + } else { + return null; + } + } + + /** + * 通过一个条件获取一堆记录(会返回null) + * + * @date 2017年2月22日 下午10:45:51 + */ + public <E> List<E> selectOneByConList(String condition, Object value) { + HashMap<String, Object> conditionMap = new HashMap<String, Object>(); + conditionMap.put(condition, value); + + List<E> results = (List<E>) this.baseMapper.selectByMap(conditionMap); + if (results == null || results.size() == 0) { + return null; + } else { + return results; + } + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsException.java b/user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsException.java new file mode 100644 index 0000000..406a3f1 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsException.java @@ -0,0 +1,36 @@ +package com.agentdriving.user.core.exception; + +/** + * 封装guns的异常 + * + * @author fengshuonan + * @Date 2017/12/28 下午10:32 + */ +public class GunsException extends RuntimeException { + + private Integer code; + + private String message; + + public GunsException(ServiceExceptionEnum serviceExceptionEnum) { + this.code = serviceExceptionEnum.getCode(); + this.message = serviceExceptionEnum.getMessage(); + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + @Override + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsExceptionEnum.java b/user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsExceptionEnum.java new file mode 100644 index 0000000..86dfcc3 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsExceptionEnum.java @@ -0,0 +1,59 @@ +package com.agentdriving.user.core.exception; + +/** + * Guns异常枚举 + * + * @author fengshuonan + * @Date 2017/12/28 下午10:33 + */ +public enum GunsExceptionEnum implements ServiceExceptionEnum { + + /** + * 其他 + */ + INVLIDE_DATE_STRING(400, "输入日期格式不对"), + + /** + * 其他 + */ + WRITE_ERROR(500, "渲染界面错误"), + + /** + * 文件上传 + */ + FILE_READING_ERROR(400, "FILE_READING_ERROR!"), + FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"), + + /** + * 错误的请求 + */ + REQUEST_NULL(400, "请求有错误"), + SERVER_ERROR(500, "服务器异常"); + + GunsExceptionEnum(int code, String message) { + this.code = code; + this.message = message; + } + + private Integer code; + + private String message; + + @Override + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + @Override + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/exception/ServiceExceptionEnum.java b/user/guns-core/src/main/java/com/agentdriving/user/core/exception/ServiceExceptionEnum.java new file mode 100644 index 0000000..8086304 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/exception/ServiceExceptionEnum.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.core.exception; + +/** + * 抽象接口 + * + * @author fengshuonan + * @date 2017-12-28-下午10:27 + */ +public interface ServiceExceptionEnum { + + /** + * 获取异常编码 + */ + Integer getCode(); + + /** + * 获取异常信息 + */ + String getMessage(); +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DataSourceContextHolder.java b/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DataSourceContextHolder.java new file mode 100644 index 0000000..26a8e07 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DataSourceContextHolder.java @@ -0,0 +1,35 @@ +package com.agentdriving.user.core.mutidatasource; + +/** + * datasource的上下文 + * + * @author fengshuonan + * @date 2017年3月5日 上午9:10:58 + */ +public class DataSourceContextHolder { + + private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>(); + + /** + * 设置数据源类型 + * + * @param dataSourceType 数据库类型 + */ + public static void setDataSourceType(String dataSourceType) { + contextHolder.set(dataSourceType); + } + + /** + * 获取数据源类型 + */ + public static String getDataSourceType() { + return contextHolder.get(); + } + + /** + * 清除数据源类型 + */ + public static void clearDataSourceType() { + contextHolder.remove(); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DynamicDataSource.java b/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DynamicDataSource.java new file mode 100644 index 0000000..61450f4 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DynamicDataSource.java @@ -0,0 +1,18 @@ +package com.agentdriving.user.core.mutidatasource; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +/** + * 动态数据源 + * + * @author fengshuonan + * @date 2017年3月5日 上午9:11:49 + */ +public class DynamicDataSource extends AbstractRoutingDataSource { + + @Override + protected Object determineCurrentLookupKey() { + return DataSourceContextHolder.getDataSourceType(); + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/annotion/DataSource.java b/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/annotion/DataSource.java new file mode 100644 index 0000000..68215de --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/annotion/DataSource.java @@ -0,0 +1,18 @@ +package com.agentdriving.user.core.mutidatasource.annotion; + +import java.lang.annotation.*; + +/** + * + * 多数据源标识 + * + * @author fengshuonan + * @date 2017年3月5日 上午9:44:24 + */ +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.METHOD }) +public @interface DataSource { + + String name() default ""; +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/aop/MultiSourceExAop.java b/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/aop/MultiSourceExAop.java new file mode 100644 index 0000000..959a6cc --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/aop/MultiSourceExAop.java @@ -0,0 +1,77 @@ +package com.agentdriving.user.core.mutidatasource.aop; + +import com.agentdriving.user.core.mutidatasource.annotion.DataSource; +import com.agentdriving.user.core.mutidatasource.DataSourceContextHolder; +import com.agentdriving.user.core.config.properties.MutiDataSourceProperties; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.Signature; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.Ordered; + +import java.lang.reflect.Method; + +/** + * 多数据源切换的aop + * + * @author fengshuonan + * @date 2017年3月5日 上午10:22:16 + */ +@Aspect +public class MultiSourceExAop implements Ordered { + + private Logger log = LoggerFactory.getLogger(this.getClass()); + + @Autowired + MutiDataSourceProperties mutiDataSourceProperties; + + @Pointcut(value = "@annotation(com.agentdriving.user.core.mutidatasource.annotion.DataSource)") + private void cut() { + + } + + @Around("cut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + + Signature signature = point.getSignature(); + MethodSignature methodSignature = null; + if (!(signature instanceof MethodSignature)) { + throw new IllegalArgumentException("该注解只能用于方法"); + } + methodSignature = (MethodSignature) signature; + + Object target = point.getTarget(); + Method currentMethod = target.getClass().getMethod(methodSignature.getName(), methodSignature.getParameterTypes()); + + DataSource datasource = currentMethod.getAnnotation(DataSource.class); + if (datasource != null) { + DataSourceContextHolder.setDataSourceType(datasource.name()); + log.debug("设置数据源为:" + datasource.name()); + } else { + DataSourceContextHolder.setDataSourceType(mutiDataSourceProperties.getDataSourceNames()[0]); + log.debug("设置数据源为:dataSourceCurrent"); + } + + try { + return point.proceed(); + } finally { + log.debug("清空数据源信息!"); + DataSourceContextHolder.clearDataSourceType(); + } + } + + + /** + * aop的顺序要早于spring的事务 + */ + @Override + public int getOrder() { + return 1; + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/node/MenuNode.java b/user/guns-core/src/main/java/com/agentdriving/user/core/node/MenuNode.java new file mode 100644 index 0000000..b56eac5 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/node/MenuNode.java @@ -0,0 +1,238 @@ +package com.agentdriving.user.core.node; + +import com.agentdriving.user.core.constant.IsMenu; + +import java.util.*; + +/** + * @author fengshuonan + * @Description 菜单的节点 + * @date 2016年12月6日 上午11:34:17 + */ +public class MenuNode implements Comparable { + + /** + * 节点id + */ + private Long id; + + /** + * 父节点 + */ + private Long parentId; + + /** + * 节点名称 + */ + private String name; + + /** + * 按钮级别 + */ + private Integer levels; + + /** + * 按钮级别 + */ + private Integer ismenu; + + /** + * 按钮的排序 + */ + private Integer num; + + /** + * 节点的url + */ + private String url; + + /** + * 节点图标 + */ + private String icon; + + /** + * 子节点的集合 + */ + private List<MenuNode> children; + + /** + * 查询子节点时候的临时集合 + */ + private List<MenuNode> linkedList = new ArrayList<MenuNode>(); + + public MenuNode() { + super(); + } + + public MenuNode(Long id, Long parentId) { + super(); + this.id = id; + this.parentId = parentId; + } + + public Integer getLevels() { + return levels; + } + + public void setLevels(Integer levels) { + this.levels = levels; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public static MenuNode createRoot() { + return new MenuNode(0L, -1L); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public List<MenuNode> getChildren() { + return children; + } + + public void setChildren(List<MenuNode> children) { + this.children = children; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Integer getIsmenu() { + return ismenu; + } + + public void setIsmenu(Integer ismenu) { + this.ismenu = ismenu; + } + + @Override + public String toString() { + return "MenuNode{" + + "id=" + id + + ", parentId=" + parentId + + ", name='" + name + '\'' + + ", levels=" + levels + + ", num=" + num + + ", url='" + url + '\'' + + ", icon='" + icon + '\'' + + ", children=" + children + + ", linkedList=" + linkedList + + '}'; + } + + /** + * 重写排序比较接口,首先根据等级排序,然后更具排序字段排序 + * + * @param o + * @return + */ + @Override + public int compareTo(Object o) { + MenuNode menuNode = (MenuNode) o; + Integer num = menuNode.getNum(); + Integer levels = menuNode.getLevels(); + if (num == null) { + num = 0; + } + if (levels == null) { + levels = 0; + } + if (this.levels.compareTo(levels) == 0) { + return this.num.compareTo(num); + } else { + return this.levels.compareTo(levels); + } + + } + + /** + * 构建页面菜单列表 + */ + public static List<MenuNode> buildTitle(List<MenuNode> nodes) { + if (nodes.size() <= 0) { + return nodes; + } + //剔除非菜单 + nodes.removeIf(node -> node.getIsmenu() != IsMenu.YES.getCode()); + //对菜单排序,返回列表按菜单等级,序号的排序方式排列 + Collections.sort(nodes); + return mergeList(nodes, nodes.get(nodes.size() - 1).getLevels(), null); + } + + /** + * 递归合并数组为子数组,最后返回第一层 + * + * @param menuList + * @param listMap + * @return + */ + private static List<MenuNode> mergeList(List<MenuNode> menuList, int rank, Map<Long, List<MenuNode>> listMap) { + //保存当次调用总共合并了多少元素 + int n; + //保存当次调用总共合并出来的list + Map<Long, List<MenuNode>> currentMap = new HashMap<>(); + //由于按等级从小到大排序,需要从后往前排序 + //判断该节点是否属于当前循环的等级,不等于则跳出循环 + for (n = menuList.size() - 1; n >=0&&menuList.get(n).getLevels() == rank; n--) { + //判断之前的调用是否有返回以该节点的id为key的map,有则设置为children列表。 + if (listMap != null && listMap.get(menuList.get(n).getId()) != null) { + menuList.get(n).setChildren(listMap.get(menuList.get(n).getId())); + } + if (menuList.get(n).getParentId()!=null&&menuList.get(n).getParentId()!=0) { + //判断当前节点所属的pid是否已经创建了以该pid为key的键值对,没有则创建新的链表 + currentMap.computeIfAbsent(menuList.get(n).getParentId(), k -> new LinkedList<>()); + //将该节点插入到对应的list的头部 + currentMap.get(menuList.get(n).getParentId()).add(0, menuList.get(n)); + } + } + if (n <0) { + return menuList; + } else { + return mergeList(menuList.subList(0, n+1), menuList.get(n).getLevels(), currentMap); + } + } + + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/node/ZTreeNode.java b/user/guns-core/src/main/java/com/agentdriving/user/core/node/ZTreeNode.java new file mode 100644 index 0000000..07a694f --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/node/ZTreeNode.java @@ -0,0 +1,79 @@ +package com.agentdriving.user.core.node; + +/** + * + * jquery ztree 插件的节点 + * + * @author fengshuonan + * @date 2017年2月17日 下午8:25:14 + */ +public class ZTreeNode { + + private Long id; //节点id + + private Long pId;//父节点id + + private String name;//节点名称 + + private Boolean open;//是否打开节点 + + private Boolean checked;//是否被选中 + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getpId() { + return pId; + } + + public void setpId(Long pId) { + this.pId = pId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Boolean getOpen() { + return open; + } + + public void setOpen(Boolean open) { + this.open = open; + } + + public Boolean getIsOpen() { + return open; + } + + public void setIsOpen(Boolean open) { + this.open = open; + } + + public Boolean getChecked() { + return checked; + } + + public void setChecked(Boolean checked) { + this.checked = checked; + } + + public static ZTreeNode createParent(){ + ZTreeNode zTreeNode = new ZTreeNode(); + zTreeNode.setChecked(true); + zTreeNode.setId(0L); + zTreeNode.setName("顶级"); + zTreeNode.setOpen(true); + zTreeNode.setpId(0L); + return zTreeNode; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/page/PageBT.java b/user/guns-core/src/main/java/com/agentdriving/user/core/page/PageBT.java new file mode 100644 index 0000000..60dc7ea --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/page/PageBT.java @@ -0,0 +1,65 @@ +package com.agentdriving.user.core.page; + +/** + * 分页参数类(for BootStrap Table) + * + * @author fengshuonan + * @date 2017年1月21日 下午2:21:35 + */ +public class PageBT { + + private int limit; // 每页显示个数 + + private int offset; // 查询的偏移量(查询的页数 = offset/limit + 1) + + private String order; // 排序方式 + + + public PageBT() { + super(); + } + + public PageBT(int limit, int offset) { + super(); + this.limit = limit; + this.offset = offset; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public String getOrder() { + return order; + } + + public void setOrder(String order) { + this.order = order; + } + + public int getPageSize() { + return this.limit; + } + + public int getPageNumber() { + return this.offset / this.limit + 1; + } + + @Override + public String toString() { + return "PageBT [limit=" + limit + ", offset=" + offset + ", order=" + order + "]"; + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/page/PageInfoBT.java b/user/guns-core/src/main/java/com/agentdriving/user/core/page/PageInfoBT.java new file mode 100644 index 0000000..e3e8500 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/page/PageInfoBT.java @@ -0,0 +1,41 @@ +package com.agentdriving.user.core.page; + +import com.baomidou.mybatisplus.plugins.Page; + +import java.util.List; + +/** + * 分页结果的封装(for Bootstrap Table) + * + * @author fengshuonan + * @Date 2017年1月22日 下午11:06:41 + */ +public class PageInfoBT<T> { + + // 结果集 + private List<T> rows; + + // 总数 + private long total; + + public PageInfoBT(Page<T> page) { + this.rows = page.getRecords(); + this.total = page.getTotal(); + } + + public List<T> getRows() { + return rows; + } + + public void setRows(List<T> rows) { + this.rows = rows; + } + + public long getTotal() { + return total; + } + + public void setTotal(long total) { + this.total = total; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/qr/ImgQrTool.java b/user/guns-core/src/main/java/com/agentdriving/user/core/qr/ImgQrTool.java new file mode 100644 index 0000000..ef8303b --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/qr/ImgQrTool.java @@ -0,0 +1,294 @@ +package com.agentdriving.user.core.qr; + +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.MultiFormatWriter; +import com.google.zxing.WriterException; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.geom.AffineTransform; +import java.awt.image.AffineTransformOp; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +/** + * 内嵌图片的二维码生成器 + * + * @author lichunxi + */ +public class ImgQrTool { + + private static Logger log = LoggerFactory.getLogger(ImgQrTool.class); + + // 镶嵌的图片宽度的一般 + private static final int IMAGE_WIDTH = 80; + private static final int IMAGE_HEIGHT = 80; + private static final int IMAGE_HALF_WIDTH = IMAGE_WIDTH / 2; + private static final int FRAME_WIDTH = 2; + + // 二维码写码器 + private static MultiFormatWriter mutiWriter = new MultiFormatWriter(); + + /** + * 生成带图片的二维码 + * + * @param content 二维码的内容 + * @param width 宽度 + * @param height 高度 + * @param srcImagePath 被镶嵌的图片的地址 + * @param destImagePath 生成二维码图片的地址 + * @author fengshuonan + * @since 2.3.0 + */ + public static void encode(String content, int width, int height, String srcImagePath, String destImagePath) { + try { + ImageIO.write(genBarcode(content, width, height, srcImagePath), "jpg", new File(destImagePath)); + } catch (IOException e) { + e.printStackTrace(); + } catch (WriterException e) { + e.printStackTrace(); + } + } + + /** + * 生成带图片的二维码 + * + * @param content 二维码的内容 + * @param width 宽度 + * @param height 高度 + * @param srcImagePath 被镶嵌的图片的地址 + * @author fengshuonan + * @since 2.3.0 + */ + public static void encode(String content, int width, int height, String srcImagePath, OutputStream outputStream) { + try { + ImageIO.write(genBarcode(content, width, height, srcImagePath), "jpg", outputStream); + } catch (IOException e) { + e.printStackTrace(); + } catch (WriterException e) { + e.printStackTrace(); + } + } + + /** + * 创建不带参数的二维码 + * + * @author fengshuonan + * @since 2.3.0 + */ + public static void createSimpleQr(String content, int width, int height, String destImagePath) { + + FileOutputStream output = null; + + try { + String format = "jpg";// 图像类型 + Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>(); + hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); + BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints);// 生成矩阵 + File dest = new File(destImagePath); + output = new FileOutputStream(dest); + MatrixToImageWriter.writeToStream(bitMatrix, format, output);// 输出图像 + } catch (Exception e) { + log.error("生成二维码出错!ImgQrTool:createSimpleQr()", e); + } finally { + try { + output.close(); + } catch (IOException e) { + log.error("生成二维码出错!ImgQrTool:createSimpleQr()", e); + } + } + } + + private static BufferedImage genBarcode(String content, int width, int height, String srcImagePath) + throws WriterException, IOException { + // 读取源图像 + BufferedImage scaleImage = scale(srcImagePath, IMAGE_WIDTH, IMAGE_HEIGHT, true); + int[][] srcPixels = new int[IMAGE_WIDTH][IMAGE_HEIGHT]; + for (int i = 0; i < scaleImage.getWidth(); i++) { + for (int j = 0; j < scaleImage.getHeight(); j++) { + srcPixels[i][j] = scaleImage.getRGB(i, j); + } + } + + Map<EncodeHintType, Object> hint = new HashMap<EncodeHintType, Object>(); + hint.put(EncodeHintType.CHARACTER_SET, "utf-8"); + hint.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); + hint.put(EncodeHintType.MARGIN, 1);// 二维码整体白框 + + // 生成二维码 + BitMatrix matrix = mutiWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hint); + + // 二维矩阵转为一维像素数组 + int halfW = matrix.getWidth() / 2; + int halfH = matrix.getHeight() / 2; + int[] pixels = new int[width * height]; + + for (int y = 0; y < matrix.getHeight(); y++) { + for (int x = 0; x < matrix.getWidth(); x++) { + // 读取图片 + if (x > halfW - IMAGE_HALF_WIDTH && x < halfW + IMAGE_HALF_WIDTH && y > halfH - IMAGE_HALF_WIDTH + && y < halfH + IMAGE_HALF_WIDTH) { + pixels[y * width + x] = srcPixels[x - halfW + IMAGE_HALF_WIDTH][y - halfH + IMAGE_HALF_WIDTH]; + } + // 在图片四周形成边框 + else if ((x > halfW - IMAGE_HALF_WIDTH - FRAME_WIDTH && x < halfW - IMAGE_HALF_WIDTH + FRAME_WIDTH + && y > halfH - IMAGE_HALF_WIDTH - FRAME_WIDTH && y < halfH + IMAGE_HALF_WIDTH + FRAME_WIDTH) + || (x > halfW + IMAGE_HALF_WIDTH - FRAME_WIDTH && x < halfW + IMAGE_HALF_WIDTH + FRAME_WIDTH + && y > halfH - IMAGE_HALF_WIDTH - FRAME_WIDTH + && y < halfH + IMAGE_HALF_WIDTH + FRAME_WIDTH) + || (x > halfW - IMAGE_HALF_WIDTH - FRAME_WIDTH && x < halfW + IMAGE_HALF_WIDTH + FRAME_WIDTH + && y > halfH - IMAGE_HALF_WIDTH - FRAME_WIDTH + && y < halfH - IMAGE_HALF_WIDTH + FRAME_WIDTH) + || (x > halfW - IMAGE_HALF_WIDTH - FRAME_WIDTH && x < halfW + IMAGE_HALF_WIDTH + FRAME_WIDTH + && y > halfH + IMAGE_HALF_WIDTH - FRAME_WIDTH + && y < halfH + IMAGE_HALF_WIDTH + FRAME_WIDTH)) { + pixels[y * width + x] = 0xfffffff; + } else { + // 此处可以修改二维码的颜色,可以分别制定二维码和背景的颜色; + pixels[y * width + x] = matrix.get(x, y) ? 0xff000000 : 0xfffffff; + } + } + } + + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + image.getRaster().setDataElements(0, 0, width, height, pixels); + + return image; + } + + /** + * 把传入的原始图像按高度和宽度进行缩放,生成符合要求的图标 + * + * @param srcImageFile 源文件地址 + * @param height 目标高度 + * @param width 目标宽度 + * @param hasFiller 比例不对时是否需要补白:true为补白; false为不补白; + * @throws IOException + */ + private static BufferedImage scale(String srcImageFile, int height, int width, boolean hasFiller) + throws IOException { + double ratio = 0.0; // 缩放比例 + File file = new File(srcImageFile); + BufferedImage srcImage = ImageIO.read(file); + Image destImage = srcImage.getScaledInstance(width, height, BufferedImage.SCALE_SMOOTH); + // 计算比例 + if ((srcImage.getHeight() > height) || (srcImage.getWidth() > width)) { + if (srcImage.getHeight() > srcImage.getWidth()) { + ratio = (new Integer(height)).doubleValue() / srcImage.getHeight(); + } else { + ratio = (new Integer(width)).doubleValue() / srcImage.getWidth(); + } + AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(ratio, ratio), null); + destImage = op.filter(srcImage, null); + } + if (hasFiller) {// 补白 + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D graphic = image.createGraphics(); + graphic.setColor(Color.white); + graphic.fillRect(0, 0, width, height); + if (width == destImage.getWidth(null)) + graphic.drawImage(destImage, 0, (height - destImage.getHeight(null)) / 2, destImage.getWidth(null), + destImage.getHeight(null), Color.white, null); + else + graphic.drawImage(destImage, (width - destImage.getWidth(null)) / 2, 0, destImage.getWidth(null), + destImage.getHeight(null), Color.white, null); + graphic.dispose(); + destImage = image; + } + return (BufferedImage) destImage; + } + + /** + * 生成上方带文字的二维码 + */ + public static void createQrWithFontsAbove(QrImage para) { + try { + // 首先生成二维码图片 + BufferedImage qrImage = genBarcode(para.getQrContent(), para.getQrWidth(), para.getQrHeight(), para.getQrIconFilePath()); + + int qrImageWidth = qrImage.getWidth(); + int qrImageHeight = qrImage.getHeight(); + + String[] splitStrLines = null; + splitStrLines = splitStrLines(para.getWordContent(), qrImageWidth / para.getWordSize()); + int fontsImageHeight = splitStrLines.length * para.getWordSize() + 10; //防止文字遮挡 + + //创建顶部文字的图片 + BufferedImage imageWithFonts = new BufferedImage(qrImageWidth, fontsImageHeight, BufferedImage.TYPE_4BYTE_ABGR); + Graphics fontsImageGraphics = imageWithFonts.getGraphics(); + fontsImageGraphics.fillRect(0, 0, qrImageWidth, fontsImageHeight); + fontsImageGraphics.setColor(Color.black); + fontsImageGraphics.setFont(new Font("宋体", Font.PLAIN, para.getWordSize())); + + //文字长度大于一行的长度,进行分行 + if (para.getWordContent().length() > qrImageWidth / para.getWordSize()) {//每行限制的文字个数 + for (int i = 0; i < splitStrLines.length; i++) { + fontsImageGraphics.drawString(splitStrLines[i], 0, para.getWordSize() * (i + 1)); + } + } else { + fontsImageGraphics.drawString( + para.getWordContent(), + ((qrImageWidth / para.getWordSize() - para.getWordContent().length()) / 2) * para.getWordSize() + 20, //总长度减去字长度除以2为向右偏移长度 + para.getWordSize()); + } + + // 从图片中读取RGB + int[] ImageArrayFonts = new int[qrImageWidth * fontsImageHeight]; + ImageArrayFonts = imageWithFonts.getRGB(0, 0, qrImageWidth, fontsImageHeight, ImageArrayFonts, 0, qrImageWidth); + + int[] ImageArrayQr = new int[qrImageWidth * qrImageHeight]; + ImageArrayQr = qrImage.getRGB(0, 0, qrImageWidth, qrImageHeight, ImageArrayQr, 0, qrImageWidth); + + // 生成新图片 + BufferedImage ImageNew = new BufferedImage(qrImageWidth, qrImageHeight + fontsImageHeight, BufferedImage.TYPE_INT_RGB); + ImageNew.setRGB(0, 0, qrImageWidth, fontsImageHeight, ImageArrayFonts, 0, qrImageWidth);// 设置上半部分的RGB + ImageNew.setRGB(0, fontsImageHeight, qrImageWidth, qrImageHeight, ImageArrayQr, 0, qrImageWidth);// 设置下半部分的RGB + + File outFile = new File(para.getFileOutputPath()); + ImageIO.write(ImageNew, "jpg", outFile); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 一行字符串拆分成多行 + */ + private static String[] splitStrLines(String str, int len) { + int blocks = str.length() / len + 1; + String[] strs = new String[blocks]; + for (int i = 0; i < blocks; i++) { + if ((i + 1) * len > str.length()) { + strs[i] = str.substring(i * len); + } else { + strs[i] = str.substring(i * len, (i + 1) * len); + } + } + return strs; + } + + public static void main(String[] args) throws IOException { + for (int i = 1; i <= 1; i++) { + QrImage para = new QrImage.Builder() + .setFileOutputPath("D:\\二维码\\test\\" + i + ".jpg") + .setQrContent("http://www.baidu.com?a=" + "123") + .setQrHeight(300) + .setQrWidth(300) + .setQrIconFilePath("D:\\二维码\\中间图标\\1.png") + .setTopWrodHeight(100) + .setWordContent("test" + 1) + .setWordSize(18).build(); + ImgQrTool.createQrWithFontsAbove(para); + } + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageConfig.java b/user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageConfig.java new file mode 100644 index 0000000..c7e58ac --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageConfig.java @@ -0,0 +1,62 @@ +/* + * Copyright 2012 ZXing authors + * + * 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. + */ + +package com.agentdriving.user.core.qr; + +import java.awt.image.BufferedImage; + +/** + * Encapsulates custom configuration used in methods of {@link MatrixToImageWriter}. + */ +public final class MatrixToImageConfig { + + public static final int BLACK = 0xFF000000; + public static final int WHITE = 0xFFFFFFFF; + + private final int onColor; + private final int offColor; + + /** + * Creates a default config with on color {@link #BLACK} and off color {@link #WHITE}, generating normal + * black-on-white barcodes. + */ + public MatrixToImageConfig() { + this(BLACK, WHITE); + } + + /** + * @param onColor pixel on color, specified as an ARGB value as an int + * @param offColor pixel off color, specified as an ARGB value as an int + */ + public MatrixToImageConfig(int onColor, int offColor) { + this.onColor = onColor; + this.offColor = offColor; + } + + public int getPixelOnColor() { + return onColor; + } + + public int getPixelOffColor() { + return offColor; + } + + int getBufferedImageColorModel() { + // Use faster BINARY if colors match default + return onColor == BLACK && offColor == WHITE ? BufferedImage.TYPE_BYTE_BINARY : BufferedImage.TYPE_INT_RGB; + } + +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageWriter.java b/user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageWriter.java new file mode 100644 index 0000000..d540b9d --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageWriter.java @@ -0,0 +1,122 @@ +/* + * Copyright 2009 ZXing authors + * + * 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. + */ +package com.agentdriving.user.core.qr; + +import com.google.zxing.common.BitMatrix; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Path; + +/** + * Writes a {@link BitMatrix} to {@link BufferedImage}, + * file or stream. Provided here instead of core since it depends on + * Java SE libraries. + * + * @author Sean Owen + */ +public final class MatrixToImageWriter { + + private static final MatrixToImageConfig DEFAULT_CONFIG = new MatrixToImageConfig(); + + private MatrixToImageWriter() {} + + /** + * Renders a {@link BitMatrix} as an image, where "false" bits are rendered + * as white, and "true" bits are rendered as black. + */ + public static BufferedImage toBufferedImage(BitMatrix matrix) { + return toBufferedImage(matrix, DEFAULT_CONFIG); + } + + /** + * As {@link #toBufferedImage(BitMatrix)}, but allows customization of the output. + */ + public static BufferedImage toBufferedImage(BitMatrix matrix, MatrixToImageConfig config) { + int width = matrix.getWidth(); + int height = matrix.getHeight(); + BufferedImage image = new BufferedImage(width, height, config.getBufferedImageColorModel()); + int onColor = config.getPixelOnColor(); + int offColor = config.getPixelOffColor(); + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + image.setRGB(x, y, matrix.get(x, y) ? onColor : offColor); + } + } + return image; + } + + /** + * @deprecated use {@link #writeToPath(BitMatrix, String, Path)} + */ + @Deprecated + public static void writeToFile(BitMatrix matrix, String format, File file) throws IOException { + writeToPath(matrix, format, file.toPath()); + } + + /** + * Writes a {@link BitMatrix} to a file. + * + * @see #toBufferedImage(BitMatrix) + */ + public static void writeToPath(BitMatrix matrix, String format, Path file) throws IOException { + writeToPath(matrix, format, file, DEFAULT_CONFIG); + } + + /** + * @deprecated use {@link #writeToPath(BitMatrix, String, Path, MatrixToImageConfig)} + */ + @Deprecated + public static void writeToFile(BitMatrix matrix, String format, File file, MatrixToImageConfig config) + throws IOException { + writeToPath(matrix, format, file.toPath(), config); + } + + /** + * As {@link #writeToFile(BitMatrix, String, File)}, but allows customization of the output. + */ + public static void writeToPath(BitMatrix matrix, String format, Path file, MatrixToImageConfig config) + throws IOException { + BufferedImage image = toBufferedImage(matrix, config); + if (!ImageIO.write(image, format, file.toFile())) { + throw new IOException("Could not write an image of format " + format + " to " + file); + } + } + + /** + * Writes a {@link BitMatrix} to a stream. + * + * @see #toBufferedImage(BitMatrix) + */ + public static void writeToStream(BitMatrix matrix, String format, OutputStream stream) throws IOException { + writeToStream(matrix, format, stream, DEFAULT_CONFIG); + } + + /** + * As {@link #writeToStream(BitMatrix, String, OutputStream)}, but allows customization of the output. + */ + public static void writeToStream(BitMatrix matrix, String format, OutputStream stream, MatrixToImageConfig config) + throws IOException { + BufferedImage image = toBufferedImage(matrix, config); + if (!ImageIO.write(image, format, stream)) { + throw new IOException("Could not write an image of format " + format); + } + } + +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/qr/QrImage.java b/user/guns-core/src/main/java/com/agentdriving/user/core/qr/QrImage.java new file mode 100644 index 0000000..41eac75 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/qr/QrImage.java @@ -0,0 +1,170 @@ +package com.agentdriving.user.core.qr; + +/** + * 二维码图片对象 + * + * @author fengshuonan + * @date 2016年12月8日 上午11:37:09 + */ +public class QrImage { + + /** + * 二维码的内容 + */ + private String qrContent; + + /** + * 二维码的宽度 + */ + private int qrWidth; + + /** + * 二维码的高度 + */ + private int qrHeight; + + /** + * 二维码中间图标的文件路径 + */ + private String qrIconFilePath; + + /** + * 二维码中间小图标的边长 + */ + private int qrIconWidth; + + /** + * 顶部文字的高度 + */ + private int topWrodHeight; + + /** + * 文字的大小 + */ + private int wordSize; + + /** + * 文字的内容 + */ + private String wordContent; + + /** + * 文件的输出路径 + */ + private String fileOutputPath; + + public static class Builder { + private String qrContent; + private int qrWidth; + private int qrHeight; + private String qrIconFilePath; + private int topWrodHeight; + private int wordSize; + private String wordContent; + private String fileOutputPath; + private int qrIconWidth; + + public Builder() { + } + + public Builder setQrContent(String qrContent) { + this.qrContent = qrContent; + return this; + } + + public Builder setQrWidth(int qrWidth) { + this.qrWidth = qrWidth; + return this; + } + + public Builder setQrHeight(int qrHeight) { + this.qrHeight = qrHeight; + return this; + } + + public Builder setQrIconFilePath(String qrIconFilePath) { + this.qrIconFilePath = qrIconFilePath; + return this; + } + + public Builder setTopWrodHeight(int topWrodHeight) { + this.topWrodHeight = topWrodHeight; + return this; + } + + public Builder setWordSize(int wordSize) { + this.wordSize = wordSize; + return this; + } + + public Builder setWordContent(String wordContent) { + this.wordContent = wordContent; + return this; + } + + public Builder setFileOutputPath(String fileOutputPath) { + this.fileOutputPath = fileOutputPath; + return this; + } + + public Builder setQrIconWidth(int qrIconWidth) { + this.qrIconWidth = qrIconWidth; + return this; + } + + public QrImage build() { + return new QrImage(this.qrContent, this.qrWidth, this.qrHeight, this.qrIconFilePath, this.qrIconWidth, + this.topWrodHeight, this.wordSize, this.wordContent, this.fileOutputPath); + } + } + + public QrImage(String qrContent, int qrWidth, int qrHeight, String qrIconFilePath, int qrIconWidth, + int topWrodHeight, int wordSize, String wordContent, String fileOutputPath) { + super(); + this.qrContent = qrContent; + this.qrWidth = qrWidth; + this.qrHeight = qrHeight; + this.qrIconFilePath = qrIconFilePath; + this.qrIconWidth = qrIconWidth; + this.topWrodHeight = topWrodHeight; + this.wordSize = wordSize; + this.wordContent = wordContent; + this.fileOutputPath = fileOutputPath; + } + + public String getQrContent() { + return qrContent; + } + + public int getQrWidth() { + return qrWidth; + } + + public int getQrHeight() { + return qrHeight; + } + + public String getQrIconFilePath() { + return qrIconFilePath; + } + + public int getTopWrodHeight() { + return topWrodHeight; + } + + public int getWordSize() { + return wordSize; + } + + public String getWordContent() { + return wordContent; + } + + public String getFileOutputPath() { + return fileOutputPath; + } + + public int getQrIconWidth() { + return qrIconWidth; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/BasicType.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/BasicType.java new file mode 100644 index 0000000..7ea256a --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/BasicType.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.core.support; + +import java.util.HashMap; +import java.util.Map; + +/** + * 基本变量类型的枚举 + * + * @author xiaoleilu + */ +public enum BasicType { + BYTE, SHORT, INT, INTEGER, LONG, DOUBLE, FLOAT, BOOLEAN, CHAR, CHARACTER, STRING; + + /** + * 原始类型为Key,包装类型为Value,例如: int.class -> Integer.class. + */ + public static final Map<Class<?>, Class<?>> wrapperPrimitiveMap = new HashMap<Class<?>, Class<?>>(8); + + /** + * 包装类型为Key,原始类型为Value,例如: Integer.class -> int.class. + */ + public static final Map<Class<?>, Class<?>> primitiveWrapperMap = new HashMap<Class<?>, Class<?>>(8); + + static { + wrapperPrimitiveMap.put(Boolean.class, boolean.class); + wrapperPrimitiveMap.put(Byte.class, byte.class); + wrapperPrimitiveMap.put(Character.class, char.class); + wrapperPrimitiveMap.put(Double.class, double.class); + wrapperPrimitiveMap.put(Float.class, float.class); + wrapperPrimitiveMap.put(Integer.class, int.class); + wrapperPrimitiveMap.put(Long.class, long.class); + wrapperPrimitiveMap.put(Short.class, short.class); + + for (Map.Entry<Class<?>, Class<?>> entry : wrapperPrimitiveMap.entrySet()) { + primitiveWrapperMap.put(entry.getValue(), entry.getKey()); + } + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/BeanKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/BeanKit.java new file mode 100644 index 0000000..6a916fd --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/BeanKit.java @@ -0,0 +1,508 @@ +package com.agentdriving.user.core.support; + +import com.agentdriving.user.core.util.Convert; +import com.agentdriving.user.core.support.exception.ToolBoxException; + +import java.beans.*; +import java.lang.reflect.Method; +import java.util.*; +import java.util.Map.Entry; + +/** + * Bean工具类 + * + * @author Looly + */ +public class BeanKit { + + /** + * 判断是否为Bean对象 + * + * @param clazz 待测试类 + * @return 是否为Bean对象 + */ + public static boolean isBean(Class<?> clazz) { + if (ClassKit.isNormalClass(clazz)) { + Method[] methods = clazz.getMethods(); + for (Method method : methods) { + if (method.getParameterTypes().length == 1 && method.getName().startsWith("set")) { + //检测包含标准的setXXX方法即视为标准的JavaBean + return true; + } + } + } + return false; + } + + public static PropertyEditor findEditor(Class<?> type) { + return PropertyEditorManager.findEditor(type); + } + + /** + * 获得Bean字段描述数组 + * + * @param clazz Bean类 + * @return 字段描述数组 + * @throws IntrospectionException + */ + public static PropertyDescriptor[] getPropertyDescriptors(Class<?> clazz) throws IntrospectionException { + return Introspector.getBeanInfo(clazz).getPropertyDescriptors(); + } + + /** + * 获得字段名和字段描述Map + * + * @param clazz Bean类 + * @return 字段名和字段描述Map + * @throws IntrospectionException + */ + public static Map<String, PropertyDescriptor> getFieldNamePropertyDescriptorMap(Class<?> clazz) throws IntrospectionException { + final PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(clazz); + Map<String, PropertyDescriptor> map = new HashMap<>(); + for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { + map.put(propertyDescriptor.getName(), propertyDescriptor); + } + return map; + } + + /** + * 获得Bean类属性描述 + * + * @param clazz Bean类 + * @param fieldName 字段名 + * @return PropertyDescriptor + * @throws IntrospectionException + */ + public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, final String fieldName) throws IntrospectionException { + PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(clazz); + for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { + if (ObjectKit.equals(fieldName, propertyDescriptor.getName())) { + return propertyDescriptor; + } + } + return null; + } + + /** + * Map转换为Bean对象 + * + * @param map Map + * @param beanClass Bean Class + * @return Bean + */ + public static <T> T mapToBean(Map<?, ?> map, Class<T> beanClass) { + return fillBeanWithMap(map, ClassKit.newInstance(beanClass)); + } + + /** + * Map转换为Bean对象<br> + * 忽略大小写 + * + * @param map Map + * @param beanClass Bean Class + * @return Bean + */ + public static <T> T mapToBeanIgnoreCase(Map<?, ?> map, Class<T> beanClass) { + return fillBeanWithMapIgnoreCase(map, ClassKit.newInstance(beanClass)); + } + + /** + * 使用Map填充Bean对象 + * + * @param map Map + * @param bean Bean + * @return Bean + */ + public static <T> T fillBeanWithMap(final Map<?, ?> map, T bean) { + return fillBean(bean, new ValueProvider() { + @Override + public Object value(String name) { + return map.get(name); + } + }); + } + + /** + * 使用Map填充Bean对象,可配置将下划线转换为驼峰 + * + * @param map Map + * @param bean Bean + * @param isToCamelCase 是否将下划线模式转换为驼峰模式 + * @return Bean + */ + public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, boolean isToCamelCase) { + if (isToCamelCase) { + final Map<Object, Object> map2 = new HashMap<Object, Object>(); + for (Entry<?, ?> entry : map.entrySet()) { + final Object key = entry.getKey(); + if (null != key && key instanceof String) { + final String keyStr = (String) key; + map2.put(StrKit.toCamelCase(keyStr), entry.getValue()); + } else { + map2.put(key, entry.getValue()); + } + } + return fillBeanWithMap(map2, bean); + } + + return fillBeanWithMap(map, bean); + } + + /** + * 使用Map填充Bean对象,忽略大小写 + * + * @param map Map + * @param bean Bean + * @return Bean + */ + public static <T> T fillBeanWithMapIgnoreCase(Map<?, ?> map, T bean) { + final Map<Object, Object> map2 = new HashMap<Object, Object>(); + for (Entry<?, ?> entry : map.entrySet()) { + final Object key = entry.getKey(); + if (key instanceof String) { + final String keyStr = (String) key; + map2.put(keyStr.toLowerCase(), entry.getValue()); + } else { + map2.put(key, entry.getValue()); + } + } + + return fillBean(bean, new ValueProvider() { + @Override + public Object value(String name) { + return map2.get(name.toLowerCase()); + } + }); + } + + /** + * ServletRequest 参数转Bean + * + * @param request ServletRequest + * @param beanClass Bean Class + * @return Bean + */ + public static <T> T requestParamToBean(javax.servlet.ServletRequest request, Class<T> beanClass) { + return fillBeanWithRequestParam(request, ClassKit.newInstance(beanClass)); + } + + /** + * ServletRequest 参数转Bean + * + * @param request ServletRequest + * @param bean Bean + * @return Bean + */ + public static <T> T fillBeanWithRequestParam(final javax.servlet.ServletRequest request, T bean) { + final String beanName = StrKit.lowerFirst(bean.getClass().getSimpleName()); + return fillBean(bean, new ValueProvider() { + @Override + public Object value(String name) { + String value = request.getParameter(name); + if (StrKit.isEmpty(value)) { + // 使用类名前缀尝试查找值 + value = request.getParameter(beanName + StrKit.DOT + name); + if (StrKit.isEmpty(value)) { + // 此处取得的值为空时跳过,包括null和"" + value = null; + } + } + return value; + } + }); + } + + /** + * ServletRequest 参数转Bean + * + * @param <T> + * @param beanClass Bean Class + * @param valueProvider 值提供者 + * @return Bean + */ + public static <T> T toBean(Class<T> beanClass, ValueProvider valueProvider) { + return fillBean(ClassKit.newInstance(beanClass), valueProvider); + } + + /** + * 填充Bean + * + * @param <T> + * @param bean Bean + * @param valueProvider 值提供者 + * @return Bean + */ + public static <T> T fillBean(T bean, ValueProvider valueProvider) { + if (null == valueProvider) { + return bean; + } + + Class<?> beanClass = bean.getClass(); + try { + PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(beanClass); + String propertyName; + Object value; + for (PropertyDescriptor property : propertyDescriptors) { + propertyName = property.getName(); + value = valueProvider.value(propertyName); + if (null == value) { + continue; + } + try { + property.getWriteMethod().invoke(bean, Convert.parse(property.getPropertyType(), value)); + } catch (Exception e) { + e.printStackTrace(); + } + } + } catch (Exception e) { + throw new ToolBoxException(e); + } + return bean; + } + + /** + * 对象转Map + * + * @param bean bean对象 + * @return Map + */ + public static <T> Map<String, Object> beanToMap(T bean) { + return beanToMap(bean, false); + } + + /** + * 对象转Map + * + * @param bean bean对象 + * @return Map + */ + public static <T> List<Map<String, Object>> listToMapList(List<T> bean) { + ArrayList<Map<String, Object>> maps = new ArrayList<>(); + for (T t : bean) { + maps.add(beanToMap(bean, false)); + } + return maps; + } + + /** + * 对象转Map + * + * @param bean bean对象 + * @param isToUnderlineCase 是否转换为下划线模式 + * @return Map + */ + public static <T> Map<String, Object> beanToMap(T bean, boolean isToUnderlineCase) { + + if (bean == null) { + return null; + } + Map<String, Object> map = new HashMap<String, Object>(); + try { + final PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(bean.getClass()); + for (PropertyDescriptor property : propertyDescriptors) { + String key = property.getName(); + // 过滤class属性 + if (false == key.equals("class")) { + // 得到property对应的getter方法 + Method getter = property.getReadMethod(); + Object value = getter.invoke(bean); + if (null != value) { + map.put(isToUnderlineCase ? StrKit.toUnderlineCase(key) : key, value); + } + } + } + } catch (Exception e) { + throw new ToolBoxException(e); + } + return map; + } + + /** + * 复制Bean对象属性 + * + * @param source 源Bean对象 + * @param target 目标Bean对象 + */ + public static void copyProperties(Object source, Object target) { + copyProperties(source, target, CopyOptions.create()); + } + + /** + * 复制Bean对象属性<br> + * 限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类 + * + * @param source 源Bean对象 + * @param target 目标Bean对象 + * @param ignoreProperties 不拷贝的的属性列表 + */ + public static void copyProperties(Object source, Object target, String... ignoreProperties) { + copyProperties(source, target, CopyOptions.create().setIgnoreProperties(ignoreProperties)); + } + + /** + * 复制Bean对象属性<br> + * 限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类 + * + * @param source 源Bean对象 + * @param target 目标Bean对象 + * @param copyOptions 拷贝选项,见 {@link CopyOptions} + */ + public static void copyProperties(Object source, Object target, CopyOptions copyOptions) { + if (null == copyOptions) { + copyOptions = new CopyOptions(); + } + + Class<?> actualEditable = target.getClass(); + if (copyOptions.editable != null) { + //检查限制类是否为target的父类或接口 + if (!copyOptions.editable.isInstance(target)) { + throw new IllegalArgumentException(StrKit.format("Target class [{}] not assignable to Editable class [{}]", target.getClass().getName(), copyOptions.editable.getName())); + } + actualEditable = copyOptions.editable; + } + PropertyDescriptor[] targetPds = null; + Map<String, PropertyDescriptor> sourcePdMap; + try { + sourcePdMap = getFieldNamePropertyDescriptorMap(source.getClass()); + targetPds = getPropertyDescriptors(actualEditable); + } catch (IntrospectionException e) { + throw new ToolBoxException(e); + } + + HashSet<String> ignoreSet = copyOptions.ignoreProperties != null ? CollectionKit.newHashSet(copyOptions.ignoreProperties) : null; + for (PropertyDescriptor targetPd : targetPds) { + Method writeMethod = targetPd.getWriteMethod(); + if (writeMethod != null && (ignoreSet == null || false == ignoreSet.contains(targetPd.getName()))) { + PropertyDescriptor sourcePd = sourcePdMap.get(targetPd.getName()); + if (sourcePd != null) { + Method readMethod = sourcePd.getReadMethod(); + // 源对象字段的getter方法返回值必须可转换为目标对象setter方法的第一个参数 + if (readMethod != null && ClassKit.isAssignable(writeMethod.getParameterTypes()[0], readMethod.getReturnType())) { + try { + Object value = ClassKit.setAccessible(readMethod).invoke(source); + if (null != value || false == copyOptions.isIgnoreNullValue) { + ClassKit.setAccessible(writeMethod).invoke(target, value); + } + } catch (Throwable ex) { + throw new ToolBoxException(ex, "Copy property [{}] to [{}] error: {}", sourcePd.getName(), targetPd.getName(), ex.getMessage()); + } + } + } + } + } + } + + /** + * 值提供者,用于提供Bean注入时参数对应值得抽象接口<br> + * 继承或匿名实例化此接口<br> + * 在Bean注入过程中,Bean获得字段名,通过外部方式根据这个字段名查找相应的字段值,然后注入Bean<br> + * + * @author Looly + */ + public static interface ValueProvider { + /** + * 获取值 + * + * @param name Bean对象中参数名 + * @return 对应参数名的值 + */ + public Object value(String name); + } + + /** + * 属性拷贝选项<br> + * 包括:<br> + * 1、限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类<br> + * 2、是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null<br> + * 3、忽略的属性列表,设置一个属性列表,不拷贝这些属性值<br> + * + * @author Looly + */ + public static class CopyOptions { + /** + * 限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类 + */ + private Class<?> editable; + /** + * 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null + */ + private boolean isIgnoreNullValue; + /** + * 忽略的属性列表,设置一个属性列表,不拷贝这些属性值 + */ + private String[] ignoreProperties; + + /** + * 创建拷贝选项 + * + * @return 拷贝选项 + */ + public static CopyOptions create() { + return new CopyOptions(); + } + + /** + * 创建拷贝选项 + * + * @param editable 限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性 + * @param isIgnoreNullValue 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null + * @param ignoreProperties 忽略的属性列表,设置一个属性列表,不拷贝这些属性值 + * @return 拷贝选项 + */ + public static CopyOptions create(Class<?> editable, boolean isIgnoreNullValue, String... ignoreProperties) { + return new CopyOptions(editable, isIgnoreNullValue, ignoreProperties); + } + + /** + * 构造拷贝选项 + */ + public CopyOptions() { + } + + /** + * 构造拷贝选项 + * + * @param editable 限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性 + * @param isIgnoreNullValue 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null + * @param ignoreProperties 忽略的属性列表,设置一个属性列表,不拷贝这些属性值 + */ + public CopyOptions(Class<?> editable, boolean isIgnoreNullValue, String... ignoreProperties) { + this.editable = editable; + this.isIgnoreNullValue = isIgnoreNullValue; + this.ignoreProperties = ignoreProperties; + } + + /** + * 设置限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性 + * + * @param editable 限制的类或接口 + * @return CopyOptions + */ + public CopyOptions setEditable(Class<?> editable) { + this.editable = editable; + return this; + } + + /** + * 设置是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null + * + * @param isIgnoreNullVall 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null + * @return CopyOptions + */ + public CopyOptions setIgnoreNullValue(boolean isIgnoreNullVall) { + this.isIgnoreNullValue = isIgnoreNullVall; + return this; + } + + /** + * 设置忽略的属性列表,设置一个属性列表,不拷贝这些属性值 + * + * @param ignoreProperties 忽略的属性列表,设置一个属性列表,不拷贝这些属性值 + * @return CopyOptions + */ + public CopyOptions setIgnoreProperties(String... ignoreProperties) { + this.ignoreProperties = ignoreProperties; + return this; + } + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/ClassKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/ClassKit.java new file mode 100644 index 0000000..672852d --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/ClassKit.java @@ -0,0 +1,206 @@ +package com.agentdriving.user.core.support; + + +import com.agentdriving.user.core.support.exception.ToolBoxException; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +/** + * 类工具类 + * 1、扫描指定包下的所有类<br> + * 参考 http://www.oschina.net/code/snippet_234657_22722 + * @author seaside_hi, xiaoleilu, chill + * + */ +public class ClassKit { + + private ClassKit() { + // 静态类不可实例化 + } + + /** + * 是否为标准的类<br> + * 这个类必须:<br> + * 1、非接口 2、非抽象类 3、非Enum枚举 4、非数组 5、非注解 6、非原始类型(int, long等) + * + * @param clazz 类 + * @return 是否为标准类 + */ + public static boolean isNormalClass(Class<?> clazz) { + return null != clazz && false == clazz.isInterface() && false == isAbstract(clazz) && false == clazz.isEnum() && false == clazz.isArray() && false == clazz.isAnnotation() && false == clazz + .isSynthetic() && false == clazz.isPrimitive(); + } + + /** + * 是否为抽象类 + * + * @param clazz 类 + * @return 是否为抽象类 + */ + public static boolean isAbstract(Class<?> clazz) { + return Modifier.isAbstract(clazz.getModifiers()); + } + + /** + * 实例化对象 + * + * @param clazz 类名 + * @return 对象 + */ + @SuppressWarnings("unchecked") + public static <T> T newInstance(String clazz) { + if (null == clazz) + return null; + try { + return (T) Class.forName(clazz).newInstance(); + } catch (Exception e) { + throw new ToolBoxException(StrKit.format("Instance class [{}] error!", clazz), e); + } + } + + /** + * 实例化对象 + * + * @param clazz 类 + * @return 对象 + */ + public static <T> T newInstance(Class<T> clazz) { + if (null == clazz) + return null; + try { + return (T) clazz.newInstance(); + } catch (Exception e) { + throw new ToolBoxException(StrKit.format("Instance class [{}] error!", clazz), e); + } + } + + /** + * 实例化对象 + * + * @param clazz 类 + * @return 对象 + */ + public static <T> T newInstance(Class<T> clazz, Object... params) { + if (null == clazz) + return null; + if (CollectionKit.isEmpty(params)) { + return newInstance(clazz); + } + try { + return clazz.getDeclaredConstructor(getClasses(params)).newInstance(params); + } catch (Exception e) { + throw new ToolBoxException(StrKit.format("Instance class [{}] error!", clazz), e); + } + } + + /** + * 获得对象数组的类数组 + * @param objects 对象数组 + * @return 类数组 + */ + public static Class<?>[] getClasses(Object... objects){ + Class<?>[] classes = new Class<?>[objects.length]; + for (int i = 0; i < objects.length; i++) { + classes[i] = objects[i].getClass(); + } + return classes; + } + + /** + * 检查目标类是否可以从原类转化<br> + * 转化包括:<br> + * 1、原类是对象,目标类型是原类型实现的接口<br> + * 2、目标类型是原类型的父类<br> + * 3、两者是原始类型或者包装类型(相互转换) + * + * @param targetType 目标类型 + * @param sourceType 原类型 + * @return 是否可转化 + */ + public static boolean isAssignable(Class<?> targetType, Class<?> sourceType) { + if (null == targetType || null == sourceType) { + return false; + } + + // 对象类型 + if (targetType.isAssignableFrom(sourceType)) { + return true; + } + + // 基本类型 + if (targetType.isPrimitive()) { + // 原始类型 + Class<?> resolvedPrimitive = BasicType.wrapperPrimitiveMap.get(sourceType); + if (resolvedPrimitive != null && targetType.equals(resolvedPrimitive)) { + return true; + } + } else { + // 包装类型 + Class<?> resolvedWrapper = BasicType.primitiveWrapperMap.get(sourceType); + if (resolvedWrapper != null && targetType.isAssignableFrom(resolvedWrapper)) { + return true; + } + } + return false; + } + + /** + * 设置方法为可访问 + * + * @param method 方法 + * @return 方法 + */ + public static Method setAccessible(Method method) { + if (null != method && ClassKit.isNotPublic(method)) { + method.setAccessible(true); + } + return method; + } + + /** + * 指定类是否为非public + * + * @param clazz 类 + * @return 是否为非public + */ + public static boolean isNotPublic(Class<?> clazz) { + return false == isPublic(clazz); + } + + /** + * 指定方法是否为非public + * + * @param method 方法 + * @return 是否为非public + */ + public static boolean isNotPublic(Method method) { + return false == isPublic(method); + } + + /** + * 指定类是否为Public + * + * @param clazz 类 + * @return 是否为public + */ + public static boolean isPublic(Class<?> clazz) { + if (null == clazz) { + throw new NullPointerException("Class to provided is null."); + } + return Modifier.isPublic(clazz.getModifiers()); + } + + /** + * 指定方法是否为Public + * + * @param method 方法 + * @return 是否为public + */ + public static boolean isPublic(Method method) { + if (null == method) { + throw new NullPointerException("Method to provided is null."); + } + return isPublic(method.getDeclaringClass()); + } +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/CollectionKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/CollectionKit.java new file mode 100644 index 0000000..32d5c7b --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/CollectionKit.java @@ -0,0 +1,801 @@ +package com.agentdriving.user.core.support; + + +import com.agentdriving.user.core.support.exception.ToolBoxException; + +import java.lang.reflect.Array; +import java.util.*; +import java.util.Map.Entry; + +/** + * 集合相关工具类,包括数组 + * + * @author xiaoleilu + * + */ +public class CollectionKit { + + private CollectionKit() { + // 静态类不可实例化 + } + + /** + * 以 conjunction 为分隔符将集合转换为字符串 + * + * @param <T> 被处理的集合 + * @param collection 集合 + * @param conjunction 分隔符 + * @return 连接后的字符串 + */ + public static <T> String join(Iterable<T> collection, String conjunction) { + StringBuilder sb = new StringBuilder(); + boolean isFirst = true; + for (T item : collection) { + if (isFirst) { + isFirst = false; + } else { + sb.append(conjunction); + } + sb.append(item); + } + return sb.toString(); + } + + /** + * 以 conjunction 为分隔符将数组转换为字符串 + * + * @param <T> 被处理的集合 + * @param array 数组 + * @param conjunction 分隔符 + * @return 连接后的字符串 + */ + public static <T> String join(T[] array, String conjunction) { + StringBuilder sb = new StringBuilder(); + boolean isFirst = true; + for (T item : array) { + if (isFirst) { + isFirst = false; + } else { + sb.append(conjunction); + } + sb.append(item); + } + return sb.toString(); + } + + /** + * 将多个集合排序并显示不同的段落(分页) + * @param pageNo 页码 + * @param numPerPage 每页的条目数 + * @param comparator 比较器 + * @param colls 集合数组 + * @return 分页后的段落内容 + */ + @SafeVarargs + public static <T> List<T> sortPageAll(int pageNo, int numPerPage, Comparator<T> comparator, Collection<T>... colls) { + final List<T> result = new ArrayList<T>(); + for (Collection<T> coll : colls) { + result.addAll(coll); + } + + Collections.sort(result, comparator); + + //第一页且数目少于第一页显示的数目 + if(pageNo <=1 && result.size() <= numPerPage) { + return result; + } + + final int[] startEnd = PageKit.transToStartEnd(pageNo, numPerPage); + return result.subList(startEnd[0], startEnd[1]); + } + + /** + * 将多个集合排序并显示不同的段落(分页) + * @param pageNo 页码 + * @param numPerPage 每页的条目数 + * @param comparator 比较器 + * @param colls 集合数组 + * @return 分业后的段落内容 + */ +// @SafeVarargs +// public static <T> List<T> sortPageAll2(int pageNo, int numPerPage, Comparator<T> comparator, Collection<T>... colls) { +// BoundedPriorityQueue<T> queue = new BoundedPriorityQueue<T>(pageNo * numPerPage); +// for (Collection<T> coll : colls) { +// queue.addAll(coll); +// } +// +// //第一页且数目少于第一页显示的数目 +// if(pageNo <=1 && queue.size() <= numPerPage) { +// return queue.toList(); +// } +// +// final int[] startEnd = PageKit.transToStartEnd(pageNo, numPerPage); +// return queue.toList().subList(startEnd[0], startEnd[1]); +// } + + /** + * 将Set排序(根据Entry的值) + * + * @param set 被排序的Set + * @return 排序后的Set + */ + public static List<Entry<Long, Long>> sortEntrySetToList(Set<Entry<Long, Long>> set) { + List<Entry<Long, Long>> list = new LinkedList<Entry<Long, Long>>(set); + Collections.sort(list, new Comparator<Entry<Long, Long>>(){ + + @Override + public int compare(Entry<Long, Long> o1, Entry<Long, Long> o2) { + if (o1.getValue() > o2.getValue()){ + return 1; + } + if (o1.getValue() < o2.getValue()){ + return -1; + } + return 0; + } + }); + return list; + } + + /** + * 切取部分数据 + * + * @param <T> 集合元素类型 + * @param surplusAlaDatas 原数据 + * @param partSize 每部分数据的长度 + * @return 切取出的数据或null + */ + public static <T> List<T> popPart(Stack<T> surplusAlaDatas, int partSize) { + if (surplusAlaDatas == null || surplusAlaDatas.size() <= 0){ + return null; + } + + final List<T> currentAlaDatas = new ArrayList<T>(); + int size = surplusAlaDatas.size(); + // 切割 + if (size > partSize) { + for (int i = 0; i < partSize; i++) { + currentAlaDatas.add(surplusAlaDatas.pop()); + } + } else { + for (int i = 0; i < size; i++) { + currentAlaDatas.add(surplusAlaDatas.pop()); + } + } + return currentAlaDatas; + } + + /** + * 切取部分数据 + * + * @param <T> 集合元素类型 + * @param surplusAlaDatas 原数据 + * @param partSize 每部分数据的长度 + * @return 切取出的数据或null + */ + public static <T> List<T> popPart(Deque<T> surplusAlaDatas, int partSize) { + if (surplusAlaDatas == null || surplusAlaDatas.size() <= 0){ + return null; + } + + final List<T> currentAlaDatas = new ArrayList<T>(); + int size = surplusAlaDatas.size(); + // 切割 + if (size > partSize) { + for (int i = 0; i < partSize; i++) { + currentAlaDatas.add(surplusAlaDatas.pop()); + } + } else { + for (int i = 0; i < size; i++) { + currentAlaDatas.add(surplusAlaDatas.pop()); + } + } + return currentAlaDatas; + } + + /** + * 新建一个HashMap + * + * @return HashMap对象 + */ + public static <T, K> HashMap<T, K> newHashMap() { + return new HashMap<T, K>(); + } + + /** + * 新建一个HashMap + * @param size 初始大小,由于默认负载因子0.75,传入的size会实际初始大小为size / 0.75 + * @return HashMap对象 + */ + public static <T, K> HashMap<T, K> newHashMap(int size) { + return new HashMap<T, K>((int)(size / 0.75)); + } + + /** + * 新建一个HashSet + * + * @return HashSet对象 + */ + public static <T> HashSet<T> newHashSet() { + return new HashSet<T>(); + } + + /** + * 新建一个HashSet + * + * @return HashSet对象 + */ + @SafeVarargs + public static <T> HashSet<T> newHashSet(T... ts) { + HashSet<T> set = new HashSet<T>(); + for (T t : ts) { + set.add(t); + } + return set; + } + + /** + * 新建一个ArrayList + * + * @return ArrayList对象 + */ + public static <T> ArrayList<T> newArrayList() { + return new ArrayList<T>(); + } + + /** + * 新建一个ArrayList + * + * @return ArrayList对象 + */ + @SafeVarargs + public static <T> ArrayList<T> newArrayList(T... values) { + return new ArrayList<T>(Arrays.asList(values)); + } + + /** + * 将新元素添加到已有数组中<br/> + * 添加新元素会生成一个新的数组,不影响原数组 + * + * @param buffer 已有数组 + * @param newElement 新元素 + * @return 新数组 + */ + public static <T> T[] append(T[] buffer, T newElement) { + T[] t = resize(buffer, buffer.length + 1, newElement.getClass()); + t[buffer.length] = newElement; + return t; + } + + /** + * 生成一个新的重新设置大小的数组 + * + * @param buffer 原数组 + * @param newSize 新的数组大小 + * @param componentType 数组元素类型 + * @return 调整后的新数组 + */ + public static <T> T[] resize(T[] buffer, int newSize, Class<?> componentType) { + T[] newArray = newArray(componentType, newSize); + System.arraycopy(buffer, 0, newArray, 0, buffer.length >= newSize ? newSize : buffer.length); + return newArray; + } + + /** + * 新建一个空数组 + * @param componentType 元素类型 + * @param newSize 大小 + * @return 空数组 + */ + @SuppressWarnings("unchecked") + public static <T> T[] newArray(Class<?> componentType, int newSize) { + return (T[]) Array.newInstance(componentType, newSize); + } + + /** + * 生成一个新的重新设置大小的数组<br/> + * 新数组的类型为原数组的类型 + * + * @param buffer 原数组 + * @param newSize 新的数组大小 + * @return 调整后的新数组 + */ + public static <T> T[] resize(T[] buffer, int newSize) { + return resize(buffer, newSize, buffer.getClass().getComponentType()); + } + + /** + * 将多个数组合并在一起<br> + * 忽略null的数组 + * + * @param arrays 数组集合 + * @return 合并后的数组 + */ + @SafeVarargs + public static <T> T[] addAll(T[]... arrays) { + if (arrays.length == 1) { + return arrays[0]; + } + + int length = 0; + for (T[] array : arrays) { + if(array == null) { + continue; + } + length += array.length; + } + T[] result = newArray(arrays.getClass().getComponentType().getComponentType(), length); + + length = 0; + for (T[] array : arrays) { + if(array == null) { + continue; + } + System.arraycopy(array, 0, result, length, array.length); + length += array.length; + } + return result; + } + + /** + * 克隆数组 + * @param array 被克隆的数组 + * @return 新数组 + */ + public static <T> T[] clone(T[] array) { + if (array == null) { + return null; + } + return array.clone(); + } + + /** + * 生成一个数字列表<br> + * 自动判定正序反序 + * @param excludedEnd 结束的数字(不包含) + * @return 数字列表 + */ + public static int[] range(int excludedEnd) { + return range(0, excludedEnd, 1); + } + + /** + * 生成一个数字列表<br> + * 自动判定正序反序 + * @param includedStart 开始的数字(包含) + * @param excludedEnd 结束的数字(不包含) + * @return 数字列表 + */ + public static int[] range(int includedStart, int excludedEnd) { + return range(includedStart, excludedEnd, 1); + } + + /** + * 生成一个数字列表<br> + * 自动判定正序反序 + * @param includedStart 开始的数字(包含) + * @param excludedEnd 结束的数字(不包含) + * @param step 步进 + * @return 数字列表 + */ + public static int[] range(int includedStart, int excludedEnd, int step) { + if(includedStart > excludedEnd) { + int tmp = includedStart; + includedStart = excludedEnd; + excludedEnd = tmp; + } + + if(step <=0) { + step = 1; + } + + int deviation = excludedEnd - includedStart; + int length = deviation / step; + if(deviation % step != 0) { + length += 1; + } + int[] range = new int[length]; + for(int i = 0; i < length; i++) { + range[i] = includedStart; + includedStart += step; + } + return range; + } + + /** + * 截取数组的部分 + * @param list 被截取的数组 + * @param start 开始位置(包含) + * @param end 结束位置(不包含) + * @return 截取后的数组,当开始位置超过最大时,返回null + */ + public static <T> List<T> sub(List<T> list, int start, int end) { + if(list == null || list.isEmpty()) { + return null; + } + + if(start < 0) { + start = 0; + } + if(end < 0) { + end = 0; + } + + if(start > end) { + int tmp = start; + start = end; + end = tmp; + } + + final int size = list.size(); + if(end > size) { + if(start >= size) { + return null; + } + end = size; + } + + return list.subList(start, end); + } + + /** + * 截取集合的部分 + * @param list 被截取的数组 + * @param start 开始位置(包含) + * @param end 结束位置(不包含) + * @return 截取后的数组,当开始位置超过最大时,返回null + */ + public static <T> List<T> sub(Collection<T> list, int start, int end) { + if(list == null || list.isEmpty()) { + return null; + } + + return sub(new ArrayList<T>(list), start, end); + } + + /** + * 数组是否为空 + * @param array 数组 + * @return 是否为空 + */ + public static <T> boolean isEmpty(T[] array) { + return array == null || array.length == 0; + } + + /** + * 数组是否为非空 + * @param array 数组 + * @return 是否为非空 + */ + public static <T> boolean isNotEmpty(T[] array) { + return false == isEmpty(array); + } + + /** + * 集合是否为空 + * @param collection 集合 + * @return 是否为空 + */ + public static boolean isEmpty(Collection<?> collection) { + return collection == null || collection.isEmpty(); + } + + /** + * 集合是否为非空 + * @param collection 集合 + * @return 是否为非空 + */ + public static boolean isNotEmpty(Collection<?> collection) { + return false == isEmpty(collection); + } + + /** + * Map是否为空 + * @param map 集合 + * @return 是否为空 + */ + public static boolean isEmpty(Map<?, ?> map) { + return map == null || map.isEmpty(); + } + + /** + * Map是否为非空 + * @param map 集合 + * @return 是否为非空 + */ + public static <T> boolean isNotEmpty(Map<?, ?> map) { + return false == isEmpty(map); + } + + /** + * 映射键值(参考Python的zip()函数)<br> + * 例如:<br> + * keys = [a,b,c,d]<br> + * values = [1,2,3,4]<br> + * 则得到的Map是 {a=1, b=2, c=3, d=4}<br> + * 如果两个数组长度不同,则只对应最短部分 + * @param keys 键列表 + * @param values 值列表 + * @return Map + */ + public static <T, K> Map<T, K> zip(T[] keys, K[] values) { + if(isEmpty(keys) || isEmpty(values)) { + return null; + } + + final int size = Math.min(keys.length, values.length); + final Map<T, K> map = new HashMap<T, K>((int)(size / 0.75)); + for(int i = 0; i < size; i++) { + map.put(keys[i], values[i]); + } + + return map; + } + + /** + * 映射键值(参考Python的zip()函数)<br> + * 例如:<br> + * keys = a,b,c,d<br> + * values = 1,2,3,4<br> + * delimiter = , + * 则得到的Map是 {a=1, b=2, c=3, d=4}<br> + * 如果两个数组长度不同,则只对应最短部分 + * @param keys 键列表 + * @param values 值列表 + * @return Map + */ + public static Map<String, String> zip(String keys, String values, String delimiter) { + return zip(StrKit.split(keys, delimiter), StrKit.split(values, delimiter)); + } + + /** + * 映射键值(参考Python的zip()函数)<br> + * 例如:<br> + * keys = [a,b,c,d]<br> + * values = [1,2,3,4]<br> + * 则得到的Map是 {a=1, b=2, c=3, d=4}<br> + * 如果两个数组长度不同,则只对应最短部分 + * @param keys 键列表 + * @param values 值列表 + * @return Map + */ + public static <T, K> Map<T, K> zip(Collection<T> keys, Collection<K> values) { + if(isEmpty(keys) || isEmpty(values)) { + return null; + } + + final List<T> keyList = new ArrayList<T>(keys); + final List<K> valueList = new ArrayList<K>(values); + + final int size = Math.min(keys.size(), values.size()); + final Map<T, K> map = new HashMap<T, K>((int)(size / 0.75)); + for(int i = 0; i < size; i++) { + map.put(keyList.get(i), valueList.get(i)); + } + + return map; + } + + /** + * 数组中是否包含元素 + * @param array 数组 + * @param value 被检查的元素 + * @return 是否包含 + */ + public static <T> boolean contains(T[] array, T value) { + final Class<?> componetType = array.getClass().getComponentType(); + boolean isPrimitive = false; + if(null != componetType) { + isPrimitive = componetType.isPrimitive(); + } + for (T t : array) { + if(t == value) { + return true; + }else if(false == isPrimitive && null != value && value.equals(t)) { + return true; + } + } + return false; + } + + /** + * 将Entry集合转换为HashMap + * @param entryCollection entry集合 + * @return Map + */ + public static <T, K> HashMap<T, K> toMap(Collection<Entry<T, K>> entryCollection) { + HashMap<T,K> map = new HashMap<T, K>(); + for (Entry<T, K> entry : entryCollection) { + map.put(entry.getKey(), entry.getValue()); + } + return map; + } + + /** + * 将集合转换为排序后的TreeSet + * @param collection 集合 + * @param comparator 比较器 + * @return treeSet + */ + public static <T> TreeSet<T> toTreeSet(Collection<T> collection, Comparator<T> comparator){ + final TreeSet<T> treeSet = new TreeSet<T>(comparator); + for (T t : collection) { + treeSet.add(t); + } + return treeSet; + } + + /** + * 排序集合 + * @param collection 集合 + * @param comparator 比较器 + * @return treeSet + */ + public static <T> List<T> sort(Collection<T> collection, Comparator<T> comparator){ + List<T> list = new ArrayList<T>(collection); + Collections.sort(list, comparator); + return list; + } + + //------------------------------------------------------------------- 基本类型的数组转换为包装类型数组 + /** + * 将基本类型数组包装为包装类型 + * @param values 基本类型数组 + * @return 包装类型数组 + */ + public static Integer[] wrap(int... values){ + final int length = values.length; + Integer[] array = new Integer[length]; + for(int i = 0; i < length; i++){ + array[i] = values[i]; + } + return array; + } + + /** + * 将基本类型数组包装为包装类型 + * @param values 基本类型数组 + * @return 包装类型数组 + */ + public static Long[] wrap(long... values){ + final int length = values.length; + Long[] array = new Long[length]; + for(int i = 0; i < length; i++){ + array[i] = values[i]; + } + return array; + } + + /** + * 将基本类型数组包装为包装类型 + * @param values 基本类型数组 + * @return 包装类型数组 + */ + public static Character[] wrap(char... values){ + final int length = values.length; + Character[] array = new Character[length]; + for(int i = 0; i < length; i++){ + array[i] = values[i]; + } + return array; + } + + /** + * 将基本类型数组包装为包装类型 + * @param values 基本类型数组 + * @return 包装类型数组 + */ + public static Byte[] wrap(byte... values){ + final int length = values.length; + Byte[] array = new Byte[length]; + for(int i = 0; i < length; i++){ + array[i] = values[i]; + } + return array; + } + + /** + * 将基本类型数组包装为包装类型 + * @param values 基本类型数组 + * @return 包装类型数组 + */ + public static Short[] wrap(short... values){ + final int length = values.length; + Short[] array = new Short[length]; + for(int i = 0; i < length; i++){ + array[i] = values[i]; + } + return array; + } + + /** + * 将基本类型数组包装为包装类型 + * @param values 基本类型数组 + * @return 包装类型数组 + */ + public static Float[] wrap(float... values){ + final int length = values.length; + Float[] array = new Float[length]; + for(int i = 0; i < length; i++){ + array[i] = values[i]; + } + return array; + } + + /** + * 将基本类型数组包装为包装类型 + * @param values 基本类型数组 + * @return 包装类型数组 + */ + public static Double[] wrap(double... values){ + final int length = values.length; + Double[] array = new Double[length]; + for(int i = 0; i < length; i++){ + array[i] = values[i]; + } + return array; + } + + /** + * 将基本类型数组包装为包装类型 + * @param values 基本类型数组 + * @return 包装类型数组 + */ + public static Boolean[] wrap(boolean... values){ + final int length = values.length; + Boolean[] array = new Boolean[length]; + for(int i = 0; i < length; i++){ + array[i] = values[i]; + } + return array; + } + + /** + * 判定给定对象是否为数组类型 + * @param obj 对象 + * @return 是否为数组类型 + */ + public static boolean isArray(Object obj){ + return obj.getClass().isArray(); + } + + /** + * 数组或集合转String + * + * @param obj 集合或数组对象 + * @return 数组字符串,与集合转字符串格式相同 + */ + public static String toString(Object obj) { + if (null == obj) { + return null; + } + if (isArray(obj)) { + try { + return Arrays.deepToString((Object[]) obj); + } catch (Exception e) { + final String className = obj.getClass().getComponentType().getName(); + switch (className) { + case "long": + return Arrays.toString((long[]) obj); + case "int": + return Arrays.toString((int[]) obj); + case "short": + return Arrays.toString((short[]) obj); + case "char": + return Arrays.toString((char[]) obj); + case "byte": + return Arrays.toString((byte[]) obj); + case "boolean": + return Arrays.toString((boolean[]) obj); + case "float": + return Arrays.toString((float[]) obj); + case "double": + return Arrays.toString((double[]) obj); + default: + throw new ToolBoxException(e); + } + } + } + return obj.toString(); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTime.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTime.java new file mode 100644 index 0000000..90479be --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTime.java @@ -0,0 +1,67 @@ +package com.agentdriving.user.core.support; + +import java.util.Date; + +/** + * 封装java.util.Date + * @author xiaoleilu + * + */ +public class DateTime extends Date{ + private static final long serialVersionUID = -5395712593979185936L; + + /** + * 转换JDK date为 DateTime + * @param date JDK Date + * @return DateTime + */ + public static DateTime parse(Date date) { + return new DateTime(date); + } + + /** + * 当前时间 + */ + public DateTime() { + super(); + } + + /** + * 给定日期的构造 + * @param date 日期 + */ + public DateTime(Date date) { + this(date.getTime()); + } + + /** + * 给定日期毫秒数的构造 + * @param timeMillis 日期毫秒数 + */ + public DateTime(long timeMillis) { + super(timeMillis); + } + + @Override + public String toString() { + return DateTimeKit.formatDateTime(this); + } + + public String toString(String format) { + return DateTimeKit.format(this, format); + } + + /** + * @return 输出精确到毫秒的标准日期形式 + */ + public String toMsStr() { + return DateTimeKit.format(this, DateTimeKit.NORM_DATETIME_MS_PATTERN); + } + + /** + * @return java.util.Date + */ + public Date toDate() { + return new Date(this.getTime()); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTimeKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTimeKit.java new file mode 100644 index 0000000..f0d93cb --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTimeKit.java @@ -0,0 +1,665 @@ +package com.agentdriving.user.core.support; + +import com.agentdriving.user.core.support.exception.ToolBoxException; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.Locale; + +/** + * 时间工具类 + * @author xiaoleilu + */ +public class DateTimeKit { + /** 毫秒 */ + public final static long MS = 1; + /** 每秒钟的毫秒数 */ + public final static long SECOND_MS = MS * 1000; + /** 每分钟的毫秒数 */ + public final static long MINUTE_MS = SECOND_MS * 60; + /** 每小时的毫秒数 */ + public final static long HOUR_MS = MINUTE_MS * 60; + /** 每天的毫秒数 */ + public final static long DAY_MS = HOUR_MS * 24; + + /** 标准日期格式 */ + public final static String NORM_DATE_PATTERN = "yyyy-MM-dd"; + /** 标准时间格式 */ + public final static String NORM_TIME_PATTERN = "HH:mm:ss"; + /** 标准日期时间格式,精确到分 */ + public final static String NORM_DATETIME_MINUTE_PATTERN = "yyyy-MM-dd HH:mm"; + /** 标准日期时间格式,精确到秒 */ + public final static String NORM_DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; + /** 标准日期时间格式,精确到毫秒 */ + public final static String NORM_DATETIME_MS_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS"; + /** HTTP头中日期时间格式 */ + public final static String HTTP_DATETIME_PATTERN = "EEE, dd MMM yyyy HH:mm:ss z"; + + /** 标准日期(不含时间)格式化器 */ + // private final static SimpleDateFormat NORM_DATE_FORMAT = new SimpleDateFormat(NORM_DATE_PATTERN); + private static ThreadLocal<SimpleDateFormat> NORM_DATE_FORMAT = new ThreadLocal<SimpleDateFormat>(){ + synchronized protected SimpleDateFormat initialValue() { + return new SimpleDateFormat(NORM_DATE_PATTERN); + }; + }; + /** 标准时间格式化器 */ + // private final static SimpleDateFormat NORM_TIME_FORMAT = new SimpleDateFormat(NORM_TIME_PATTERN); + private static ThreadLocal<SimpleDateFormat> NORM_TIME_FORMAT = new ThreadLocal<SimpleDateFormat>(){ + synchronized protected SimpleDateFormat initialValue() { + return new SimpleDateFormat(NORM_TIME_PATTERN); + }; + }; + /** 标准日期时间格式化器 */ + // private final static SimpleDateFormat NORM_DATETIME_FORMAT = new SimpleDateFormat(NORM_DATETIME_PATTERN); + private static ThreadLocal<SimpleDateFormat> NORM_DATETIME_FORMAT = new ThreadLocal<SimpleDateFormat>(){ + synchronized protected SimpleDateFormat initialValue() { + return new SimpleDateFormat(NORM_DATETIME_PATTERN); + }; + }; + /** HTTP日期时间格式化器 */ + // private final static SimpleDateFormat HTTP_DATETIME_FORMAT = new SimpleDateFormat(HTTP_DATETIME_PATTERN, Locale.US); + private static ThreadLocal<SimpleDateFormat> HTTP_DATETIME_FORMAT = new ThreadLocal<SimpleDateFormat>(){ + synchronized protected SimpleDateFormat initialValue() { + return new SimpleDateFormat(HTTP_DATETIME_PATTERN, Locale.US); + }; + }; + + /** + * 当前时间,格式 yyyy-MM-dd HH:mm:ss + * + * @return 当前时间的标准形式字符串 + */ + public static String now() { + return formatDateTime(new DateTime()); + } + + /** + * 当前时间long + * + * @param isNano 是否为高精度时间 + * @return 时间 + */ + public static long current(boolean isNano) { + return isNano ? System.nanoTime() : System.currentTimeMillis(); + } + + /** + * 当前日期,格式 yyyy-MM-dd + * + * @return 当前日期的标准形式字符串 + */ + public static String today() { + return formatDate(new DateTime()); + } + + /** + * @return 当前月份 + */ + public static int thisMonth() { + return month(date()); + } + + /** + * @return 今年 + */ + public static int thisYear() { + return year(date()); + } + + /** + * @return 当前时间 + */ + public static DateTime date() { + return new DateTime(); + } + + /** + * Long类型时间转为Date + * + * @param date Long类型Date(Unix时间戳) + * @return 时间对象 + */ + public static DateTime date(long date) { + return new DateTime(date); + } + + /** + * 转换为Calendar对象 + * + * @param date 日期对象 + * @return Calendar对象 + */ + public static Calendar toCalendar(Date date) { + final Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal; + } + + /** + * 获得月份,从1月开始计数 + * + * @param date 日期 + * @return 月份 + */ + public static int month(Date date) { + return toCalendar(date).get(Calendar.MONTH) + 1; + } + + /** + * 获得年 + * + * @param date 日期 + * @return 年 + */ + public static int year(Date date) { + return toCalendar(date).get(Calendar.YEAR); + } + + /** + * 获得季节 + * + * @param date 日期 + * @return 第几个季节 + */ + public static int season(Date date) { + return toCalendar(date).get(Calendar.MONTH) / 3 + 1; + } + + /** + * 获得指定日期年份和季节<br> + * 格式:[20131]表示2013年第一季度 + * + * @param date 日期 + * @return Season ,类似于 20132 + */ + public static String yearAndSeason(Date date) { + return yearAndSeason(toCalendar(date)); + } + + /** + * 获得指定日期区间内的年份和季节<br> + * + * @param startDate 其实日期(包含) + * @param endDate 结束日期(包含) + * @return Season列表 ,元素类似于 20132 + */ + public static LinkedHashSet<String> yearAndSeasons(Date startDate, Date endDate) { + final LinkedHashSet<String> seasons = new LinkedHashSet<String>(); + if (startDate == null || endDate == null) { + return seasons; + } + + final Calendar cal = Calendar.getInstance(); + cal.setTime(startDate); + while (true) { + // 如果开始时间超出结束时间,让结束时间为开始时间,处理完后结束循环 + if (startDate.after(endDate)) { + startDate = endDate; + } + + seasons.add(yearAndSeason(cal)); + + if (startDate.equals(endDate)) { + break; + } + + cal.add(Calendar.MONTH, 3); + startDate = cal.getTime(); + } + + return seasons; + } + + // ------------------------------------ Format start ---------------------------------------------- + /** + * 根据特定格式格式化日期 + * + * @param date 被格式化的日期 + * @param format 格式 + * @return 格式化后的字符串 + */ + public static String format(Date date, String format) { + return new SimpleDateFormat(format).format(date); + } + + /** + * 格式 yyyy-MM-dd HH:mm:ss + * + * @param date 被格式化的日期 + * @return 格式化后的日期 + */ + public static String formatDateTime(Date date) { + if(null == date){ + return null; + } + return NORM_DATETIME_FORMAT.get().format(date); + } + + /** + * 格式 yyyy-MM-dd + * + * @param date 被格式化的日期 + * @return 格式化后的字符串 + */ + public static String formatDate(Date date) { + if(null == date){ + return null; + } + return NORM_DATE_FORMAT.get().format(date); + } + + /** + * 格式化为Http的标准日期格式 + * + * @param date 被格式化的日期 + * @return HTTP标准形式日期字符串 + */ + public static String formatHttpDate(Date date) { + if(null == date){ + return null; + } + return HTTP_DATETIME_FORMAT.get().format(date); + } + // ------------------------------------ Format end ---------------------------------------------- + + // ------------------------------------ Parse start ---------------------------------------------- + + /** + * 构建DateTime对象 + * + * @param dateStr Date字符串 + * @param simpleDateFormat 格式化器 + * @return DateTime对象 + */ + public static DateTime parse(String dateStr, SimpleDateFormat simpleDateFormat) { + try { + return new DateTime(simpleDateFormat.parse(dateStr)); + } catch (Exception e) { + throw new ToolBoxException(StrKit.format("Parse [{}] with format [{}] error!", dateStr, simpleDateFormat.toPattern()), e); + } + } + + /** + * 将特定格式的日期转换为Date对象 + * + * @param dateString 特定格式的日期 + * @param format 格式,例如yyyy-MM-dd + * @return 日期对象 + */ + public static DateTime parse(String dateString, String format) { + return parse(dateString, new SimpleDateFormat(format)); + } + + /** + * 格式yyyy-MM-dd HH:mm:ss + * + * @param dateString 标准形式的时间字符串 + * @return 日期对象 + */ + public static DateTime parseDateTime(String dateString) { + return parse(dateString, NORM_DATETIME_FORMAT.get()); + } + + /** + * 格式yyyy-MM-dd + * + * @param dateString 标准形式的日期字符串 + * @return 日期对象 + */ + public static DateTime parseDate(String dateString) { + return parse(dateString, NORM_DATE_FORMAT.get()); + } + + /** + * 格式HH:mm:ss + * + * @param timeString 标准形式的日期字符串 + * @return 日期对象 + */ + public static DateTime parseTime(String timeString) { + return parse(timeString, NORM_TIME_FORMAT.get()); + } + + /** + * 格式:<br> + * 1、yyyy-MM-dd HH:mm:ss<br> + * 2、yyyy-MM-dd<br> + * 3、HH:mm:ss<br> + * 4、yyyy-MM-dd HH:mm 5、yyyy-MM-dd HH:mm:ss.SSS + * + * @param dateStr 日期字符串 + * @return 日期 + */ + public static DateTime parse(String dateStr) { + if (null == dateStr) { + return null; + } + dateStr = dateStr.trim(); + int length = dateStr.length(); + try { + if (length == NORM_DATETIME_PATTERN.length()) { + return parseDateTime(dateStr); + } else if (length == NORM_DATE_PATTERN.length()) { + return parseDate(dateStr); + } else if (length == NORM_TIME_PATTERN.length()) { + return parseTime(dateStr); + } else if (length == NORM_DATETIME_MINUTE_PATTERN.length()) { + return parse(dateStr, NORM_DATETIME_MINUTE_PATTERN); + } else if (length >= NORM_DATETIME_MS_PATTERN.length() - 2) { + return parse(dateStr, NORM_DATETIME_MS_PATTERN); + } + } catch (Exception e) { + throw new ToolBoxException(StrKit.format("Parse [{}] with format normal error!", dateStr)); + } + + // 没有更多匹配的时间格式 + throw new ToolBoxException(StrKit.format(" [{}] format is not fit for date pattern!", dateStr)); + } + // ------------------------------------ Parse end ---------------------------------------------- + + // ------------------------------------ Offset start ---------------------------------------------- + /** + * 获取某天的开始时间 + * + * @param date 日期 + * @return 某天的开始时间 + */ + public static DateTime getBeginTimeOfDay(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return new DateTime(calendar.getTime()); + } + + /** + * 获取某天的结束时间 + * + * @param date 日期 + * @return 某天的结束时间 + */ + public static DateTime getEndTimeOfDay(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + calendar.set(Calendar.MILLISECOND, 999); + return new DateTime(calendar.getTime()); + } + + /** + * 昨天 + * + * @return 昨天 + */ + public static DateTime yesterday() { + return offsiteDay(new DateTime(), -1); + } + + /** + * 上周 + * + * @return 上周 + */ + public static DateTime lastWeek() { + return offsiteWeek(new DateTime(), -1); + } + + /** + * 上个月 + * + * @return 上个月 + */ + public static DateTime lastMouth() { + return offsiteMonth(new DateTime(), -1); + } + + /** + * 偏移天 + * + * @param date 日期 + * @param offsite 偏移天数,正数向未来偏移,负数向历史偏移 + * @return 偏移后的日期 + */ + public static DateTime offsiteDay(Date date, int offsite) { + return offsiteDate(date, Calendar.DAY_OF_YEAR, offsite); + } + + /** + * 偏移周 + * + * @param date 日期 + * @param offsite 偏移周数,正数向未来偏移,负数向历史偏移 + * @return 偏移后的日期 + */ + public static DateTime offsiteWeek(Date date, int offsite) { + return offsiteDate(date, Calendar.WEEK_OF_YEAR, offsite); + } + + /** + * 偏移月 + * + * @param date 日期 + * @param offsite 偏移月数,正数向未来偏移,负数向历史偏移 + * @return 偏移后的日期 + */ + public static DateTime offsiteMonth(Date date, int offsite) { + return offsiteDate(date, Calendar.MONTH, offsite); + } + + /** + * 获取指定日期偏移指定时间后的时间 + * + * @param date 基准日期 + * @param calendarField 偏移的粒度大小(小时、天、月等)使用Calendar中的常数 + * @param offsite 偏移量,正数为向后偏移,负数为向前偏移 + * @return 偏移后的日期 + */ + public static DateTime offsiteDate(Date date, int calendarField, int offsite) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.add(calendarField, offsite); + return new DateTime(cal.getTime()); + } + // ------------------------------------ Offset end ---------------------------------------------- + + /** + * 判断两个日期相差的时长<br/> + * 返回 minuend - subtrahend 的差 + * + * @param subtrahend 减数日期 + * @param minuend 被减数日期 + * @param diffField 相差的选项:相差的天、小时 + * @return 日期差 + */ + public static long diff(Date subtrahend, Date minuend, long diffField) { + long diff = minuend.getTime() - subtrahend.getTime(); + return diff / diffField; + } + + /** + * 计时,常用于记录某段代码的执行时间,单位:纳秒 + * + * @param preTime 之前记录的时间 + * @return 时间差,纳秒 + */ + public static long spendNt(long preTime) { + return System.nanoTime() - preTime; + } + + /** + * 计时,常用于记录某段代码的执行时间,单位:毫秒 + * + * @param preTime 之前记录的时间 + * @return 时间差,毫秒 + */ + public static long spendMs(long preTime) { + return System.currentTimeMillis() - preTime; + } + + /** + * 格式化成yyMMddHHmm后转换为int型 + * + * @param date 日期 + * @return int + */ + public static int toIntSecond(Date date) { + return Integer.parseInt(format(date, "yyMMddHHmm")); + } + + /** + * 计算指定指定时间区间内的周数 + * + * @param start 开始时间 + * @param end 结束时间 + * @return 周数 + */ + public static int weekCount(Date start, Date end) { + final Calendar startCalendar = Calendar.getInstance(); + startCalendar.setTime(start); + final Calendar endCalendar = Calendar.getInstance(); + endCalendar.setTime(end); + + final int startWeekofYear = startCalendar.get(Calendar.WEEK_OF_YEAR); + final int endWeekofYear = endCalendar.get(Calendar.WEEK_OF_YEAR); + + int count = endWeekofYear - startWeekofYear + 1; + + if (Calendar.SUNDAY != startCalendar.get(Calendar.DAY_OF_WEEK)) { + count--; + } + + return count; + } + + /** + * 计时器<br> + * 计算某个过程话费的时间,精确到毫秒 + * + * @return Timer + */ + public static Timer timer() { + return new Timer(); + + } + + /** + * 生日转为年龄,计算法定年龄 + * @param birthDay 生日,标准日期字符串 + * @return 年龄 + * @throws Exception + */ + public static int ageOfNow(String birthDay) { + return ageOfNow(parse(birthDay)); + } + + /** + * 生日转为年龄,计算法定年龄 + * @param birthDay 生日 + * @return 年龄 + * @throws Exception + */ + public static int ageOfNow(Date birthDay) { + return age(birthDay,date()); + } + + /** + * 计算相对于dateToCompare的年龄,长用于计算指定生日在某年的年龄 + * @param birthDay 生日 + * @param dateToCompare 需要对比的日期 + * @return 年龄 + * @throws Exception + */ + public static int age(Date birthDay, Date dateToCompare) { + Calendar cal = Calendar.getInstance(); + cal.setTime(dateToCompare); + + if (cal.before(birthDay)) { + throw new IllegalArgumentException(StrKit.format("Birthday is after date {}!", formatDate(dateToCompare))); + } + + int year = cal.get(Calendar.YEAR); + int month = cal.get(Calendar.MONTH); + int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH); + + cal.setTime(birthDay); + int age = year - cal.get(Calendar.YEAR); + + int monthBirth = cal.get(Calendar.MONTH); + if (month == monthBirth) { + int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH); + if (dayOfMonth < dayOfMonthBirth) { + //如果生日在当月,但是未达到生日当天的日期,年龄减一 + age--; + } + } else if (month < monthBirth){ + //如果当前月份未达到生日的月份,年龄计算减一 + age--; + } + + return age; + } + + /** + * 计时器<br> + * 计算某个过程话费的时间,精确到毫秒 + * + * @author Looly + * + */ + public static class Timer { + private long time; + private boolean isNano; + + public Timer() { + this(false); + } + + public Timer(boolean isNano) { + this.isNano = isNano; + start(); + } + + /** + * @return 开始计时并返回当前时间 + */ + public long start() { + time = current(isNano); + return time; + } + + /** + * @return 重新计时并返回从开始到当前的持续时间 + */ + public long durationRestart() { + long now = current(isNano); + long d = now - time; + time = now; + return d; + } + + /** + * @return 从开始到当前的持续时间 + */ + public long duration() { + return current(isNano) - time; + } + } + + // ------------------------------------------------------------------------ Private method start + /** + * 获得指定日期年份和季节<br> + * 格式:[20131]表示2013年第一季度 + * + * @param cal 日期 + */ + private static String yearAndSeason(Calendar cal) { + return new StringBuilder().append(cal.get(Calendar.YEAR)).append(cal.get(Calendar.MONTH) / 3 + 1).toString(); + } + // ------------------------------------------------------------------------ Private method end +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/HexKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/HexKit.java new file mode 100644 index 0000000..0fa6a7e --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/HexKit.java @@ -0,0 +1,254 @@ +package com.agentdriving.user.core.support; + +import java.nio.charset.Charset; + +/** + * 十六进制(简写为hex或下标16)在数学中是一种逢16进1的进位制,一般用数字0到9和字母A到F表示(其中:A~F即10~15)。<br> + * 例如十进制数57,在二进制写作111001,在16进制写作39。<br> + * 像java,c这样的语言为了区分十六进制和十进制数值,会在十六进制数的前面加上 0x,比如0x20是十进制的32,而不是十进制的20<br> + * + * 参考:https://my.oschina.net/xinxingegeya/blog/287476 + * + * @author Looly + * + */ +public class HexKit { + + /** + * 用于建立十六进制字符的输出的小写字符数组 + */ + private static final char[] DIGITS_LOWER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + /** + * 用于建立十六进制字符的输出的大写字符数组 + */ + private static final char[] DIGITS_UPPER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + + //---------------------------------------------------------------------------------------------------- encode + /** + * 将字节数组转换为十六进制字符数组 + * + * @param data byte[] + * @return 十六进制char[] + */ + public static char[] encodeHex(byte[] data) { + return encodeHex(data, true); + } + + /** + * 将字节数组转换为十六进制字符数组 + * + * @param str 字符串 + * @param charset 编码 + * @return 十六进制char[] + */ + public static char[] encodeHex(String str, Charset charset) { + return encodeHex(StrKit.getBytes(str, charset), true); + } + + /** + * 将字节数组转换为十六进制字符数组 + * + * @param data byte[] + * @param toLowerCase <code>true</code> 传换成小写格式 , <code>false</code> 传换成大写格式 + * @return 十六进制char[] + */ + public static char[] encodeHex(byte[] data, boolean toLowerCase) { + return encodeHex(data, toLowerCase ? DIGITS_LOWER : DIGITS_UPPER); + } + + /** + * 将字节数组转换为十六进制字符串 + * + * @param data byte[] + * @return 十六进制String + */ + public static String encodeHexStr(byte[] data) { + return encodeHexStr(data, true); + } + + /** + * 将字节数组转换为十六进制字符串 + * + * @param data byte[] + * @param toLowerCase <code>true</code> 传换成小写格式 , <code>false</code> 传换成大写格式 + * @return 十六进制String + */ + public static String encodeHexStr(byte[] data, boolean toLowerCase) { + return encodeHexStr(data, toLowerCase ? DIGITS_LOWER : DIGITS_UPPER); + } + + //---------------------------------------------------------------------------------------------------- decode + /** + * 将十六进制字符数组转换为字符串 + * + * @param hexStr 十六进制String + * @param charset 编码 + * @return 字符串 + */ + public static String decodeHexStr(String hexStr, Charset charset) { + if(StrKit.isEmpty(hexStr)){ + return hexStr; + } + return decodeHexStr(hexStr.toCharArray(), charset); + } + + /** + * 将十六进制字符数组转换为字符串 + * + * @param hexData 十六进制char[] + * @param charset 编码 + * @return 字符串 + */ + public static String decodeHexStr(char[] hexData, Charset charset) { + return StrKit.str(decodeHex(hexData), charset); + } + + /** + * 将十六进制字符数组转换为字节数组 + * + * @param hexData 十六进制char[] + * @return byte[] + * @throws RuntimeException 如果源十六进制字符数组是一个奇怪的长度,将抛出运行时异常 + */ + public static byte[] decodeHex(char[] hexData) { + + int len = hexData.length; + + if ((len & 0x01) != 0) { + throw new RuntimeException("Odd number of characters."); + } + + byte[] out = new byte[len >> 1]; + + // two characters form the hex value. + for (int i = 0, j = 0; j < len; i++) { + int f = toDigit(hexData[j], j) << 4; + j++; + f = f | toDigit(hexData[j], j); + j++; + out[i] = (byte) (f & 0xFF); + } + + return out; + } + + //---------------------------------------------------------------------------------------- Private method start + /** + * 将字节数组转换为十六进制字符串 + * + * @param data byte[] + * @param toDigits 用于控制输出的char[] + * @return 十六进制String + */ + private static String encodeHexStr(byte[] data, char[] toDigits) { + return new String(encodeHex(data, toDigits)); + } + + /** + * 将字节数组转换为十六进制字符数组 + * + * @param data byte[] + * @param toDigits 用于控制输出的char[] + * @return 十六进制char[] + */ + private static char[] encodeHex(byte[] data, char[] toDigits) { + int l = data.length; + char[] out = new char[l << 1]; + // two characters form the hex value. + for (int i = 0, j = 0; i < l; i++) { + out[j++] = toDigits[(0xF0 & data[i]) >>> 4]; + out[j++] = toDigits[0x0F & data[i]]; + } + return out; + } + + /** + * 将十六进制字符转换成一个整数 + * + * @param ch 十六进制char + * @param index 十六进制字符在字符数组中的位置 + * @return 一个整数 + * @throws RuntimeException 当ch不是一个合法的十六进制字符时,抛出运行时异常 + */ + private static int toDigit(char ch, int index) { + int digit = Character.digit(ch, 16); + if (digit == -1) { + throw new RuntimeException("Illegal hexadecimal character " + ch + " at index " + index); + } + return digit; + } + //---------------------------------------------------------------------------------------- Private method end + + + + /** + * 2进制转16进制 + * @param bString 2进制字符串 + * @return + */ + public static String binary2Hex(String bString) { + if (bString == null || bString.equals("") || bString.length() % 8 != 0) + return null; + StringBuffer tmp = new StringBuffer(); + int iTmp = 0; + for (int i = 0; i < bString.length(); i += 4) { + iTmp = 0; + for (int j = 0; j < 4; j++) { + iTmp += Integer.parseInt(bString.substring(i + j, i + j + 1)) << (4 - j - 1); + } + tmp.append(Integer.toHexString(iTmp)); + } + return tmp.toString(); + } + + /** + * 16进制转2进制 + * @param hexString + * @return + */ + public static String hex2Binary(String hexString) { + if (hexString == null || hexString.length() % 2 != 0) + return null; + String bString = "", tmp; + for (int i = 0; i < hexString.length(); i++) { + tmp = "0000" + Integer.toBinaryString(Integer.parseInt(hexString.substring(i, i + 1), 16)); + bString += tmp.substring(tmp.length() - 4); + } + return bString; + } + + /** + * 将二进制转换成16进制 + * @param buf + * @return + */ + public static String binary2Hex(byte buf[]) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < buf.length; i++) { + String hex = Integer.toHexString(buf[i] & 0xFF); + if (hex.length() == 1) { + hex = '0' + hex; + } + sb.append(hex.toUpperCase()); + } + return sb.toString(); + } + + /** + * 将16进制转换为二进制 + * @param hexStr + * @return + */ + public static byte[] hex2Byte(String hexStr) { + if (hexStr.length() < 1) + return null; + byte[] result = new byte[hexStr.length() / 2]; + for (int i = 0; i < hexStr.length() / 2; i++) { + int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); + int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); + result[i] = (byte) (high * 16 + low); + } + return result; + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/HttpKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/HttpKit.java new file mode 100644 index 0000000..52b4284 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/HttpKit.java @@ -0,0 +1,195 @@ +/** + * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.support; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.URL; +import java.net.URLConnection; +import java.util.Enumeration; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class HttpKit { + + public static String getIp(){ + return HttpKit.getRequest().getRemoteHost(); + } + + /** + * 获取所有请求的值 + */ + public static Map<String, String> getRequestParameters() { + HashMap<String, String> values = new HashMap<>(); + HttpServletRequest request = HttpKit.getRequest(); + Enumeration enums = request.getParameterNames(); + while ( enums.hasMoreElements()){ + String paramName = (String) enums.nextElement(); + String paramValue = request.getParameter(paramName); + values.put(paramName, paramValue); + } + return values; + } + + /** + * 获取 HttpServletRequest + */ + public static HttpServletResponse getResponse() { + HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); + return response; + } + + /** + * 获取 包装防Xss Sql注入的 HttpServletRequest + * @return request + */ + public static HttpServletRequest getRequest() { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + return new WafRequestWrapper(request); + } + + /** + * 向指定URL发送GET方法的请求 + * + * @param url 发送请求的URL + * @param param 请求参数 + * @return URL 所代表远程资源的响应结果 + */ + public static String sendGet(String url, Map<String, String> param) { + String result = ""; + BufferedReader in = null; + try { + StringBuffer query = new StringBuffer(); + + for (Map.Entry<String, String> kv : param.entrySet()) { + query.append(URLEncoder.encode(kv.getKey(), "UTF-8") + "="); + query.append(URLEncoder.encode(kv.getValue(), "UTF-8") + "&"); + } + if (query.lastIndexOf("&") > 0) { + query.deleteCharAt(query.length() - 1); + } + + String urlNameString = url + "?" + query.toString(); + URL realUrl = new URL(urlNameString); + // 打开和URL之间的连接 + URLConnection connection = realUrl.openConnection(); + // 设置通用的请求属性 + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + // 建立实际的连接 + connection.connect(); + // 获取所有响应头字段 + Map<String, List<String>> map = connection.getHeaderFields(); + // 遍历所有的响应头字段 + for (String key : map.keySet()) { + System.out.println(key + "--->" + map.get(key)); + } + // 定义 BufferedReader输入流来读取URL的响应 + in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String line; + while ((line = in.readLine()) != null) { + result += line; + } + } catch (Exception e) { + System.out.println("发送GET请求出现异常!" + e); + e.printStackTrace(); + } + // 使用finally块来关闭输入流 + finally { + try { + if (in != null) { + in.close(); + } + } catch (Exception e2) { + e2.printStackTrace(); + } + } + return result; + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数 + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url, Map<String, String> param) { + PrintWriter out = null; + BufferedReader in = null; + String result = ""; + try { + String para = ""; + for (String key : param.keySet()) { + para += (key + "=" + param.get(key) + "&"); + } + if (para.lastIndexOf("&") > 0) { + para = para.substring(0, para.length() - 1); + } + String urlNameString = url + "?" + para; + URL realUrl = new URL(urlNameString); + // 打开和URL之间的连接 + URLConnection conn = realUrl.openConnection(); + // 设置通用的请求属性 + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + // 发送POST请求必须设置如下两行 + conn.setDoOutput(true); + conn.setDoInput(true); + // 获取URLConnection对象对应的输出流 + out = new PrintWriter(conn.getOutputStream()); + // 发送请求参数 + out.print(param); + // flush输出流的缓冲 + out.flush(); + // 定义BufferedReader输入流来读取URL的响应 + in = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line; + while ((line = in.readLine()) != null) { + result += line; + } + } catch (Exception e) { + System.out.println("发送 POST 请求出现异常!" + e); + e.printStackTrace(); + } + // 使用finally块来关闭输出流、输入流 + finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + return result; + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/ObjectKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/ObjectKit.java new file mode 100644 index 0000000..b42fbc9 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/ObjectKit.java @@ -0,0 +1,22 @@ +package com.agentdriving.user.core.support; + +/** + * 一些通用的函数 + * + * @author Looly + * + */ +public class ObjectKit { + /** + * 比较两个对象是否相等。<br> + * 相同的条件有两个,满足其一即可:<br> + * 1. obj1 == null && obj2 == null; 2. obj1.equals(obj2) + * + * @param obj1 对象1 + * @param obj2 对象2 + * @return 是否相等 + */ + public static boolean equals(Object obj1, Object obj2) { + return (obj1 != null) ? (obj1.equals(obj2)) : (obj2 == null); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/PageKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/PageKit.java new file mode 100644 index 0000000..227d964 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/PageKit.java @@ -0,0 +1,57 @@ +package com.agentdriving.user.core.support; + +/** + * 分页工具类 + * + * @author xiaoleilu + * + */ +public class PageKit { + + /** + * 将页数和每页条目数转换为开始位置和结束位置<br> + * 此方法用于不包括结束位置的分页方法<br> + * 例如:<br> + * 页码:1,每页10 -> [0, 10]<br> + * 页码:2,每页10 -> [10, 20]<br> + * 。。。<br> + * + * @param pageNo + * 页码(从1计数) + * @param countPerPage + * 每页条目数 + * @return 第一个数为开始位置,第二个数为结束位置 + */ + public static int[] transToStartEnd(int pageNo, int countPerPage) { + if (pageNo < 1) { + pageNo = 1; + } + + if (countPerPage < 1) { + countPerPage = 0; +// LogKit.warn("Count per page [" + countPerPage + "] is not valid!"); + } + + int start = (pageNo - 1) * countPerPage; + int end = start + countPerPage; + + return new int[] { start, end }; + } + + /** + * 根据总数计算总页数 + * + * @param totalCount + * 总数 + * @param numPerPage + * 每页数 + * @return 总页数 + */ + public static int totalPage(int totalCount, int numPerPage) { + if (numPerPage == 0) { + return 0; + } + return totalCount % numPerPage == 0 ? (totalCount / numPerPage) + : (totalCount / numPerPage + 1); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/StrKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/StrKit.java new file mode 100644 index 0000000..7cb0fa8 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/StrKit.java @@ -0,0 +1,1370 @@ +package com.agentdriving.user.core.support; + +import java.io.StringReader; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +/** + * 字符串工具类 + * + * @author xiaoleilu + * + */ +public class StrKit { + + public static final String SPACE = " "; + public static final String DOT = "."; + public static final String SLASH = "/"; + public static final String BACKSLASH = "\\"; + public static final String EMPTY = ""; + public static final String CRLF = "\r\n"; + public static final String NEWLINE = "\n"; + public static final String UNDERLINE = "_"; + public static final String COMMA = ","; + + public static final String HTML_NBSP = " "; + public static final String HTML_AMP = "&"; + public static final String HTML_QUOTE = """; + public static final String HTML_LT = "<"; + public static final String HTML_GT = ">"; + + public static final String EMPTY_JSON = "{}"; + + + /** + * 首字母变小写 + */ + public static String firstCharToLowerCase(String str) { + char firstChar = str.charAt(0); + if (firstChar >= 'A' && firstChar <= 'Z') { + char[] arr = str.toCharArray(); + arr[0] += ('a' - 'A'); + return new String(arr); + } + return str; + } + + /** + * 首字母变大写 + */ + public static String firstCharToUpperCase(String str) { + char firstChar = str.charAt(0); + if (firstChar >= 'a' && firstChar <= 'z') { + char[] arr = str.toCharArray(); + arr[0] -= ('a' - 'A'); + return new String(arr); + } + return str; + } + + // ------------------------------------------------------------------------ Blank + /** + * 字符串是否为空白 空白的定义如下: <br> + * 1、为null <br> + * 2、为不可见字符(如空格)<br> + * 3、""<br> + * + * @param str 被检测的字符串 + * @return 是否为空 + */ + public static boolean isBlank(String str) { + int length; + if ((str == null) || ((length = str.length()) == 0)) { + return true; + } + for (int i = 0; i < length; i++) { + // 只要有一个非空字符即为非空字符串 + if (false == Character.isWhitespace(str.charAt(i))) { + return false; + } + } + return true; + } + + /** + * 字符串是否为非空白 空白的定义如下: <br> + * 1、不为null <br> + * 2、不为不可见字符(如空格)<br> + * 3、不为""<br> + * + * @param str 被检测的字符串 + * @return 是否为非空 + */ + public static boolean notBlank(String str) { + return false == isBlank(str); + } + + /** + * 是否包含空字符串 + * + * @param strs 字符串列表 + * @return 是否包含空字符串 + */ + public static boolean hasBlank(String... strs) { + if (CollectionKit.isEmpty(strs)) { + return true; + } + for (String str : strs) { + if (isBlank(str)) { + return true; + } + } + return false; + } + + /** + * 给定所有字符串是否为空白 + * + * @param strs 字符串 + * @return 所有字符串是否为空白 + */ + public static boolean isAllBlank(String... strs) { + if (CollectionKit.isEmpty(strs)) { + return true; + } + for (String str : strs) { + if (notBlank(str)) { + return false; + } + } + return true; + } + + // ------------------------------------------------------------------------ Empty + /** + * 字符串是否为空,空的定义如下 1、为null <br> + * 2、为""<br> + * + * @param str 被检测的字符串 + * @return 是否为空 + */ + public static boolean isEmpty(String str) { + return str == null || str.length() == 0; + } + + /** + * 字符串是否为非空白 空白的定义如下: <br> + * 1、不为null <br> + * 2、不为""<br> + * + * @param str 被检测的字符串 + * @return 是否为非空 + */ + public static boolean isNotEmpty(String str) { + return false == isEmpty(str); + } + + /** + * 当给定字符串为null时,转换为Empty + * + * @param str 被转换的字符串 + * @return 转换后的字符串 + */ + public static String nullToEmpty(String str) { + return nullToDefault(str, EMPTY); + } + + /** + * 如果字符串是<code>null</code>,则返回指定默认字符串,否则返回字符串本身。 + * + * <pre> + * nullToDefault(null, "default") = "default" + * nullToDefault("", "default") = "" + * nullToDefault(" ", "default") = " " + * nullToDefault("bat", "default") = "bat" + * </pre> + * + * @param str 要转换的字符串 + * @param defaultStr 默认字符串 + * + * @return 字符串本身或指定的默认字符串 + */ + public static String nullToDefault(String str, String defaultStr) { + return (str == null) ? defaultStr : str; + } + + /** + * 当给定字符串为空字符串时,转换为<code>null</code> + * + * @param str 被转换的字符串 + * @return 转换后的字符串 + */ + public static String emptyToNull(String str) { + return isEmpty(str) ? null : str; + } + + /** + * 是否包含空字符串 + * + * @param strs 字符串列表 + * @return 是否包含空字符串 + */ + public static boolean hasEmpty(String... strs) { + if (CollectionKit.isEmpty(strs)) { + return true; + } + + for (String str : strs) { + if (isEmpty(str)) { + return true; + } + } + return false; + } + + /** + * 是否全部为空字符串 + * + * @param strs 字符串列表 + * @return 是否全部为空字符串 + */ + public static boolean isAllEmpty(String... strs) { + if (CollectionKit.isEmpty(strs)) { + return true; + } + + for (String str : strs) { + if (isNotEmpty(str)) { + return false; + } + } + return true; + } + + // ------------------------------------------------------------------------ Trim + /** + * 除去字符串头尾部的空白,如果字符串是<code>null</code>,依然返回<code>null</code>。 + * + * <p> + * 注意,和<code>String.trim</code>不同,此方法使用<code>Character.isWhitespace</code> 来判定空白, 因而可以除去英文字符集之外的其它空白,如中文空格。 + * + * <pre> + * trim(null) = null + * trim("") = "" + * trim(" ") = "" + * trim("abc") = "abc" + * trim(" abc ") = "abc" + * </pre> + * + * </p> + * + * @param str 要处理的字符串 + * + * @return 除去空白的字符串,如果原字串为<code>null</code>,则返回<code>null</code> + */ + public static String trim(String str) { + return (null == str) ? null : trim(str, 0); + } + + /** + * 给定字符串数组全部做去首尾空格 + * + * @param strs 字符串数组 + */ + public static void trim(String[] strs) { + if (null == strs) { + return; + } + String str; + for (int i = 0; i < strs.length; i++) { + str = strs[i]; + if (null != str) { + strs[i] = str.trim(); + } + } + } + + /** + * 除去字符串头部的空白,如果字符串是<code>null</code>,则返回<code>null</code>。 + * + * <p> + * 注意,和<code>String.trim</code>不同,此方法使用<code>Character.isWhitespace</code> 来判定空白, 因而可以除去英文字符集之外的其它空白,如中文空格。 + * + * <pre> + * trimStart(null) = null + * trimStart("") = "" + * trimStart("abc") = "abc" + * trimStart(" abc") = "abc" + * trimStart("abc ") = "abc " + * trimStart(" abc ") = "abc " + * </pre> + * + * </p> + * + * @param str 要处理的字符串 + * + * @return 除去空白的字符串,如果原字串为<code>null</code>或结果字符串为<code>""</code>,则返回 <code>null</code> + */ + public static String trimStart(String str) { + return trim(str, -1); + } + + /** + * 除去字符串尾部的空白,如果字符串是<code>null</code>,则返回<code>null</code>。 + * + * <p> + * 注意,和<code>String.trim</code>不同,此方法使用<code>Character.isWhitespace</code> 来判定空白, 因而可以除去英文字符集之外的其它空白,如中文空格。 + * + * <pre> + * trimEnd(null) = null + * trimEnd("") = "" + * trimEnd("abc") = "abc" + * trimEnd(" abc") = " abc" + * trimEnd("abc ") = "abc" + * trimEnd(" abc ") = " abc" + * </pre> + * + * </p> + * + * @param str 要处理的字符串 + * + * @return 除去空白的字符串,如果原字串为<code>null</code>或结果字符串为<code>""</code>,则返回 <code>null</code> + */ + public static String trimEnd(String str) { + return trim(str, 1); + } + + /** + * 除去字符串头尾部的空白符,如果字符串是<code>null</code>,依然返回<code>null</code>。 + * + * @param str 要处理的字符串 + * @param mode <code>-1</code>表示trimStart,<code>0</code>表示trim全部, <code>1</code>表示trimEnd + * + * @return 除去指定字符后的的字符串,如果原字串为<code>null</code>,则返回<code>null</code> + */ + public static String trim(String str, int mode) { + if (str == null) { + return null; + } + + int length = str.length(); + int start = 0; + int end = length; + + // 扫描字符串头部 + if (mode <= 0) { + while ((start < end) && (Character.isWhitespace(str.charAt(start)))) { + start++; + } + } + + // 扫描字符串尾部 + if (mode >= 0) { + while ((start < end) && (Character.isWhitespace(str.charAt(end - 1)))) { + end--; + } + } + + if ((start > 0) || (end < length)) { + return str.substring(start, end); + } + + return str; + } + + /** + * 是否以指定字符串开头 + * @param str 被监测字符串 + * @param prefix 开头字符串 + * @param isIgnoreCase 是否忽略大小写 + * @return 是否以指定字符串开头 + */ + public static boolean startWith(String str, String prefix, boolean isIgnoreCase){ + if(isIgnoreCase){ + return str.toLowerCase().startsWith(prefix.toLowerCase()); + }else{ + return str.startsWith(prefix); + } + } + + /** + * 是否以指定字符串结尾 + * @param str 被监测字符串 + * @param suffix 结尾字符串 + * @param isIgnoreCase 是否忽略大小写 + * @return 是否以指定字符串结尾 + */ + public static boolean endWith(String str, String suffix, boolean isIgnoreCase){ + if(isIgnoreCase){ + return str.toLowerCase().endsWith(suffix.toLowerCase()); + }else{ + return str.endsWith(suffix); + } + } + + /** + * 是否包含特定字符,忽略大小写,如果给定两个参数都为<code>null</code>,返回true + * @param str 被检测字符串 + * @param testStr 被测试是否包含的字符串 + * @return 是否包含 + */ + public static boolean containsIgnoreCase(String str, String testStr){ + if(null == str){ + //如果被监测字符串和 + return null == testStr; + } + return str.toLowerCase().contains(testStr.toLowerCase()); + } + + /** + * 获得set或get方法对应的标准属性名<br/> + * 例如:setName 返回 name + * + * @param getOrSetMethodName + * @return 如果是set或get方法名,返回field, 否则null + */ + public static String getGeneralField(String getOrSetMethodName) { + if (getOrSetMethodName.startsWith("get") || getOrSetMethodName.startsWith("set")) { + return cutPreAndLowerFirst(getOrSetMethodName, 3); + } + return null; + } + + /** + * 生成set方法名<br/> + * 例如:name 返回 setName + * + * @param fieldName 属性名 + * @return setXxx + */ + public static String genSetter(String fieldName) { + return upperFirstAndAddPre(fieldName, "set"); + } + + /** + * 生成get方法名 + * + * @param fieldName 属性名 + * @return getXxx + */ + public static String genGetter(String fieldName) { + return upperFirstAndAddPre(fieldName, "get"); + } + + /** + * 去掉首部指定长度的字符串并将剩余字符串首字母小写<br/> + * 例如:str=setName, preLength=3 -> return name + * + * @param str 被处理的字符串 + * @param preLength 去掉的长度 + * @return 处理后的字符串,不符合规范返回null + */ + public static String cutPreAndLowerFirst(String str, int preLength) { + if (str == null) { + return null; + } + if (str.length() > preLength) { + char first = Character.toLowerCase(str.charAt(preLength)); + if (str.length() > preLength + 1) { + return first + str.substring(preLength + 1); + } + return String.valueOf(first); + } + return null; + } + + /** + * 原字符串首字母大写并在其首部添加指定字符串 例如:str=name, preString=get -> return getName + * + * @param str 被处理的字符串 + * @param preString 添加的首部 + * @return 处理后的字符串 + */ + public static String upperFirstAndAddPre(String str, String preString) { + if (str == null || preString == null) { + return null; + } + return preString + upperFirst(str); + } + + /** + * 大写首字母<br> + * 例如:str = name, return Name + * + * @param str 字符串 + * @return 字符串 + */ + public static String upperFirst(String str) { + return Character.toUpperCase(str.charAt(0)) + str.substring(1); + } + + /** + * 小写首字母<br> + * 例如:str = Name, return name + * + * @param str 字符串 + * @return 字符串 + */ + public static String lowerFirst(String str) { + if(isBlank(str)){ + return str; + } + return Character.toLowerCase(str.charAt(0)) + str.substring(1); + } + + /** + * 去掉指定前缀 + * + * @param str 字符串 + * @param prefix 前缀 + * @return 切掉后的字符串,若前缀不是 preffix, 返回原字符串 + */ + public static String removePrefix(String str, String prefix) { + if(isEmpty(str) || isEmpty(prefix)){ + return str; + } + + if (str.startsWith(prefix)) { + return str.substring(prefix.length()); + } + return str; + } + + /** + * 忽略大小写去掉指定前缀 + * + * @param str 字符串 + * @param prefix 前缀 + * @return 切掉后的字符串,若前缀不是 prefix, 返回原字符串 + */ + public static String removePrefixIgnoreCase(String str, String prefix) { + if(isEmpty(str) || isEmpty(prefix)){ + return str; + } + + if (str.toLowerCase().startsWith(prefix.toLowerCase())) { + return str.substring(prefix.length()); + } + return str; + } + + /** + * 去掉指定后缀 + * + * @param str 字符串 + * @param suffix 后缀 + * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 + */ + public static String removeSuffix(String str, String suffix) { + if(isEmpty(str) || isEmpty(suffix)){ + return str; + } + + if (str.endsWith(suffix)) { + return str.substring(0, str.length() - suffix.length()); + } + return str; + } + + /** + * 获得字符串对应byte数组 + * @param str 字符串 + * @param charset 编码,如果为<code>null</code>使用系统默认编码 + * @return bytes + */ + public static byte[] getBytes(String str, Charset charset){ + if(null == str){ + return null; + } + return null == charset ? str.getBytes() : str.getBytes(charset); + } + + /** + * 忽略大小写去掉指定后缀 + * + * @param str 字符串 + * @param suffix 后缀 + * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 + */ + public static String removeSuffixIgnoreCase(String str, String suffix) { + if(isEmpty(str) || isEmpty(suffix)){ + return str; + } + + if (str.toLowerCase().endsWith(suffix.toLowerCase())) { + return str.substring(0, str.length() - suffix.length()); + } + return str; + } + + /** + * 如果给定字符串不是以prefix开头的,在开头补充 prefix + * @param str 字符串 + * @param prefix 前缀 + * @return 补充后的字符串 + */ + public static String addPrefixIfNot(String str, String prefix){ + if(isEmpty(str) || isEmpty(prefix)){ + return str; + } + if(false == str.startsWith(prefix)){ + str = prefix + str; + } + return str; + } + + /** + * 如果给定字符串不是以suffix结尾的,在尾部补充 suffix + * @param str 字符串 + * @param suffix 后缀 + * @return 补充后的字符串 + */ + public static String addSuffixIfNot(String str, String suffix){ + if(isEmpty(str) || isEmpty(suffix)){ + return str; + } + if(false == str.endsWith(suffix)){ + str += suffix; + } + return str; + } + + /** + * 清理空白字符 + * + * @param str 被清理的字符串 + * @return 清理后的字符串 + */ + public static String cleanBlank(String str) { + if (str == null) { + return null; + } + + return str.replaceAll("\\s*", EMPTY); + } + + /** + * 切分字符串<br> + * a#b#c -> [a,b,c] <br> + * a##b#c -> [a,"",b,c] + * + * @param str 被切分的字符串 + * @param separator 分隔符字符 + * @return 切分后的集合 + */ + public static List<String> split(String str, char separator) { + return split(str, separator, 0); + } + + /** + * 切分字符串 + * + * @param str 被切分的字符串 + * @param separator 分隔符字符 + * @param limit 限制分片数 + * @return 切分后的集合 + */ + public static List<String> split(String str, char separator, int limit) { + if (str == null) { + return null; + } + List<String> list = new ArrayList<String>(limit == 0 ? 16 : limit); + if (limit == 1) { + list.add(str); + return list; + } + + boolean isNotEnd = true; // 未结束切分的标志 + int strLen = str.length(); + StringBuilder sb = new StringBuilder(strLen); + for (int i = 0; i < strLen; i++) { + char c = str.charAt(i); + if (isNotEnd && c == separator) { + list.add(sb.toString()); + // 清空StringBuilder + sb.delete(0, sb.length()); + + // 当达到切分上限-1的量时,将所剩字符全部作为最后一个串 + if (limit != 0 && list.size() == limit - 1) { + isNotEnd = false; + } + } else { + sb.append(c); + } + } + list.add(sb.toString());// 加入尾串 + return list; + } + + /** + * 切分字符串<br> + * from jodd + * + * @param str 被切分的字符串 + * @param delimiter 分隔符 + * @return 字符串 + */ + public static String[] split(String str, String delimiter) { + if (str == null) { + return null; + } + if (str.trim().length() == 0) { + return new String[] { str }; + } + + int dellen = delimiter.length(); // del length + int maxparts = (str.length() / dellen) + 2; // one more for the last + int[] positions = new int[maxparts]; + + int i, j = 0; + int count = 0; + positions[0] = -dellen; + while ((i = str.indexOf(delimiter, j)) != -1) { + count++; + positions[count] = i; + j = i + dellen; + } + count++; + positions[count] = str.length(); + + String[] result = new String[count]; + + for (i = 0; i < count; i++) { + result[i] = str.substring(positions[i] + dellen, positions[i + 1]); + } + return result; + } + + /** + * 改进JDK subString<br> + * index从0开始计算,最后一个字符为-1<br> + * 如果from和to位置一样,返回 "" <br> + * 如果from或to为负数,则按照length从后向前数位置,如果绝对值大于字符串长度,则from归到0,to归到length<br> + * 如果经过修正的index中from大于to,则互换from和to + * example: <br> + * abcdefgh 2 3 -> c <br> + * abcdefgh 2 -3 -> cde <br> + * + * @param string String + * @param fromIndex 开始的index(包括) + * @param toIndex 结束的index(不包括) + * @return 字串 + */ + public static String sub(String string, int fromIndex, int toIndex) { + int len = string.length(); + if (fromIndex < 0) { + fromIndex = len + fromIndex; + if(fromIndex < 0 ) { + fromIndex = 0; + } + } else if(fromIndex >= len) { + fromIndex = len -1; + } + if (toIndex < 0) { + toIndex = len + toIndex; + if(toIndex < 0) { + toIndex = len; + } + } else if(toIndex > len) { + toIndex = len; + } + if (toIndex < fromIndex) { + int tmp = fromIndex; + fromIndex = toIndex; + toIndex = tmp; + } + if (fromIndex == toIndex) { + return EMPTY; + } + char[] strArray = string.toCharArray(); + char[] newStrArray = Arrays.copyOfRange(strArray, fromIndex, toIndex); + return new String(newStrArray); + } + + /** + * 切割前部分 + * + * @param string 字符串 + * @param toIndex 切割到的位置(不包括) + * @return 切割后的字符串 + */ + public static String subPre(String string, int toIndex) { + return sub(string, 0, toIndex); + } + + /** + * 切割后部分 + * + * @param string 字符串 + * @param fromIndex 切割开始的位置(包括) + * @return 切割后的字符串 + */ + public static String subSuf(String string, int fromIndex) { + if (isEmpty(string)) { + return null; + } + return sub(string, fromIndex, string.length()); + } + + /** + * 给定字符串是否被字符包围 + * + * @param str 字符串 + * @param prefix 前缀 + * @param suffix 后缀 + * @return 是否包围,空串不包围 + */ + public static boolean isSurround(String str, String prefix, String suffix) { + if (StrKit.isBlank(str)) { + return false; + } + if (str.length() < (prefix.length() + suffix.length())) { + return false; + } + + return str.startsWith(prefix) && str.endsWith(suffix); + } + + /** + * 给定字符串是否被字符包围 + * + * @param str 字符串 + * @param prefix 前缀 + * @param suffix 后缀 + * @return 是否包围,空串不包围 + */ + public static boolean isSurround(String str, char prefix, char suffix) { + if (StrKit.isBlank(str)) { + return false; + } + if (str.length() < 2) { + return false; + } + + return str.charAt(0) == prefix && str.charAt(str.length() - 1) == suffix; + } + + /** + * 重复某个字符 + * + * @param c 被重复的字符 + * @param count 重复的数目 + * @return 重复字符字符串 + */ + public static String repeat(char c, int count) { + char[] result = new char[count]; + for (int i = 0; i < count; i++) { + result[i] = c; + } + return new String(result); + } + + /** + * 重复某个字符串 + * + * @param str 被重复的字符 + * @param count 重复的数目 + * @return 重复字符字符串 + */ + public static String repeat(String str, int count) { + + // 检查 + final int len = str.length(); + final long longSize = (long) len * (long) count; + final int size = (int) longSize; + if (size != longSize) { + throw new ArrayIndexOutOfBoundsException("Required String length is too large: " + longSize); + } + + final char[] array = new char[size]; + str.getChars(0, len, array, 0); + int n; + for (n = len; n < size - n; n <<= 1) {// n <<= 1相当于n *2 + System.arraycopy(array, 0, array, n, n); + } + System.arraycopy(array, 0, array, n, size - n); + return new String(array); + } + + /** + * 比较两个字符串(大小写敏感)。 + * + * <pre> + * equals(null, null) = true + * equals(null, "abc") = false + * equals("abc", null) = false + * equals("abc", "abc") = true + * equals("abc", "ABC") = false + * </pre> + * + * @param str1 要比较的字符串1 + * @param str2 要比较的字符串2 + * + * @return 如果两个字符串相同,或者都是<code>null</code>,则返回<code>true</code> + */ + public static boolean equals(String str1, String str2) { + if (str1 == null) { + return str2 == null; + } + + return str1.equals(str2); + } + + /** + * 比较两个字符串(大小写不敏感)。 + * + * <pre> + * equalsIgnoreCase(null, null) = true + * equalsIgnoreCase(null, "abc") = false + * equalsIgnoreCase("abc", null) = false + * equalsIgnoreCase("abc", "abc") = true + * equalsIgnoreCase("abc", "ABC") = true + * </pre> + * + * @param str1 要比较的字符串1 + * @param str2 要比较的字符串2 + * + * @return 如果两个字符串相同,或者都是<code>null</code>,则返回<code>true</code> + */ + public static boolean equalsIgnoreCase(String str1, String str2) { + if (str1 == null) { + return str2 == null; + } + + return str1.equalsIgnoreCase(str2); + } + + /** + * 格式化文本, {} 表示占位符<br> + * 例如:format("aaa {} ccc", "bbb") ----> aaa bbb ccc + * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param values 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... values) { + if (CollectionKit.isEmpty(values) || isBlank(template)) { + return template; + } + + final StringBuilder sb = new StringBuilder(); + final int length = template.length(); + + int valueIndex = 0; + char currentChar; + for (int i = 0; i < length; i++) { + if (valueIndex >= values.length) { + sb.append(sub(template, i, length)); + break; + } + + currentChar = template.charAt(i); + if (currentChar == '{') { + final char nextChar = template.charAt(++i); + if (nextChar == '}') { + sb.append(values[valueIndex++]); + } else { + sb.append('{').append(nextChar); + } + } else { + sb.append(currentChar); + } + + } + + return sb.toString(); + } + + /** + * 格式化文本,使用 {varName} 占位<br> + * map = {a: "aValue", b: "bValue"} + * format("{a} and {b}", map) ----> aValue and bValue + * + * @param template 文本模板,被替换的部分用 {key} 表示 + * @param map 参数值对 + * @return 格式化后的文本 + */ + public static String format(String template, Map<?, ?> map) { + if (null == map || map.isEmpty()) { + return template; + } + + for (Entry<?, ?> entry : map.entrySet()) { + template = template.replace("{" + entry.getKey() + "}", entry.getValue().toString()); + } + return template; + } + + /** + * 编码字符串 + * + * @param str 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 编码后的字节码 + */ + public static byte[] bytes(String str, String charset) { + return bytes(str, isBlank(charset) ? Charset.defaultCharset() : Charset.forName(charset)); + } + + /** + * 编码字符串 + * + * @param str 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 编码后的字节码 + */ + public static byte[] bytes(String str, Charset charset) { + if (str == null) { + return null; + } + + if (null == charset) { + return str.getBytes(); + } + return str.getBytes(charset); + } + + /** + * 将byte数组转为字符串 + * + * @param bytes byte数组 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(byte[] bytes, String charset) { + return str(bytes, isBlank(charset) ? Charset.defaultCharset() : Charset.forName(charset)); + } + + /** + * 解码字节码 + * + * @param data 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 解码后的字符串 + */ + public static String str(byte[] data, Charset charset) { + if (data == null) { + return null; + } + + if (null == charset) { + return new String(data); + } + return new String(data, charset); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, String charset){ + if(data == null) { + return null; + } + + return str(data, Charset.forName(charset)); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, Charset charset){ + if(null == charset) { + charset = Charset.defaultCharset(); + } + return charset.decode(data).toString(); + } + + /** + * 字符串转换为byteBuffer + * @param str 字符串 + * @param charset 编码 + * @return byteBuffer + */ + public static ByteBuffer byteBuffer(String str, String charset) { + return ByteBuffer.wrap(StrKit.bytes(str, charset)); + } + + /** + * 以 conjunction 为分隔符将多个对象转换为字符串 + * + * @param conjunction 分隔符 + * @param objs 数组 + * @return 连接后的字符串 + */ + public static String join(String conjunction, Object... objs) { + StringBuilder sb = new StringBuilder(); + boolean isFirst = true; + for (Object item : objs) { + if (isFirst) { + isFirst = false; + } else { + sb.append(conjunction); + } + sb.append(item); + } + return sb.toString(); + } + + /** + * 将驼峰式命名的字符串转换为下划线方式。如果转换前的驼峰式命名的字符串为空,则返回空字符串。</br> + * 例如:HelloWorld->hello_world + * + * @param camelCaseStr 转换前的驼峰式命名的字符串 + * @return 转换后下划线大写方式命名的字符串 + */ + public static String toUnderlineCase(String camelCaseStr) { + if (camelCaseStr == null) { + return null; + } + + final int length = camelCaseStr.length(); + StringBuilder sb = new StringBuilder(); + char c; + boolean isPreUpperCase = false; + for (int i = 0; i < length; i++) { + c = camelCaseStr.charAt(i); + boolean isNextUpperCase = true; + if (i < (length - 1)) { + isNextUpperCase = Character.isUpperCase(camelCaseStr.charAt(i + 1)); + } + if (Character.isUpperCase(c)) { + if (!isPreUpperCase || !isNextUpperCase) { + if (i > 0) sb.append(UNDERLINE); + } + isPreUpperCase = true; + } else { + isPreUpperCase = false; + } + sb.append(Character.toLowerCase(c)); + } + return sb.toString(); + } + + /** + * 将下划线方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> + * 例如:hello_world->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String toCamelCase(String name) { + if (name == null) { + return null; + } + if (name.contains(UNDERLINE)) { + name = name.toLowerCase(); + + StringBuilder sb = new StringBuilder(name.length()); + boolean upperCase = false; + for (int i = 0; i < name.length(); i++) { + char c = name.charAt(i); + + if (c == '_') { + upperCase = true; + } else if (upperCase) { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } else { + sb.append(c); + } + } + return sb.toString(); + } else + return name; + } + + /** + * 包装指定字符串 + * + * @param str 被包装的字符串 + * @param prefix 前缀 + * @param suffix 后缀 + * @return 包装后的字符串 + */ + public static String wrap(String str, String prefix, String suffix) { + return format("{}{}{}", prefix, str, suffix); + } + + /** + * 指定字符串是否被包装 + * + * @param str 字符串 + * @param prefix 前缀 + * @param suffix 后缀 + * @return 是否被包装 + */ + public static boolean isWrap(String str, String prefix, String suffix) { + return str.startsWith(prefix) && str.endsWith(suffix); + } + + /** + * 指定字符串是否被同一字符包装(前后都有这些字符串) + * + * @param str 字符串 + * @param wrapper 包装字符串 + * @return 是否被包装 + */ + public static boolean isWrap(String str, String wrapper) { + return isWrap(str, wrapper, wrapper); + } + + /** + * 指定字符串是否被同一字符包装(前后都有这些字符串) + * + * @param str 字符串 + * @param wrapper 包装字符 + * @return 是否被包装 + */ + public static boolean isWrap(String str, char wrapper) { + return isWrap(str, wrapper, wrapper); + } + + /** + * 指定字符串是否被包装 + * + * @param str 字符串 + * @param prefixChar 前缀 + * @param suffixChar 后缀 + * @return 是否被包装 + */ + public static boolean isWrap(String str, char prefixChar, char suffixChar) { + return str.charAt(0) == prefixChar && str.charAt(str.length() - 1) == suffixChar; + } + + /** + * 补充字符串以满足最小长度 StrUtil.padPre("1", 3, '0');//"001" + * + * @param str 字符串 + * @param minLength 最小长度 + * @param padChar 补充的字符 + * @return 补充后的字符串 + */ + public static String padPre(String str, int minLength, char padChar) { + if (str.length() >= minLength) { + return str; + } + StringBuilder sb = new StringBuilder(minLength); + for (int i = str.length(); i < minLength; i++) { + sb.append(padChar); + } + sb.append(str); + return sb.toString(); + } + + /** + * 补充字符串以满足最小长度 StrUtil.padEnd("1", 3, '0');//"100" + * + * @param str 字符串 + * @param minLength 最小长度 + * @param padChar 补充的字符 + * @return 补充后的字符串 + */ + public static String padEnd(String str, int minLength, char padChar) { + if (str.length() >= minLength) { + return str; + } + StringBuilder sb = new StringBuilder(minLength); + sb.append(str); + for (int i = str.length(); i < minLength; i++) { + sb.append(padChar); + } + return sb.toString(); + } + + /** + * 创建StringBuilder对象 + * + * @return StringBuilder对象 + */ + public static StringBuilder builder() { + return new StringBuilder(); + } + + /** + * 创建StringBuilder对象 + * + * @return StringBuilder对象 + */ + public static StringBuilder builder(int capacity) { + return new StringBuilder(capacity); + } + + /** + * 创建StringBuilder对象 + * + * @return StringBuilder对象 + */ + public static StringBuilder builder(String... strs) { + final StringBuilder sb = new StringBuilder(); + for (String str : strs) { + sb.append(str); + } + return sb; + } + + /** + * 获得StringReader + * + * @param str 字符串 + * @return StringReader + */ + public static StringReader getReader(String str) { + return new StringReader(str); + } + + /** + * 获得StringWriter + * + * @return StringWriter + */ + public static StringWriter getWriter() { + return new StringWriter(); + } + + /** + * 编码字符串 + * + * @param str 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 编码后的字节码 + */ + public static byte[] encode(String str, String charset) { + if (str == null) { + return null; + } + + if(isBlank(charset)) { + return str.getBytes(); + } + try { + return str.getBytes(charset); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(format("Charset [{}] unsupported!", charset)); + } + } + + /** + * 解码字节码 + * + * @param data 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 解码后的字符串 + */ + public static String decode(byte[] data, String charset) { + if (data == null) { + return null; + } + + if(isBlank(charset)) { + return new String(data); + } + try { + return new String(data, charset); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(format("Charset [{}] unsupported!", charset)); + } + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/WafKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/WafKit.java new file mode 100644 index 0000000..ea3ff6e --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/WafKit.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) 2011-2014, hubin (jobob@qq.com). + * + * 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. + */ +package com.agentdriving.user.core.support; + +import java.util.regex.Pattern; + +/** + * Web防火墙工具类 + * <p> + * @author hubin + * @Date 2014-5-8 + */ +public class WafKit { + + /** + * @Description 过滤XSS脚本内容 + * @param value + * 待处理内容 + * @return + */ + public static String stripXSS(String value) { + String rlt = null; + + if (null != value) { + // NOTE: It's highly recommended to use the ESAPI library and uncomment the following line to + // avoid encoded attacks. + // value = ESAPI.encoder().canonicalize(value); + + // Avoid null characters + rlt = value.replaceAll("", ""); + + // Avoid anything between script tags + Pattern scriptPattern = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + + // Avoid anything in a src='...' type of expression + /*scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'", Pattern.CASE_INSENSITIVE + | Pattern.MULTILINE | Pattern.DOTALL); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + + scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\"(.*?)\\\"", Pattern.CASE_INSENSITIVE + | Pattern.MULTILINE | Pattern.DOTALL); + rlt = scriptPattern.matcher(rlt).replaceAll("");*/ + + // Remove any lonesome </script> tag + scriptPattern = Pattern.compile("</script>", Pattern.CASE_INSENSITIVE); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + + // Remove any lonesome <script ...> tag + scriptPattern = Pattern.compile("<script(.*?)>", Pattern.CASE_INSENSITIVE + | Pattern.MULTILINE | Pattern.DOTALL); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + + // Avoid eval(...) expressions + scriptPattern = Pattern.compile("eval\\((.*?)\\)", Pattern.CASE_INSENSITIVE + | Pattern.MULTILINE | Pattern.DOTALL); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + + // Avoid expression(...) expressions + scriptPattern = Pattern.compile("expression\\((.*?)\\)", Pattern.CASE_INSENSITIVE + | Pattern.MULTILINE | Pattern.DOTALL); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + + // Avoid javascript:... expressions + scriptPattern = Pattern.compile("javascript:", Pattern.CASE_INSENSITIVE); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + + // Avoid vbscript:... expressions + scriptPattern = Pattern.compile("vbscript:", Pattern.CASE_INSENSITIVE); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + + // Avoid onload= expressions + scriptPattern = Pattern.compile("onload(.*?)=", Pattern.CASE_INSENSITIVE + | Pattern.MULTILINE | Pattern.DOTALL); + rlt = scriptPattern.matcher(rlt).replaceAll(""); + } + + return rlt; + } + + /** + * @Description 过滤SQL注入内容 + * @param value + * 待处理内容 + * @return + */ + public static String stripSqlInjection(String value) { + return (null == value) ? null : value.replaceAll("('.+--)|(--)|(%7C)", ""); //value.replaceAll("('.+--)|(--)|(\\|)|(%7C)", ""); + } + + /** + * @Description 过滤SQL/XSS注入内容 + * @param value + * 待处理内容 + * @return + */ + public static String stripSqlXSS(String value) { + return stripXSS(stripSqlInjection(value)); + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/WafRequestWrapper.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/WafRequestWrapper.java new file mode 100644 index 0000000..7a41c06 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/WafRequestWrapper.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) 2011-2014, hubin (jobob@qq.com). + * + * 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. + */ +package com.agentdriving.user.core.support; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import java.util.HashMap; +import java.util.Map; + +/** + * Request请求过滤包装 + * <p> + * @author hubin + * @Date 2014-5-8 + */ +public class WafRequestWrapper extends HttpServletRequestWrapper { + + private boolean filterXSS = true; + + private boolean filterSQL = true; + + + public WafRequestWrapper(HttpServletRequest request, boolean filterXSS, boolean filterSQL) { + super(request); + this.filterXSS = filterXSS; + this.filterSQL = filterSQL; + } + + + public WafRequestWrapper(HttpServletRequest request) { + this(request, true, true); + } + + + /** + * @Description 数组参数过滤 + * @param parameter + * 过滤参数 + * @return + */ + @Override + public String[] getParameterValues(String parameter) { + String[] values = super.getParameterValues(parameter); + if ( values == null ) { + return null; + } + + int count = values.length; + String[] encodedValues = new String[count]; + for ( int i = 0 ; i < count ; i++ ) { + encodedValues[i] = filterParamString(values[i]); + } + + return encodedValues; + } + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public Map getParameterMap() { + Map<String, String[]> primary = super.getParameterMap(); + Map<String, String[]> result = new HashMap<String, String[]>(primary.size()); + for ( Map.Entry<String, String[]> entry : primary.entrySet() ) { + result.put(entry.getKey(), filterEntryString(entry.getValue())); + } + return result; + + } + + protected String[] filterEntryString(String[] rawValue) { + for ( int i = 0 ; i < rawValue.length ; i++ ) { + rawValue[i] = filterParamString(rawValue[i]); + } + return rawValue; + } + + /** + * @Description 参数过滤 + * @param parameter + * 过滤参数 + * @return + */ + @Override + public String getParameter(String parameter) { + return filterParamString(super.getParameter(parameter)); + } + + + /** + * @Description 请求头过滤 + * @param name + * 过滤内容 + * @return + */ + @Override + public String getHeader(String name) { + return filterParamString(super.getHeader(name)); + } + + + /** + * @Description Cookie内容过滤 + * @return + */ + @Override + public Cookie[] getCookies() { + Cookie[] existingCookies = super.getCookies(); + if (existingCookies != null) { + for (int i = 0 ; i < existingCookies.length ; ++i) { + Cookie cookie = existingCookies[i]; + cookie.setValue(filterParamString(cookie.getValue())); + } + } + return existingCookies; + } + + /** + * @Description 过滤字符串内容 + * @param rawValue + * 待处理内容 + * @return + */ + protected String filterParamString(String rawValue) { + if (null == rawValue) { + return null; + } + String tmpStr = rawValue; + if (this.filterXSS) { + tmpStr = WafKit.stripXSS(rawValue); + } + if (this.filterSQL) { + tmpStr = WafKit.stripSqlInjection(tmpStr); + } + return tmpStr; + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/support/exception/ToolBoxException.java b/user/guns-core/src/main/java/com/agentdriving/user/core/support/exception/ToolBoxException.java new file mode 100644 index 0000000..ec75678 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/support/exception/ToolBoxException.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). + * + * 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. + */ +package com.agentdriving.user.core.support.exception; + +import com.agentdriving.user.core.support.StrKit; + +/** + * 工具类初始化异常 + */ +public class ToolBoxException extends RuntimeException{ + private static final long serialVersionUID = 8247610319171014183L; + + public ToolBoxException(Throwable e) { + super(e.getMessage(), e); + } + + public ToolBoxException(String message) { + super(message); + } + + public ToolBoxException(String messageTemplate, Object... params) { + super(StrKit.format(messageTemplate, params)); + } + + public ToolBoxException(String message, Throwable throwable) { + super(message, throwable); + } + + public ToolBoxException(Throwable throwable, String messageTemplate, Object... params) { + super(StrKit.format(messageTemplate, params), throwable); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/Convert.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/Convert.java new file mode 100644 index 0000000..b373324 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/Convert.java @@ -0,0 +1,1061 @@ +package com.agentdriving.user.core.util; + +import com.agentdriving.user.core.support.*; +import com.agentdriving.user.core.support.*; +import com.agentdriving.user.core.support.exception.ToolBoxException; + +import java.io.UnsupportedEncodingException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.charset.Charset; +import java.text.NumberFormat; +import java.util.Date; +import java.util.Set; + + +/** + * 类型转换器 + * + * @author xiaoleilu + * + */ +public class Convert { + + + private Convert() { + // 静态类不可实例化 + } + + /** + * 强制转换类型 + * + * @param clazz 被转换成的类型 + * @param value 需要转换的对象 + * @return 转换后的对象 + */ + public static Object parse(Class<?> clazz, Object value) { + try { + if (clazz.isAssignableFrom(String.class)) { + // ----2016-12-19---zhuangqian----防止beetlsql对空字符串不检测导致无法入库的问题---- + if (StrKit.isBlank(String.valueOf(value))) + return " "; + else + return String.valueOf(value); + } + return clazz.cast(value); + } catch (ClassCastException e) { + String valueStr = String.valueOf(value); + + Object result = parseBasic(clazz, valueStr); + if (result != null) { + return result; + } + + if (Date.class.isAssignableFrom(clazz)) { + // 判断标准日期 + // ----2016-11-24---zhuangqian----需要加toDate(),不然beetlsql转换date类型的时候会报错---- + return DateTimeKit.parse(valueStr).toDate(); + } else if (clazz == BigInteger.class) { + // 数学计算数字 + return new BigInteger(valueStr); + } else if (clazz == BigDecimal.class) { + // 数学计算数字 + return new BigDecimal(valueStr); + } else if (clazz == byte[].class) { + // 流,由于有字符编码问题,在此使用系统默认 + return valueStr.getBytes(); + } + // 未找到可转换的类型,返回原值 + return (StrKit.isBlank(valueStr)) ? null : value; + } + } + + /** + * 转换基本类型<br> + * 将字符串转换为原始类型或包装类型 + * + * @param clazz 转换到的类,可以是原始类型类,也可以是包装类型类 + * @param valueStr 被转换的字符串 + * @return 转换后的对象,如果非基本类型,返回null + */ + public static Object parseBasic(Class<?> clazz, String valueStr) { + if (null == clazz || null == valueStr) { + return null; + } + + if (StrKit.isBlank(valueStr)) return null; + + BasicType basicType = null; + try { + basicType = BasicType.valueOf(clazz.getSimpleName().toUpperCase()); + } catch (Exception e) { + // 非基本类型数据 + return null; + } + + switch (basicType) { + case BYTE: + if (clazz == byte.class) { + return Byte.parseByte(valueStr); + } + return Byte.valueOf(valueStr); + case SHORT: + if (clazz == short.class) { + return Short.parseShort(valueStr); + } + return Short.valueOf(valueStr); + case INT: + return Integer.parseInt(valueStr); + case INTEGER: + return Integer.valueOf(valueStr); + case LONG: + if (clazz == long.class) { + return new BigDecimal(valueStr).longValue(); + } + return Long.valueOf(valueStr); + case DOUBLE: + if (clazz == double.class) { + return new BigDecimal(valueStr).doubleValue(); + } + case FLOAT: + if (clazz == float.class) { + return Float.parseFloat(valueStr); + } + return Float.valueOf(valueStr); + case BOOLEAN: + if (clazz == boolean.class) { + return Boolean.parseBoolean(valueStr); + } + return Boolean.valueOf(valueStr); + case CHAR: + return valueStr.charAt(0); + case CHARACTER: + return Character.valueOf(valueStr.charAt(0)); + default: + return null; + } + } + + /** + * 转换为字符串<br> + * 如果给定的值为null,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static String toStr(Object value, String defaultValue) { + if (null == value) { + return defaultValue; + } + if (value instanceof String) { + return (String) value; + } else if (CollectionKit.isArray(value)) { + return CollectionKit.toString(value); + } + return value.toString(); + } + + /** + * 转换为字符串<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static String toStr(Object value) { + return toStr(value, null); + } + + /** + * 转换为字符<br> + * 如果给定的值为null,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Character toChar(Object value, Character defaultValue) { + if (null == value) { + return defaultValue; + } + if (value instanceof Character) { + return (Character) value; + } + + final String valueStr = toStr(value, null); + return StrKit.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); + } + + /** + * 转换为字符<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Character toChar(Object value) { + return toChar(value, null); + } + + /** + * 转换为byte<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Byte toByte(Object value, Byte defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Byte) { + return (Byte) value; + } + if (value instanceof Number) { + return ((Number) value).byteValue(); + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + return Byte.parseByte(valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为byte<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Byte toByte(Object value) { + return toByte(value, null); + } + + /** + * 转换为Short<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Short toShort(Object value, Short defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Short) { + return (Short) value; + } + if (value instanceof Number) { + return ((Number) value).shortValue(); + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + return Short.parseShort(valueStr.trim()); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为Short<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Short toShort(Object value) { + return toShort(value, null); + } + + /** + * 转换为Number<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Number toNumber(Object value, Number defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Number) { + return (Number) value; + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + return NumberFormat.getInstance().parse(valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为Number<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Number toNumber(Object value) { + return toNumber(value, null); + } + + /** + * 转换为int<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Integer toInt(Object value, Integer defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Integer) { + return (Integer) value; + } + if (value instanceof Number) { + return ((Number) value).intValue(); + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + return Integer.parseInt(valueStr.trim()); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为int<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Integer toInt(Object value) { + return toInt(value, null); + } + + /** + * 转换为Integer数组<br> + * + * @param isIgnoreConvertError 是否忽略转换错误,忽略则给值null + * @param values 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(boolean isIgnoreConvertError, Object... values) { + if (CollectionKit.isEmpty(values)) { + return new Integer[] {}; + } + final Integer[] ints = new Integer[values.length]; + for (int i = 0; i < values.length; i++) { + final Integer v = toInt(values[i], null); + if (null == v && isIgnoreConvertError == false) { + throw new ToolBoxException(StrKit.format("Convert [{}] to Integer error!", values[i])); + } + ints[i] = v; + } + return ints; + } + + + /** + * 转换为Integer数组<br> + * + * @param split 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String str) { + return toIntArray(",", str); + } + + /** + * 转换为Integer数组<br> + * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String split, String str) { + if (StrKit.isEmpty(str)) { + return new Integer[] {}; + } + String[] arr = str.split(split); + final Integer[] ints = new Integer[arr.length]; + for (int i = 0; i < arr.length; i++) { + final Integer v = toInt(arr[i], 0); + ints[i] = v; + } + return ints; + } + + /** + * 转换为String数组<br> + * + * @param split 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String str) { + return toStrArray("", str); + } + + /** + * 转换为String数组<br> + * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String split, String str) { + return str.split(split); + } + + /** + * 转换为long<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Long toLong(Object value, Long defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Long) { + return (Long) value; + } + if (value instanceof Number) { + return ((Number) value).longValue(); + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).longValue(); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为long<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Long toLong(Object value) { + return toLong(value, null); + } + + /** + * 转换为Long数组<br> + * + * @param isIgnoreConvertError 是否忽略转换错误,忽略则给值null + * @param values 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(boolean isIgnoreConvertError, Object... values) { + if (CollectionKit.isEmpty(values)) { + return new Long[] {}; + } + final Long[] longs = new Long[values.length]; + for (int i = 0; i < values.length; i++) { + final Long v = toLong(values[i], null); + if (null == v && isIgnoreConvertError == false) { + throw new ToolBoxException(StrKit.format("Convert [{}] to Long error!", values[i])); + } + longs[i] = v; + } + return longs; + } + + /** + * 转换为double<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Double toDouble(Object value, Double defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Double) { + return (Double) value; + } + if (value instanceof Number) { + return ((Number) value).doubleValue(); + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).doubleValue(); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为double<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Double toDouble(Object value) { + return toDouble(value, null); + } + + /** + * 转换为Double数组<br> + * + * @param isIgnoreConvertError 是否忽略转换错误,忽略则给值null + * @param values 被转换的值 + * @return 结果 + */ + public static Double[] toDoubleArray(boolean isIgnoreConvertError, Object... values) { + if (CollectionKit.isEmpty(values)) { + return new Double[] {}; + } + final Double[] doubles = new Double[values.length]; + for (int i = 0; i < values.length; i++) { + final Double v = toDouble(values[i], null); + if (null == v && isIgnoreConvertError == false) { + throw new ToolBoxException(StrKit.format("Convert [{}] to Double error!", values[i])); + } + doubles[i] = v; + } + return doubles; + } + + /** + * 转换为Float<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Float toFloat(Object value, Float defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Float) { + return (Float) value; + } + if (value instanceof Number) { + return ((Number) value).floatValue(); + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + return Float.parseFloat(valueStr.trim()); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为Float<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Float toFloat(Object value) { + return toFloat(value, null); + } + + /** + * 转换为Float数组<br> + * + * @param isIgnoreConvertError 是否忽略转换错误,忽略则给值null + * @param values 被转换的值 + * @return 结果 + */ + public static <T> Float[] toFloatArray(boolean isIgnoreConvertError, Object... values) { + if (CollectionKit.isEmpty(values)) { + return new Float[] {}; + } + final Float[] floats = new Float[values.length]; + for (int i = 0; i < values.length; i++) { + final Float v = toFloat(values[i], null); + if (null == v && isIgnoreConvertError == false) { + throw new ToolBoxException(StrKit.format("Convert [{}] to Float error!", values[i])); + } + floats[i] = v; + } + return floats; + } + + /** + * 转换为boolean<br> + * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Boolean toBool(Object value, Boolean defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Boolean) { + return (Boolean) value; + } + String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + valueStr = valueStr.trim().toLowerCase(); + switch (valueStr) { + case "true": + return true; + case "false": + return false; + case "yes": + return true; + case "ok": + return true; + case "no": + return false; + case "1": + return true; + case "0": + return false; + default: + return defaultValue; + } + } + + /** + * 转换为boolean<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Boolean toBool(Object value) { + return toBool(value, null); + } + + /** + * 转换为Boolean数组<br> + * + * @param isIgnoreConvertError 是否忽略转换错误,忽略则给值null + * @param values 被转换的值 + * @return 结果 + */ + public static Boolean[] toBooleanArray(boolean isIgnoreConvertError, Object... values) { + if (CollectionKit.isEmpty(values)) { + return new Boolean[] {}; + } + final Boolean[] bools = new Boolean[values.length]; + for (int i = 0; i < values.length; i++) { + final Boolean v = toBool(values[i], null); + if (null == v && isIgnoreConvertError == false) { + throw new ToolBoxException(StrKit.format("Convert [{}] to Boolean error!", values[i])); + } + bools[i] = v; + } + return bools; + } + + /** + * 转换为Enum对象<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * + * @param clazz Enum的Class + * @param value 值 + * @param defaultValue 默认值 + * @return Enum + */ + public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) { + if (value == null) { + return defaultValue; + } + if (clazz.isAssignableFrom(value.getClass())) { + @SuppressWarnings("unchecked") + E myE = (E) value; + return myE; + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + return Enum.valueOf(clazz, valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为Enum对象<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * + * @param clazz Enum的Class + * @param value 值 + * @return Enum + */ + public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) { + return toEnum(clazz, value, null); + } + + /** + * 转换为BigInteger<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value, BigInteger defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof BigInteger) { + return (BigInteger) value; + } + if (value instanceof Long) { + return BigInteger.valueOf((Long) value); + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + return new BigInteger(valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为BigInteger<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value) { + return toBigInteger(value, null); + } + + /** + * 转换为BigDecimal<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof BigDecimal) { + return (BigDecimal) value; + } + if (value instanceof Long) { + return new BigDecimal((Long) value); + } + if (value instanceof Double) { + return new BigDecimal((Double) value); + } + if (value instanceof Integer) { + return new BigDecimal((Integer) value); + } + final String valueStr = toStr(value, null); + if (StrKit.isBlank(valueStr)) { + return defaultValue; + } + try { + return new BigDecimal(valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为BigDecimal<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value) { + return toBigDecimal(value, null); + } + + // ----------------------------------------------------------------------- 全角半角转换 + /** + * 半角转全角 + * + * @param input String. + * @return 全角字符串. + */ + public static String toSBC(String input) { + return toSBC(input, null); + } + + /** + * 半角转全角 + * + * @param input String + * @param notConvertSet 不替换的字符集合 + * @return 全角字符串. + */ + public static String toSBC(String input, Set<Character> notConvertSet) { + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (null != notConvertSet && notConvertSet.contains(c[i])) { + // 跳过不替换的字符 + continue; + } + + if (c[i] == ' ') { + c[i] = '\u3000'; + } else if (c[i] < '\177') { + c[i] = (char) (c[i] + 65248); + + } + } + return new String(c); + } + + /** + * 全角转半角 + * + * @param input String. + * @return 半角字符串 + */ + public static String toDBC(String input) { + return toDBC(input, null); + } + + /** + * 替换全角为半角 + * + * @param text 文本 + * @param notConvertSet 不替换的字符集合 + * @return 替换后的字符 + */ + public static String toDBC(String text, Set<Character> notConvertSet) { + char c[] = text.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (null != notConvertSet && notConvertSet.contains(c[i])) { + // 跳过不替换的字符 + continue; + } + + if (c[i] == '\u3000') { + c[i] = ' '; + } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') { + c[i] = (char) (c[i] - 65248); + } + } + String returnString = new String(c); + + return returnString; + } + + // --------------------------------------------------------------------- hex + /** + * 字符串转换成十六进制字符串 + * + * @param str 待转换的ASCII字符串 + * @return 16进制字符串 + */ + public static String toHex(String str) { + return HexKit.encodeHexStr(str.getBytes()); + } + + /** + * byte数组转16进制串 + * + * @param bytes 被转换的byte数组 + * @return 转换后的值 + */ + public static String toHex(byte[] bytes) { + return HexKit.encodeHexStr(bytes); + } + + /** + * Hex字符串转换为Byte值 + * + * @param src Byte字符串,每个Byte之间没有分隔符 + * @return byte[] + */ + public static byte[] hexToBytes(String src) { + return HexKit.decodeHex(src.toCharArray()); + } + + /** + * 十六进制转换字符串 + * + * @param hexStr Byte字符串(Byte之间无分隔符 如:[616C6B]) + * @param charset 编码 {@link Charset} + * @return 对应的字符串 + */ + public static String hexStrToStr(String hexStr, Charset charset) { + return HexKit.decodeHexStr(hexStr, charset); + } + + /** + * String的字符串转换成unicode的String + * + * @param strText 全角字符串 + * @return String 每个unicode之间无分隔符 + * @throws Exception + */ + public static String strToUnicode(String strText) throws Exception { + char c; + StringBuilder str = new StringBuilder(); + int intAsc; + String strHex; + for (int i = 0; i < strText.length(); i++) { + c = strText.charAt(i); + intAsc = (int) c; + strHex = Integer.toHexString(intAsc); + if (intAsc > 128) + str.append("\\u" + strHex); + else // 低位在前面补00 + str.append("\\u00" + strHex); + } + return str.toString(); + } + + /** + * unicode的String转换成String的字符串 + * + * @param hex 16进制值字符串 (一个unicode为2byte) + * @return String 全角字符串 + */ + public static String unicodeToStr(String hex) { + int t = hex.length() / 6; + StringBuilder str = new StringBuilder(); + for (int i = 0; i < t; i++) { + String s = hex.substring(i * 6, (i + 1) * 6); + // 高位需要补上00再转 + String s1 = s.substring(2, 4) + "00"; + // 低位直接转 + String s2 = s.substring(4); + // 将16进制的string转为int + int n = Integer.valueOf(s1, 16) + Integer.valueOf(s2, 16); + // 将int转换为字符 + char[] chars = Character.toChars(n); + str.append(new String(chars)); + } + return str.toString(); + } + + /** + * 给定字符串转换字符编码<br/> + * 如果参数为空,则返回原字符串,不报错。 + * + * @param str 被转码的字符串 + * @param sourceCharset 原字符集 + * @param destCharset 目标字符集 + * @return 转换后的字符串 + */ + public static String convertCharset(String str, String sourceCharset, String destCharset) { + if (StrKit.hasBlank(str, sourceCharset, destCharset)) { + return str; + } + + try { + return new String(str.getBytes(sourceCharset), destCharset); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * 数字金额大写转换 先写个完整的然后将如零拾替换成零 + * + * @param n 数字 + * @return 中文大写数字 + */ + public static String digitUppercase(double n) { + String fraction[] = { "角", "分" }; + String digit[] = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; + String unit[][] = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; + + String head = n < 0 ? "负" : ""; + n = Math.abs(n); + + String s = ""; + for (int i = 0; i < fraction.length; i++) { + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); + } + if (s.length() < 1) { + s = "整"; + } + int integerPart = (int) Math.floor(n); + + for (int i = 0; i < unit[0].length && integerPart > 0; i++) { + String p = ""; + for (int j = 0; j < unit[1].length && n > 0; j++) { + p = digit[integerPart % 10] + unit[1][j] + p; + integerPart = integerPart / 10; + } + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; + } + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/DateUtil.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/DateUtil.java new file mode 100644 index 0000000..d5b833c --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/DateUtil.java @@ -0,0 +1,250 @@ +/** + * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.util; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +public class DateUtil { + + /** + * 获取YYYY格式 + */ + public static String getYear() { + return formatDate(new Date(), "yyyy"); + } + + /** + * 获取YYYY格式 + */ + public static String getYear(Date date) { + return formatDate(date, "yyyy"); + } + + /** + * 获取YYYY-MM-DD格式 + */ + public static String getDay() { + return formatDate(new Date(), "yyyy-MM-dd"); + } + + /** + * 获取YYYY-MM-DD格式 + */ + public static String getDay(Date date) { + return formatDate(date, "yyyy-MM-dd"); + } + + /** + * 获取YYYYMMDD格式 + */ + public static String getDays() { + return formatDate(new Date(), "yyyyMMdd"); + } + + /** + * 获取YYYYMMDD格式 + */ + public static String getDays(Date date) { + return formatDate(date, "yyyyMMdd"); + } + + /** + * 获取YYYY-MM-DD HH:mm:ss格式 + */ + public static String getTime() { + return formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"); + } + + /** + * 获取YYYY-MM-DD HH:mm:ss.SSS格式 + */ + public static String getMsTime() { + return formatDate(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"); + } + + /** + * 获取YYYYMMDDHHmmss格式 + */ + public static String getAllTime() { + return formatDate(new Date(), "yyyyMMddHHmmss"); + } + + /** + * 获取YYYY-MM-DD HH:mm:ss格式 + */ + public static String getTime(Date date) { + return formatDate(date, "yyyy-MM-dd HH:mm:ss"); + } + + public static String formatDate(Date date, String pattern) { + String formatDate = null; + if (StringUtils.isNotBlank(pattern)) { + formatDate = DateFormatUtils.format(date, pattern); + } else { + formatDate = DateFormatUtils.format(date, "yyyy-MM-dd"); + } + return formatDate; + } + + /** + * 日期比较,如果s>=e 返回true 否则返回false) + * + * @author luguosui + */ + public static boolean compareDate(String s, String e) { + if (parseDate(s) == null || parseDate(e) == null) { + return false; + } + return parseDate(s).getTime() >= parseDate(e).getTime(); + } + + /** + * 格式化日期 + */ + public static Date parseDate(String date) { + return parse(date, "yyyy-MM-dd"); + } + + /** + * 格式化日期 + */ + public static Date parseTimeMinutes(String date) { + return parse(date, "yyyy-MM-dd HH:mm"); + } + + /** + * 格式化日期 + */ + public static Date parseTime(String date) { + return parse(date, "yyyy-MM-dd HH:mm:ss"); + } + + /** + * 格式化日期 + */ + public static Date parse(String date, String pattern) { + try { + return DateUtils.parseDate(date, pattern); + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + /** + * 格式化日期 + */ + public static String format(Date date, String pattern) { + return DateFormatUtils.format(date, pattern); + } + + /** + * 把日期转换为Timestamp + */ + public static Timestamp format(Date date) { + return new Timestamp(date.getTime()); + } + + /** + * 校验日期是否合法 + */ + public static boolean isValidDate(String s) { + return parse(s, "yyyy-MM-dd HH:mm:ss") != null; + } + + /** + * 校验日期是否合法 + */ + public static boolean isValidDate(String s, String pattern) { + return parse(s, pattern) != null; + } + + public static int getDiffYear(String startTime, String endTime) { + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + try { + int years = (int) (((fmt.parse(endTime).getTime() - fmt.parse( + startTime).getTime()) / (1000 * 60 * 60 * 24)) / 365); + return years; + } catch (Exception e) { + // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 + return 0; + } + } + + /** + * <li>功能描述:时间相减得到天数 + */ + public static long getDaySub(String beginDateStr, String endDateStr) { + long day = 0; + SimpleDateFormat format = new SimpleDateFormat( + "yyyy-MM-dd"); + Date beginDate = null; + Date endDate = null; + + try { + beginDate = format.parse(beginDateStr); + endDate = format.parse(endDateStr); + } catch (ParseException e) { + e.printStackTrace(); + } + day = (endDate.getTime() - beginDate.getTime()) / (24 * 60 * 60 * 1000); + // System.out.println("相隔的天数="+day); + + return day; + } + + /** + * 得到n天之后的日期 + */ + public static String getAfterDayDate(String days) { + int daysInt = Integer.parseInt(days); + + Calendar canlendar = Calendar.getInstance(); // java.util包 + canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 + Date date = canlendar.getTime(); + + SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateStr = sdfd.format(date); + + return dateStr; + } + + /** + * 得到n天之后是周几 + */ + public static String getAfterDayWeek(String days) { + int daysInt = Integer.parseInt(days); + + Calendar canlendar = Calendar.getInstance(); // java.util包 + canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 + Date date = canlendar.getTime(); + + SimpleDateFormat sdf = new SimpleDateFormat("E"); + String dateStr = sdf.format(date); + + return dateStr; + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/FileUtil.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/FileUtil.java new file mode 100644 index 0000000..e958d6c --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/FileUtil.java @@ -0,0 +1,73 @@ +package com.agentdriving.user.core.util; + +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.exception.GunsExceptionEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; + +public class FileUtil { + + private static Logger log = LoggerFactory.getLogger(FileUtil.class); + + /** + * NIO way + */ + public static byte[] toByteArray(String filename) { + + File f = new File(filename); + if (!f.exists()) { + log.error("文件未找到!" + filename); + throw new GunsException(GunsExceptionEnum.FILE_NOT_FOUND); + } + FileChannel channel = null; + FileInputStream fs = null; + try { + fs = new FileInputStream(f); + channel = fs.getChannel(); + ByteBuffer byteBuffer = ByteBuffer.allocate((int) channel.size()); + while ((channel.read(byteBuffer)) > 0) { + // do nothing + // System.out.println("reading"); + } + return byteBuffer.array(); + } catch (IOException e) { + throw new GunsException(GunsExceptionEnum.FILE_READING_ERROR); + } finally { + try { + channel.close(); + } catch (IOException e) { + throw new GunsException(GunsExceptionEnum.FILE_READING_ERROR); + } + try { + fs.close(); + } catch (IOException e) { + throw new GunsException(GunsExceptionEnum.FILE_READING_ERROR); + } + } + } + + /** + * 删除目录 + * + * @author fengshuonan + * @Date 2017/10/30 下午4:15 + */ + public static boolean deleteDir(File dir) { + if (dir.isDirectory()) { + String[] children = dir.list(); + for (int i = 0; i < children.length; i++) { + boolean success = deleteDir(new File(dir, children[i])); + if (!success) { + return false; + } + } + } + return dir.delete(); + } +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/HttpSessionHolder.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/HttpSessionHolder.java new file mode 100644 index 0000000..7d61d77 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/HttpSessionHolder.java @@ -0,0 +1,26 @@ +package com.agentdriving.user.core.util; + +import javax.servlet.http.HttpSession; + +/** + * 非Controller中获取当前session的工具类 + * + * @author fengshuonan + * @date 2016年11月28日 上午10:24:31 + */ +public class HttpSessionHolder { + + private static ThreadLocal<HttpSession> tl = new ThreadLocal<HttpSession>(); + + public static void put(HttpSession s) { + tl.set(s); + } + + public static HttpSession get() { + return tl.get(); + } + + public static void remove() { + tl.remove(); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/IdGenerator.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/IdGenerator.java new file mode 100644 index 0000000..cc054ea --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/IdGenerator.java @@ -0,0 +1,20 @@ +package com.agentdriving.user.core.util; + +import com.baomidou.mybatisplus.toolkit.IdWorker; + +/** + * 唯一id生成器 + * + * @author fengshuonan + * @date 2017-08-23 11:10 + */ +public class IdGenerator { + + public static String getId() { + return String.valueOf(IdWorker.getId()); + } + + public static long getIdLong() { + return IdWorker.getId(); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/MD5Util.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/MD5Util.java new file mode 100644 index 0000000..1845b08 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/MD5Util.java @@ -0,0 +1,39 @@ +package com.agentdriving.user.core.util; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * MD5加密类(封装jdk自带的md5加密方法) + * + * @author fengshuonan + * @date 2016年12月2日 下午4:14:22 + */ +public class MD5Util { + + public static String encrypt(String source) { + return encodeMd5(source.getBytes()); + } + + private static String encodeMd5(byte[] source) { + try { + return encodeHex(MessageDigest.getInstance("MD5").digest(source)); + } catch (NoSuchAlgorithmException e) { + throw new IllegalStateException(e.getMessage(), e); + } + } + + private static String encodeHex(byte[] bytes) { + StringBuffer buffer = new StringBuffer(bytes.length * 2); + for (int i = 0; i < bytes.length; i++) { + if (((int) bytes[i] & 0xff) < 0x10) + buffer.append("0"); + buffer.append(Long.toString((int) bytes[i] & 0xff, 16)); + } + return buffer.toString(); + } + + public static void main(String[] args) { + System.out.println(encrypt("123456")); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/NumUtil.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/NumUtil.java new file mode 100644 index 0000000..78d2aa4 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/NumUtil.java @@ -0,0 +1,89 @@ +package com.agentdriving.user.core.util; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +/** + * 数字格式化的类 + * + * @author fengshuonan + * @date 2016年11月30日 下午5:58:40 + */ +public class NumUtil { + + /** + * @Description 保留指定位数的小数(少的位数不补零) + * @author fengshuonan + */ + public static String keepRandomPoint(Double value, int n) { + if (value == null) { + value = 0.00; + return new BigDecimal(value).setScale(n, RoundingMode.HALF_UP).toString(); + } else { + return new BigDecimal(value).setScale(n, RoundingMode.HALF_UP).toString(); + } + } + + /** + * @Description 浮点保留两位小数(少的位数不补零) + * @author fengshuonan + */ + public static String keep2Point(double value) { + return keepRandomPoint(value, 2); + } + + /** + * @Description 浮点保留1位小数(少的位数不补零) + * @author fengshuonan + */ + public static String keep1Point(double value) { + return keepRandomPoint(value, 1); + } + + /** + * @Description 浮点保留任意位小数(少位补零) + * @author fengshuonan + */ + public static String keepRandomPointZero(double value, int n) { + DecimalFormat df = new DecimalFormat("#0.00"); + return df.format(Double.valueOf(keepRandomPoint(value, n))); + } + + /** + * @Description 浮点保留两位小数(少位补零) + * @author fengshuonan + */ + public static String keep2PointZero(double value) { + return keepRandomPointZero(value, 2); + } + + /** + * @Description 获取任意小数点位的百分比表示 + * @author fengshuonan + */ + public static String percentRandomPoint(double value, int n) { + NumberFormat percent = NumberFormat.getPercentInstance(); + percent.setGroupingUsed(false); + percent.setMaximumFractionDigits(n); + return percent.format(value); + } + + /** + * @Description 百分比保留两位小数 + * @author fengshuonan + */ + public static String percent2Point(double value) { + return percentRandomPoint(value, 2); + } + + /** + * @Description 获取格式化经纬度后的小数(保留3位) + * @author fengshuonan + */ + public static String latLngPoint(double value) { + return keepRandomPoint(value, 3); + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/PingYinUtil.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/PingYinUtil.java new file mode 100644 index 0000000..0ebf2b1 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/PingYinUtil.java @@ -0,0 +1,206 @@ +package com.agentdriving.user.core.util; + +import java.util.Random; + +/*** + * + * 得到中文首字母 + * + * @author lxm_09 + * + */ + +public class PingYinUtil { + + public static void main(String[] args) { + String str = "这是一个测试"; + System.out.println("中文首字母:" + getPYIndexStr(str, true)); + } + + /** + * 返回首字母 + */ + public static String getPYIndexStr(String strChinese, boolean bUpCase) { + try { + StringBuffer buffer = new StringBuffer(); + byte b[] = strChinese.getBytes("GBK");// 把中文转化成byte数组 + for (int i = 0; i < b.length; i++) { + if ((b[i] & 255) > 128) { + int char1 = b[i++] & 255; + char1 <<= 8;// 左移运算符用“<<”表示,是将运算符左边的对象,向左移动运算符右边指定的位数,并且在低位补零。其实,向左移n位,就相当于乘上2的n次方 + int chart = char1 + (b[i] & 255); + buffer.append(getPYIndexChar((char) chart, bUpCase)); + continue; + } + char c = (char) b[i]; + if (!Character.isJavaIdentifierPart(c))// 确定指定字符是否可以是 Java + // 标识符中首字符以外的部分。 + c = 'A'; + buffer.append(c); + } + return buffer.toString(); + } catch (Exception e) { + System.out.println((new StringBuilder()).append("\u53D6\u4E2D\u6587\u62FC\u97F3\u6709\u9519") + .append(e.getMessage()).toString()); + } + return null; + } + + /** + * 得到首字母 + */ + private static char getPYIndexChar(char strChinese, boolean bUpCase) { + + int charGBK = strChinese; + + char result; + + if (charGBK >= 45217 && charGBK <= 45252) + + result = 'A'; + + else + + if (charGBK >= 45253 && charGBK <= 45760) + + result = 'B'; + + else + + if (charGBK >= 45761 && charGBK <= 46317) + + result = 'C'; + + else + + if (charGBK >= 46318 && charGBK <= 46825) + + result = 'D'; + + else + + if (charGBK >= 46826 && charGBK <= 47009) + + result = 'E'; + + else + + if (charGBK >= 47010 && charGBK <= 47296) + + result = 'F'; + + else + + if (charGBK >= 47297 && charGBK <= 47613) + + result = 'G'; + + else + + if (charGBK >= 47614 && charGBK <= 48118) + + result = 'H'; + + else + + if (charGBK >= 48119 && charGBK <= 49061) + + result = 'J'; + + else + + if (charGBK >= 49062 && charGBK <= 49323) + + result = 'K'; + + else + + if (charGBK >= 49324 && charGBK <= 49895) + + result = 'L'; + + else + + if (charGBK >= 49896 && charGBK <= 50370) + + result = 'M'; + + else + + if (charGBK >= 50371 && charGBK <= 50613) + + result = 'N'; + + else + + if (charGBK >= 50614 && charGBK <= 50621) + + result = 'O'; + + else + + if (charGBK >= 50622 && charGBK <= 50905) + + result = 'P'; + + else + + if (charGBK >= 50906 && charGBK <= 51386) + + result = 'Q'; + + else + + if (charGBK >= 51387 && charGBK <= 51445) + + result = 'R'; + + else + + if (charGBK >= 51446 && charGBK <= 52217) + + result = 'S'; + + else + + if (charGBK >= 52218 && charGBK <= 52697) + + result = 'T'; + + else + + if (charGBK >= 52698 && charGBK <= 52979) + + result = 'W'; + + else + + if (charGBK >= 52980 && charGBK <= 53688) + + result = 'X'; + + else + + if (charGBK >= 53689 && charGBK <= 54480) + + result = 'Y'; + + else + + if (charGBK >= 54481 && charGBK <= 55289) + + result = 'Z'; + + else + + result = (char) (65 + (new Random()).nextInt(25)); + + if (!bUpCase) + + result = Character.toLowerCase(result); + + return result; + + } + +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/RenderUtil.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/RenderUtil.java new file mode 100644 index 0000000..13b836a --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/RenderUtil.java @@ -0,0 +1,32 @@ +package com.agentdriving.user.core.util; + +import com.agentdriving.user.core.exception.GunsException; +import com.agentdriving.user.core.exception.GunsExceptionEnum; +import com.alibaba.fastjson.JSON; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; + +/** + * 渲染工具类 + * + * @author stylefeng + * @date 2017-08-25 14:13 + */ +public class RenderUtil { + + /** + * 渲染json对象 + */ + public static void renderJson(HttpServletResponse response, Object jsonObject) { + try { + response.setContentType("application/json"); + response.setCharacterEncoding("UTF-8"); + PrintWriter writer = response.getWriter(); + writer.write(JSON.toJSONString(jsonObject)); + } catch (IOException e) { + throw new GunsException(GunsExceptionEnum.WRITE_ERROR); + } + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/ResKit.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/ResKit.java new file mode 100644 index 0000000..d2c6280 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/ResKit.java @@ -0,0 +1,38 @@ +package com.agentdriving.user.core.util; + +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; + +import java.io.IOException; + +/** + * 资源文件相关的操作类 + * + * @author fengshuonan + * @date 2016年11月17日 下午10:09:23 + */ +public class ResKit { + + /** + * @Description 批量获取ClassPath下的资源文件 + * @author fengshuonan + */ + public static Resource[] getClassPathResources(String pattern) { + ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); + try { + return resolver.getResources(pattern); + } catch (IOException e) { + throw new RuntimeException("加载resource文件时,找不到文件,所找文件为:" + pattern); + } + } + + /** + * @Description 批量获取ClassPath下的资源文件 + * @author fengshuonan + */ + public static String getClassPathFile(String file) { + //return ResKit.class.getClassLoader().getResource(file).getPath(); + return Thread.currentThread().getContextClassLoader().getResource(file).getPath(); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/SimpleContrast.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/SimpleContrast.java new file mode 100644 index 0000000..f32ef65 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/SimpleContrast.java @@ -0,0 +1,58 @@ +package com.agentdriving.user.core.util; + +import java.beans.PropertyDescriptor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Date; + +/** + * 对比两个对象的变化的工具类 + * + * @author fengshuonan + * @Date 2017/3/31 10:36 + */ +public class SimpleContrast { + + //记录每个修改字段的分隔符 + public static final String separator = ";;;"; + + /** + * 比较两个对象,并返回不一致的信息 + * + * @author stylefeng + * @Date 2017/5/9 19:34 + */ + public static String contrastObj(Object pojo1, Object pojo2) { + String str = ""; + try { + Class clazz = pojo1.getClass(); + Field[] fields = pojo1.getClass().getDeclaredFields(); + int i = 1; + for (Field field : fields) { + if ("serialVersionUID".equals(field.getName())) { + continue; + } + PropertyDescriptor pd = new PropertyDescriptor(field.getName(), clazz); + Method getMethod = pd.getReadMethod(); + Object o1 = getMethod.invoke(pojo1); + Object o2 = getMethod.invoke(pojo2); + if (o1 == null || o2 == null) { + continue; + } + if (o1 instanceof Date) { + o1 = DateUtil.getDay((Date) o1); + } + if (!o1.toString().equals(o2.toString())) { + if (i != 1) { + str += separator; + } + str += "字段名称" + field.getName() + ",旧值:" + o1 + ",新值:" + o2; + i++; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return str; + } +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/SpringContextHolder.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/SpringContextHolder.java new file mode 100644 index 0000000..4412430 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/SpringContextHolder.java @@ -0,0 +1,46 @@ +package com.agentdriving.user.core.util; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * Spring的ApplicationContext的持有者,可以用静态方法的方式获取spring容器中的bean + * + * @author fengshuonan + * @date 2016年11月27日 下午3:32:11 + */ +@Component +public class SpringContextHolder implements ApplicationContextAware { + + private static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + SpringContextHolder.applicationContext = applicationContext; + } + + public static ApplicationContext getApplicationContext() { + assertApplicationContext(); + return applicationContext; + } + + @SuppressWarnings("unchecked") + public static <T> T getBean(String beanName) { + assertApplicationContext(); + return (T) applicationContext.getBean(beanName); + } + + public static <T> T getBean(Class<T> requiredType) { + assertApplicationContext(); + return applicationContext.getBean(requiredType); + } + + private static void assertApplicationContext() { + if (SpringContextHolder.applicationContext == null) { + throw new RuntimeException("applicaitonContext属性为null,请检查是否注入了SpringContextHolder!"); + } + } + +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/SqlUtil.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/SqlUtil.java new file mode 100644 index 0000000..cb1ba17 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/SqlUtil.java @@ -0,0 +1,35 @@ +package com.agentdriving.user.core.util; + +import java.util.ArrayList; +import java.util.List; + +/** + * sql语句工具类 + * + * @author fengshuonan + * @date 2016年12月6日 下午1:01:54 + */ +public class SqlUtil { + + /** + * @Description 根据集合的大小,输出相应个数"?" + * @author fengshuonan + */ + public static String parse(List<?> list) { + String str = ""; + if (list != null && list.size() > 0) { + str = str + "?"; + for (int i = 1; i < list.size(); i++) { + str = str + ",?"; + } + } + return str; + } + + public static void main(String[] args) { + ArrayList<Object> arrayList = new ArrayList<>(); + arrayList.add(2); + arrayList.add(2); + System.out.println(parse(arrayList)); + } +} diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/util/ToolUtil.java b/user/guns-core/src/main/java/com/agentdriving/user/core/util/ToolUtil.java new file mode 100644 index 0000000..447c4f4 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/util/ToolUtil.java @@ -0,0 +1,582 @@ +/** + * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). + * <p> + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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. + */ +package com.agentdriving.user.core.util; + +import com.agentdriving.user.core.support.StrKit; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.Array; +import java.math.BigDecimal; +import java.net.URISyntaxException; +import java.util.*; +import java.util.Map.Entry; + +/** + * 高频方法集合类 + */ +public class ToolUtil { + + /** + * 获取随机位数的字符串 + * + * @author fengshuonan + * @Date 2017/8/24 14:09 + */ + public static String getRandomString(int length) { + String base = "abcdefghijklmnopqrstuvwxyz0123456789"; + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < length; i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + return sb.toString(); + } + + /** + * 判断一个对象是否是时间类型 + * + * @author stylefeng + * @Date 2017/4/18 12:55 + */ + public static String dateType(Object o) { + if (o instanceof Date) { + return DateUtil.getDay((Date) o); + } else { + return o.toString(); + } + } + + /** + * 获取异常的具体信息 + * + * @author fengshuonan + * @Date 2017/3/30 9:21 + * @version 2.0 + */ + public static String getExceptionMsg(Exception e) { + StringWriter sw = new StringWriter(); + try { + e.printStackTrace(new PrintWriter(sw)); + } finally { + try { + sw.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + return sw.getBuffer().toString().replaceAll("\\$", "T"); + } + + /** + * 比较两个对象是否相等。<br> + * 相同的条件有两个,满足其一即可:<br> + * 1. obj1 == null && obj2 == null; 2. obj1.equals(obj2) + * + * @param obj1 对象1 + * @param obj2 对象2 + * @return 是否相等 + */ + public static boolean equals(Object obj1, Object obj2) { + return (obj1 != null) ? (obj1.equals(obj2)) : (obj2 == null); + } + + /** + * 计算对象长度,如果是字符串调用其length函数,集合类调用其size函数,数组调用其length属性,其他可遍历对象遍历计算长度 + * + * @param obj 被计算长度的对象 + * @return 长度 + */ + public static int length(Object obj) { + if (obj == null) { + return 0; + } + if (obj instanceof CharSequence) { + return ((CharSequence) obj).length(); + } + if (obj instanceof Collection) { + return ((Collection<?>) obj).size(); + } + if (obj instanceof Map) { + return ((Map<?, ?>) obj).size(); + } + + int count; + if (obj instanceof Iterator) { + Iterator<?> iter = (Iterator<?>) obj; + count = 0; + while (iter.hasNext()) { + count++; + iter.next(); + } + return count; + } + if (obj instanceof Enumeration) { + Enumeration<?> enumeration = (Enumeration<?>) obj; + count = 0; + while (enumeration.hasMoreElements()) { + count++; + enumeration.nextElement(); + } + return count; + } + if (obj.getClass().isArray() == true) { + return Array.getLength(obj); + } + return -1; + } + + /** + * 对象中是否包含元素 + * + * @param obj 对象 + * @param element 元素 + * @return 是否包含 + */ + public static boolean contains(Object obj, Object element) { + if (obj == null) { + return false; + } + if (obj instanceof String) { + if (element == null) { + return false; + } + return ((String) obj).contains(element.toString()); + } + if (obj instanceof Collection) { + return ((Collection<?>) obj).contains(element); + } + if (obj instanceof Map) { + return ((Map<?, ?>) obj).values().contains(element); + } + + if (obj instanceof Iterator) { + Iterator<?> iter = (Iterator<?>) obj; + while (iter.hasNext()) { + Object o = iter.next(); + if (equals(o, element)) { + return true; + } + } + return false; + } + if (obj instanceof Enumeration) { + Enumeration<?> enumeration = (Enumeration<?>) obj; + while (enumeration.hasMoreElements()) { + Object o = enumeration.nextElement(); + if (equals(o, element)) { + return true; + } + } + return false; + } + if (obj.getClass().isArray() == true) { + int len = Array.getLength(obj); + for (int i = 0; i < len; i++) { + Object o = Array.get(obj, i); + if (equals(o, element)) { + return true; + } + } + } + return false; + } + + /** + * 对象是否不为空(新增) + * + * @param obj String,List,Map,Object[],int[],long[] + * @return + */ + public static boolean isNotEmpty(Object o) { + return !isEmpty(o); + } + + /** + * 对象是否为空 + * + * @param obj String,List,Map,Object[],int[],long[] + * @return + */ + @SuppressWarnings("rawtypes") + public static boolean isEmpty(Object o) { + if (o == null) { + return true; + } + if (o instanceof String) { + if (o.toString().trim().equals("")) { + return true; + } + } else if (o instanceof List) { + if (((List) o).size() == 0) { + return true; + } + } else if (o instanceof Map) { + if (((Map) o).size() == 0) { + return true; + } + } else if (o instanceof Set) { + if (((Set) o).size() == 0) { + return true; + } + } else if (o instanceof Object[]) { + if (((Object[]) o).length == 0) { + return true; + } + } else if (o instanceof int[]) { + if (((int[]) o).length == 0) { + return true; + } + } else if (o instanceof long[]) { + if (((long[]) o).length == 0) { + return true; + } + } + return false; + } + + /** + * 对象组中是否存在 Empty Object + * + * @param os 对象组 + * @return + */ + public static boolean isOneEmpty(Object... os) { + for (Object o : os) { + if (isEmpty(o)) { + return true; + } + } + return false; + } + + /** + * 对象组中是否全是 Empty Object + * + * @param os + * @return + */ + public static boolean isAllEmpty(Object... os) { + for (Object o : os) { + if (!isEmpty(o)) { + return false; + } + } + return true; + } + + /** + * 是否为数字 + * + * @param obj + * @return + */ + public static boolean isNum(Object obj) { + try { + Integer.parseInt(obj.toString()); + } catch (Exception e) { + return false; + } + return true; + } + + /** + * 如果为空, 则调用默认值 + * + * @param str + * @return + */ + public static Object getValue(Object str, Object defaultValue) { + if (isEmpty(str)) { + return defaultValue; + } + return str; + } + + /** + * 格式化文本 + * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param values 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... values) { + return StrKit.format(template, values); + } + + /** + * 格式化文本 + * + * @param template 文本模板,被替换的部分用 {key} 表示 + * @param map 参数值对 + * @return 格式化后的文本 + */ + public static String format(String template, Map<?, ?> map) { + return StrKit.format(template, map); + } + + /** + * 强转->string,并去掉多余空格 + * + * @param str + * @return + */ + public static String toStr(Object str) { + return toStr(str, ""); + } + + /** + * 强转->string,并去掉多余空格 + * + * @param str + * @param defaultValue + * @return + */ + public static String toStr(Object str, String defaultValue) { + if (null == str) { + return defaultValue; + } + return str.toString().trim(); + } + + /** + * 强转->int + * + * @param obj + * @return + */ +// public static int toInt(Object value) { +// return toInt(value, -1); +// } + + /** + * 强转->int + * + * @param obj + * @param defaultValue + * @return + */ +// public static int toInt(Object value, int defaultValue) { +// return Convert.toInt(value, defaultValue); +// } + + /** + * 强转->long + * + * @param obj + * @return + */ +// public static long toLong(Object value) { +// return toLong(value, -1); +// } + + /** + * 强转->long + * + * @param obj + * @param defaultValue + * @return + */ +// public static long toLong(Object value, long defaultValue) { +// return Convert.toLong(value, defaultValue); +// } +// +// public static String encodeUrl(String url) { +// return URLKit.encode(url, CharsetKit.UTF_8); +// } +// +// public static String decodeUrl(String url) { +// return URLKit.decode(url, CharsetKit.UTF_8); +// } + + /** + * map的key转为小写 + * + * @param map + * @return Map<String , Object> + */ + public static Map<String, Object> caseInsensitiveMap(Map<String, Object> map) { + Map<String, Object> tempMap = new HashMap<>(); + for (String key : map.keySet()) { + tempMap.put(key.toLowerCase(), map.get(key)); + } + return tempMap; + } + + /** + * 获取map中第一个数据值 + * + * @param <K> Key的类型 + * @param <V> Value的类型 + * @param map 数据源 + * @return 返回的值 + */ + public static <K, V> V getFirstOrNull(Map<K, V> map) { + V obj = null; + for (Entry<K, V> entry : map.entrySet()) { + obj = entry.getValue(); + if (obj != null) { + break; + } + } + return obj; + } + + /** + * 创建StringBuilder对象 + * + * @return StringBuilder对象 + */ + public static StringBuilder builder(String... strs) { + final StringBuilder sb = new StringBuilder(); + for (String str : strs) { + sb.append(str); + } + return sb; + } + + /** + * 创建StringBuilder对象 + * + * @return StringBuilder对象 + */ + public static void builder(StringBuilder sb, String... strs) { + for (String str : strs) { + sb.append(str); + } + } + + /** + * 去掉指定后缀 + * + * @param str 字符串 + * @param suffix 后缀 + * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 + */ + public static String removeSuffix(String str, String suffix) { + if (isEmpty(str) || isEmpty(suffix)) { + return str; + } + + if (str.endsWith(suffix)) { + return str.substring(0, str.length() - suffix.length()); + } + return str; + } + + /** + * 当前时间 + * + * @author stylefeng + * @Date 2017/5/7 21:56 + */ + public static String currentTime() { + return DateUtil.getTime(); + } + + /** + * 首字母大写 + * + * @author stylefeng + * @Date 2017/5/7 22:01 + */ + public static String firstLetterToUpper(String val) { + return StrKit.firstCharToUpperCase(val); + } + + /** + * 首字母小写 + * + * @author stylefeng + * @Date 2017/5/7 22:02 + */ + public static String firstLetterToLower(String val) { + return StrKit.firstCharToLowerCase(val); + } + + /** + * 判断是否是windows操作系统 + * + * @author stylefeng + * @Date 2017/5/24 22:34 + */ + public static Boolean isWinOs() { + String os = System.getProperty("os.name"); + if (os.toLowerCase().startsWith("win")) { + return true; + } else { + return false; + } + } + + /** + * 获取临时目录 + * + * @author stylefeng + * @Date 2017/5/24 22:35 + */ + public static String getTempPath() { + return System.getProperty("java.io.tmpdir"); + } + + /** + * 把一个数转化为int + * + * @author fengshuonan + * @Date 2017/11/15 下午11:10 + */ + public static Integer toInt(Object val) { + if (val instanceof Double) { + BigDecimal bigDecimal = new BigDecimal((Double) val); + return bigDecimal.intValue(); + } else { + return Integer.valueOf(val.toString()); + } + + } + + /** + * 获取项目路径 + */ + public static String getWebRootPath(String filePath) { + try { + String path = ToolUtil.class.getClassLoader().getResource("").toURI().getPath(); + path = path.replace("/WEB-INF/classes/", ""); + path = path.replace("/target/classes/", ""); + path = path.replace("file:/", ""); + if (ToolUtil.isEmpty(filePath)) { + return path; + } else { + return path + "/" + filePath; + } + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + } + + /** + * 获取文件后缀名 不包含点 + */ + public static String getFileSuffix(String fileWholeName) { + if (ToolUtil.isEmpty(fileWholeName)) { + return "none"; + } + int lastIndexOf = fileWholeName.lastIndexOf("."); + return fileWholeName.substring(lastIndexOf + 1); + } +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssFilter.java b/user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssFilter.java new file mode 100644 index 0000000..90befff --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssFilter.java @@ -0,0 +1,42 @@ +package com.agentdriving.user.core.xss; + + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.List; + + +public class XssFilter implements Filter { + + FilterConfig filterConfig = null; + + private List<String> urlExclusion = null; + + public void init(FilterConfig filterConfig) throws ServletException { + this.filterConfig = filterConfig; + } + + public void destroy() { + this.filterConfig = null; + } + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) request; + String servletPath = httpServletRequest.getServletPath(); + + if (urlExclusion != null && urlExclusion.contains(servletPath)) { + chain.doFilter(request, response); + } else { + chain.doFilter(new XssHttpServletRequestWrapper((HttpServletRequest) request), response); + } + } + + public List<String> getUrlExclusion() { + return urlExclusion; + } + + public void setUrlExclusion(List<String> urlExclusion) { + this.urlExclusion = urlExclusion; + } +} \ No newline at end of file diff --git a/user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssHttpServletRequestWrapper.java b/user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssHttpServletRequestWrapper.java new file mode 100644 index 0000000..8dd34e4 --- /dev/null +++ b/user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssHttpServletRequestWrapper.java @@ -0,0 +1,87 @@ +package com.agentdriving.user.core.xss; + + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; + + +public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper { + + public XssHttpServletRequestWrapper(HttpServletRequest servletRequest) { + + super(servletRequest); + + } + + public String[] getParameterValues(String parameter) { + + String[] values = super.getParameterValues(parameter); + + if (values == null) { + + return null; + + } + + int count = values.length; + + String[] encodedValues = new String[count]; + + for (int i = 0; i < count; i++) { + + encodedValues[i] = cleanXSS(values[i]); + + } + + return encodedValues; + + } + + public String getParameter(String parameter) { + + String value = super.getParameter(parameter); + + if (value == null) { + + return null; + + } + + return cleanXSS(value); + + } + + public String getHeader(String name) { + + String value = super.getHeader(name); + + if (value == null) + + return null; + + return cleanXSS(value); + + } + + private String cleanXSS(String value) { + + //You'll need to remove the spaces from the html entities below + + value = value.replaceAll("<", "& lt;").replaceAll(">", "& gt;"); + + value = value.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;"); + + value = value.replaceAll("'", "& #39;"); + + value = value.replaceAll("eval\\((.*)\\)", ""); + + value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\""); + + value = value.replaceAll("script", ""); + + return value; + + } + + +} \ No newline at end of file diff --git a/user/guns-core/src/main/resources/META-INF/spring.factories b/user/guns-core/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..3d8c5cf --- /dev/null +++ b/user/guns-core/src/main/resources/META-INF/spring.factories @@ -0,0 +1,6 @@ +# AutoConfiguration +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +com.agentdriving.user.core.base.controller.GlobalController,\ +com.agentdriving.user.core.config.DefaultFastjsonConfig,\ +com.agentdriving.user.core.config.DefaultProperties,\ +com.agentdriving.user.core.config.DefaultWebConfig \ No newline at end of file diff --git a/user/guns-core/src/main/resources/default-config.properties b/user/guns-core/src/main/resources/default-config.properties new file mode 100644 index 0000000..8d458f7 --- /dev/null +++ b/user/guns-core/src/main/resources/default-config.properties @@ -0,0 +1,36 @@ +#\u8FD9\u4E2A\u914D\u7F6E\u6587\u4EF6\u91CC\u5199\u5176\u4ED6\u9879\u76EE\u53EF\u80FD\u5171\u7528\u7684\u914D\u7F6E,\u53EF\u4EE5\u5728application.yml\u4E2D\u914D\u7F6E\u4FE1\u606F\u8986\u76D6\u8FD9\u91CC\u7684\u914D\u7F6E + + +######################### springs\u9ED8\u8BA4\u914D\u7F6E ######################### +spring.aop.proxy-target-class=true + + +###################### mybatis-plus\u9ED8\u8BA4\u914D\u7F6E ####################### +mybatis-plus.mapper-locations=classpath*:com/stylefeng/guns/**/mapping/*.xml +# 0:\u6570\u636E\u5E93ID\u81EA\u589E 1:\u7528\u6237\u8F93\u5165id 2:\u5168\u5C40\u552F\u4E00id(IdWorker) 3:\u5168\u5C40\u552F\u4E00ID(uuid) +mybatis-plus.global-config.id-type=0 +mybatis-plus.global-config.db-column-underline=false +mybatis-plus.global-config.refresh-mapper=true +mybatis-plus.global-config.logic-delete-value=0 +mybatis-plus.global-config.logic-not-delete-value=1 +mybatis-plus.global-config.sql-injector=com.baomidou.mybatisplus.mapper.LogicSqlInjector +mybatis-plus.configuration.map-underscore-to-camel-case=false +#\u914D\u7F6E\u7684\u7F13\u5B58\u7684\u5168\u5C40\u5F00\u5173 +mybatis-plus.configuration.cache-enabled=true +# \u5EF6\u65F6\u52A0\u8F7D\u7684\u5F00\u5173 +mybatis-plus.configuration.lazyLoadingEnabled=true +# \u5F00\u542F\u7684\u8BDD\uFF0C\u5EF6\u65F6\u52A0\u8F7D\u4E00\u4E2A\u5C5E\u6027\u65F6\u4F1A\u52A0\u8F7D\u8BE5\u5BF9\u8C61\u5168\u90E8\u5C5E\u6027\uFF0C\u5426\u5219\u6309\u9700\u52A0\u8F7D\u5C5E\u6027 +mybatis-plus.configuration.multipleResultSetsEnabled=true +# \u6253\u5370sql\u8BED\u53E5,\u8C03\u8BD5\u7528 +mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl + + +########################## beetl\u9ED8\u8BA4\u914D\u7F6E ########################### +#\u5F00\u59CB\u7ED3\u675F\u6807\u7B7E(yaml\u4E0D\u5141\u8BB8@\u5F00\u5934) +beetl.delimiter-statement-start=@ +beetl.delimiter-statement-end=null +#\u81EA\u5B9A\u4E49\u6807\u7B7E\u6587\u4EF6Root\u76EE\u5F55\u548C\u540E\u7F00 +beetl.resource-tagroot=common/tags +beetl.resource-tagsuffix=tag +#\u662F\u5426\u68C0\u6D4B\u6587\u4EF6\u53D8\u5316,\u5F00\u53D1\u7528true\u5408\u9002\uFF0C\u4F46\u7EBF\u4E0A\u8981\u6539\u4E3Afalse +beetl.resource-auto-check=true \ No newline at end of file diff --git a/user/guns-generator/pom.xml b/user/guns-generator/pom.xml new file mode 100644 index 0000000..1328611 --- /dev/null +++ b/user/guns-generator/pom.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <artifactId>guns-generator</artifactId> + <packaging>jar</packaging> + + <name>guns-generator</name> + <description>代码生成器</description> + + <parent> + <groupId>com.stylefeng</groupId> + <artifactId>guns-parent</artifactId> + <version>1.0.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>com.stylefeng</groupId> + <artifactId>guns-core</artifactId> + </dependency> + <dependency> + <groupId>com.ibeetl</groupId> + <artifactId>beetl</artifactId> + </dependency> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatis-plus-generate</artifactId> + </dependency> + </dependencies> + + +</project> diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/GunsCodeGenerator.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/GunsCodeGenerator.java new file mode 100644 index 0000000..2952a0b --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/GunsCodeGenerator.java @@ -0,0 +1,30 @@ +package com.agentdriving.user.generator.action; + + +import com.agentdriving.user.generator.action.config.GunsGeneratorConfig; + +/** + * 代码生成器,可以生成实体,dao,service,controller,html,js + * + * @author stylefeng + * @Date 2017/5/21 12:38 + */ +public class GunsCodeGenerator { + + public static void main(String[] args) { + + /** + * Mybatis-Plus的代码生成器: + * mp的代码生成器可以生成实体,mapper,mapper对应的xml,service + */ + GunsGeneratorConfig gunsGeneratorConfig = new GunsGeneratorConfig(); + gunsGeneratorConfig.doMpGeneration(); + + /** + * guns的生成器: + * guns的代码生成器可以生成controller,html页面,页面对应的js + */ + gunsGeneratorConfig.doGunsGeneration(); + } + +} \ No newline at end of file diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/AbstractGeneratorConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/AbstractGeneratorConfig.java new file mode 100644 index 0000000..d0a9eb8 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/AbstractGeneratorConfig.java @@ -0,0 +1,109 @@ +package com.agentdriving.user.generator.action.config; + +import com.agentdriving.user.core.util.FileUtil; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.agentdriving.user.generator.engine.SimpleTemplateEngine; +import com.agentdriving.user.generator.engine.base.GunsTemplateEngine; +import com.agentdriving.user.generator.engine.config.ContextConfig; +import com.agentdriving.user.generator.engine.config.SqlConfig; + +import java.io.File; +import java.util.List; + +/** + * 代码生成的抽象配置 + * + * @author fengshuonan + * @date 2017-10-28-下午8:22 + */ +public abstract class AbstractGeneratorConfig { + + /** + * mybatis-plus代码生成器配置 + */ + GlobalConfig globalConfig = new GlobalConfig(); + + DataSourceConfig dataSourceConfig = new DataSourceConfig(); + + StrategyConfig strategyConfig = new StrategyConfig(); + + PackageConfig packageConfig = new PackageConfig(); + + TableInfo tableInfo = null; + + /** + * Guns代码生成器配置 + */ + ContextConfig contextConfig = new ContextConfig(); + + SqlConfig sqlConfig = new SqlConfig(); + + protected abstract void config(); + + public void init() { + config(); + + packageConfig.setService(contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service"); + packageConfig.setServiceImpl(contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service.impl"); + + //controller没用掉,生成之后会自动删掉 + packageConfig.setController("TTT"); + + if (!contextConfig.getEntitySwitch()) { + packageConfig.setEntity("TTT"); + } + + if (!contextConfig.getDaoSwitch()) { + packageConfig.setMapper("TTT"); + packageConfig.setXml("TTT"); + } + + if (!contextConfig.getServiceSwitch()) { + packageConfig.setService("TTT"); + packageConfig.setServiceImpl("TTT"); + } + + } + + /** + * 删除不必要的代码 + */ + public void destory() { + String outputDir = globalConfig.getOutputDir() + "/TTT"; + FileUtil.deleteDir(new File(outputDir)); + } + + public AbstractGeneratorConfig() { + } + + public void doMpGeneration() { + init(); + AutoGenerator autoGenerator = new AutoGenerator(); + autoGenerator.setGlobalConfig(globalConfig); + autoGenerator.setDataSource(dataSourceConfig); + autoGenerator.setStrategy(strategyConfig); + autoGenerator.setPackageInfo(packageConfig); + autoGenerator.execute(); + destory(); + + //获取table信息,用于guns代码生成 + List<TableInfo> tableInfoList = autoGenerator.getConfig().getTableInfoList(); + if (tableInfoList != null && tableInfoList.size() > 0) { + this.tableInfo = tableInfoList.get(0); + } + } + + public void doGunsGeneration() { + GunsTemplateEngine GunsTemplateEngine = new SimpleTemplateEngine(); + GunsTemplateEngine.setContextConfig(contextConfig); + sqlConfig.setConnection(dataSourceConfig.getConn()); + GunsTemplateEngine.setSqlConfig(sqlConfig); + GunsTemplateEngine.setTableInfo(tableInfo); + GunsTemplateEngine.start(); + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/GunsGeneratorConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/GunsGeneratorConfig.java new file mode 100644 index 0000000..5e8c424 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/GunsGeneratorConfig.java @@ -0,0 +1,81 @@ +package com.agentdriving.user.generator.action.config; + +import com.baomidou.mybatisplus.generator.config.rules.DbType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; + +/** + * 默认的代码生成的配置 + * + * @author fengshuonan + * @date 2017-10-28-下午8:27 + */ +public class GunsGeneratorConfig extends AbstractGeneratorConfig { + + protected void globalConfig() { + globalConfig.setOutputDir("D:\\ttt");//写自己项目的绝对路径,注意具体到java目录 + globalConfig.setFileOverride(true); + globalConfig.setEnableCache(false); + globalConfig.setBaseResultMap(true); + globalConfig.setBaseColumnList(true); + globalConfig.setOpen(false); + globalConfig.setAuthor("stylefeng"); + } + + protected void dataSourceConfig() { + dataSourceConfig.setDbType(DbType.MYSQL); + dataSourceConfig.setDriverName("com.mysql.jdbc.Driver"); + dataSourceConfig.setUsername("root"); + dataSourceConfig.setPassword("root"); + dataSourceConfig.setUrl("jdbc:mysql://127.0.0.1:3306/guns?characterEncoding=utf8"); + } + + protected void strategyConfig() { + strategyConfig.setTablePrefix(new String[]{"sys_"});// 此处可以修改为您的表前缀 + strategyConfig.setNaming(NamingStrategy.underline_to_camel); + } + + protected void packageConfig() { + packageConfig.setParent(null); + packageConfig.setEntity("com.agentdriving.user.admin.common.persistence.model"); + packageConfig.setMapper("com.agentdriving.user.admin.common.persistence.dao"); + packageConfig.setXml("com.agentdriving.user.admin.common.persistence.dao.mapping"); + } + + protected void contextConfig() { + contextConfig.setProPackage("com.agentdriving.user.admin"); + contextConfig.setCoreBasePackage("com.agentdriving.user.core"); + contextConfig.setBizChName("字典管理"); + contextConfig.setBizEnName("sysDict"); + contextConfig.setModuleName("system"); + contextConfig.setProjectPath("D:\\ideaSpace\\guns\\guns-admin");//写自己项目的绝对路径 + contextConfig.setEntityName("SysDict"); + sqlConfig.setParentMenuName(null);//这里写已有菜单的名称,当做父节点 + + /** + * mybatis-plus 生成器开关 + */ + contextConfig.setEntitySwitch(true); + contextConfig.setDaoSwitch(true); + contextConfig.setServiceSwitch(true); + + /** + * guns 生成器开关 + */ + contextConfig.setControllerSwitch(true); + contextConfig.setIndexPageSwitch(true); + contextConfig.setAddPageSwitch(true); + contextConfig.setEditPageSwitch(true); + contextConfig.setJsSwitch(true); + contextConfig.setInfoJsSwitch(true); + contextConfig.setSqlSwitch(true); + } + + @Override + protected void config() { + globalConfig(); + dataSourceConfig(); + strategyConfig(); + packageConfig(); + contextConfig(); + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/WebGeneratorConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/WebGeneratorConfig.java new file mode 100644 index 0000000..f0d019b --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/WebGeneratorConfig.java @@ -0,0 +1,97 @@ +package com.agentdriving.user.generator.action.config; + +import com.agentdriving.user.core.support.StrKit; +import com.agentdriving.user.core.util.ToolUtil; +import com.baomidou.mybatisplus.generator.config.rules.DbType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import com.agentdriving.user.generator.action.model.GenQo; + +import java.io.File; + +/** + * 默认的代码生成的配置 + * + * @author fengshuonan + * @date 2017-10-28-下午8:27 + */ +public class WebGeneratorConfig extends AbstractGeneratorConfig { + + private GenQo genQo; + + public WebGeneratorConfig(GenQo genQo) { + this.genQo = genQo; + } + + @Override + protected void config() { + /** + * 数据库配置 + */ + dataSourceConfig.setDbType(DbType.MYSQL); + dataSourceConfig.setDriverName("com.mysql.cj.jdbc.Driver"); + dataSourceConfig.setUsername(genQo.getUserName()); + dataSourceConfig.setPassword(genQo.getPassword()); + dataSourceConfig.setUrl(genQo.getUrl()); + + /** + * 全局配置 + */ + globalConfig.setOutputDir(genQo.getProjectPath() + File.separator + "src" + File.separator + "main" + File.separator + "java"); + globalConfig.setFileOverride(true); + globalConfig.setEnableCache(false); + globalConfig.setBaseResultMap(true); + globalConfig.setBaseColumnList(true); + globalConfig.setOpen(false); + globalConfig.setAuthor(genQo.getAuthor()); + contextConfig.setProPackage(genQo.getProjectPackage()); + contextConfig.setCoreBasePackage(genQo.getCorePackage()); + + /** + * 生成策略 + */ + if (genQo.getIgnoreTabelPrefix() != null) { + strategyConfig.setTablePrefix(new String[]{genQo.getIgnoreTabelPrefix()}); + } + strategyConfig.setInclude(new String[]{genQo.getTableName()}); + strategyConfig.setNaming(NamingStrategy.underline_to_camel); + packageConfig.setParent(null); + packageConfig.setEntity(genQo.getProjectPackage() + ".modular.system.model"); + packageConfig.setMapper(genQo.getProjectPackage() + ".modular.system.dao"); + packageConfig.setXml(genQo.getProjectPackage() + ".modular.system.dao.mapping"); + + /** + * 业务代码配置 + */ + contextConfig.setBizChName(genQo.getBizName()); + contextConfig.setModuleName(genQo.getModuleName()); + contextConfig.setProjectPath(genQo.getProjectPath());//写自己项目的绝对路径 + if(ToolUtil.isEmpty(genQo.getIgnoreTabelPrefix())){ + String entityName = StrKit.toCamelCase(genQo.getTableName()); + contextConfig.setEntityName(StrKit.firstCharToUpperCase(entityName)); + contextConfig.setBizEnName(StrKit.firstCharToLowerCase(entityName)); + }else{ + String entiyName = StrKit.toCamelCase(StrKit.removePrefix(genQo.getTableName(), genQo.getIgnoreTabelPrefix())); + contextConfig.setEntityName(StrKit.firstCharToUpperCase(entiyName)); + contextConfig.setBizEnName(StrKit.firstCharToLowerCase(entiyName)); + } + sqlConfig.setParentMenuName(genQo.getParentMenuName());//这里写已有菜单的名称,当做父节点 + + /** + * mybatis-plus 生成器开关 + */ + contextConfig.setEntitySwitch(genQo.getEntitySwitch()); + contextConfig.setDaoSwitch(genQo.getDaoSwitch()); + contextConfig.setServiceSwitch(genQo.getServiceSwitch()); + + /** + * guns 生成器开关 + */ + contextConfig.setControllerSwitch(genQo.getControllerSwitch()); + contextConfig.setIndexPageSwitch(genQo.getIndexPageSwitch()); + contextConfig.setAddPageSwitch(genQo.getAddPageSwitch()); + contextConfig.setEditPageSwitch(genQo.getEditPageSwitch()); + contextConfig.setJsSwitch(genQo.getJsSwitch()); + contextConfig.setInfoJsSwitch(genQo.getInfoJsSwitch()); + contextConfig.setSqlSwitch(genQo.getSqlSwitch()); + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/model/GenQo.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/model/GenQo.java new file mode 100644 index 0000000..58ad2db --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/action/model/GenQo.java @@ -0,0 +1,297 @@ +package com.agentdriving.user.generator.action.model; + +/** + * 代码生成的查询参数 + * + * @author fengshuonan + * @date 2017-11-30-下午2:05 + */ +public class GenQo { + + /** + * 数据库账号 + */ + private String userName; + + /** + * 数据库密码 + */ + private String password; + + /** + * 数据库url + */ + private String url; + + /** + * 项目地址 + */ + private String projectPath; + + /** + * 作者 + */ + private String author; + + /** + * 项目的包 + */ + private String projectPackage; + + /** + * 核心模块的包 + */ + private String corePackage; + + /** + * 表名称 + */ + private String tableName; + + /** + * 忽略的表前缀 + */ + private String ignoreTabelPrefix; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 模块名 + */ + private String moduleName; + + /** + * 父级菜单名称 + */ + private String parentMenuName; + + /** + * 是否生成控制器代码开关 + */ + private Boolean controllerSwitch = false; + + /** + * 主页 + */ + private Boolean indexPageSwitch = false; + + /** + * 添加页面 + */ + private Boolean addPageSwitch = false; + + /** + * 编辑页面 + */ + private Boolean editPageSwitch = false; + + /** + * 主页的js + */ + private Boolean jsSwitch = false; + + /** + * 详情页面js + */ + private Boolean infoJsSwitch = false; + + /** + * dao的开关 + */ + private Boolean daoSwitch = false; + + /** + * service + */ + private Boolean serviceSwitch = false; + + /** + * 生成实体的开关 + */ + private Boolean entitySwitch = false; + + /** + * 生成sql的开关 + */ + private Boolean sqlSwitch = false; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getProjectPath() { + return projectPath; + } + + public void setProjectPath(String projectPath) { + this.projectPath = projectPath; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getCorePackage() { + return corePackage; + } + + public void setCorePackage(String corePackage) { + this.corePackage = corePackage; + } + + public String getProjectPackage() { + + return projectPackage; + } + + public void setProjectPackage(String projectPackage) { + this.projectPackage = projectPackage; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getIgnoreTabelPrefix() { + return ignoreTabelPrefix; + } + + public void setIgnoreTabelPrefix(String ignoreTabelPrefix) { + this.ignoreTabelPrefix = ignoreTabelPrefix; + } + + public String getBizName() { + return bizName; + } + + public void setBizName(String bizName) { + this.bizName = bizName; + } + + public String getModuleName() { + return moduleName; + } + + public void setModuleName(String moduleName) { + this.moduleName = moduleName; + } + + public Boolean getControllerSwitch() { + return controllerSwitch; + } + + public void setControllerSwitch(Boolean controllerSwitch) { + this.controllerSwitch = controllerSwitch; + } + + public Boolean getIndexPageSwitch() { + return indexPageSwitch; + } + + public void setIndexPageSwitch(Boolean indexPageSwitch) { + this.indexPageSwitch = indexPageSwitch; + } + + public Boolean getAddPageSwitch() { + return addPageSwitch; + } + + public void setAddPageSwitch(Boolean addPageSwitch) { + this.addPageSwitch = addPageSwitch; + } + + public Boolean getEditPageSwitch() { + return editPageSwitch; + } + + public void setEditPageSwitch(Boolean editPageSwitch) { + this.editPageSwitch = editPageSwitch; + } + + public Boolean getJsSwitch() { + return jsSwitch; + } + + public void setJsSwitch(Boolean jsSwitch) { + this.jsSwitch = jsSwitch; + } + + public Boolean getInfoJsSwitch() { + return infoJsSwitch; + } + + public void setInfoJsSwitch(Boolean infoJsSwitch) { + this.infoJsSwitch = infoJsSwitch; + } + + public Boolean getDaoSwitch() { + return daoSwitch; + } + + public void setDaoSwitch(Boolean daoSwitch) { + this.daoSwitch = daoSwitch; + } + + public Boolean getServiceSwitch() { + return serviceSwitch; + } + + public void setServiceSwitch(Boolean serviceSwitch) { + this.serviceSwitch = serviceSwitch; + } + + public Boolean getEntitySwitch() { + return entitySwitch; + } + + public void setEntitySwitch(Boolean entitySwitch) { + this.entitySwitch = entitySwitch; + } + + public Boolean getSqlSwitch() { + return sqlSwitch; + } + + public void setSqlSwitch(Boolean sqlSwitch) { + this.sqlSwitch = sqlSwitch; + } + + public String getParentMenuName() { + return parentMenuName; + } + + public void setParentMenuName(String parentMenuName) { + this.parentMenuName = parentMenuName; + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/SimpleTemplateEngine.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/SimpleTemplateEngine.java new file mode 100644 index 0000000..2ccd37d --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/SimpleTemplateEngine.java @@ -0,0 +1,70 @@ +package com.agentdriving.user.generator.engine; + + +import com.agentdriving.user.core.util.ToolUtil; +import com.agentdriving.user.generator.engine.base.GunsTemplateEngine; + +/** + * 通用的模板生成引擎 + * + * @author fengshuonan + * @date 2017-05-09 20:32 + */ +public class SimpleTemplateEngine extends GunsTemplateEngine { + + @Override + protected void generatePageEditHtml() { + String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPageEditPathTemplate(), + super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); + generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page_edit.html.btl", path); + System.out.println("生成编辑页面成功!"); + } + + @Override + protected void generatePageAddHtml() { + String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPageAddPathTemplate(), + super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); + generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page_add.html.btl", path); + System.out.println("生成添加页面成功!"); + } + + @Override + protected void generatePageInfoJs() { + String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPageInfoJsPathTemplate(), + super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); + generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page_info.js.btl", path); + System.out.println("生成页面详情js成功!"); + } + + @Override + protected void generatePageJs() { + String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPageJsPathTemplate(), + super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); + generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page.js.btl", path); + System.out.println("生成页面js成功!"); + } + + @Override + protected void generatePageHtml() { + String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPagePathTemplate(), + super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); + generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page.html.btl", path); + System.out.println("生成页面成功!"); + } + + @Override + protected void generateController() { + String controllerPath = ToolUtil.format(super.getContextConfig().getProjectPath() + super.getControllerConfig().getControllerPathTemplate(), + ToolUtil.firstLetterToUpper(super.getContextConfig().getBizEnName())); + generateFile(super.getContextConfig().getTemplatePrefixPath() + "/Controller.java.btl", controllerPath); + System.out.println("生成控制器成功!"); + } + + @Override + protected void generateSqls() { + String path = ToolUtil.format(super.getContextConfig().getProjectPath() + super.sqlConfig.getSqlPathTemplate(), + ToolUtil.firstLetterToUpper(super.getContextConfig().getBizEnName())); + generateFile(super.getContextConfig().getTemplatePrefixPath() + "/menu_sql.sql.btl", path); + System.out.println("生成sql成功!"); + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/AbstractTemplateEngine.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/AbstractTemplateEngine.java new file mode 100644 index 0000000..0f929d3 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/AbstractTemplateEngine.java @@ -0,0 +1,116 @@ +package com.agentdriving.user.generator.engine.base; + +import com.agentdriving.user.generator.engine.config.*; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.agentdriving.user.generator.engine.config.*; + +/** + * 模板生成父类 + * + * @author fengshuonan + * @date 2017-05-08 20:17 + */ +public class AbstractTemplateEngine { + + protected ContextConfig contextConfig; //全局配置 + protected ControllerConfig controllerConfig; //控制器的配置 + protected PageConfig pageConfig; //页面的控制器 + protected DaoConfig daoConfig; //Dao配置 + protected ServiceConfig serviceConfig; //Service配置 + protected SqlConfig sqlConfig; //sql配置 + protected TableInfo tableInfo; //表的信息 + + public void initConfig() { + if (this.contextConfig == null) { + this.contextConfig = new ContextConfig(); + } + if (this.controllerConfig == null) { + this.controllerConfig = new ControllerConfig(); + } + if (this.pageConfig == null) { + this.pageConfig = new PageConfig(); + } + if (this.daoConfig == null) { + this.daoConfig = new DaoConfig(); + } + if (this.serviceConfig == null) { + this.serviceConfig = new ServiceConfig(); + } + if (this.sqlConfig == null) { + this.sqlConfig = new SqlConfig(); + } + this.contextConfig.init(); + + this.controllerConfig.setContextConfig(this.contextConfig); + this.controllerConfig.init(); + + this.serviceConfig.setContextConfig(this.contextConfig); + this.serviceConfig.init(); + + this.daoConfig.setContextConfig(this.contextConfig); + this.daoConfig.init(); + + this.pageConfig.setContextConfig(this.contextConfig); + this.pageConfig.init(); + + this.sqlConfig.setContextConfig(this.contextConfig); + this.sqlConfig.init(); + } + + public PageConfig getPageConfig() { + return pageConfig; + } + + public void setPageConfig(PageConfig pageConfig) { + this.pageConfig = pageConfig; + } + + public ContextConfig getContextConfig() { + return contextConfig; + } + + public void setContextConfig(ContextConfig contextConfig) { + this.contextConfig = contextConfig; + } + + public ControllerConfig getControllerConfig() { + return controllerConfig; + } + + public void setControllerConfig(ControllerConfig controllerConfig) { + this.controllerConfig = controllerConfig; + } + + public DaoConfig getDaoConfig() { + return daoConfig; + } + + public void setDaoConfig(DaoConfig daoConfig) { + this.daoConfig = daoConfig; + } + + public ServiceConfig getServiceConfig() { + return serviceConfig; + } + + public void setServiceConfig(ServiceConfig serviceConfig) { + this.serviceConfig = serviceConfig; + } + + public SqlConfig getSqlConfig() { + return sqlConfig; + } + + public void setSqlConfig(SqlConfig sqlConfig) { + this.sqlConfig = sqlConfig; + } + + public TableInfo getTableInfo() { + return tableInfo; + } + + public void setTableInfo(TableInfo tableInfo) { + this.tableInfo = tableInfo; + } +} + diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/GunsTemplateEngine.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/GunsTemplateEngine.java new file mode 100644 index 0000000..20bf7b5 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/GunsTemplateEngine.java @@ -0,0 +1,126 @@ +package com.agentdriving.user.generator.engine.base; + +import com.agentdriving.user.core.util.ToolUtil; +import com.sun.javafx.PlatformUtil; +import org.beetl.core.Configuration; +import org.beetl.core.GroupTemplate; +import org.beetl.core.Template; +import org.beetl.core.resource.ClasspathResourceLoader; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; + +/** + * ADI项目模板生成 引擎 + * + * @author fengshuonan + * @date 2017-05-07 22:15 + */ +public abstract class GunsTemplateEngine extends AbstractTemplateEngine { + + private GroupTemplate groupTemplate; + + public GunsTemplateEngine() { + initBeetlEngine(); + } + + protected void initBeetlEngine() { + Properties properties = new Properties(); + properties.put("RESOURCE.root", ""); + properties.put("DELIMITER_STATEMENT_START", "<%"); + properties.put("DELIMITER_STATEMENT_END", "%>"); + properties.put("HTML_TAG_FLAG", "##"); + Configuration cfg = null; + try { + cfg = new Configuration(properties); + } catch (IOException e) { + e.printStackTrace(); + } + ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader(); + groupTemplate = new GroupTemplate(resourceLoader, cfg); + groupTemplate.registerFunctionPackage("tool", new ToolUtil()); + } + + protected void configTemplate(Template template) { + template.binding("controller", super.controllerConfig); + template.binding("context", super.contextConfig); + template.binding("dao", super.daoConfig); + template.binding("service", super.serviceConfig); + template.binding("sqls", super.sqlConfig); + template.binding("table", super.tableInfo); + } + + protected void generateFile(String template, String filePath) { + Template pageTemplate = groupTemplate.getTemplate(template); + configTemplate(pageTemplate); + if (PlatformUtil.isWindows()) { + filePath = filePath.replaceAll("/+|\\\\+", "\\\\"); + } else { + filePath = filePath.replaceAll("/+|\\\\+", "/"); + } + File file = new File(filePath); + File parentFile = file.getParentFile(); + if (!parentFile.exists()) { + parentFile.mkdirs(); + } + FileOutputStream fileOutputStream = null; + try { + fileOutputStream = new FileOutputStream(file); + pageTemplate.renderTo(fileOutputStream); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } finally { + try { + fileOutputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public void start() { + //配置之间的相互依赖 + super.initConfig(); + + //生成模板 + if (super.contextConfig.getControllerSwitch()) { + generateController(); + } + if (super.contextConfig.getIndexPageSwitch()) { + generatePageHtml(); + } + if (super.contextConfig.getAddPageSwitch()) { + generatePageAddHtml(); + } + if (super.contextConfig.getEditPageSwitch()) { + generatePageEditHtml(); + } + if (super.contextConfig.getJsSwitch()) { + generatePageJs(); + } + if (super.contextConfig.getInfoJsSwitch()) { + generatePageInfoJs(); + } + if (super.contextConfig.getSqlSwitch()) { + generateSqls(); + } + } + + protected abstract void generatePageEditHtml(); + + protected abstract void generatePageAddHtml(); + + protected abstract void generatePageInfoJs(); + + protected abstract void generatePageJs(); + + protected abstract void generatePageHtml(); + + protected abstract void generateController(); + + protected abstract void generateSqls(); + +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ContextConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ContextConfig.java new file mode 100644 index 0000000..4a16176 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ContextConfig.java @@ -0,0 +1,214 @@ +package com.agentdriving.user.generator.engine.config; + + +import com.agentdriving.user.core.util.ToolUtil; + +/** + * 全局配置 + * + * @author fengshuonan + * @date 2017-05-08 20:21 + */ +public class ContextConfig { + + private String templatePrefixPath = "gunsTemplate/advanced"; + private String projectPath = "D:\\ideaSpace\\guns";//模板输出的项目目录 + private String bizChName; //业务名称 + private String bizEnName; //业务英文名称 + private String bizEnBigName;//业务英文名称(大写) + private String moduleName = "system"; //模块名称 + + private String proPackage = "com.agentdriving.user.admin"; + private String coreBasePackage = "com.agentdriving.user.core"; + private String modelPackageName = "com.agentdriving.user.modular.system.model"; //model的包名 + private String modelMapperPackageName = "com.agentdriving.user.modular.system.dao"; //model的dao + private String entityName; //实体的名称 + + private Boolean controllerSwitch = true; //是否生成控制器代码开关 + private Boolean indexPageSwitch = true; //主页 + private Boolean addPageSwitch = true; //添加页面 + private Boolean editPageSwitch = true; //编辑页面 + private Boolean jsSwitch = true; //js + private Boolean infoJsSwitch = true; //详情页面js + private Boolean daoSwitch = true; //dao + private Boolean serviceSwitch = true; //service + private Boolean entitySwitch = true; //生成实体的开关 + private Boolean sqlSwitch = true; //生成sql的开关 + + public void init() { + if (entityName == null) { + entityName = bizEnBigName; + } + modelPackageName = proPackage + "." + "modular.system.model"; + modelMapperPackageName = proPackage + "." + "modular.system.dao"; + } + + public String getBizEnBigName() { + return bizEnBigName; + } + + public void setBizEnBigName(String bizEnBigName) { + this.bizEnBigName = bizEnBigName; + } + + public String getBizChName() { + return bizChName; + } + + public void setBizChName(String bizChName) { + this.bizChName = bizChName; + } + + public String getBizEnName() { + return bizEnName; + } + + public void setBizEnName(String bizEnName) { + this.bizEnName = bizEnName; + this.bizEnBigName = ToolUtil.firstLetterToUpper(this.bizEnName); + } + + public String getProjectPath() { + return projectPath; + } + + public void setProjectPath(String projectPath) { + this.projectPath = projectPath; + } + + public String getModuleName() { + return moduleName; + } + + public void setModuleName(String moduleName) { + this.moduleName = moduleName; + } + + public Boolean getControllerSwitch() { + return controllerSwitch; + } + + public void setControllerSwitch(Boolean controllerSwitch) { + this.controllerSwitch = controllerSwitch; + } + + public Boolean getIndexPageSwitch() { + return indexPageSwitch; + } + + public void setIndexPageSwitch(Boolean indexPageSwitch) { + this.indexPageSwitch = indexPageSwitch; + } + + public Boolean getAddPageSwitch() { + return addPageSwitch; + } + + public void setAddPageSwitch(Boolean addPageSwitch) { + this.addPageSwitch = addPageSwitch; + } + + public Boolean getEditPageSwitch() { + return editPageSwitch; + } + + public void setEditPageSwitch(Boolean editPageSwitch) { + this.editPageSwitch = editPageSwitch; + } + + public Boolean getJsSwitch() { + return jsSwitch; + } + + public void setJsSwitch(Boolean jsSwitch) { + this.jsSwitch = jsSwitch; + } + + public Boolean getInfoJsSwitch() { + return infoJsSwitch; + } + + public void setInfoJsSwitch(Boolean infoJsSwitch) { + this.infoJsSwitch = infoJsSwitch; + } + + public Boolean getDaoSwitch() { + return daoSwitch; + } + + public void setDaoSwitch(Boolean daoSwitch) { + this.daoSwitch = daoSwitch; + } + + public Boolean getServiceSwitch() { + return serviceSwitch; + } + + public void setServiceSwitch(Boolean serviceSwitch) { + this.serviceSwitch = serviceSwitch; + } + + public String getTemplatePrefixPath() { + return templatePrefixPath; + } + + public void setTemplatePrefixPath(String templatePrefixPath) { + this.templatePrefixPath = templatePrefixPath; + } + + public String getModelPackageName() { + return modelPackageName; + } + + public void setModelPackageName(String modelPackageName) { + this.modelPackageName = modelPackageName; + } + + public String getEntityName() { + return entityName; + } + + public void setEntityName(String entityName) { + this.entityName = entityName; + } + + public String getModelMapperPackageName() { + return modelMapperPackageName; + } + + public void setModelMapperPackageName(String modelMapperPackageName) { + this.modelMapperPackageName = modelMapperPackageName; + } + + public Boolean getEntitySwitch() { + return entitySwitch; + } + + public void setEntitySwitch(Boolean entitySwitch) { + this.entitySwitch = entitySwitch; + } + + public Boolean getSqlSwitch() { + return sqlSwitch; + } + + public void setSqlSwitch(Boolean sqlSwitch) { + this.sqlSwitch = sqlSwitch; + } + + public String getProPackage() { + return proPackage; + } + + public void setProPackage(String proPackage) { + this.proPackage = proPackage; + } + + public String getCoreBasePackage() { + return coreBasePackage; + } + + public void setCoreBasePackage(String coreBasePackage) { + this.coreBasePackage = coreBasePackage; + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ControllerConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ControllerConfig.java new file mode 100644 index 0000000..ac5d130 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ControllerConfig.java @@ -0,0 +1,70 @@ +package com.agentdriving.user.generator.engine.config; + +import java.util.ArrayList; +import java.util.List; + +/** + * 控制器模板生成的配置 + * + * @author fengshuonan + * @date 2017-05-07 22:12 + */ +public class ControllerConfig { + + private ContextConfig contextConfig; + + private String controllerPathTemplate; + private String packageName;//包名称 + private List<String> imports;//所引入的包 + + public void init() { + ArrayList<String> imports = new ArrayList<>(); + imports.add(contextConfig.getCoreBasePackage() + ".base.controller.BaseController"); + imports.add("org.springframework.stereotype.Controller"); + imports.add("org.springframework.web.bind.annotation.RequestMapping"); + imports.add("org.springframework.web.bind.annotation.ResponseBody"); + imports.add("org.springframework.ui.Model"); + imports.add("org.springframework.web.bind.annotation.PathVariable"); + imports.add("org.springframework.beans.factory.annotation.Autowired"); + imports.add(contextConfig.getProPackage() + ".core.log.LogObjectHolder"); + imports.add("org.springframework.web.bind.annotation.RequestParam"); + imports.add(contextConfig.getModelPackageName() + "." + contextConfig.getEntityName()); + imports.add(contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service" + ".I" + contextConfig.getEntityName() + "Service"); + this.imports = imports; + this.packageName = contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".controller"; + this.controllerPathTemplate = "\\src\\main\\java\\"+contextConfig.getProPackage().replaceAll("\\.","\\\\")+"\\modular\\" + contextConfig.getModuleName() + "\\controller\\{}Controller.java"; + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public List<String> getImports() { + return imports; + } + + public void setImports(List<String> imports) { + this.imports = imports; + } + + public String getControllerPathTemplate() { + return controllerPathTemplate; + } + + public void setControllerPathTemplate(String controllerPathTemplate) { + this.controllerPathTemplate = controllerPathTemplate; + } + + public ContextConfig getContextConfig() { + return contextConfig; + } + + public void setContextConfig(ContextConfig contextConfig) { + this.contextConfig = contextConfig; + } + +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/DaoConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/DaoConfig.java new file mode 100644 index 0000000..7442cb5 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/DaoConfig.java @@ -0,0 +1,55 @@ +package com.agentdriving.user.generator.engine.config; + +/** + * Dao模板生成的配置 + * + * @author fengshuonan + * @date 2017-05-07 22:12 + */ +public class DaoConfig { + + private ContextConfig contextConfig; + + private String daoPathTemplate; + private String xmlPathTemplate; + + private String packageName; + + public void init() { + this.daoPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\modular\\" + contextConfig.getModuleName() + "\\dao\\{}Dao.java"; + this.xmlPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\modular\\" + contextConfig.getModuleName() + "\\dao\\mapping\\{}Dao.xml"; + this.packageName = contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".dao"; + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public String getDaoPathTemplate() { + return daoPathTemplate; + } + + public void setDaoPathTemplate(String daoPathTemplate) { + this.daoPathTemplate = daoPathTemplate; + } + + public String getXmlPathTemplate() { + return xmlPathTemplate; + } + + public void setXmlPathTemplate(String xmlPathTemplate) { + this.xmlPathTemplate = xmlPathTemplate; + } + + public ContextConfig getContextConfig() { + return contextConfig; + } + + public void setContextConfig(ContextConfig contextConfig) { + this.contextConfig = contextConfig; + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/Menu.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/Menu.java new file mode 100644 index 0000000..5a10d30 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/Menu.java @@ -0,0 +1,203 @@ +package com.agentdriving.user.generator.engine.config; + +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.enums.IdType; + +import java.io.Serializable; + +/** + * <p> + * 菜单表 + * </p> + * + * @author stylefeng + * @since 2017-07-11 + */ +public class Menu extends Model<Menu> { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + /** + * 菜单编号 + */ + private String code; + /** + * 菜单父编号 + */ + private String pcode; + /** + * 当前菜单的所有父菜单编号 + */ + private String pcodes; + /** + * 菜单名称 + */ + private String name; + /** + * 菜单图标 + */ + private String icon; + /** + * url地址 + */ + private String url; + /** + * 菜单排序号 + */ + private Integer num; + /** + * 菜单层级 + */ + private Integer levels; + /** + * 是否是菜单(1:是 0:不是) + */ + private Integer ismenu; + /** + * 备注 + */ + private String tips; + /** + * 菜单状态 : 1:启用 0:不启用 + */ + private Integer status; + /** + * 是否打开: 1:打开 0:不打开 + */ + private Integer isopen; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getPcode() { + return pcode; + } + + public void setPcode(String pcode) { + this.pcode = pcode; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Integer getLevels() { + return levels; + } + + public void setLevels(Integer levels) { + this.levels = levels; + } + + public Integer getIsmenu() { + return ismenu; + } + + public void setIsmenu(Integer ismenu) { + this.ismenu = ismenu; + } + + public String getTips() { + return tips; + } + + public void setTips(String tips) { + this.tips = tips; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Integer getIsopen() { + return isopen; + } + + public void setIsopen(Integer isopen) { + this.isopen = isopen; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "Menu{" + + "id=" + id + + ", code=" + code + + ", pcode=" + pcode + + ", pcodes=" + pcodes + + ", name=" + name + + ", icon=" + icon + + ", url=" + url + + ", num=" + num + + ", levels=" + levels + + ", ismenu=" + ismenu + + ", tips=" + tips + + ", status=" + status + + ", isopen=" + isopen + + "}"; + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/PageConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/PageConfig.java new file mode 100644 index 0000000..cee9bac --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/PageConfig.java @@ -0,0 +1,74 @@ +package com.agentdriving.user.generator.engine.config; + +/** + * 页面 模板生成的配置 + * + * @author fengshuonan + * @date 2017-05-07 22:12 + */ +public class PageConfig { + + private ContextConfig contextConfig; + + private String pagePathTemplate; + private String pageAddPathTemplate; + private String pageEditPathTemplate; + private String pageJsPathTemplate; + private String pageInfoJsPathTemplate; + + public void init() { + pagePathTemplate = "\\src\\main\\webapp\\WEB-INF\\view\\" + contextConfig.getModuleName() + "\\{}\\{}.html"; + pageAddPathTemplate = "\\src\\main\\webapp\\WEB-INF\\view\\" + contextConfig.getModuleName() + "\\{}\\{}_add.html"; + pageEditPathTemplate = "\\src\\main\\webapp\\WEB-INF\\view\\" + contextConfig.getModuleName() + "\\{}\\{}_edit.html"; + pageJsPathTemplate = "\\src\\main\\webapp\\static\\modular\\" + contextConfig.getModuleName() + "\\{}\\{}.js"; + pageInfoJsPathTemplate = "\\src\\main\\webapp\\static\\modular\\" + contextConfig.getModuleName() + "\\{}\\{}_info.js"; + } + + public String getPagePathTemplate() { + return pagePathTemplate; + } + + public void setPagePathTemplate(String pagePathTemplate) { + this.pagePathTemplate = pagePathTemplate; + } + + public String getPageJsPathTemplate() { + return pageJsPathTemplate; + } + + public void setPageJsPathTemplate(String pageJsPathTemplate) { + this.pageJsPathTemplate = pageJsPathTemplate; + } + + public String getPageAddPathTemplate() { + return pageAddPathTemplate; + } + + public void setPageAddPathTemplate(String pageAddPathTemplate) { + this.pageAddPathTemplate = pageAddPathTemplate; + } + + public String getPageEditPathTemplate() { + return pageEditPathTemplate; + } + + public void setPageEditPathTemplate(String pageEditPathTemplate) { + this.pageEditPathTemplate = pageEditPathTemplate; + } + + public String getPageInfoJsPathTemplate() { + return pageInfoJsPathTemplate; + } + + public void setPageInfoJsPathTemplate(String pageInfoJsPathTemplate) { + this.pageInfoJsPathTemplate = pageInfoJsPathTemplate; + } + + public ContextConfig getContextConfig() { + return contextConfig; + } + + public void setContextConfig(ContextConfig contextConfig) { + this.contextConfig = contextConfig; + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ServiceConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ServiceConfig.java new file mode 100644 index 0000000..cd2f543 --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ServiceConfig.java @@ -0,0 +1,91 @@ +package com.agentdriving.user.generator.engine.config; + +import java.util.ArrayList; +import java.util.List; + +/** + * Service模板生成的配置 + * + * @author fengshuonan + * @date 2017-05-07 22:12 + */ +public class ServiceConfig { + + private ContextConfig contextConfig; + + private String servicePathTemplate; + private String serviceImplPathTemplate; + + private String packageName; + + private List<String> serviceInterfaceImports; + private List<String> serviceImplImports; + + public void init() { + ArrayList<String> imports = new ArrayList<>(); + imports.add("org.springframework.stereotype.Service"); + imports.add("com.baomidou.mybatisplus.service.impl.ServiceImpl"); + imports.add(contextConfig.getModelPackageName() + "." + contextConfig.getEntityName()); + imports.add(contextConfig.getModelMapperPackageName() + "." + contextConfig.getEntityName() + "Mapper"); + imports.add(contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service.I" + contextConfig.getBizEnBigName() + "Service"); + this.serviceImplImports = imports; + + ArrayList<String> interfaceImports = new ArrayList<>(); + interfaceImports.add("com.baomidou.mybatisplus.service.IService"); + interfaceImports.add(contextConfig.getModelPackageName() + "." + contextConfig.getEntityName()); + this.serviceInterfaceImports = interfaceImports; + + this.servicePathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\modular\\" + contextConfig.getModuleName() + "\\service\\I{}Service.java"; + this.serviceImplPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\modular\\" + contextConfig.getModuleName() + "\\service\\impl\\{}ServiceImpl.java"; + this.packageName = contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service"; + } + + + public String getServicePathTemplate() { + return servicePathTemplate; + } + + public void setServicePathTemplate(String servicePathTemplate) { + this.servicePathTemplate = servicePathTemplate; + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public String getServiceImplPathTemplate() { + return serviceImplPathTemplate; + } + + public void setServiceImplPathTemplate(String serviceImplPathTemplate) { + this.serviceImplPathTemplate = serviceImplPathTemplate; + } + + public List<String> getServiceImplImports() { + return serviceImplImports; + } + + public void setServiceImplImports(List<String> serviceImplImports) { + this.serviceImplImports = serviceImplImports; + } + + public ContextConfig getContextConfig() { + return contextConfig; + } + + public void setContextConfig(ContextConfig contextConfig) { + this.contextConfig = contextConfig; + } + + public List<String> getServiceInterfaceImports() { + return serviceInterfaceImports; + } + + public void setServiceInterfaceImports(List<String> serviceInterfaceImports) { + this.serviceInterfaceImports = serviceInterfaceImports; + } +} diff --git a/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/SqlConfig.java b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/SqlConfig.java new file mode 100644 index 0000000..27145bd --- /dev/null +++ b/user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/SqlConfig.java @@ -0,0 +1,194 @@ +package com.agentdriving.user.generator.engine.config; + +import com.agentdriving.user.core.constant.IsMenu; +import com.agentdriving.user.core.util.ToolUtil; +import com.baomidou.mybatisplus.toolkit.IdWorker; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +/** + * 全局配置 + * + * @author fengshuonan + * @date 2017-05-08 20:21 + */ +public class SqlConfig { + + private String sqlPathTemplate; + + private ContextConfig contextConfig; + + private Connection connection; + + private String parentMenuName; + + private List<Menu> menus = new ArrayList<>(6); + + public void init() { + + this.sqlPathTemplate = "\\src\\main\\java\\{}.sql"; + + if (parentMenuName == null) { + return; + } + + //根据父菜单查询数据库中的pcode和pcodes + String[] pcodeAndPcodes = getPcodeAndPcodes(); + if (pcodeAndPcodes == null) { + System.err.println("父级菜单名称输入有误!!!!"); + return; + } + + //业务菜单 + Menu menu = new Menu(); + menu.setId(IdWorker.getId()); + menu.setCode(contextConfig.getBizEnName()); + menu.setPcode(pcodeAndPcodes[0]); + menu.setPcodes(pcodeAndPcodes[1] + "[" + pcodeAndPcodes[0] + "],"); + menu.setName(contextConfig.getBizChName()); + menu.setIcon(""); + menu.setUrl("/" + contextConfig.getBizEnName()); + menu.setNum(99); + + if (parentMenuName.equals("顶级")) { + menu.setLevels(1); + } else { + menu.setLevels(2); + } + menu.setIsmenu(IsMenu.YES.getCode()); + menu.setStatus(1); + menu.setIsopen(0); + menus.add(menu); + + //列表 + Menu list = createSubMenu(menu); + list.setCode(contextConfig.getBizEnName() + "_list"); + list.setName(contextConfig.getBizChName() + "列表"); + list.setUrl("/" + contextConfig.getBizEnName() + "/list"); + menus.add(list); + + //添加 + Menu add = createSubMenu(menu); + add.setCode(contextConfig.getBizEnName() + "_add"); + add.setName(contextConfig.getBizChName() + "添加"); + add.setUrl("/" + contextConfig.getBizEnName() + "/add"); + menus.add(add); + + //更新 + Menu update = createSubMenu(menu); + update.setCode(contextConfig.getBizEnName() + "_update"); + update.setName(contextConfig.getBizChName() + "更新"); + update.setUrl("/" + contextConfig.getBizEnName() + "/update"); + menus.add(update); + + //删除 + Menu delete = createSubMenu(menu); + delete.setCode(contextConfig.getBizEnName() + "_delete"); + delete.setName(contextConfig.getBizChName() + "删除"); + delete.setUrl("/" + contextConfig.getBizEnName() + "/delete"); + menus.add(delete); + + //详情 + Menu detail = createSubMenu(menu); + detail.setCode(contextConfig.getBizEnName() + "_detail"); + detail.setName(contextConfig.getBizChName() + "详情"); + detail.setUrl("/" + contextConfig.getBizEnName() + "/detail"); + menus.add(detail); + } + + private Menu createSubMenu(Menu parentMenu) { + Menu menu = new Menu(); + menu.setId(IdWorker.getId()); + menu.setPcode(parentMenu.getCode()); + menu.setPcodes(parentMenu.getPcodes() + "[" + parentMenu.getCode() + "],"); + menu.setIcon(""); + menu.setNum(99); + menu.setLevels(parentMenu.getLevels() + 1); + menu.setIsmenu(IsMenu.NO.getCode()); + menu.setStatus(1); + menu.setIsopen(0); + return menu; + } + + public String[] getPcodeAndPcodes() { + if (parentMenuName.equals("顶级")) { + return new String[]{"0", ""}; + } + PreparedStatement preparedStatement = null; + try { + preparedStatement = connection.prepareStatement("select * from sys_menu where name like ?"); + preparedStatement.setString(1, "%" + parentMenuName + "%"); + ResultSet results = preparedStatement.executeQuery(); + while (results.next()) { + String pcode = results.getString("code"); + String pcodes = results.getString("pcodes"); + if (ToolUtil.isNotEmpty(pcode) && ToolUtil.isNotEmpty(pcodes)) { + String[] strings = {pcode, pcodes}; + return strings; + } else { + return null; + } + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + // 释放资源 + try { + if (preparedStatement != null) { + preparedStatement.close(); + } + if (connection != null) { + connection.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + public ContextConfig getContextConfig() { + return contextConfig; + } + + public void setContextConfig(ContextConfig contextConfig) { + this.contextConfig = contextConfig; + } + + public String getParentMenuName() { + return parentMenuName; + } + + public void setParentMenuName(String parentMenuName) { + this.parentMenuName = parentMenuName; + } + + public Connection getConnection() { + return connection; + } + + public void setConnection(Connection connection) { + this.connection = connection; + } + + public String getSqlPathTemplate() { + return sqlPathTemplate; + } + + public void setSqlPathTemplate(String sqlPathTemplate) { + this.sqlPathTemplate = sqlPathTemplate; + } + + public List<Menu> getMenus() { + return menus; + } + + public void setMenus(List<Menu> menus) { + this.menus = menus; + } +} diff --git a/user/guns-generator/src/main/resources/gunsTemplate/advanced/Controller.java.btl b/user/guns-generator/src/main/resources/gunsTemplate/advanced/Controller.java.btl new file mode 100644 index 0000000..a187a36 --- /dev/null +++ b/user/guns-generator/src/main/resources/gunsTemplate/advanced/Controller.java.btl @@ -0,0 +1,96 @@ +package ${controller.packageName}; + +<% for(import in controller.imports!){ %> +import ${import}; +<% } %> + +/** + * ${context.bizChName}控制器 + * + * @author fengshuonan + * @Date ${tool.currentTime()} + */ +@Controller +@RequestMapping("/${context.bizEnName}") +public class ${context.bizEnBigName}Controller extends BaseController { + + private String PREFIX = "/${context.moduleName}/${context.bizEnName}/"; + + @Autowired + private I${context.entityName}Service ${context.bizEnName}Service; + + /** + * 跳转到${context.bizChName}首页 + */ + @RequestMapping("") + public String index() { + return PREFIX + "${context.bizEnName}.html"; + } + + /** + * 跳转到添加${context.bizChName} + */ + @RequestMapping("/${context.bizEnName}_add") + public String ${context.bizEnName}Add() { + return PREFIX + "${context.bizEnName}_add.html"; + } + + /** + * 跳转到修改${context.bizChName} + */ + @RequestMapping("/${context.bizEnName}_update/{${context.bizEnName}Id}") + public String ${context.bizEnName}Update(@PathVariable Integer ${context.bizEnName}Id, Model model) { + ${context.entityName} ${context.bizEnName} = ${context.bizEnName}Service.selectById(${context.bizEnName}Id); + model.addAttribute("item",${context.bizEnName}); + LogObjectHolder.me().set(${context.bizEnName}); + return PREFIX + "${context.bizEnName}_edit.html"; + } + + /** + * 获取${context.bizChName}列表 + */ + @RequestMapping(value = "/list") + @ResponseBody + public Object list(String condition) { + return ${context.bizEnName}Service.selectList(null); + } + + /** + * 新增${context.bizChName} + */ + @RequestMapping(value = "/add") + @ResponseBody + public Object add(${context.entityName} ${context.bizEnName}) { + ${context.bizEnName}Service.insert(${context.bizEnName}); + return SUCCESS_TIP; + } + + /** + * 删除${context.bizChName} + */ + @RequestMapping(value = "/delete") + @ResponseBody + public Object delete(@RequestParam Integer ${context.bizEnName}Id) { + ${context.bizEnName}Service.deleteById(${context.bizEnName}Id); + return SUCCESS_TIP; + } + + /** + * 修改${context.bizChName} + */ + @RequestMapping(value = "/update") + @ResponseBody + public Object update(${context.entityName} ${context.bizEnName}) { + ${context.bizEnName}Service.updateById(${context.bizEnName}); + return SUCCESS_TIP; + } + + /** + * ${context.bizChName}详情 + */ + @RequestMapping(value = "/detail/{${context.bizEnName}Id}") + @ResponseBody + public Object detail(@PathVariable("${context.bizEnName}Id") Integer ${context.bizEnName}Id) { + return ${context.bizEnName}Service.selectById(${context.bizEnName}Id); + } +} diff --git a/user/guns-generator/src/main/resources/gunsTemplate/advanced/menu_sql.sql.btl b/user/guns-generator/src/main/resources/gunsTemplate/advanced/menu_sql.sql.btl new file mode 100644 index 0000000..07b094c --- /dev/null +++ b/user/guns-generator/src/main/resources/gunsTemplate/advanced/menu_sql.sql.btl @@ -0,0 +1,3 @@ +<% for(menu in sqls.menus!){ %> +INSERT INTO `guns`.`sys_menu` (`id`, `code`, `pcode`, `pcodes`, `name`, `icon`, `url`, `num`, `levels`, `ismenu`, `tips`, `status`, `isopen`) VALUES ('${menu.id}', '${menu.code}', '${menu.pcode}', '${menu.pcodes}', '${menu.name}', '${menu.icon}', '${menu.url}', '${menu.num}', '${menu.levels}', '${menu.ismenu}', NULL, '${menu.status}', '${menu.isopen}'); +<% } %> \ No newline at end of file diff --git a/user/guns-generator/src/main/resources/gunsTemplate/advanced/page.html.btl b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page.html.btl new file mode 100644 index 0000000..b21f29e --- /dev/null +++ b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page.html.btl @@ -0,0 +1,38 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>${context.bizChName}管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <#NameCon id="condition" name="名称" /> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="${context.bizEnBigName}.search()"/> + </div> + </div> + <div class="hidden-xs" id="${context.bizEnBigName}TableToolbar" role="group"> + @if(shiro.hasPermission("/${context.bizEnName}/add")){ + <#button name="添加" icon="fa-plus" clickFun="${context.bizEnBigName}.openAdd${context.bizEnBigName}()"/> + @} + @if(shiro.hasPermission("/${context.bizEnName}/update")){ + <#button name="修改" icon="fa-edit" clickFun="${context.bizEnBigName}.open${context.bizEnBigName}Detail()" space="true"/> + @} + @if(shiro.hasPermission("/${context.bizEnName}/delete")){ + <#button name="删除" icon="fa-remove" clickFun="${context.bizEnBigName}.delete()" space="true"/> + @} + </div> + <#table id="${context.bizEnBigName}Table"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="\${ctxPath}/static/modular/${context.moduleName}/${context.bizEnName}/${context.bizEnName}.js"></script> +@} diff --git a/user/guns-generator/src/main/resources/gunsTemplate/advanced/page.js.btl b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page.js.btl new file mode 100644 index 0000000..71c6477 --- /dev/null +++ b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page.js.btl @@ -0,0 +1,102 @@ +/** + * ${context.bizChName}管理初始化 + */ +var ${context.bizEnBigName} = { + id: "${context.bizEnBigName}Table", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +${context.bizEnBigName}.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + <% for(item in table.fields!){ %> + <% if(itemLP.last != true){ %> + {title: '${item.comment}', field: '${item.propertyName}', visible: true, align: 'center', valign: 'middle'}, + <% }else{ %> + {title: '${item.comment}', field: '${item.propertyName}', visible: true, align: 'center', valign: 'middle'} + <% }} %> + ]; +}; + +/** + * 检查是否选中 + */ +${context.bizEnBigName}.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if(selected.length == 0){ + Feng.info("请先选中表格中的某一记录!"); + return false; + }else{ + ${context.bizEnBigName}.seItem = selected[0]; + return true; + } +}; + +/** + * 点击添加${context.bizChName} + */ +${context.bizEnBigName}.openAdd${context.bizEnBigName} = function () { + var index = layer.open({ + type: 2, + title: '添加${context.bizChName}', + area: ['800px', '420px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/${context.bizEnName}/${context.bizEnName}_add' + }); + this.layerIndex = index; +}; + +/** + * 打开查看${context.bizChName}详情 + */ +${context.bizEnBigName}.open${context.bizEnBigName}Detail = function () { + if (this.check()) { + var index = layer.open({ + type: 2, + title: '${context.bizChName}详情', + area: ['800px', '420px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/${context.bizEnName}/${context.bizEnName}_update/' + ${context.bizEnBigName}.seItem.id + }); + this.layerIndex = index; + } +}; + +/** + * 删除${context.bizChName} + */ +${context.bizEnBigName}.delete = function () { + if (this.check()) { + var ajax = new $ax(Feng.ctxPath + "/${context.bizEnName}/delete", function (data) { + Feng.success("删除成功!"); + ${context.bizEnBigName}.table.refresh(); + }, function (data) { + Feng.error("删除失败!" + data.responseJSON.message + "!"); + }); + ajax.set("${context.bizEnName}Id",this.seItem.id); + ajax.start(); + } +}; + +/** + * 查询${context.bizChName}列表 + */ +${context.bizEnBigName}.search = function () { + var queryData = {}; + queryData['condition'] = $("#condition").val(); + ${context.bizEnBigName}.table.refresh({query: queryData}); +}; + +$(function () { + var defaultColunms = ${context.bizEnBigName}.initColumn(); + var table = new BSTable(${context.bizEnBigName}.id, "/${context.bizEnName}/list", defaultColunms); + table.setPaginationType("client"); + ${context.bizEnBigName}.table = table.init(); +}); diff --git a/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_add.html.btl b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_add.html.btl new file mode 100644 index 0000000..1b8d41e --- /dev/null +++ b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_add.html.btl @@ -0,0 +1,41 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal"> + + <div class="row"> + <div class="col-sm-6 b-r"> + <% var leftSize = tool.toInt((table.fields.~size + 1) / 2); %> + <% var rightSize = tool.toInt(table.fields.~size - leftSize); %> + <% for(var i=0;i<leftSize;i++){ %> + <% if(i != (leftSize-1) ){ %> + <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" underline="true"/> + <% }else{ %> + <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}"/> + <% } %> + <% } %> + </div> + + <div class="col-sm-6"> + <% for(var i=leftSize;i<table.fields.~size;i++){ %> + <% if(i != (rightSize-1) ){ %> + <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" underline="true"/> + <% }else{ %> + <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}"/> + <% } %> + <% } %> + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="${context.bizEnBigName}InfoDlg.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="${context.bizEnBigName}InfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="\${ctxPath}/static/modular/${context.moduleName}/${context.bizEnName}/${context.bizEnName}_info.js"></script> +@} diff --git a/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_edit.html.btl b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_edit.html.btl new file mode 100644 index 0000000..7839f5b --- /dev/null +++ b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_edit.html.btl @@ -0,0 +1,41 @@ +@layout("/common/_container.html"){ +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal"> + + <div class="row"> + <div class="col-sm-6 b-r"> + <% var leftSize = tool.toInt((table.fields.~size + 1) / 2); %> + <% var rightSize = tool.toInt(table.fields.~size - leftSize); %> + <% for(var i=0;i<leftSize;i++){ %> + <% if(i != (leftSize-1) ){ %> + <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" underline="true"/> + <% }else{ %> + <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" /> + <% } %> + <% } %> + </div> + + <div class="col-sm-6"> + <% for(var i=leftSize;i<table.fields.~size;i++){ %> + <% if(i != (table.fields.~size-1) ){ %> + <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" underline="true"/> + <% }else{ %> + <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" /> + <% } %> + <% } %> + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="${context.bizEnBigName}InfoDlg.editSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="${context.bizEnBigName}InfoDlg.close()"/> + </div> + </div> + </div> + + </div> +</div> +<script src="\${ctxPath}/static/modular/${context.moduleName}/${context.bizEnName}/${context.bizEnName}_info.js"></script> +@} diff --git a/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_info.js.btl b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_info.js.btl new file mode 100644 index 0000000..7430b88 --- /dev/null +++ b/user/guns-generator/src/main/resources/gunsTemplate/advanced/page_info.js.btl @@ -0,0 +1,98 @@ +/** + * 初始化${context.bizChName}详情对话框 + */ +var ${context.bizEnBigName}InfoDlg = { + ${context.bizEnName}InfoData : {} +}; + +/** + * 清除数据 + */ +${context.bizEnBigName}InfoDlg.clearData = function() { + this.${context.bizEnName}InfoData = {}; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +${context.bizEnBigName}InfoDlg.set = function(key, val) { + this.${context.bizEnName}InfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; + return this; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +${context.bizEnBigName}InfoDlg.get = function(key) { + return $("#" + key).val(); +} + +/** + * 关闭此对话框 + */ +${context.bizEnBigName}InfoDlg.close = function() { + parent.layer.close(window.parent.${context.bizEnBigName}.layerIndex); +} + +/** + * 收集数据 + */ +${context.bizEnBigName}InfoDlg.collectData = function() { + this + <% for(item in table.fields!){ %> + <% if(itemLP.last != true){ %> + .set('${item.propertyName}') + <% }else{ %> + .set('${item.propertyName}'); + <% }} %> +} + +/** + * 提交添加 + */ +${context.bizEnBigName}InfoDlg.addSubmit = function() { + + this.clearData(); + this.collectData(); + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/${context.bizEnName}/add", function(data){ + Feng.success("添加成功!"); + window.parent.${context.bizEnBigName}.table.refresh(); + ${context.bizEnBigName}InfoDlg.close(); + },function(data){ + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.${context.bizEnName}InfoData); + ajax.start(); +} + +/** + * 提交修改 + */ +${context.bizEnBigName}InfoDlg.editSubmit = function() { + + this.clearData(); + this.collectData(); + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/${context.bizEnName}/update", function(data){ + Feng.success("修改成功!"); + window.parent.${context.bizEnBigName}.table.refresh(); + ${context.bizEnBigName}InfoDlg.close(); + },function(data){ + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.${context.bizEnName}InfoData); + ajax.start(); +} + +$(function() { + +}); diff --git a/user/pom.xml b/user/pom.xml new file mode 100644 index 0000000..3766e59 --- /dev/null +++ b/user/pom.xml @@ -0,0 +1,252 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.stylefeng</groupId> + <artifactId>guns-parent</artifactId> + <version>1.0.0</version> + + <name>guns-parent</name> + <packaging>pom</packaging> + + <modules> + <module>guns-admin</module> + <module>guns-core</module> + <module>guns-generator</module> + </modules> + + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>2.0.4.RELEASE</version> + </parent> + + <properties> + <spring-cloud.version>Finchley.SR1</spring-cloud.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <java.version>1.8</java.version> + <guns.version>1.0.0</guns.version> + <mybatisplus-spring-boot-starter.version>1.0.5</mybatisplus-spring-boot-starter.version> + <shiro.version>1.7.0</shiro.version> + <mybatis-plus.version>2.3</mybatis-plus.version> + <fastjson.version>1.2.47</fastjson.version> + <velocity.version>1.7</velocity.version> + <kaptcha.version>2.3.2</kaptcha.version> + <ehcache.version>3.3.1</ehcache.version> + <zxing.version>3.2.1</zxing.version> + <druid.version>1.1.10</druid.version> + <beetl.version>2.8.5</beetl.version> + <swagger.version>2.9.2</swagger.version> + <commons-lang3.version>3.7</commons-lang3.version> + <ehcache.core.version>2.6.11</ehcache.core.version> + <mysql-connector-java.version>8.0.11</mysql-connector-java.version> + <jwt.version>0.9.0</jwt.version> + <hutool.version>4.1.1</hutool.version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>com.stylefeng</groupId> + <artifactId>guns-generator</artifactId> + <version>${guns.version}</version> + </dependency> + <dependency> + <groupId>com.stylefeng</groupId> + <artifactId>guns-core</artifactId> + <version>${guns.version}</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>2.0.1.RELEASE</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatisplus-spring-boot-starter</artifactId> + <version>${mybatisplus-spring-boot-starter.version}</version> + </dependency> + <!--shiro依赖--> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-core</artifactId> + <version>${shiro.version}</version> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-spring</artifactId> + <version>${shiro.version}</version> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-ehcache</artifactId> + <version>${shiro.version}</version> + </dependency> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>${mysql-connector-java.version}</version> + </dependency> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatis-plus</artifactId> + <version>${mybatis-plus.version}</version> + </dependency> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatis-plus-generate</artifactId> + <version>${mybatis-plus.version}</version> + </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>fastjson</artifactId> + <version>${fastjson.version}</version> + </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>druid</artifactId> + <version>${druid.version}</version> + </dependency> + <dependency> + <groupId>com.github.penggle</groupId> + <artifactId>kaptcha</artifactId> + <version>${kaptcha.version}</version> + </dependency> + <dependency> + <groupId>org.ehcache</groupId> + <artifactId>ehcache</artifactId> + <version>${ehcache.version}</version> + </dependency> + <dependency> + <groupId>com.google.zxing</groupId> + <artifactId>core</artifactId> + <version>${zxing.version}</version> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>${velocity.version}</version> + </dependency> + <dependency> + <groupId>com.ibeetl</groupId> + <artifactId>beetl</artifactId> + <version>${beetl.version}</version> + </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger2</artifactId> + <version>${swagger.version}</version> + </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger-ui</artifactId> + <version>${swagger.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${commons-lang3.version}</version> + </dependency> + <dependency> + <groupId>net.sf.ehcache</groupId> + <artifactId>ehcache-core</artifactId> + <version>${ehcache.core.version}</version> + </dependency> + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt</artifactId> + <version>${jwt.version}</version> + </dependency> + <dependency> + <groupId>cn.hutool</groupId> + <artifactId>hutool-all</artifactId> + <version>${hutool.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + </configuration> + </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <configuration> + <delimiters> + <delimiter>@</delimiter> + </delimiters> + <useDefaultDelimiters>false</useDefaultDelimiters> + </configuration> + </plugin> + </plugins> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + <resource> + <directory>src/main/java</directory> + <includes> + <include>**/*.xml</include> + </includes> + </resource> + </resources> + </build> + + <profiles> + <profile> + <id>local</id> + <properties> + <spring.active>local</spring.active> + </properties> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + </profile> + <profile> + <id>dev</id> + <properties> + <spring.active>dev</spring.active> + </properties> + </profile> + <profile> + <id>test</id> + <properties> + <spring.active>test</spring.active> + </properties> + </profile> + <profile> + <id>produce</id> + <properties> + <spring.active>produce</spring.active> + </properties> + </profile> + </profiles> + +</project> -- Gitblit v1.7.1