Commit 34327c626b278ec2e8f0ddd1585dc08646bfbaec

Authored by xu
1 parent 691d74ee
Exists in master

1. F 完成所有接口的逻辑

2. A 后台添加机器状态统计功能
3. F 调整升级新增字段
app-api/config/url-rules.php
... ... @@ -7,8 +7,8 @@ return [
7 7 'POST authDevice' => 'auth-device/index',
8 8 'POST checkOtaVersion' => 'upgrade/check-version',
9 9 'POST reportOtaUpgradeEvent' => 'upgrade/report-upgrade-event',
10   - 'POST checkAppVersion' => 'upgrade/check-app-versionx',
11   - 'POST reportAppUpgradeEvent' => 'upgrade/reportAppUpgradeEvent',
  10 + 'POST checkAppVersion' => 'upgrade/check-app-version',
  11 + 'POST reportAppUpgradeEvent' => 'upgrade/report-app-upgrade-event',
12 12 'POST reportDeviceVersion' => 'upgrade/report-device-version',
13 13 'GET errorPage' => 'site/error-page-info',
14 14 'GET minaQuery' => 'site/mina-query',
... ...
app-api/controllers/AuthDeviceController.php
... ... @@ -6,6 +6,7 @@ namespace app\api\controllers;
6 6 use Yii;
7 7  
8 8 use common\helpers\Utils;
  9 +use common\helpers\Log as AppLog;
9 10 use domain\device\DeviceRepository;
10 11 use domain\device\Device;
11 12 use domain\device\DeviceStatus;
... ... @@ -32,30 +33,42 @@ class AuthDeviceController extends BaseController
32 33 {
33 34 const SIGN_SALT = '13456';
34 35  
35   -
  36 + private static function myLog($str)
  37 + {
  38 + AppLog::DEBUG($str);
  39 + }
36 40 /**
37 41 * 设备授权接口
38 42 * @return stdClass
39 43 */
40 44 public function actionIndex()
41 45 {
42   - $req = Yii::$app->request;
43   - $manufactureNo = $req->post('manufacture');
44   - $deviceId = $req->post('device_id');
45   - $projectNo = $req->post('project');
46   - $modelNo = $req->post('model');
47   - $sign = $req->post('sign');
48   - $productionNo = $req->post('production');
49   - $timestamp = $req->post('timestamp');
50 46 $e = new stdClass();
51   - $e->status = 0;
  47 + $e->status = 1;
52 48 $e->message = 'message';
53 49 $e->serial_no = '';;
54 50 $e->mac = '';
55 51  
  52 + $getPostData = file_get_contents('php://input', 'r');
  53 + self::myLog('actionIndex postData:'.$getPostData);
  54 + if (!$getPostData) {
  55 + $e->status = 2;
  56 + $e->message = '数据为空';
  57 + return $e;
  58 + }
  59 + $getPostData = json_decode($getPostData, true);
  60 + $manufactureNo = isset($getPostData['manufacture'])?$getPostData['manufacture']:'';
  61 + $deviceId = isset($getPostData['device_id'])?$getPostData['device_id']:'';
  62 + $projectNo = isset($getPostData['project'])?$getPostData['project']:'';
  63 + $modelNo = isset($getPostData['model'])?$getPostData['model']:'';
  64 + $productionNo = isset($getPostData['production'])?$getPostData['production']:'';
  65 + $timestamp = isset($getPostData['timestamp'])?$getPostData['timestamp']:'';
  66 + $sign = isset($getPostData['sign'])?$getPostData['sign']:'';
  67 +
56 68 $salt = self::SIGN_SALT;
57 69 $makeSign = md5($manufactureNo . $projectNo. $modelNo . $productionNo . $timestamp . $salt);
58 70 if ($sign != $makeSign) {
  71 + $e->status = 3;
59 72 $e->message = '签名有误';
60 73 return $e;
61 74 }
... ... @@ -65,7 +78,7 @@ class AuthDeviceController extends BaseController
65 78 $e->mac = $deviceModel->mac;
66 79 $e->serial_no = $deviceModel->serial_no;
67 80 $e->message = 'ok';
68   - $e->status = 1;
  81 + $e->status = 0;
69 82 return $e;
70 83 }
71 84 $authResult = Device::authDevice($deviceId, $manufactureNo, $projectNo, $modelNo, $productionNo);
... ... @@ -74,8 +87,9 @@ class AuthDeviceController extends BaseController
74 87 $e->mac = $authResult->mac;
75 88 $e->serial_no = $authResult->serial_no;
76 89 $e->message = $authResult->message;
77   - $e->status = 1;
  90 + $e->status = 0;
78 91 } else {
  92 + $e->status = 4;
79 93 $e->message = $authResult->message;
80 94 }
81 95  
... ...
app-api/controllers/UpgradeController.php
... ... @@ -3,8 +3,24 @@
3 3 namespace app\api\controllers;
4 4  
5 5 use Yii;
  6 +use common\helpers\Log as AppLog;
  7 +use common\helpers\Utils;
  8 +use domain\model\ModelRepository;
  9 +use domain\production\ProductionRepository;
  10 +use domain\upgrade\models\Upgrade as UpgradeModel;
  11 +use domain\upgrade\UpgradeLog;
  12 +use domain\upgrade\UpgradeLogRepository;
  13 +use domain\upgrade\UpgradeRepository;
  14 +use domain\upgrade\UpgradeStatus;
  15 +use domain\device\DeviceStatsRepository;
  16 +use domain\device\Device;
  17 +use domain\device\DeviceStats;
  18 +use domain\manufacturer\ManufacturerRepository;
  19 +use domain\project\ProjectRepository;
  20 +use domain\device\DeviceRepository;
6 21  
7 22 use stdClass;
  23 +
8 24 use function sizeof;
9 25 use function date;
10 26 use function count;
... ... @@ -16,112 +32,467 @@ use function time;
16 32 */
17 33 class UpgradeController extends BaseController
18 34 {
  35 +
  36 + private static function myLog($str)
  37 + {
  38 + AppLog::DEBUG($str);
  39 + }
19 40 /**
20 41 * OTA 包升级检测
21 42 * @return stdClass
22 43 */
23 44 public function actionCheckVersion()
24 45 {
25   - $req = Yii::$app->request;
26   - $barcode = $req->post('barcode');
27   - $deviceId = $req->post('device_id');
28   - $softwareVersion = $req->post('software_version');
29   - $hardwareVersion = $req->post('hardware_version');
30   -
31 46 $e = new stdClass();
32   - $e->status = 0;
33   - $e->message = 'fail';
  47 + $e->status = 1;
  48 + $e->message = 'ok';
34 49 $e->update_flag = 0; // 0 1 2
35   - $e->version = '';
36   - $e->file_path = '';
37   - $e->file_md5 = '';
38   - $e->size = 3627;
39   - $e->package_type = 0; // 0 1, 2
40   - $e->version_message = 'ok';
  50 + $getPostData = file_get_contents('php://input', 'r');
  51 + self::myLog('actionCheckVersion:'.$getPostData);
  52 + if (!$getPostData) {
  53 + $e->message = '数据为空';
  54 + return $e;
  55 + }
  56 + $getPostData = json_decode($getPostData, true);
  57 + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']:'';
  58 + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']:'';
  59 + $softwareVersion = isset($getPostData['software_version'])? $getPostData['software_version']:'';
  60 + $hardwareVersion = isset($getPostData['hardware_version'])? $getPostData['hardware_version']:'';
  61 +
  62 + if (empty($barcode) || empty($packageName) || empty($currentVersion) || empty($softwareVersion)|| empty($hardwareVersion)) {
  63 + $e->status = 2;
  64 + $e->message = '部分数据为空';
  65 + return $e;
  66 + }
  67 +
  68 + $deviceBatchInfo = Device::explodeBarcode($barcode);
  69 + if (empty($deviceBatchInfo)) {
  70 + $e->status = 3;
  71 + $e->message = 'barcode格式有误';
  72 + return $e;
  73 + }
  74 +
  75 + $deviceModel = DeviceRepository::findOne(['device_id' => $deviceId]);
  76 + if (empty($deviceModel)) {
  77 + $e->status = 4;
  78 + $e->message = '无该设备记录';
  79 + return $e;
  80 + }
  81 +
  82 + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]);
  83 + $manufactureId = 0;
  84 + if ($ma) {
  85 + $manufactureId = $ma->id;
  86 + }
  87 +
  88 + $upgradeModel = UpgradeModel::find();
  89 + $upgradeModel->where([
  90 + 'manufacture_id' => $manufactureId,
  91 + 'status' => UpgradeStatus::STATUS_ON,
  92 + 'is_delete' => 0,
  93 + 'type' => UpgradeStatus::TYPE_OTA
  94 + ]);
  95 + $upgradeModel->andWhere(['>', 'version', $hardwareVersion]);
  96 + $upgradeModel->orderBy('created_at desc');
  97 + $upgradeRecord = $upgradeModel->one();
  98 +
  99 + if (!$upgradeRecord) {
  100 + $e->status = 1;
  101 + $e->message = '暂无升级包';
  102 + $e->update_flag = 0;
  103 + $e->version = '';
  104 + $e->file_path = '';
  105 + $e->file_md5 = '';
  106 + $e->size = 0;
  107 + $e->version_message = '';
  108 + $e->package_type = 0;
  109 +
  110 + return $e;
  111 + }
  112 + $devices = [];
  113 + if ($upgradeRecord->device_ids) {
  114 + $devices = explode(',', $upgradeRecord->device_ids);
  115 + }
  116 + // 不在预发布指定的设备里面
  117 + if ($devices && !in_array($deviceId, $devices)) {
  118 + $e->status = 1;
  119 + $e->message = '暂无升级包';
  120 + $e->update_flag = 0;
  121 + $e->version = '';
  122 + $e->file_path = '';
  123 + $e->file_md5 = '';
  124 + $e->size = 0;
  125 + $e->version_message = '';
  126 + $e->package_type = 0;
  127 +
  128 + return $e;
  129 + }
  130 +
  131 + $domainURL = Yii::$app->params['file_upload_domain'];
  132 + $e->status = 0;
  133 + $e->message = '有升级包';
  134 + $e->update_flag = $upgradeRecord->focuse;
  135 + $e->version = $upgradeRecord->version;
  136 + $e->file_path = $domainURL.$upgradeRecord->path;
  137 + $e->file_md5 = $upgradeRecord->file_md5;
  138 + $e->size = $upgradeRecord->size;
  139 + $e->package_type = $upgradeRecord->package_type;
  140 + $e->version_message = $upgradeRecord->desc;
41 141  
42 142 return $e;
43 143 }
44 144  
45 145 /**
46   - *
  146 + * 上报 OTA 升级事件
47 147 * @return stdClass
48 148 */
49 149 public function actionReportUpgradeEvent()
50 150 {
51   - $req = Yii::$app->request;
52   - $barcode = $req->post('barcode');
53   - $deviceId = $req->post('device_id');
54   - $currentVersion = $req->post('current_version');
55   - $targetVersion = $req->post('target_version');
56   - $status = $req->post('status');
57   - $errorCode = $req->post('error_code');
58   - $timestamp = $req->post('timestamp');
59   -
60 151 $e = new stdClass();
61   - $e->status = 0;
62   - $e->message = 'fail';
  152 + $e->status = 1;
  153 + $getPostData = file_get_contents('php://input', 'r');
  154 + self::myLog('actionReportUpgradeEvent:'. $getPostData);
  155 + if (!$getPostData) {
  156 + $e->message = '数据为空';
  157 + return $e;
  158 + }
  159 + $getPostData = json_decode($getPostData, true);
  160 + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']:'';
  161 + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']:'';
  162 + $currentVersion = isset($getPostData['current_version'])? $getPostData['current_version']:'';
  163 + $targetVersion = isset($getPostData['target_version'])? $getPostData['target_version']:'';
  164 + $status = isset($getPostData['status'])? $getPostData['status']:'';
  165 + $errorCode = isset($getPostData['error_code'])? $getPostData['error_code']:'';
  166 + $timestamp = isset($getPostData['timestamp'])? $getPostData['timestamp']:'';
  167 +
  168 + if (empty($barcode) || empty($currentVersion) || empty($targetVersion) || empty($status) || empty($errorCode) || empty($timestamp)) {
  169 + $e->status = 2;
  170 + $e->message = '部分数据为空';
  171 + return $e;
  172 + }
63 173  
  174 + if (empty($deviceId)) {
  175 + $e->status = 3;
  176 + $e->message = '设备ID为空';
  177 + return $e;
  178 + }
  179 + $deviceBatchInfo = Device::explodeBarcode($barcode);
  180 + if (empty($deviceBatchInfo)) {
  181 + $e->status = 4;
  182 + $e->message = 'barcode格式有误';
  183 + return $e;
  184 + }
  185 + $upgradeLogModel = UpgradeLogRepository::findOne(['device_id' => $deviceId, 'current_version' => $currentVersion, 'target_version' => $targetVersion, 'status' => $status, 'type' => UpgradeStatus::TYPE_OTA]);
  186 + if ($upgradeLogModel) {
  187 + $upgradeLogModel->timestamp = $timestamp;
  188 + $upgradeLogModel->save();
  189 + $e->status = 0;
  190 + $e->message = '已更新';
  191 +
  192 + return $e;
  193 + }
  194 + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]);
  195 + $pro = ProjectRepository::findOne(['project_no' => $deviceBatchInfo[1]]);
  196 + $model = ModelRepository::findOne(['model_no' => $deviceBatchInfo[2]]);
  197 + $manufactureId = $projectId = $modelId = 0;
  198 + if ($ma) {
  199 + $manufactureId = $ma->id;
  200 + }
  201 + if ($pro) {
  202 + $projectId = $pro->id;
  203 + }
  204 + if ($model) {
  205 + $modelId = $model->id;
  206 + }
  207 +
  208 + $item = [
  209 + "barcode" => $barcode,
  210 + "device_id" => $deviceId,
  211 + "manufacture_id" => $manufactureId,
  212 + "project_id" => $projectId,
  213 + "model_id" => $modelId,
  214 + "current_version" => $currentVersion,
  215 + "target_version" => $targetVersion,
  216 + "status" => $status,
  217 + "error_code" => $errorCode,
  218 + "timestamp" => $timestamp,
  219 + "type" => UpgradeStatus::TYPE_OTA
  220 + ];
  221 + $saveR = UpgradeLog::create($item);
  222 + if ($saveR) {
  223 + $e->status = 0;
  224 + $e->message = 'ok';
  225 + } else {
  226 + $e->status = 5;
  227 + $e->message = '报告记录失败';
  228 + }
64 229  
65 230 return $e;
66 231 }
67 232  
  233 + /**
  234 + * APP 升级检测
  235 + * @return stdClass
  236 + */
68 237 public function actionCheckAppVersion()
69 238 {
70   - $req = Yii::$app->request;
71   - $barcode = $req->post('barcode');
72   - $deviceId = $req->post('device_id');
73   - $packageName = $req->post('package_name');
74   - $currentVersion = $req->post('current_version');
75   -
76 239 $e = new stdClass();
77   - $e->status = 0;
78   - $e->message = 'fail';
79   - $e->update_flag = 0; // 0 1 2
80   - $e->version = '';
81   - $e->file_path = '';
82   - $e->file_md5 = '';
83   - $e->size = 3627;
84   - $e->version_message = 'ok';
  240 + $e->status = 1;
  241 + $getPostData = file_get_contents('php://input', 'r');
  242 + self::myLog('actionReportUpgradeEvent:'. $getPostData);
  243 + if (!$getPostData) {
  244 + $e->message = '数据为空';
  245 + return $e;
  246 + }
  247 + $getPostData = json_decode($getPostData, true);
  248 + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']: '';
  249 + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']: '';
  250 + $packageName = isset($getPostData['package_name'])? $getPostData['package_name']: '';
  251 + $currentVersion = isset($getPostData['current_version'])? $getPostData['current_version']: '';
  252 +
  253 + if (empty($barcode) || empty($packageName) || empty($currentVersion)) {
  254 + $e->status = 2;
  255 + $e->message = '部分数据为空';
  256 + return $e;
  257 + }
  258 +
  259 + $deviceBatchInfo = Device::explodeBarcode($barcode);
  260 + if (empty($deviceBatchInfo)) {
  261 + $e->status = 3;
  262 + $e->message = 'barcode格式有误';
  263 + return $e;
  264 + }
  265 +
  266 + $deviceModel = DeviceRepository::findOne(['device_id' => $deviceId]);
  267 + if (empty($deviceModel)) {
  268 + $e->status = 4;
  269 + $e->message = '无该设备记录';
  270 + return $e;
  271 + }
  272 +
  273 + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]);
  274 + $manufactureId = 0;
  275 + if ($ma) {
  276 + $manufactureId = $ma->id;
  277 + }
  278 +
  279 + $upgradeModel = UpgradeModel::find();
  280 + $upgradeModel->where([
  281 + 'manufacture_id' => $manufactureId,
  282 + 'status' => UpgradeStatus::STATUS_ON,
  283 + 'package_name' => $packageName,
  284 + 'is_delete' => 0,
  285 + 'type' => UpgradeStatus::TYPE_APP
  286 + ]);
  287 + $upgradeModel->andWhere(['>', 'version', $currentVersion]);
  288 + $upgradeModel->orderBy('created_at desc');
  289 + $upgradeRecord = $upgradeModel->one();
  290 +
  291 + if (!$upgradeRecord) {
  292 + $e->status = 1;
  293 + $e->message = '暂无升级包';
  294 + $e->update_flag = 0;
  295 + $e->version = '';
  296 + $e->file_path = '';
  297 + $e->file_md5 = '';
  298 + $e->size = 0;
  299 + $e->version_message = '';
  300 + } else {
  301 + $domainURL = Yii::$app->params['file_upload_domain'];
  302 + $e->status = 0;
  303 + $e->message = '有升级包';
  304 + $e->update_flag = $upgradeRecord->focuse;
  305 + $e->version = $upgradeRecord->version;
  306 + $e->file_path = $domainURL.$upgradeRecord->path;
  307 + $e->file_md5 = $upgradeRecord->file_md5;
  308 + $e->size = $upgradeRecord->size;
  309 + $e->version_message = $upgradeRecord->desc;
  310 + }
85 311  
86 312 return $e;
87 313 }
88 314  
89 315 /**
  316 + * APP 升级报告
90 317 * @return stdClass
91 318 */
92 319 public function actionReportAppUpgradeEvent()
93 320 {
94   - $req = Yii::$app->request;
95   - $barcode = $req->post('barcode');
96   - $deviceId = $req->post('device_id');
97   - $currentVersion = $req->post('current_version');
98   - $targetVersion = $req->post('target_version');
99   - $status = $req->post('status');
100   - $errorCode = $req->post('error_code');
101   - $timestamp = $req->post('timestamp');
102   -
103 321 $e = new stdClass();
104   - $e->status = 0;
105   - $e->message = 'fail';
  322 + $e->status = 1;
  323 + $getPostData = file_get_contents('php://input', 'r');
  324 + self::myLog('actionReportUpgradeEvent:'. $getPostData);
  325 + if (!$getPostData) {
  326 + $e->message = '数据为空';
  327 + return $e;
  328 + }
  329 + $getPostData = json_decode($getPostData, true);
  330 + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']: '';
  331 + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']: '';
  332 + $currentVersion = isset($getPostData['current_version'])? $getPostData['current_version']: '';
  333 + $targetVersion = isset($getPostData['target_version'])? $getPostData['target_version']: '';
  334 + $status = isset($getPostData['status'])? $getPostData['status']: '';
  335 + $errorCode = isset($getPostData['error_code'])? $getPostData['error_code']: '';
  336 + $timestamp = isset($getPostData['timestamp'])? $getPostData['timestamp']: '';
  337 +
  338 + if (empty($barcode) || empty($currentVersion) || empty($targetVersion) || empty($status) || empty($errorCode) || empty($timestamp)) {
  339 + $e->status = 2;
  340 + $e->message = '部分数据为空';
  341 + return $e;
  342 + }
  343 +
  344 + if (empty($deviceId)) {
  345 + $e->status = 3;
  346 + $e->message = '设备ID为空';
  347 + return $e;
  348 + }
  349 + $deviceBatchInfo = Device::explodeBarcode($barcode);
  350 + if (empty($deviceBatchInfo)) {
  351 + $e->status = 4;
  352 + $e->message = 'barcode格式有误';
  353 + return $e;
  354 + }
  355 + $upgradeLogModel = UpgradeLogRepository::findOne(['device_id' => $deviceId, 'current_version' => $currentVersion, 'target_version' => $targetVersion, 'status' => $status, 'type' => UpgradeStatus::TYPE_APP]);
  356 + if ($upgradeLogModel) {
  357 + $upgradeLogModel->timestamp = $timestamp;
  358 + $upgradeLogModel->save();
  359 + $e->status = 0;
  360 + $e->message = '已更新';
  361 +
  362 + return $e;
  363 + }
  364 + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]);
  365 + $pro = ProjectRepository::findOne(['project_no' => $deviceBatchInfo[1]]);
  366 + $model = ModelRepository::findOne(['model_no' => $deviceBatchInfo[2]]);
  367 + $manufactureId = $projectId = $modelId = 0;
  368 + if ($ma) {
  369 + $manufactureId = $ma->id;
  370 + }
  371 + if ($pro) {
  372 + $projectId = $pro->id;
  373 + }
  374 + if ($model) {
  375 + $modelId = $model->id;
  376 + }
  377 +
  378 + $item = [
  379 + "barcode" => $barcode,
  380 + "device_id" => $deviceId,
  381 + "manufacture_id" => $manufactureId,
  382 + "project_id" => $projectId,
  383 + "model_id" => $modelId,
  384 + "current_version" => $currentVersion,
  385 + "target_version" => $targetVersion,
  386 + "status" => $status,
  387 + "error_code" => $errorCode,
  388 + "timestamp" => $timestamp,
  389 + "type" => UpgradeStatus::TYPE_APP
  390 + ];
  391 + $saveR = UpgradeLog::create($item);
  392 + if ($saveR) {
  393 + $e->status = 0;
  394 + $e->message = 'ok';
  395 + } else {
  396 + $e->status = 5;
  397 + $e->message = '记录失败';
  398 + }
106 399  
107 400 return $e;
108 401 }
109 402  
110 403 /**
  404 + * 机器状态统计
111 405 * @return stdClass
112 406 */
113 407 public function actionReportDeviceVersion()
114 408 {
115   - $req = Yii::$app->request;
116   - $barcode = $req->post('barcode');
117   - $deviceId = $req->post('device_id');
118   - $softwareVersion = $req->post('software_version');
119   - $hardwareVersion = $req->post('hardware_version');
120   - $timestamp = $req->post('timestamp');
121   -
122 409 $e = new stdClass();
  410 + $e->status = 1;
  411 + $getPostData = file_get_contents('php://input', 'r');
  412 + self::myLog('actionReportDeviceVersion:'. $getPostData);
  413 + if (!$getPostData) {
  414 + $e->message = '数据为空';
  415 + return $e;
  416 + }
  417 + $getPostData = json_decode($getPostData, true);
  418 + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']: '';
  419 + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']: '';
  420 + $softwareVersion = isset($getPostData['software_version'])? $getPostData['software_version']: '';
  421 + $hardwareVersion = isset($getPostData['hardware_version'])? $getPostData['hardware_version']: '';
  422 + $timestamp = isset($getPostData['timestamp'])? $getPostData['timestamp']: '';
  423 +
  424 + if (empty($barcode) || empty($softwareVersion) || empty($hardwareVersion) || empty($timestamp)) {
  425 + $e->status = 2;
  426 + $e->message = '部分数据为空';
  427 + return $e;
  428 + }
  429 +
  430 + if (empty($deviceId)) {
  431 + $e->status = 3;
  432 + $e->message = '设备ID为空';
  433 + return $e;
  434 + }
  435 +
  436 + $ipAddress = Utils::clientIp();
  437 + $deviceStatsModel = DeviceStatsRepository::findOne(['device_id' => $deviceId]);
  438 + if ($deviceStatsModel) {
  439 + $deviceStatsModel->timestamp = $timestamp;
  440 + $deviceStatsModel->ip = $ipAddress;
  441 + $deviceStatsModel->save();
  442 + $e->status = 0;
  443 + $e->message = 'ok';
  444 + return $e;
  445 + }
  446 +
  447 + $deviceBatchInfo = Device::explodeBarcode($barcode);
  448 + if (empty($deviceBatchInfo)) {
  449 + $e->status = 4;
  450 + $e->message = 'barcode格式有误';
  451 + return $e;
  452 + }
  453 +
  454 + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]);
  455 + $pro = ProjectRepository::findOne(['project_no' => $deviceBatchInfo[1]]);
  456 + $model = ModelRepository::findOne(['model_no' => $deviceBatchInfo[2]]);
  457 + $prod = ProductionRepository::findOne(['production_no' => $deviceBatchInfo[3]]);
  458 + $manufactureId = $projectId = $modelId = $productionId = 0;
  459 + if ($ma) {
  460 + $manufactureId = $ma->id;
  461 + }
  462 + if ($pro) {
  463 + $projectId = $pro->id;
  464 + }
  465 + if ($model) {
  466 + $modelId = $model->id;
  467 + }
  468 + if ($prod) {
  469 + $productionId = $prod->id;
  470 + }
  471 +
  472 + $cityResult = Utils::getAddressByIPAddress($ipAddress);
  473 + $city = '';
  474 + if ($cityResult && isset($cityResult['city']) && !empty($cityResult['city'])) {
  475 + $city = $cityResult['city'];
  476 + }
  477 +
  478 + $item = [
  479 + 'device_id' => $deviceId,
  480 + 'barcode' => $barcode,
  481 + 'software_version' => $softwareVersion,
  482 + 'hardware_version' => $hardwareVersion,
  483 + 'timestamp' => $timestamp,
  484 + 'manufacture_id' => $manufactureId,
  485 + 'project_id' => $projectId,
  486 + 'model_id' => $modelId,
  487 + 'production_id' => $productionId,
  488 + 'ip' => $ipAddress,
  489 + 'city' => $city
  490 + ];
  491 +
  492 + DeviceStats::create($item);
  493 +
123 494 $e->status = 0;
124   - $e->message = 'fail';
  495 + $e->message = 'ok';
125 496  
126 497 return $e;
127 498 }
... ...
app-api/helpers/Aes.php 0 → 100644
... ... @@ -0,0 +1,73 @@
  1 +<?php
  2 +
  3 +namespace app\api\helpers;
  4 +
  5 +class Aes
  6 +{
  7 + /**
  8 + * var string $method 加解密方法,可通过openssl_get_cipher_methods()获得
  9 + */
  10 + protected $method;
  11 +
  12 + /**
  13 + * var string $secret_key 加解密的密钥
  14 + */
  15 + protected $secret_key;
  16 +
  17 + /**
  18 + * var string $iv 加解密的向量,有些方法需要设置比如CBC
  19 + */
  20 + protected $iv;
  21 +
  22 + /**
  23 + * var string $options (不知道怎么解释,目前设置为0没什么问题)
  24 + */
  25 + protected $options;
  26 +
  27 + /**
  28 + * 构造函数
  29 + *
  30 + * @param string $key 密钥
  31 + * @param string $method 加密方式
  32 + * @param string $iv iv向量
  33 + * @param mixed $options 还不是很清楚
  34 + *
  35 + */
  36 + public function __construct($key, $method = 'AES-128-ECB', $iv = '', $options = 0)
  37 + {
  38 + // key是必须要设置的
  39 + $this->secret_key = isset($key) ? $key : 'king_board_key_01';
  40 +
  41 + $this->method = $method;
  42 +
  43 + $this->iv = $iv;
  44 +
  45 + $this->options = $options;
  46 + }
  47 +
  48 + /**
  49 + * 加密方法,对数据进行加密,返回加密后的数据
  50 + *
  51 + * @param string $data 要加密的数据
  52 + *
  53 + * @return string
  54 + *
  55 + */
  56 + public function encrypt($data)
  57 + {
  58 + return openssl_encrypt($data, $this->method, $this->secret_key, $this->options, $this->iv);
  59 + }
  60 +
  61 + /**
  62 + * 解密方法,对数据进行解密,返回解密后的数据
  63 + *
  64 + * @param string $data 要解密的数据
  65 + *
  66 + * @return string
  67 + *
  68 + */
  69 + public function decrypt($data)
  70 + {
  71 + return openssl_decrypt($data, $this->method, $this->secret_key, $this->options, $this->iv);
  72 + }
  73 +}
0 74 \ No newline at end of file
... ...
app-ht/modules/datas/controllers/DeviceStatsController.php 0 → 100644
... ... @@ -0,0 +1,119 @@
  1 +<?php
  2 +
  3 +namespace app\ht\modules\datas\controllers;
  4 +
  5 +use domain\device\DeviceStatsRepository;
  6 +use Yii;
  7 +use yii\data\Pagination;
  8 +use domain\upgrade\UpgradeLogRepository;
  9 +use domain\upgrade\UpgradeStatus;
  10 +use app\ht\controllers\BaseController;
  11 +
  12 +/**
  13 + * 机器状态码管理
  14 + * Class DeviceStatsController
  15 + * @package app\ht\modules\upgrade\controllers
  16 + */
  17 +class DeviceStatsController extends BaseController
  18 +{
  19 + /**
  20 + * 版本日志管理
  21 + */
  22 + public function actionIndex()
  23 + {
  24 + $params = $this->dataList(1);
  25 + /**
  26 + * 渲染模板
  27 + */
  28 + return $this->render('index', $params);
  29 + }
  30 +
  31 + /**
  32 + * 查询数据列表
  33 + */
  34 + protected function dataList($type = '')
  35 + {
  36 + $request = Yii::$app->request;
  37 + $createTime = $request->get('createTime');
  38 + $endTime = $request->get('endTime');
  39 + $software_version = $request->get('software_version');
  40 + $hardware_version = $request->get('hardware_version');
  41 + $manufacture_name = $request->get('manufacture_name');
  42 + $model_name = $request->get('model_name');
  43 + $device_id = $request->get('device_id');
  44 + $barcode = $request->get('barcode');
  45 + $city = $request->get('city');
  46 +
  47 + $gets = [
  48 + 'createTime' => $createTime,
  49 + 'endTime' => $endTime,
  50 + 'software_version' => $software_version,
  51 + 'hardware_version' => $hardware_version,
  52 + 'manufacture_name' => $manufacture_name,
  53 + 'device_id' => $device_id,
  54 + 'barcode' => $barcode,
  55 + 'model_name' => $model_name,
  56 + 'city' => $city,
  57 + ];
  58 +
  59 + $where = ['and'];
  60 + if ($createTime) {
  61 + $createTime = strtotime($createTime);
  62 + $where[] = ['>=', 'ds.created_at', $createTime];
  63 + }
  64 + if ($endTime) {
  65 + $endTime = strtotime($endTime) + 86400;
  66 + $where[] = ['<=', 'ds.created_at', $endTime];
  67 + }
  68 +
  69 + if ($software_version) {
  70 + $where[] = ['like', 'ds.software_version', $software_version];
  71 + }
  72 + if ($hardware_version) {
  73 + $where[] = ['like', 'ds.hardware_version', $hardware_version];
  74 + }
  75 + if ($manufacture_name) {
  76 + $where[] = ['like', 'mf.name', $manufacture_name];
  77 + }
  78 + if ($model_name) {
  79 + $where[] = ['like', 'md.name', $model_name];
  80 + }
  81 + if ($device_id) {
  82 + $where[] = ['like', 'ds.device_id', $device_id];
  83 + }
  84 + if ($barcode) {
  85 + $where[] = ['like', 'ds.barcode', $barcode];
  86 + }
  87 + if ($city) {
  88 + $where[] = ['like', 'ds.city', $city];
  89 + }
  90 +
  91 + if ($type == 0) {
  92 + $pageList = DeviceStatsRepository::getPageList($where, 0 , 0);
  93 + $pages = null;
  94 + } else {
  95 + $pageSize = 20;
  96 + $pages = new Pagination(['totalCount' => DeviceStatsRepository::getPageCount($where), 'pageSize' => $pageSize]);
  97 + $pageList = DeviceStatsRepository::getPageList($where, $pages->offset, $pages->limit);
  98 + }
  99 +
  100 + /**
  101 + * 数据整理
  102 + */
  103 + return [
  104 + 'listdata' => $pageList,
  105 + 'pages' => $pages,
  106 + 'gets' => $gets
  107 + ];
  108 + }
  109 +
  110 + /**
  111 + * 导出设备状态数据
  112 + * @return string
  113 + */
  114 + public function actionExport()
  115 + {
  116 + $params = $this->dataList(0);
  117 + return $this->renderPartial('export', $params);
  118 + }
  119 +}
0 120 \ No newline at end of file
... ...
app-ht/modules/datas/views/device-stats/export.php 0 → 100644
... ... @@ -0,0 +1,66 @@
  1 +<?php
  2 +
  3 +use domain\upgrade\UpgradeLogStatus;
  4 +
  5 +header('Content-Type: application/vnd.ms-excel;charset=utf-8');
  6 +$title = date('Y-m-d') . '_机器状态统计数据';
  7 +$name = $title . ".xls";
  8 +header('Content-Disposition: attachment;filename=' . $name . '');
  9 +header('Cache-Control: max-age=0');
  10 +$fp = fopen('php://output', 'a');
  11 +$limit = 10000;
  12 +$cnt = 0;
  13 +?>
  14 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  15 + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  16 +<html xmlns:o="urn:schemas-microsoft-com:office:office"
  17 + xmlns:x="urn:schemas-microsoft-com:office:excel"
  18 + xmlns="http://www.w3.org/TR/REC-html40">
  19 +
  20 +<head>
  21 + <meta http-equiv=Content-Type content="text/html; charset=utf-8">
  22 +
  23 +</head>
  24 +<body>
  25 +<div id="Classeur1_16681" align='center' x:publishsource="Excel">
  26 + <table border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse">
  27 + <thead>
  28 + <tr>
  29 + <th width="10%">设备ID</th>
  30 + <th width="10%">Barcode</th>
  31 + <th width="10%">硬件版本</th>
  32 + <th width="10%">软件版本</th>
  33 + <th width="10%">厂商</th>
  34 + <th width="10%">设备型号</th>
  35 + <th width="10%">所在城市</th>
  36 + <th width="10%">IP地址</th>
  37 + <th width="15%">时间</th>
  38 + </tr>
  39 + </thead>
  40 + <tbody>
  41 + <?php foreach ($listdata as $key => $item) : ?>
  42 + <tr>
  43 + <td style="padding:12px;"><?= (isset($item["device_id"]) ? $item["device_id"] : "-") ?></td>
  44 + <td style="padding:12px;"><?= (isset($item["barcode"]) ? $item["barcode"] : "-") ?></td>
  45 + <td style="padding:12px;"><?= (isset($item["software_version"]) ? $item["software_version"] : "-") ?></td>
  46 + <td style="padding:12px;"><?= (isset($item["hardware_version"]) ? $item["hardware_version"] : "-") ?></td>
  47 + <td style="padding:12px;"><?= (isset($item["manufacture_name"]) ? $item["manufacture_name"] : "-") ?></td>
  48 + <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td>
  49 + <td style="padding:12px;"><?= empty($item["city"])? '-':$item["city"]?></td>
  50 + <td style="padding:12px;"><?= $item["ip"]?></td>
  51 + <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td>
  52 + </tr>
  53 + <?php
  54 + $cnt++;
  55 + if (1000 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题
  56 + ob_flush();
  57 + flush();
  58 + $cnt = 0;
  59 + }
  60 + ?>
  61 + <?php endforeach; ?>
  62 + </tbody>
  63 + </table>
  64 +</div>
  65 +</body>
  66 +</html>
0 67 \ No newline at end of file
... ...
app-ht/modules/datas/views/device-stats/index.php 0 → 100644
... ... @@ -0,0 +1,160 @@
  1 +<?php
  2 +
  3 +use yii\helpers\Url;
  4 +use app\ht\widgets\LinkPager;
  5 +use domain\upgrade\UpgradeStatus;
  6 +use domain\upgrade\UpgradeLogStatus;
  7 +
  8 +$this->params['breadcrumbs'][] = '机器状态统计';
  9 +?>
  10 +<style>
  11 + .table > tbody > tr > td
  12 + {
  13 + border: white 0px solid;
  14 + border-top: solid 1px #fff;
  15 + border-bottom: 1px solid #fff;
  16 + }
  17 + .table{
  18 + margin-bottom: 0px!important;
  19 + }
  20 +</style>
  21 +<div class="panel panel-default">
  22 + <div class="panel-body">
  23 + <form action="" method="get" id="search-form" class="filter-form">
  24 + <table width="100%" class="table">
  25 + <tbody>
  26 + <tr >
  27 + <td width="10%" class="text-right">barcode</td>
  28 + <td width="10%" class="text-left">
  29 + <input type="text" class="form-control" name="barcode" style="width: 150px;" placeholder="barcode" value="<?php if (!empty($gets['barcode'])){ echo $gets['barcode']; } ?>">
  30 + </td>
  31 + <td width="10%" class="text-right">设备ID</td>
  32 + <td width="10%" class="text-left">
  33 + <input type="text" class="form-control" name="device_id" style="width: 150px;" placeholder="设备ID" value="<?php if (!empty($gets['device_id'])){ echo $gets['device_id']; } ?>">
  34 + </td>
  35 + <td width="10%" class="text-right">厂商</td>
  36 + <td width="10%" class="text-left">
  37 + <input type="text" class="form-control" name="manufacture_name" style="width: 150px;" placeholder="输入厂商" value="<?php if (!empty($gets['manufacture_name'])){ echo $gets['manufacture_name']; } ?>">
  38 + </td>
  39 + <td width="10%" class="text-right">机器型号</td>
  40 + <td width="30%" class="text-left">
  41 + <input type="text" class="form-control" name="model_name" style="width: 290px;" placeholder="机器型号" value="<?php if (!empty($gets['model_name'])){ echo $gets['model_name']; } ?>">
  42 + </td>
  43 + </tr>
  44 + <tr>
  45 + <td class="text-right">软件版本</td>
  46 + <td class="text-left">
  47 + <input type="text" class="form-control" name="software_version" style="width: 150px;" placeholder="软件版本" value="<?php if (!empty($gets['software_version'])){ echo $gets['software_version']; } ?>">
  48 + </td>
  49 + <td class="text-right">硬件版本</td>
  50 + <td class="text-left">
  51 + <input type="text" class="form-control" name="hardware_version" style="width: 150px;" placeholder="硬件版本" value="<?php if (!empty($gets['hardware_version'])){ echo $gets['hardware_version']; } ?>">
  52 + </select>
  53 + </td>
  54 + <td class="text-right">所在城市</td>
  55 + <td class="text-left">
  56 + <input type="text" class="form-control" name="city" style="width: 150px;" placeholder="城市" value="<?php if (!empty($gets['city'])){ echo $gets['city']; } ?>">
  57 + </td>
  58 + <td class="text-right">时间</td>
  59 + <td class="text-left">
  60 + <div class="form-inline">
  61 + <input type="date" class="form-control" style="width: 140px;" name="createTime" placeholder="起" value="<?php if (!empty($gets['createTime'])){ echo $gets['createTime']; } ?>"> -
  62 + <input type="date" class="form-control" style="width: 140px;" name="endTime" placeholder="止" value="<?php if (!empty($gets['endTime'])){ echo $gets['endTime']; } ?>">
  63 + </div>
  64 + </td>
  65 + </tr>
  66 +
  67 + <tr class="search">
  68 + <td colspan="8" class="text-center">
  69 +
  70 + <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button>
  71 + <a class="btn btn-default btncls" href="<?=Url::toRoute(["/datas/device-stats/index"])?>">重&nbsp;&nbsp;&nbsp;&nbsp;置</a>
  72 + <a class="btn btn-default" style="float: right;" href="javascript:void(0)" id="btn-export"> 导出数据 </a>&nbsp;&nbsp;
  73 + </td>
  74 + </tr>
  75 + </tbody>
  76 + </table>
  77 + </form>
  78 + </div>
  79 +</div>
  80 +
  81 +<div class="panel panel-default">
  82 + <div class="panel-body">
  83 + <table class="table table-striped table-bordered" id="brand-table">
  84 + <thead>
  85 + <tr>
  86 + <th width="10%">设备ID</th>
  87 + <th width="10%">Barcode</th>
  88 + <th width="10%">硬件版本</th>
  89 + <th width="10%">软件版本</th>
  90 + <th width="10%">厂商</th>
  91 + <th width="10%">设备型号</th>
  92 + <th width="10%">所在城市</th>
  93 + <th width="10%">IP地址</th>
  94 + <th width="15%">时间</th>
  95 + </tr>
  96 + </thead>
  97 +
  98 + <tbody>
  99 + <?php if ($listdata) { ?>
  100 + <?php foreach ($listdata as $item) : ?>
  101 + <tr>
  102 + <td style="padding:12px;"><?= (isset($item["device_id"]) ? $item["device_id"] : "-") ?></td>
  103 + <td style="padding:12px;"><?= (isset($item["barcode"]) ? $item["barcode"] : "-") ?></td>
  104 + <td style="padding:12px;"><?= (isset($item["software_version"]) ? $item["software_version"] : "-") ?></td>
  105 + <td style="padding:12px;"><?= (isset($item["hardware_version"]) ? $item["hardware_version"] : "-") ?></td>
  106 + <td style="padding:12px;"><?= (isset($item["manufacture_name"]) ? $item["manufacture_name"] : "-") ?></td>
  107 + <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td>
  108 + <td style="padding:12px;"><?= empty($item["city"])? '-':$item["city"]?></td>
  109 + <td style="padding:12px;"><?= $item["ip"]?></td>
  110 + <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td>
  111 + </tr>
  112 + <?php endforeach; ?>
  113 + <?php } else { ?>
  114 + <tr>
  115 + <td colspan="9">
  116 + <center>暂无记录</center>
  117 + </td>
  118 + </tr>
  119 + <?php } ?>
  120 + </tbody>
  121 + </table>
  122 + </div>
  123 +
  124 + <div class="panel-footer">
  125 + <div class="hqy-panel-pager">
  126 + <?= LinkPager::widget([
  127 + 'pagination' => $pages,
  128 + ]); ?>
  129 + <div class="clearfix"></div>
  130 + </div>
  131 + </div>
  132 +</div>
  133 +<script>
  134 + window.queryParams = function(params) {
  135 + $("#search-form").find('input[name]').each(function () {
  136 + var val = $(this).val();
  137 + var name = $(this).attr('name');
  138 + if(val){
  139 + params[name] = val;
  140 + }
  141 + });
  142 + return params;
  143 + }
  144 + $(document).ready(function () {
  145 + $('#btn-export').click(function(e){
  146 + var params = {};
  147 + window.queryParams(params);
  148 +
  149 + $strQuery = "?";
  150 + if (params) {
  151 + for (var p in params) {
  152 + $strQuery += p + "=" + params[p] + "&";
  153 + }
  154 + }
  155 + $strQuery = $strQuery.substring(0, $strQuery.length-1);
  156 + window.location.href = "export" + $strQuery;
  157 + return false;
  158 + })
  159 + });
  160 +</script>
0 161 \ No newline at end of file
... ...
app-ht/modules/device/config/perm.php
... ... @@ -9,7 +9,7 @@ return [
9 9 65 => '序列号列表',
10 10  
11 11 ],
12   - 'path' => 'serialnumber/serialnumber/*'
  12 + 'path' => 'device/device/*'
13 13 ],
14 14  
15 15 ]
... ...
app-ht/modules/device/controllers/DeviceController.php
... ... @@ -3,6 +3,7 @@
3 3 namespace app\ht\modules\device\controllers;
4 4  
5 5  
  6 +use domain\device\DeviceAuthFailRepository;
6 7 use Yii;
7 8 use yii\base\Exception;
8 9 use yii\data\Pagination;
... ... @@ -103,7 +104,8 @@ class DeviceController extends BaseController
103 104 }
104 105  
105 106 /**
106   - *
  107 + * @return string
  108 + * @throws \yii\db\Exception
107 109 */
108 110 public function actionDoCreateDevice()
109 111 {
... ... @@ -203,6 +205,69 @@ class DeviceController extends BaseController
203 205  
204 206 }
205 207  
  208 + public function actionAuthFailIndex()
  209 + {
  210 + $request = Yii::$app->request;
  211 + $serialNo = $request->get('serial_no');
  212 + $mac = $request->get('mac');
  213 + $project = $request->get('project');
  214 + $model = $request->get('model');
  215 + $production = $request->get('production');
  216 + $manufacture = $request->get('manufacture');
  217 + $deviceId = $request->get('device_id');
  218 + $status = $request->get('status');
  219 + $page = $request->get('page');
  220 + $where = [
  221 + 'and',
  222 + ['=','a.is_delete', 0]
  223 + ];
  224 + if (!empty($serialNo)) {
  225 + $where[] = ['like', 'a.serial_no', $serialNo];
  226 + }
  227 + if (!empty($project)) {
  228 + $where[] = ['like', 'p.name', $project];
  229 + }
  230 + if (!empty($model)) {
  231 + $where[] = ['like', 'mo.name', $model];
  232 + }
  233 + if (!empty($production)) {
  234 + $where[] = ['like', 'pd.name', $production];
  235 + }
  236 + if (!empty($mac)) {
  237 + $where[] = ['like', 'a.mac', $mac];
  238 + }
  239 + if (!empty($manufacture)) {
  240 + $where[] = ['like', 'm.name', $manufacture];
  241 + }
  242 + if (!empty($deviceId)) {
  243 + $where[] = ['like', 'a.device_id', $deviceId];
  244 + }
  245 + if (isset($_GET['status']) && -1 != $status) {
  246 + $where[] = ['=', 'a.status', $status];
  247 + }
  248 +
  249 + if (0 >= $page) {
  250 + $page = 1;
  251 + }
  252 + $pageSize = 20;
  253 + $page = ($page -1) * $pageSize;
  254 + // DeviceRepository::getList($where, $pageSize, $page);
  255 + $deviceData = DeviceAuthFailRepository::getList($where, $pageSize, $page);
  256 + $pages = new Pagination(['totalCount' => DeviceAuthFailRepository::getListCount($where), 'pageSize' => $pageSize]);
  257 +
  258 + $params['deviceList'] = $deviceData;
  259 + $params['pages'] = $pages;
  260 + $params["gets"] = [
  261 + 'project' => $project,
  262 + 'model' => $model,
  263 + 'device_id' => $deviceId,
  264 + 'production' => $production,
  265 + 'manufacture' => $manufacture,
  266 + ];
  267 +
  268 + return $this->render('auth-fail-index', $params);
  269 + }
  270 +
206 271 /**
207 272 * @return string
208 273 */
... ...
app-ht/modules/device/views/device/auth-fail-index.php 0 → 100644
... ... @@ -0,0 +1,163 @@
  1 +<?php
  2 +use yii\helpers\Url;
  3 +use app\ht\widgets\LinkPager;
  4 +use domain\device\DeviceStatus;
  5 +
  6 +$this->title = '授权失败管理';
  7 +$this->params['breadcrumbs'][] = '失败序列号管理';
  8 +$this->params['breadcrumbs'][] = $this->title;
  9 +?>
  10 +<style>
  11 + .cell-cls{width:60%;word-wrap: break-word}
  12 + .td-cls{padding:8px 0}
  13 +</style>
  14 +<div class="panel panel-default">
  15 + <div class="panel-body">
  16 + <form action="" method="get" id="search-form" class="filter-form">
  17 + <div class="form-group col-sm-12">
  18 + <label for="manufacture" class="col-sm-1 control-label text-right">厂商:</label>
  19 + <div class="col-sm-2 form-inline">
  20 + <input type="text" class="form-control" id="manufacture" name="manufacture" value="<?php if (!empty($gets['manufacture'])){ echo $gets['manufacture'];} ?>" autocomplete="off">
  21 + </div>
  22 + <label for="project" class="col-sm-1 control-label text-right">项目名:</label>
  23 + <div class="col-sm-2 form-inline">
  24 + <input type="text" class="form-control" id="project" name="project" value="<?php if (!empty($gets['project'])){ echo $gets['project'];} ?>" autocomplete="off">
  25 + </div>
  26 + <label for="model" class="col-sm-1 control-label text-right">型号:</label>
  27 + <div class="col-sm-2 form-inline">
  28 + <input type="text" class="form-control" id="model" name="model" value="<?php if (!empty($gets['model'])){ echo $gets['model'];} ?>" autocomplete="off">
  29 + </div>
  30 + <label for="production" class="col-sm-1 control-label text-right">生产日期:</label>
  31 + <div class="col-sm-2 form-inline">
  32 + <input type="text" class="form-control" id="production" name="production" value="<?php if (!empty($gets['production'])){ echo $gets['production'];} ?>" autocomplete="off">
  33 + </div>
  34 + </div>
  35 +
  36 + <div class="form-group col-sm-12">
  37 +
  38 + <label for="device_id" class="col-sm-1 control-label text-right">设备ID:</label>
  39 + <div class="col-sm-2 form-inline">
  40 + <input type="text" class="form-control" id="device_id" name="device_id" value="<?php if (!empty($gets['device_id'])){ echo $gets['device_id'];} ?>" autocomplete="off">
  41 + </div>
  42 + <label for="handel" class="col-sm-1 control-label text-right">处理状态:</label>
  43 + <div class="col-sm-2 form-inline">
  44 + <input type="text" class="form-control" id="handel" name="handel" value="<?php if (!empty($gets['handel'])){ echo $gets['handel'];} ?>" autocomplete="off">
  45 + </div>
  46 + <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label>
  47 + <div class="col-sm-2 form-inline">
  48 + <input type="text" class="form-control" id="apply_at" name="apply_at" value="<?php if (!empty($gets['apply_at'])){ echo $gets['apply_at'];} ?>" autocomplete="off">
  49 + </div>
  50 +
  51 + </div>
  52 +
  53 +
  54 +
  55 + <div class="form-group col-sm-12" style="text-align: center;">
  56 + <button type="submit" class="btn btn-primary font-1" id="submitFilterBtn">查询</button>
  57 + </div>
  58 + </form>
  59 + </div>
  60 +</div>
  61 +
  62 +<div class="panel panel-default">
  63 + <div class="panel-body">
  64 + <table class="table table-striped table-bordered" id="brand-table">
  65 + <thead>
  66 + <tr>
  67 + <th width="6%">ID</th>
  68 + <th width="15%">厂商</th>
  69 + <th width="6%">项目</th>
  70 + <th width="8%">设备型号</th>
  71 + <th width="8%">生产日期</th>
  72 + <th width="15%">设备ID</th>
  73 + <th width="10%">申请时间</th>
  74 + <th width="20%">操作</th>
  75 + </tr>
  76 + </thead>
  77 +
  78 + <tbody>
  79 + <?php if ($deviceList) { ?>
  80 + <?php foreach ($deviceList as $item) : ?>
  81 + <tr>
  82 + <td class="td-cls">
  83 + <?= $item['id'] ?>
  84 + </td>
  85 +
  86 + <td class="td-cls">
  87 + <?= $item['manufacture'] ?>
  88 + </td>
  89 + <td class="td-cls">
  90 + <?= $item['project'] ?>
  91 + </td>
  92 + <td class="td-cls">
  93 + <?= $item['model'] ?>
  94 + </td>
  95 + <td class="td-cls">
  96 + <?= $item['production'] ?>
  97 + </td>
  98 +
  99 + <td class="td-cls">
  100 + <?= $item['device_id']? $item['device_id']:'暂无'?>
  101 + </td>
  102 + <td class="td-cls">
  103 + <?= $item['apply_at']?date('Y-m-d H:i:s', $item['apply_at']):'暂无' ?>
  104 + </td>
  105 +
  106 + <td class="td-cls">
  107 + <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>">编辑</button> &nbsp;|&nbsp;
  108 + <button class="btn btn-primary btn-sm btn_auth" aid="<?=$item['id'] ?>">授权</button>
  109 + </td>
  110 + </tr>
  111 + <?php endforeach; ?>
  112 + <?php } else { ?>
  113 + <tr>
  114 + <td colspan="12">
  115 + <center>暂无记录</center>
  116 + </td>
  117 + </tr>
  118 + <?php } ?>
  119 + </tbody>
  120 + </table>
  121 + </div>
  122 +
  123 + <div class="panel-footer">
  124 + <div class="hqy-panel-pager">
  125 + <?= LinkPager::widget([
  126 + 'pagination' => $pages,
  127 + ]); ?>
  128 + <div class="clearfix"></div>
  129 + </div>
  130 + </div>
  131 +</div>
  132 +
  133 +<script>
  134 + var authURL = "<?=Url::toRoute('/device/device/auth-device')?>";
  135 + var delURL = "<?=Url::toRoute('/device/device/del-device')?>";
  136 + $(function () {
  137 + $('.btn_auth').click(function(e) {
  138 + var aid = $(this).attr('aid');
  139 + $.post(authURL, {id:aid}, function(res) {
  140 + if (!res.success) {
  141 + alert(res.message);
  142 + return false;
  143 + }
  144 + window.location.reload();
  145 + }, 'json')
  146 + })
  147 +
  148 + //btn_del
  149 + $('.btn_del').click(function(e) {
  150 + if (!confirm('确定删除!')) {
  151 + return false;
  152 + }
  153 + var aid = $(this).attr('aid');
  154 + $.post(delURL, {id:aid}, function(res) {
  155 + if (!res.success) {
  156 + alert(res.message);
  157 + return false;
  158 + }
  159 + window.location.reload();
  160 + }, 'json')
  161 + })
  162 + });
  163 +</script>
0 164 \ No newline at end of file
... ...
app-ht/modules/device/views/device/index.php
... ... @@ -127,10 +127,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
127 127 <?= $item['production'] ?>
128 128 </td>
129 129 <td class="td-cls">
130   - <div class="cell-cls"><?= $item['mac'] ?></div>
  130 + <div class="cell-cls edit_mac edit_mac_<?=$item['id']?>" data-id="<?=$item['id']?>" data="<?= $item['mac'] ?>"><?= $item['mac'] ?></div>
131 131 </td>
132 132 <td class="td-cls">
133   - <?= $item['device_id']? $item['device_id']:'暂无'?>
  133 + <div class="edit_device edit_device_<?=$item['id']?>" data-id="<?=$item['id']?>" data="<?=$item['device_id']?>"><?= $item['device_id']? $item['device_id']:'暂无'?></div>
134 134 </td>
135 135 <td class="td-cls">
136 136 <?= $item['apply_at']?date('Y-m-d H:i:s', $item['apply_at']):'暂无' ?>
... ... @@ -142,7 +142,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
142 142 <?= $statusList[$item['status']] ?>
143 143 </td>
144 144 <td class="td-cls">
145   - <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>">编辑</button> &nbsp;|&nbsp;
  145 + <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button> &nbsp;|&nbsp;
146 146 <?php if(DeviceStatus::HAS_AUTH != $item['status']){?> <button class="btn btn-primary btn-sm btn_auth" aid="<?=$item['id'] ?>">授权</button> &nbsp;|&nbsp; <?php }?>
147 147 <button class="btn btn-danger btn-sm btn_del" aid="<?=$item['id'] ?>">删除</button>
148 148 </td>
... ... @@ -198,5 +198,44 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
198 198 window.location.reload();
199 199 }, 'json')
200 200 })
  201 + $('.btn_edit').click(function(e) {
  202 + var action = $(this).attr('data-action')
  203 + var id = $(this).attr('aid');
  204 + var editMac = $('.edit_mac_'+id);
  205 + var editDevice = $('.edit_device_'+id);
  206 +
  207 + if ('edit' == action ) {
  208 + var editMacs = $('.edit_mac');
  209 + $.each(editMacs, function(i,n){
  210 + $(n).html($(n).attr('data'));
  211 + })
  212 + var editDevices = $('.edit_device');
  213 + $.each(editDevices, function(i,n){
  214 + $(n).html($(n).attr('data'));
  215 + })
  216 + var btnEdits = $('.btn_edit');
  217 + $.each(btnEdits, function(i,n){
  218 + $(n).html('编辑').attr('data-action','edit');
  219 + })
  220 + $(this).html('保存').attr('data-action','save');
  221 +
  222 + var editMacVal = editMac.attr('data');
  223 + var editDeviceVal = editDevice.attr('data');
  224 + editMac.html('<input type="text" class="mac_edit" value="'+editMacVal+'">');
  225 + editDevice.html('<input type="text" class="device_edit" value="'+editDeviceVal+'">');
  226 + } else {
  227 + var newMAc = editMac.find('.mac_edit').val();
  228 + var newDevice = editDevice.find('.device_edit').val();
  229 + // 请求之后保存
  230 + //$.post()
  231 + editMac.html(newMAc).attr('data', newMAc);
  232 + editDevice.html(newDevice).attr('data', newDevice);
  233 + $(this).html('编辑').attr('data-action','edit');
  234 + }
  235 +
  236 +
  237 + })
  238 +
  239 +
201 240 });
202 241 </script>
203 242 \ No newline at end of file
... ...
app-ht/modules/upgrade/controllers/UpgradeController.php
... ... @@ -369,7 +369,8 @@ class UpgradeController extends BaseController
369 369 * 值:4; 没有文件被上传。
370 370 * date:2018.4.18 from:zhix.net
371 371 */
372   - public function actionUploadFile(){
  372 + public function actionUploadFile()
  373 + {
373 374 header("Expires: Mon, 26 Jul 2020 05:00:00 GMT");
374 375 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
375 376 header("Content-type: text/html; charset=utf-8");
... ... @@ -502,12 +503,12 @@ class UpgradeController extends BaseController
502 503 }
503 504 fclose($out);
504 505 $response = [
505   - 'success'=>true,
506   - 'oldName'=>$oldName,
507   - 'filePath'=>$savePath,
508   - 'fileSize'=>filesize($uploadPath),
509   - 'fileSuffixes'=>$pathInfo['extension'], //文件后缀名
510   - 'file_md5'=>md5_file($uploadPath),
  506 + 'success' => true,
  507 + 'oldName' => $oldName,
  508 + 'filePath' => $savePath,
  509 + 'fileSize' => filesize($uploadPath),
  510 + 'fileSuffixes' => $pathInfo['extension'], //文件后缀名
  511 + 'file_md5' => md5_file($uploadPath),
511 512 ];
512 513 /**
513 514 * 后台操作日志
... ...
app-ht/views/layouts/routes.php
... ... @@ -56,7 +56,9 @@ if (isset($user-&gt;is_manufacture) &amp;&amp; $user-&gt;is_manufacture == 1) {
56 56 'path' => '/device',
57 57 'redirect' => '/device/device/index'
58 58 ],
  59 +
59 60 ['label' => '序列号管理', 'path' => '/device/device/index'],
  61 + ['label' => '授权失败管理', 'path' => '/device/device/auth-fail-index'],
60 62 ['label' => '创建序列号', 'path' => '/device/device/create-device'],
61 63 ]
62 64 ],
... ... @@ -110,12 +112,12 @@ if (isset($user-&gt;is_manufacture) &amp;&amp; $user-&gt;is_manufacture == 1) {
110 112 'routes' => [
111 113 [
112 114 'path' => '/datas',
113   - 'redirect' => '/datas/datas/index'
  115 + 'redirect' => '/datas/upgrade-log/index?type=' . UpgradeStatus::TYPE_OTA
114 116 ],
115   - ['label' => '序列号统计', 'path' => '/datas/datas/index'],
  117 + /*['label' => '序列号统计', 'path' => '/datas/datas/index'], */
116 118 ['label' => 'OTA升级统计', 'path' => '/datas/upgrade-log/index?type=' . UpgradeStatus::TYPE_OTA],
117 119 ['label' => 'APP升级统计', 'path' => '/datas/upgrade-log/index?type=' . UpgradeStatus::TYPE_APP],
118   - ['label' => '机器状态统计', 'path' => '/datas/datas-setting/default'],
  120 + ['label' => '机器状态统计', 'path' => '/datas/device-stats/index'],
119 121 ]
120 122 ],
121 123 [
... ...
app-ht/web/exts-src/baidumap/MarkerClusterer.js
... ... @@ -1,636 +0,0 @@
1   -/**
2   - * @fileoverview MarkerClusterer标记聚合器用来解决加载大量点要素到地图上产生覆盖现象的问题,并提高性能。
3   - * 主入口类是<a href="symbols/BMapLib.MarkerClusterer.html">MarkerClusterer</a>,
4   - * 基于Baidu Map API 1.2。
5   - *
6   - * @author Baidu Map Api Group
7   - * @version 1.2
8   - */
9   -
10   -
11   -/**
12   - * @namespace BMap的所有library类均放在BMapLib命名空间下
13   - */
14   -var BMapLib = window.BMapLib = BMapLib || {};
15   -(function(){
16   -
17   - /**
18   - * 获取一个扩展的视图范围,把上下左右都扩大一样的像素值。
19   - * @param {Map} map BMap.Map的实例化对象
20   - * @param {BMap.Bounds} bounds BMap.Bounds的实例化对象
21   - * @param {Number} gridSize 要扩大的像素值
22   - *
23   - * @return {BMap.Bounds} 返回扩大后的视图范围。
24   - */
25   - var getExtendedBounds = function(map, bounds, gridSize){
26   - bounds = cutBoundsInRange(bounds);
27   - var pixelNE = map.pointToPixel(bounds.getNorthEast());
28   - var pixelSW = map.pointToPixel(bounds.getSouthWest());
29   - pixelNE.x += gridSize;
30   - pixelNE.y -= gridSize;
31   - pixelSW.x -= gridSize;
32   - pixelSW.y += gridSize;
33   - var newNE = map.pixelToPoint(pixelNE);
34   - var newSW = map.pixelToPoint(pixelSW);
35   - return new BMap.Bounds(newSW, newNE);
36   - };
37   -
38   - /**
39   - * 按照百度地图支持的世界范围对bounds进行边界处理
40   - * @param {BMap.Bounds} bounds BMap.Bounds的实例化对象
41   - *
42   - * @return {BMap.Bounds} 返回不越界的视图范围
43   - */
44   - var cutBoundsInRange = function (bounds) {
45   - var maxX = getRange(bounds.getNorthEast().lng, -180, 180);
46   - var minX = getRange(bounds.getSouthWest().lng, -180, 180);
47   - var maxY = getRange(bounds.getNorthEast().lat, -74, 74);
48   - var minY = getRange(bounds.getSouthWest().lat, -74, 74);
49   - return new BMap.Bounds(new BMap.Point(minX, minY), new BMap.Point(maxX, maxY));
50   - };
51   -
52   - /**
53   - * 对单个值进行边界处理。
54   - * @param {Number} i 要处理的数值
55   - * @param {Number} min 下边界值
56   - * @param {Number} max 上边界值
57   - *
58   - * @return {Number} 返回不越界的数值
59   - */
60   - var getRange = function (i, mix, max) {
61   - mix && (i = Math.max(i, mix));
62   - max && (i = Math.min(i, max));
63   - return i;
64   - };
65   -
66   - /**
67   - * 判断给定的对象是否为数组
68   - * @param {Object} source 要测试的对象
69   - *
70   - * @return {Boolean} 如果是数组返回true,否则返回false
71   - */
72   - var isArray = function (source) {
73   - return '[object Array]' === Object.prototype.toString.call(source);
74   - };
75   -
76   - /**
77   - * 返回item在source中的索引位置
78   - * @param {Object} item 要测试的对象
79   - * @param {Array} source 数组
80   - *
81   - * @return {Number} 如果在数组内,返回索引,否则返回-1
82   - */
83   - var indexOf = function(item, source){
84   - var index = -1;
85   - if(isArray(source)){
86   - if (source.indexOf) {
87   - index = source.indexOf(item);
88   - } else {
89   - for (var i = 0, m; m = source[i]; i++) {
90   - if (m === item) {
91   - index = i;
92   - break;
93   - }
94   - }
95   - }
96   - }
97   - return index;
98   - };
99   -
100   - /**
101   - *@exports MarkerClusterer as BMapLib.MarkerClusterer
102   - */
103   - var MarkerClusterer =
104   - /**
105   - * MarkerClusterer
106   - * @class 用来解决加载大量点要素到地图上产生覆盖现象的问题,并提高性能
107   - * @constructor
108   - * @param {Map} map 地图的一个实例。
109   - * @param {Json Object} options 可选参数,可选项包括:<br />
110   - * markers {Array<Marker>} 要聚合的标记数组<br />
111   - * girdSize {Number} 聚合计算时网格的像素大小,默认60<br />
112   - * maxZoom {Number} 最大的聚合级别,大于该级别就不进行相应的聚合<br />
113   - * minClusterSize {Number} 最小的聚合数量,小于该数量的不能成为一个聚合,默认为2<br />
114   - * isAverangeCenter {Boolean} 聚合点的落脚位置是否是所有聚合在内点的平均值,默认为否,落脚在聚合内的第一个点<br />
115   - * styles {Array<IconStyle>} 自定义聚合后的图标风格,请参考TextIconOverlay类<br />
116   - */
117   - BMapLib.MarkerClusterer = function(map, options){
118   - if (!map){
119   - return;
120   - }
121   - this._map = map;
122   - this._markers = [];
123   - this._clusters = [];
124   -
125   - var opts = options || {};
126   - this._gridSize = opts["gridSize"] || 60;
127   - this._maxZoom = opts["maxZoom"] || 18;
128   - this._minClusterSize = opts["minClusterSize"] || 2;
129   - this._isAverageCenter = false;
130   - if (opts['isAverageCenter'] != undefined) {
131   - this._isAverageCenter = opts['isAverageCenter'];
132   - }
133   - this._styles = opts["styles"] || [];
134   -
135   - var that = this;
136   - this._map.addEventListener("zoomend",function(){
137   - that._redraw();
138   - });
139   -
140   - this._map.addEventListener("moveend",function(){
141   - that._redraw();
142   - });
143   -
144   - var mkrs = opts["markers"];
145   - isArray(mkrs) && this.addMarkers(mkrs);
146   - };
147   -
148   - /**
149   - * 添加要聚合的标记数组。
150   - * @param {Array<Marker>} markers 要聚合的标记数组
151   - *
152   - * @return 无返回值。
153   - */
154   - MarkerClusterer.prototype.addMarkers = function(markers){
155   - for(var i = 0, len = markers.length; i <len ; i++){
156   - this._pushMarkerTo(markers[i]);
157   - }
158   - this._createClusters();
159   - };
160   -
161   - /**
162   - * 把一个标记添加到要聚合的标记数组中
163   - * @param {BMap.Marker} marker 要添加的标记
164   - *
165   - * @return 无返回值。
166   - */
167   - MarkerClusterer.prototype._pushMarkerTo = function(marker){
168   -
169   - var index = indexOf(marker, this._markers);
170   - if(index === -1){
171   - marker.isInCluster = false;
172   - this._markers.push(marker);//Marker拖放后enableDragging不做变化,忽略
173   - }
174   - /* 用这个索引方式20万条数据可以把时间缩为原来的 20分之1, 但是会把重复坐标的给 排除 了*/
175   -
176   - /*
177   - var position = marker.getPosition();
178   - var key = 'A'+position.lng+'_'+position.lat;
179   - if (undefined === this._markers[key]) {
180   - marker.isInCluster = false;
181   - this._markers.push(marker);
182   - }
183   - */
184   - };
185   -
186   - /**
187   - * 添加一个聚合的标记。
188   - * @param {BMap.Marker} marker 要聚合的单个标记。
189   - * @return 无返回值。
190   - */
191   - MarkerClusterer.prototype.addMarker = function(marker) {
192   - this._pushMarkerTo(marker);
193   - this._createClusters();
194   - };
195   -
196   - /**
197   - * 根据所给定的标记,创建聚合点
198   - * @return 无返回值
199   - */
200   - MarkerClusterer.prototype._createClusters = function(){
201   - var mapBounds = this._map.getBounds();
202   - var extendedBounds = getExtendedBounds(this._map, mapBounds, this._gridSize);
203   - for(var i = 0, marker; marker = this._markers[i]; i++){
204   - if(!marker.isInCluster && extendedBounds.containsPoint(marker.getPosition()) ){
205   - this._addToClosestCluster(marker);
206   - }
207   - }
208   - var len = this._markers.length;
209   - for (var i = 0; i < len; i++) {
210   - if(this._clusters[i]){
211   - this._clusters[i].render();
212   - }
213   - }
214   - };
215   -
216   - /**
217   - * 根据标记的位置,把它添加到最近的聚合中
218   - * @param {BMap.Marker} marker 要进行聚合的单个标记
219   - *
220   - * @return 无返回值。
221   - */
222   - MarkerClusterer.prototype._addToClosestCluster = function (marker){
223   - var distance = 4000000;
224   - var clusterToAddTo = null;
225   - var position = marker.getPosition();
226   - for(var i = 0, cluster; cluster = this._clusters[i]; i++){
227   - var center = cluster.getCenter();
228   - if(center){
229   - var d = this._map.getDistance(center, marker.getPosition());
230   - if(d < distance){
231   - distance = d;
232   - clusterToAddTo = cluster;
233   - }
234   - }
235   - }
236   -
237   - if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)){
238   - clusterToAddTo.addMarker(marker);
239   - } else {
240   - var cluster = new Cluster(this);
241   - cluster.addMarker(marker);
242   - this._clusters.push(cluster);
243   - }
244   - };
245   -
246   - /**
247   - * 清除上一次的聚合的结果
248   - * @return 无返回值。
249   - */
250   - MarkerClusterer.prototype._clearLastClusters = function(){
251   - for(var i = 0, cluster; cluster = this._clusters[i]; i++){
252   - cluster.remove();
253   - }
254   - this._clusters = [];//置空Cluster数组
255   - this._removeMarkersFromCluster();//把Marker的cluster标记设为false
256   - };
257   -
258   - /**
259   - * 清除某个聚合中的所有标记
260   - * @return 无返回值
261   - */
262   - MarkerClusterer.prototype._removeMarkersFromCluster = function(){
263   - for(var i = 0, marker; marker = this._markers[i]; i++){
264   - marker.isInCluster = false;
265   - }
266   - };
267   -
268   - /**
269   - * 把所有的标记从地图上清除
270   - * @return 无返回值
271   - */
272   - MarkerClusterer.prototype._removeMarkersFromMap = function(){
273   - for(var i = 0, marker; marker = this._markers[i]; i++){
274   - marker.isInCluster = false;
275   - this._map.removeOverlay(marker);
276   - }
277   - };
278   -
279   - /**
280   - * 删除单个标记
281   - * @param {BMap.Marker} marker 需要被删除的marker
282   - *
283   - * @return {Boolean} 删除成功返回true,否则返回false
284   - */
285   - MarkerClusterer.prototype._removeMarker = function(marker) {
286   - var index = indexOf(marker, this._markers);
287   - if (index === -1) {
288   - return false;
289   - }
290   - this._map.removeOverlay(marker);
291   - this._markers.splice(index, 1);
292   - return true;
293   - };
294   -
295   - /**
296   - * 删除单个标记
297   - * @param {BMap.Marker} marker 需要被删除的marker
298   - *
299   - * @return {Boolean} 删除成功返回true,否则返回false
300   - */
301   - MarkerClusterer.prototype.removeMarker = function(marker) {
302   - var success = this._removeMarker(marker);
303   - if (success) {
304   - this._clearLastClusters();
305   - this._createClusters();
306   - }
307   - return success;
308   - };
309   -
310   - /**
311   - * 删除一组标记
312   - * @param {Array<BMap.Marker>} markers 需要被删除的marker数组
313   - *
314   - * @return {Boolean} 删除成功返回true,否则返回false
315   - */
316   - MarkerClusterer.prototype.removeMarkers = function(markers) {
317   - var success = false;
318   - for (var i = 0; i < markers.length; i++) {
319   - var r = this._removeMarker(markers[i]);
320   - success = success || r;
321   - }
322   -
323   - if (success) {
324   - this._clearLastClusters();
325   - this._createClusters();
326   - }
327   - return success;
328   - };
329   -
330   - /**
331   - * 从地图上彻底清除所有的标记
332   - * @return 无返回值
333   - */
334   - MarkerClusterer.prototype.clearMarkers = function() {
335   - this._clearLastClusters();
336   - this._removeMarkersFromMap();
337   - this._markers = [];
338   - };
339   -
340   - /**
341   - * 重新生成,比如改变了属性等
342   - * @return 无返回值
343   - */
344   - MarkerClusterer.prototype._redraw = function () {
345   - this._clearLastClusters();
346   - this._createClusters();
347   - };
348   -
349   - /**
350   - * 获取网格大小
351   - * @return {Number} 网格大小
352   - */
353   - MarkerClusterer.prototype.getGridSize = function() {
354   - return this._gridSize;
355   - };
356   -
357   - /**
358   - * 设置网格大小
359   - * @param {Number} size 网格大小
360   - * @return 无返回值
361   - */
362   - MarkerClusterer.prototype.setGridSize = function(size) {
363   - this._gridSize = size;
364   - this._redraw();
365   - };
366   -
367   - /**
368   - * 获取聚合的最大缩放级别。
369   - * @return {Number} 聚合的最大缩放级别。
370   - */
371   - MarkerClusterer.prototype.getMaxZoom = function() {
372   - return this._maxZoom;
373   - };
374   -
375   - /**
376   - * 设置聚合的最大缩放级别
377   - * @param {Number} maxZoom 聚合的最大缩放级别
378   - * @return 无返回值
379   - */
380   - MarkerClusterer.prototype.setMaxZoom = function(maxZoom) {
381   - this._maxZoom = maxZoom;
382   - this._redraw();
383   - };
384   -
385   - /**
386   - * 获取聚合的样式风格集合
387   - * @return {Array<IconStyle>} 聚合的样式风格集合
388   - */
389   - MarkerClusterer.prototype.getStyles = function() {
390   - return this._styles;
391   - };
392   -
393   - /**
394   - * 设置聚合的样式风格集合
395   - * @param {Array<IconStyle>} styles 样式风格数组
396   - * @return 无返回值
397   - */
398   - MarkerClusterer.prototype.setStyles = function(styles) {
399   - this._styles = styles;
400   - this._redraw();
401   - };
402   -
403   - /**
404   - * 获取单个聚合的最小数量。
405   - * @return {Number} 单个聚合的最小数量。
406   - */
407   - MarkerClusterer.prototype.getMinClusterSize = function() {
408   - return this._minClusterSize;
409   - };
410   -
411   - /**
412   - * 设置单个聚合的最小数量。
413   - * @param {Number} size 单个聚合的最小数量。
414   - * @return 无返回值。
415   - */
416   - MarkerClusterer.prototype.setMinClusterSize = function(size) {
417   - this._minClusterSize = size;
418   - this._redraw();
419   - };
420   -
421   - /**
422   - * 获取单个聚合的落脚点是否是聚合内所有标记的平均中心。
423   - * @return {Boolean} true或false。
424   - */
425   - MarkerClusterer.prototype.isAverageCenter = function() {
426   - return this._isAverageCenter;
427   - };
428   -
429   - /**
430   - * 获取聚合的Map实例。
431   - * @return {Map} Map的示例。
432   - */
433   - MarkerClusterer.prototype.getMap = function() {
434   - return this._map;
435   - };
436   -
437   - /**
438   - * 获取所有的标记数组。
439   - * @return {Array<Marker>} 标记数组。
440   - */
441   - MarkerClusterer.prototype.getMarkers = function() {
442   - return this._markers;
443   - };
444   -
445   - /**
446   - * 获取聚合的总数量。
447   - * @return {Number} 聚合的总数量。
448   - */
449   - MarkerClusterer.prototype.getClustersCount = function() {
450   - var count = 0;
451   - for(var i = 0, cluster; cluster = this._clusters[i]; i++){
452   - cluster.isReal() && count++;
453   - }
454   - return count;
455   - };
456   -
457   - /**
458   - * @ignore
459   - * Cluster
460   - * @class 表示一个聚合对象,该聚合,包含有N个标记,这N个标记组成的范围,并有予以显示在Map上的TextIconOverlay等。
461   - * @constructor
462   - * @param {MarkerClusterer} markerClusterer 一个标记聚合器示例。
463   - */
464   - function Cluster(markerClusterer){
465   - this._markerClusterer = markerClusterer;
466   - this._map = markerClusterer.getMap();
467   - this._minClusterSize = markerClusterer.getMinClusterSize();
468   - this._isAverageCenter = markerClusterer.isAverageCenter();
469   - this._center = null;//落脚位置
470   - this._markers = [];//这个Cluster中所包含的markers
471   - this._gridBounds = null;//以中心点为准,向四边扩大gridSize个像素的范围,也即网格范围
472   - this._isReal = false; //真的是个聚合
473   -
474   - this._clusterMarker = new BMapLib.TextIconOverlay(this._center, this._markers.length, {"styles":this._markerClusterer.getStyles()});
475   - //this._map.addOverlay(this._clusterMarker);
476   - }
477   -
478   - /**
479   - * 向该聚合添加一个标记。
480   - * @param {Marker} marker 要添加的标记。
481   - * @return 无返回值。
482   - */
483   - Cluster.prototype.addMarker = function(marker){
484   - if(this.isMarkerInCluster(marker)){
485   - return false;
486   - }//也可用marker.isInCluster判断,外面判断OK,这里基本不会命中
487   -
488   - if (!this._center){
489   - this._center = marker.getPosition();
490   - this.updateGridBounds();//
491   - } else {
492   - if(this._isAverageCenter){
493   - var l = this._markers.length + 1;
494   - var lat = (this._center.lat * (l - 1) + marker.getPosition().lat) / l;
495   - var lng = (this._center.lng * (l - 1) + marker.getPosition().lng) / l;
496   - this._center = new BMap.Point(lng, lat);
497   - this.updateGridBounds();
498   - }//计算新的Center
499   - }
500   -
501   - marker.isInCluster = true;
502   - this._markers.push(marker);
503   - /*
504   - var len = this._markers.length;
505   - if(len < this._minClusterSize ){
506   - this._map.addOverlay(marker);
507   - //this.updateClusterMarker();
508   - return true;
509   - } else if (len === this._minClusterSize) {
510   - for (var i = 0; i < len; i++) {
511   - this._markers[i].getMap() && this._map.removeOverlay(this._markers[i]);
512   - }
513   -
514   - }
515   - this._map.addOverlay(this._clusterMarker);
516   - this._isReal = true;
517   - this.updateClusterMarker();
518   - return true; */
519   - };
520   - Cluster.prototype.render = function(){
521   - var len = this._markers.length;
522   -
523   - if (len < this._minClusterSize) {
524   - for (var i = 0; i < len; i++) {
525   - this._map.addOverlay(this._markers[i]);
526   - }
527   - } else {
528   - this._map.addOverlay(this._clusterMarker);
529   - this._isReal = true;
530   - this.updateClusterMarker();
531   - }
532   - }
533   - /**
534   - * 判断一个标记是否在该聚合中。
535   - * @param {Marker} marker 要判断的标记。
536   - * @return {Boolean} true或false。
537   - */
538   - Cluster.prototype.isMarkerInCluster= function(marker){
539   - if (this._markers.indexOf) {
540   - return this._markers.indexOf(marker) != -1;
541   - } else {
542   - for (var i = 0, m; m = this._markers[i]; i++) {
543   - if (m === marker) {
544   - return true;
545   - }
546   - }
547   - }
548   - return false;
549   - };
550   -
551   - /**
552   - * 判断一个标记是否在该聚合网格范围中。
553   - * @param {Marker} marker 要判断的标记。
554   - * @return {Boolean} true或false。
555   - */
556   - Cluster.prototype.isMarkerInClusterBounds = function(marker) {
557   - return this._gridBounds.containsPoint(marker.getPosition());
558   - };
559   -
560   - Cluster.prototype.isReal = function(marker) {
561   - return this._isReal;
562   - };
563   -
564   - /**
565   - * 更新该聚合的网格范围。
566   - * @return 无返回值。
567   - */
568   - Cluster.prototype.updateGridBounds = function() {
569   - var bounds = new BMap.Bounds(this._center, this._center);
570   - this._gridBounds = getExtendedBounds(this._map, bounds, this._markerClusterer.getGridSize());
571   - };
572   -
573   - /**
574   - * 更新该聚合的显示样式,也即TextIconOverlay。
575   - * @return 无返回值。
576   - */
577   - Cluster.prototype.updateClusterMarker = function () {
578   - if (this._map.getZoom() > this._markerClusterer.getMaxZoom()) {
579   - this._clusterMarker && this._map.removeOverlay(this._clusterMarker);
580   - for (var i = 0, marker; marker = this._markers[i]; i++) {
581   - this._map.addOverlay(marker);
582   - }
583   - return;
584   - }
585   -
586   - if (this._markers.length < this._minClusterSize) {
587   - this._clusterMarker.hide();
588   - return;
589   - }
590   -
591   - this._clusterMarker.setPosition(this._center);
592   -
593   - this._clusterMarker.setText(this._markers.length);
594   -
595   - var thatMap = this._map;
596   - var thatBounds = this.getBounds();
597   - this._clusterMarker.addEventListener("click", function(event){
598   - thatMap.setViewport(thatBounds);
599   - });
600   -
601   - };
602   -
603   - /**
604   - * 删除该聚合。
605   - * @return 无返回值。
606   - */
607   - Cluster.prototype.remove = function(){
608   - for (var i = 0, m; m = this._markers[i]; i++) {
609   - this._markers[i].getMap() && this._map.removeOverlay(this._markers[i]);
610   - }//清除散的标记点
611   - this._map.removeOverlay(this._clusterMarker);
612   - this._markers.length = 0;
613   - delete this._markers;
614   - }
615   -
616   - /**
617   - * 获取该聚合所包含的所有标记的最小外接矩形的范围。
618   - * @return {BMap.Bounds} 计算出的范围。
619   - */
620   - Cluster.prototype.getBounds = function() {
621   - var bounds = new BMap.Bounds(this._center,this._center);
622   - for (var i = 0, marker; marker = this._markers[i]; i++) {
623   - bounds.extend(marker.getPosition());
624   - }
625   - return bounds;
626   - };
627   -
628   - /**
629   - * 获取该聚合的落脚点。
630   - * @return {BMap.Point} 该聚合的落脚点。
631   - */
632   - Cluster.prototype.getCenter = function() {
633   - return this._center;
634   - };
635   -
636   -})();
637 0 \ No newline at end of file
app-ht/web/exts-src/baidumap/TextIconOverlay.js
... ... @@ -1,1046 +0,0 @@
1   -/**
2   - * @fileoverview 此类表示地图上的一个覆盖物,该覆盖物由文字和图标组成,从Overlay继承。
3   - * 主入口类是<a href="symbols/BMapLib.TextIconOverlay.html">TextIconOverlay</a>,
4   - * 基于Baidu Map API 1.2。
5   - *
6   - * @author Baidu Map Api Group
7   - * @version 1.2
8   - */
9   -
10   -
11   -/**
12   - * @namespace BMap的所有library类均放在BMapLib命名空间下
13   - */
14   -var BMapLib = window.BMapLib = BMapLib || {};
15   -
16   -(function () {
17   -
18   - /**
19   - * 声明baidu包
20   - */
21   - var T,
22   - baidu = T = baidu || {version: "1.3.8"};
23   -
24   - (function (){
25   - //提出guid,防止在与老版本Tangram混用时
26   - //在下一行错误的修改window[undefined]
27   - baidu.guid = "$BAIDU$";
28   -
29   - //Tangram可能被放在闭包中
30   - //一些页面级别唯一的属性,需要挂载在window[baidu.guid]上
31   - window[baidu.guid] = window[baidu.guid] || {};
32   -
33   - /**
34   - * @ignore
35   - * @namespace baidu.dom 操作dom的方法。
36   - */
37   - baidu.dom = baidu.dom || {};
38   -
39   -
40   - /**
41   - * 从文档中获取指定的DOM元素
42   - * @name baidu.dom.g
43   - * @function
44   - * @grammar baidu.dom.g(id)
45   - * @param {string|HTMLElement} id 元素的id或DOM元素
46   - * @shortcut g,T.G
47   - * @meta standard
48   - * @see baidu.dom.q
49   - *
50   - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数
51   - */
52   - baidu.dom.g = function (id) {
53   - if ('string' == typeof id || id instanceof String) {
54   - return document.getElementById(id);
55   - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) {
56   - return id;
57   - }
58   - return null;
59   - };
60   -
61   - // 声明快捷方法
62   - baidu.g = baidu.G = baidu.dom.g;
63   -
64   - /**
65   - * 获取目标元素所属的document对象
66   - * @name baidu.dom.getDocument
67   - * @function
68   - * @grammar baidu.dom.getDocument(element)
69   - * @param {HTMLElement|string} element 目标元素或目标元素的id
70   - * @meta standard
71   - * @see baidu.dom.getWindow
72   - *
73   - * @returns {HTMLDocument} 目标元素所属的document对象
74   - */
75   - baidu.dom.getDocument = function (element) {
76   - element = baidu.dom.g(element);
77   - return element.nodeType == 9 ? element : element.ownerDocument || element.document;
78   - };
79   -
80   - /**
81   - * @ignore
82   - * @namespace baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。
83   - */
84   - baidu.lang = baidu.lang || {};
85   -
86   - /**
87   - * 判断目标参数是否string类型或String对象
88   - * @name baidu.lang.isString
89   - * @function
90   - * @grammar baidu.lang.isString(source)
91   - * @param {Any} source 目标参数
92   - * @shortcut isString
93   - * @meta standard
94   - * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
95   - *
96   - * @returns {boolean} 类型判断结果
97   - */
98   - baidu.lang.isString = function (source) {
99   - return '[object String]' == Object.prototype.toString.call(source);
100   - };
101   -
102   - // 声明快捷方法
103   - baidu.isString = baidu.lang.isString;
104   -
105   - /**
106   - * 从文档中获取指定的DOM元素
107   - * **内部方法**
108   - *
109   - * @param {string|HTMLElement} id 元素的id或DOM元素
110   - * @meta standard
111   - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数
112   - */
113   - baidu.dom._g = function (id) {
114   - if (baidu.lang.isString(id)) {
115   - return document.getElementById(id);
116   - }
117   - return id;
118   - };
119   -
120   - // 声明快捷方法
121   - baidu._g = baidu.dom._g;
122   -
123   - /**
124   - * @ignore
125   - * @namespace baidu.browser 判断浏览器类型和特性的属性。
126   - */
127   - baidu.browser = baidu.browser || {};
128   -
129   - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) {
130   - //IE 8下,以documentMode为准
131   - //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241
132   - /**
133   - * 判断是否为ie浏览器
134   - * @property ie ie版本号
135   - * @grammar baidu.browser.ie
136   - * @meta standard
137   - * @shortcut ie
138   - * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon
139   - */
140   - baidu.browser.ie = baidu.ie = document.documentMode || + RegExp['\x241'];
141   - }
142   -
143   - /**
144   - * 获取目标元素的computed style值。如果元素的样式值不能被浏览器计算,则会返回空字符串(IE)
145   - *
146   - * @author berg
147   - * @name baidu.dom.getComputedStyle
148   - * @function
149   - * @grammar baidu.dom.getComputedStyle(element, key)
150   - * @param {HTMLElement|string} element 目标元素或目标元素的id
151   - * @param {string} key 要获取的样式名
152   - *
153   - * @see baidu.dom.getStyle
154   - *
155   - * @returns {string} 目标元素的computed style值
156   - */
157   -
158   - baidu.dom.getComputedStyle = function(element, key){
159   - element = baidu.dom._g(element);
160   - var doc = baidu.dom.getDocument(element),
161   - styles;
162   - if (doc.defaultView && doc.defaultView.getComputedStyle) {
163   - styles = doc.defaultView.getComputedStyle(element, null);
164   - if (styles) {
165   - return styles[key] || styles.getPropertyValue(key);
166   - }
167   - }
168   - return '';
169   - };
170   -
171   - /**
172   - * 提供给setStyle与getStyle使用
173   - */
174   - baidu.dom._styleFixer = baidu.dom._styleFixer || {};
175   -
176   - /**
177   - * 提供给setStyle与getStyle使用
178   - */
179   - baidu.dom._styleFilter = baidu.dom._styleFilter || [];
180   -
181   - /**
182   - * 为获取和设置样式的过滤器
183   - * @private
184   - * @meta standard
185   - */
186   - baidu.dom._styleFilter.filter = function (key, value, method) {
187   - for (var i = 0, filters = baidu.dom._styleFilter, filter; filter = filters[i]; i++) {
188   - if (filter = filter[method]) {
189   - value = filter(key, value);
190   - }
191   - }
192   - return value;
193   - };
194   -
195   - /**
196   - * @ignore
197   - * @namespace baidu.string 操作字符串的方法。
198   - */
199   - baidu.string = baidu.string || {};
200   -
201   - /**
202   - * 将目标字符串进行驼峰化处理
203   - * @name baidu.string.toCamelCase
204   - * @function
205   - * @grammar baidu.string.toCamelCase(source)
206   - * @param {string} source 目标字符串
207   - * @remark
208   - * 支持单词以“-_”分隔
209   - * @meta standard
210   - *
211   - * @returns {string} 驼峰化处理后的字符串
212   - */
213   - baidu.string.toCamelCase = function (source) {
214   - //提前判断,提高getStyle等的效率 thanks xianwei
215   - if (source.indexOf('-') < 0 && source.indexOf('_') < 0) {
216   - return source;
217   - }
218   - return source.replace(/[-_][^-_]/g, function (match) {
219   - return match.charAt(1).toUpperCase();
220   - });
221   - };
222   -
223   - /**
224   - * 获取目标元素的样式值
225   - * @name baidu.dom.getStyle
226   - * @function
227   - * @grammar baidu.dom.getStyle(element, key)
228   - * @param {HTMLElement|string} element 目标元素或目标元素的id
229   - * @param {string} key 要获取的样式名
230   - * @remark
231   - *
232   - * 为了精简代码,本模块默认不对任何浏览器返回值进行归一化处理(如使用getStyle时,不同浏览器下可能返回rgb颜色或hex颜色),也不会修复浏览器的bug和差异性(如设置IE的float属性叫styleFloat,firefox则是cssFloat)。<br />
233   - * baidu.dom._styleFixer和baidu.dom._styleFilter可以为本模块提供支持。<br />
234   - * 其中_styleFilter能对颜色和px进行归一化处理,_styleFixer能对display,float,opacity,textOverflow的浏览器兼容性bug进行处理。
235   - * @shortcut getStyle
236   - * @meta standard
237   - * @see baidu.dom.setStyle,baidu.dom.setStyles, baidu.dom.getComputedStyle
238   - *
239   - * @returns {string} 目标元素的样式值
240   - */
241   - baidu.dom.getStyle = function (element, key) {
242   - var dom = baidu.dom;
243   -
244   - element = dom.g(element);
245   - key = baidu.string.toCamelCase(key);
246   - //computed style, then cascaded style, then explicitly set style.
247   - var value = element.style[key] ||
248   - (element.currentStyle ? element.currentStyle[key] : "") ||
249   - dom.getComputedStyle(element, key);
250   -
251   - // 在取不到值的时候,用fixer进行修正
252   - if (!value) {
253   - var fixer = dom._styleFixer[key];
254   - if(fixer){
255   - value = fixer.get ? fixer.get(element) : baidu.dom.getStyle(element, fixer);
256   - }
257   - }
258   -
259   - /* 检查结果过滤器 */
260   - if (fixer = dom._styleFilter) {
261   - value = fixer.filter(key, value, 'get');
262   - }
263   -
264   - return value;
265   - };
266   -
267   - // 声明快捷方法
268   - baidu.getStyle = baidu.dom.getStyle;
269   -
270   -
271   - if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) {
272   - /**
273   - * 判断是否为opera浏览器
274   - * @property opera opera版本号
275   - * @grammar baidu.browser.opera
276   - * @meta standard
277   - * @see baidu.browser.ie,baidu.browser.firefox,baidu.browser.safari,baidu.browser.chrome
278   - */
279   - baidu.browser.opera = + RegExp['\x241'];
280   - }
281   -
282   - /**
283   - * 判断是否为webkit内核
284   - * @property isWebkit
285   - * @grammar baidu.browser.isWebkit
286   - * @meta standard
287   - * @see baidu.browser.isGecko
288   - */
289   - baidu.browser.isWebkit = /webkit/i.test(navigator.userAgent);
290   -
291   - /**
292   - * 判断是否为gecko内核
293   - * @property isGecko
294   - * @grammar baidu.browser.isGecko
295   - * @meta standard
296   - * @see baidu.browser.isWebkit
297   - */
298   - baidu.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent);
299   -
300   - /**
301   - * 判断是否严格标准的渲染模式
302   - * @property isStrict
303   - * @grammar baidu.browser.isStrict
304   - * @meta standard
305   - */
306   - baidu.browser.isStrict = document.compatMode == "CSS1Compat";
307   -
308   - /**
309   - * 获取目标元素相对于整个文档左上角的位置
310   - * @name baidu.dom.getPosition
311   - * @function
312   - * @grammar baidu.dom.getPosition(element)
313   - * @param {HTMLElement|string} element 目标元素或目标元素的id
314   - * @meta standard
315   - *
316   - * @returns {Object} 目标元素的位置,键值为top和left的Object。
317   - */
318   - baidu.dom.getPosition = function (element) {
319   - element = baidu.dom.g(element);
320   - var doc = baidu.dom.getDocument(element),
321   - browser = baidu.browser,
322   - getStyle = baidu.dom.getStyle,
323   - // Gecko 1.9版本以下用getBoxObjectFor计算位置
324   - // 但是某些情况下是有bug的
325   - // 对于这些有bug的情况
326   - // 使用递归查找的方式
327   - BUGGY_GECKO_BOX_OBJECT = browser.isGecko > 0 &&
328   - doc.getBoxObjectFor &&
329   - getStyle(element, 'position') == 'absolute' &&
330   - (element.style.top === '' || element.style.left === ''),
331   - pos = {"left":0,"top":0},
332   - viewport = (browser.ie && !browser.isStrict) ? doc.body : doc.documentElement,
333   - parent,
334   - box;
335   -
336   - if(element == viewport){
337   - return pos;
338   - }
339   -
340   - if(element.getBoundingClientRect){ // IE and Gecko 1.9+
341   -
342   - //当HTML或者BODY有border width时, 原生的getBoundingClientRect返回值是不符合预期的
343   - //考虑到通常情况下 HTML和BODY的border只会设成0px,所以忽略该问题.
344   - box = element.getBoundingClientRect();
345   -
346   - pos.left = Math.floor(box.left) + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
347   - pos.top = Math.floor(box.top) + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
348   -
349   - // IE会给HTML元素添加一个border,默认是medium(2px)
350   - // 但是在IE 6 7 的怪异模式下,可以被html { border: 0; } 这条css规则覆盖
351   - // 在IE7的标准模式下,border永远是2px,这个值通过clientLeft 和 clientTop取得
352   - // 但是。。。在IE 6 7的怪异模式,如果用户使用css覆盖了默认的medium
353   - // clientTop和clientLeft不会更新
354   - pos.left -= doc.documentElement.clientLeft;
355   - pos.top -= doc.documentElement.clientTop;
356   -
357   - var htmlDom = doc.body,
358   - // 在这里,不使用element.style.borderLeftWidth,只有computedStyle是可信的
359   - htmlBorderLeftWidth = parseInt(getStyle(htmlDom, 'borderLeftWidth')),
360   - htmlBorderTopWidth = parseInt(getStyle(htmlDom, 'borderTopWidth'));
361   - if(browser.ie && !browser.isStrict){
362   - pos.left -= isNaN(htmlBorderLeftWidth) ? 2 : htmlBorderLeftWidth;
363   - pos.top -= isNaN(htmlBorderTopWidth) ? 2 : htmlBorderTopWidth;
364   - }
365   - } else {
366   - // safari/opera/firefox
367   - parent = element;
368   -
369   - do {
370   - pos.left += parent.offsetLeft;
371   - pos.top += parent.offsetTop;
372   -
373   - // safari里面,如果遍历到了一个fixed的元素,后面的offset都不准了
374   - if (browser.isWebkit > 0 && getStyle(parent, 'position') == 'fixed') {
375   - pos.left += doc.body.scrollLeft;
376   - pos.top += doc.body.scrollTop;
377   - break;
378   - }
379   -
380   - parent = parent.offsetParent;
381   - } while (parent && parent != element);
382   -
383   - // 对body offsetTop的修正
384   - if(browser.opera > 0 || (browser.isWebkit > 0 && getStyle(element, 'position') == 'absolute')){
385   - pos.top -= doc.body.offsetTop;
386   - }
387   -
388   - // 计算除了body的scroll
389   - parent = element.offsetParent;
390   - while (parent && parent != doc.body) {
391   - pos.left -= parent.scrollLeft;
392   - // see https://bugs.opera.com/show_bug.cgi?id=249965
393   - if (!browser.opera || parent.tagName != 'TR') {
394   - pos.top -= parent.scrollTop;
395   - }
396   - parent = parent.offsetParent;
397   - }
398   - }
399   -
400   - return pos;
401   - };
402   -
403   - /**
404   - * @ignore
405   - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。
406   - * @property target 事件的触发元素
407   - * @property pageX 鼠标事件的鼠标x坐标
408   - * @property pageY 鼠标事件的鼠标y坐标
409   - * @property keyCode 键盘事件的键值
410   - */
411   - baidu.event = baidu.event || {};
412   -
413   - /**
414   - * 事件监听器的存储表
415   - * @private
416   - * @meta standard
417   - */
418   - baidu.event._listeners = baidu.event._listeners || [];
419   -
420   - /**
421   - * 为目标元素添加事件监听器
422   - * @name baidu.event.on
423   - * @function
424   - * @grammar baidu.event.on(element, type, listener)
425   - * @param {HTMLElement|string|window} element 目标元素或目标元素id
426   - * @param {string} type 事件类型
427   - * @param {Function} listener 需要添加的监听器
428   - * @remark
429   - *
430   - 1. 不支持跨浏览器的鼠标滚轮事件监听器添加<br>
431   - 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败
432   -
433   - * @shortcut on
434   - * @meta standard
435   - * @see baidu.event.un
436   - *
437   - * @returns {HTMLElement|window} 目标元素
438   - */
439   - baidu.event.on = function (element, type, listener) {
440   - type = type.replace(/^on/i, '');
441   - element = baidu.dom._g(element);
442   -
443   - var realListener = function (ev) {
444   - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载
445   - // 2. element是为了修正this
446   - listener.call(element, ev);
447   - },
448   - lis = baidu.event._listeners,
449   - filter = baidu.event._eventFilter,
450   - afterFilter,
451   - realType = type;
452   - type = type.toLowerCase();
453   - // filter过滤
454   - if(filter && filter[type]){
455   - afterFilter = filter[type](element, type, realListener);
456   - realType = afterFilter.type;
457   - realListener = afterFilter.listener;
458   - }
459   -
460   - // 事件监听器挂载
461   - if (element.addEventListener) {
462   - element.addEventListener(realType, realListener, false);
463   - } else if (element.attachEvent) {
464   - element.attachEvent('on' + realType, realListener);
465   - }
466   -
467   - // 将监听器存储到数组中
468   - lis[lis.length] = [element, type, listener, realListener, realType];
469   - return element;
470   - };
471   -
472   - // 声明快捷方法
473   - baidu.on = baidu.event.on;
474   -
475   - /**
476   - * 返回一个当前页面的唯一标识字符串。
477   - * @name baidu.lang.guid
478   - * @function
479   - * @grammar baidu.lang.guid()
480   - * @version 1.1.1
481   - * @meta standard
482   - *
483   - * @returns {String} 当前页面的唯一标识字符串
484   - */
485   -
486   - (function(){
487   - //不直接使用window,可以提高3倍左右性能
488   - var guid = window[baidu.guid];
489   -
490   - baidu.lang.guid = function() {
491   - return "TANGRAM__" + (guid._counter ++).toString(36);
492   - };
493   -
494   - guid._counter = guid._counter || 1;
495   - })();
496   -
497   - /**
498   - * 所有类的实例的容器
499   - * key为每个实例的guid
500   - * @meta standard
501   - */
502   -
503   - window[baidu.guid]._instances = window[baidu.guid]._instances || {};
504   -
505   - /**
506   - * 判断目标参数是否为function或Function实例
507   - * @name baidu.lang.isFunction
508   - * @function
509   - * @grammar baidu.lang.isFunction(source)
510   - * @param {Any} source 目标参数
511   - * @version 1.2
512   - * @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
513   - * @meta standard
514   - * @returns {boolean} 类型判断结果
515   - */
516   - baidu.lang.isFunction = function (source) {
517   - // chrome下,'function' == typeof /a/ 为true.
518   - return '[object Function]' == Object.prototype.toString.call(source);
519   - };
520   -
521   - /**
522   - *
523   - * @ignore
524   - * @class Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。
525   - * @name baidu.lang.Class
526   - * @grammar baidu.lang.Class(guid)
527   - * @param {string} guid 对象的唯一标识
528   - * @meta standard
529   - * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。<br>baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。
530   - * @meta standard
531   - * @see baidu.lang.inherits,baidu.lang.Event
532   - */
533   - baidu.lang.Class = function(guid) {
534   - this.guid = guid || baidu.lang.guid();
535   - window[baidu.guid]._instances[this.guid] = this;
536   - };
537   - window[baidu.guid]._instances = window[baidu.guid]._instances || {};
538   -
539   - /**
540   - * 释放对象所持有的资源,主要是自定义事件。
541   - * @name dispose
542   - * @grammar obj.dispose()
543   - */
544   - baidu.lang.Class.prototype.dispose = function(){
545   - delete window[baidu.guid]._instances[this.guid];
546   -
547   - for(var property in this){
548   - if (!baidu.lang.isFunction(this[property])) {
549   - delete this[property];
550   - }
551   - }
552   - this.disposed = true;
553   - };
554   -
555   - /**
556   - * 重载了默认的toString方法,使得返回信息更加准确一些。
557   - * @return {string} 对象的String表示形式
558   - */
559   - baidu.lang.Class.prototype.toString = function(){
560   - return "[object " + (this._className || "Object" ) + "]";
561   - };
562   -
563   - /**
564   - * @ignore
565   - * @class 自定义的事件对象。
566   - * @name baidu.lang.Event
567   - * @grammar baidu.lang.Event(type[, target])
568   - * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。
569   - * @param {Object} [target]触发事件的对象
570   - * @meta standard
571   - * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。
572   - * @meta standard
573   - * @see baidu.lang.Class
574   - */
575   - baidu.lang.Event = function (type, target) {
576   - this.type = type;
577   - this.returnValue = true;
578   - this.target = target || null;
579   - this.currentTarget = null;
580   - };
581   -
582   - /**
583   - * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
584   - * @grammar obj.addEventListener(type, handler[, key])
585   - * @param {string} type 自定义事件的名称
586   - * @param {Function} handler 自定义事件被触发时应该调用的回调函数
587   - * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。
588   - * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。
589   - */
590   - baidu.lang.Class.prototype.addEventListener = function (type, handler, key) {
591   - if (!baidu.lang.isFunction(handler)) {
592   - return;
593   - }
594   -
595   - !this.__listeners && (this.__listeners = {});
596   -
597   - var t = this.__listeners, id;
598   - if (typeof key == "string" && key) {
599   - if (/[^\w\-]/.test(key)) {
600   - throw("nonstandard key:" + key);
601   - } else {
602   - handler.hashCode = key;
603   - id = key;
604   - }
605   - }
606   - type.indexOf("on") != 0 && (type = "on" + type);
607   -
608   - typeof t[type] != "object" && (t[type] = {});
609   - id = id || baidu.lang.guid();
610   - handler.hashCode = id;
611   - t[type][id] = handler;
612   - };
613   -
614   - /**
615   - * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
616   - * @grammar obj.removeEventListener(type, handler)
617   - * @param {string} type 事件类型
618   - * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key
619   - * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。
620   - */
621   - baidu.lang.Class.prototype.removeEventListener = function (type, handler) {
622   - if (typeof handler != "undefined") {
623   - if ( (baidu.lang.isFunction(handler) && ! (handler = handler.hashCode))
624   - || (! baidu.lang.isString(handler))
625   - ){
626   - return;
627   - }
628   - }
629   -
630   - !this.__listeners && (this.__listeners = {});
631   -
632   - type.indexOf("on") != 0 && (type = "on" + type);
633   -
634   - var t = this.__listeners;
635   - if (!t[type]) {
636   - return;
637   - }
638   - if (typeof handler != "undefined") {
639   - t[type][handler] && delete t[type][handler];
640   - } else {
641   - for(var guid in t[type]){
642   - delete t[type][guid];
643   - }
644   - }
645   - };
646   -
647   - /**
648   - * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
649   - * @grammar obj.dispatchEvent(event, options)
650   - * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持)
651   - * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持)
652   - * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。例如:<br>
653   - myobj.onMyEvent = function(){}<br>
654   - myobj.addEventListener("onMyEvent", function(){});
655   - */
656   - baidu.lang.Class.prototype.dispatchEvent = function (event, options) {
657   - if (baidu.lang.isString(event)) {
658   - event = new baidu.lang.Event(event);
659   - }
660   - !this.__listeners && (this.__listeners = {});
661   -
662   - // 20100603 添加本方法的第二个参数,将 options extend到event中去传递
663   - options = options || {};
664   - for (var i in options) {
665   - event[i] = options[i];
666   - }
667   -
668   - var i, t = this.__listeners, p = event.type;
669   - event.target = event.target || this;
670   - event.currentTarget = this;
671   -
672   - p.indexOf("on") != 0 && (p = "on" + p);
673   -
674   - baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments);
675   -
676   - if (typeof t[p] == "object") {
677   - for (i in t[p]) {
678   - t[p][i].apply(this, arguments);
679   - }
680   - }
681   - return event.returnValue;
682   - };
683   -
684   -
685   - baidu.lang.inherits = function (subClass, superClass, className) {
686   - var key, proto,
687   - selfProps = subClass.prototype,
688   - clazz = new Function();
689   -
690   - clazz.prototype = superClass.prototype;
691   - proto = subClass.prototype = new clazz();
692   - for (key in selfProps) {
693   - proto[key] = selfProps[key];
694   - }
695   - subClass.prototype.constructor = subClass;
696   - subClass.superClass = superClass.prototype;
697   -
698   - // 类名标识,兼容Class的toString,基本没用
699   - if ("string" == typeof className) {
700   - proto._className = className;
701   - }
702   - };
703   - // 声明快捷方法
704   - baidu.inherits = baidu.lang.inherits;
705   - })();
706   -
707   -
708   - /**
709   -
710   - * 图片的路径
711   -
712   - * @private
713   - * @type {String}
714   -
715   - */
716   - var _IMAGE_PATH = 'http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m';
717   -
718   - /**
719   -
720   - * 图片的后缀名
721   -
722   - * @private
723   - * @type {String}
724   -
725   - */
726   - var _IMAGE_EXTENSION = 'png';
727   -
728   - /**
729   - *@exports TextIconOverlay as BMapLib.TextIconOverlay
730   - */
731   - var TextIconOverlay =
732   - /**
733   - * TextIconOverlay
734   - * @class 此类表示地图上的一个覆盖物,该覆盖物由文字和图标组成,从Overlay继承。文字通常是数字(0-9)或字母(A-Z ),而文字与图标之间有一定的映射关系。
735   - *该覆盖物适用于以下类似的场景:需要在地图上添加一系列覆盖物,这些覆盖物之间用不同的图标和文字来区分,文字可能表示了该覆盖物的某一属性值,根据该文字和一定的映射关系,自动匹配相应颜色和大小的图标。
736   - *
737   - *@constructor
738   - *@param {Point} position 表示一个经纬度坐标位置。
739   - *@param {String} text 表示该覆盖物显示的文字信息。
740   - *@param {Json Object} options 可选参数,可选项包括:<br />
741   - *"<b>styles</b>":{Array<IconStyle>} 一组图标风格。单个图表风格包括以下几个属性:<br />
742   - * url {String} 图片的url地址。(必选)<br />
743   - * size {Size} 图片的大小。(必选)<br />
744   - * anchor {Size} 图标定位在地图上的位置相对于图标左上角的偏移值,默认偏移值为图标的中心位置。(可选)<br />
745   - * offset {Size} 图片相对于可视区域的偏移值,此功能的作用等同于CSS中的background-position属性。(可选)<br />
746   - * textSize {Number} 文字的大小。(可选,默认10)<br />
747   - * textColor {String} 文字的颜色。(可选,默认black)<br />
748   - */
749   - BMapLib.TextIconOverlay = function(position, text, options){
750   - this._position = position;
751   - this._text = text;
752   - this._options = options || {};
753   - this._styles = this._options['styles'] || [];
754   - (!this._styles.length) && this._setupDefaultStyles();
755   - };
756   -
757   - T.lang.inherits(TextIconOverlay, BMap.Overlay, "TextIconOverlay");
758   -
759   - TextIconOverlay.prototype._setupDefaultStyles = function(){
760   - var sizes = [53, 56, 66, 78, 90];
761   - for(var i = 0, size; size = sizes[i]; i++){
762   - this._styles.push({
763   - url:_IMAGE_PATH + i + '.' + _IMAGE_EXTENSION,
764   - size: new BMap.Size(size, size)
765   - });
766   - }//for循环的简洁写法
767   - };
768   -
769   - /**
770   - *继承Overlay的intialize方法,自定义覆盖物时必须。
771   - *@param {Map} map BMap.Map的实例化对象。
772   - *@return {HTMLElement} 返回覆盖物对应的HTML元素。
773   - */
774   - TextIconOverlay.prototype.initialize = function(map){
775   - this._map = map;
776   -
777   - this._domElement = document.createElement('div');
778   - this._updateCss();
779   - this._updateText();
780   - this._updatePosition();
781   -
782   - this._bind();
783   -
784   - this._map.getPanes().markerMouseTarget.appendChild(this._domElement);
785   - return this._domElement;
786   - };
787   -
788   - /**
789   - *继承Overlay的draw方法,自定义覆盖物时必须。
790   - *@return 无返回值。
791   - */
792   - TextIconOverlay.prototype.draw = function(){
793   - this._map && this._updatePosition();
794   - };
795   -
796   - /**
797   - *获取该覆盖物上的文字。
798   - *@return {String} 该覆盖物上的文字。
799   - */
800   - TextIconOverlay.prototype.getText = function(){
801   - return this._text;
802   - };
803   -
804   - /**
805   - *设置该覆盖物上的文字。
806   - *@param {String} text 要设置的文字,通常是字母A-Z或数字0-9。
807   - *@return 无返回值。
808   - */
809   - TextIconOverlay.prototype.setText = function(text){
810   - if(text && (!this._text || (this._text.toString() != text.toString()))){
811   - this._text = text;
812   - this._updateText();
813   - this._updateCss();
814   - this._updatePosition();
815   - }
816   - };
817   -
818   - /**
819   - *获取该覆盖物的位置。
820   - *@return {Point} 该覆盖物的经纬度坐标。
821   - */
822   - TextIconOverlay.prototype.getPosition = function () {
823   - return this._position;
824   - };
825   -
826   - /**
827   - *设置该覆盖物的位置。
828   - *@param {Point} position 要设置的经纬度坐标。
829   - *@return 无返回值。
830   - */
831   - TextIconOverlay.prototype.setPosition = function (position) {
832   - if(position && (!this._position || !this._position.equals(position))){
833   - this._position = position;
834   - this._updatePosition();
835   - }
836   - };
837   -
838   - /**
839   - *由文字信息获取风格数组的对应索引值。
840   - *内部默认的对应函数为文字转换为数字除以10的结果,比如文字8返回索引0,文字25返回索引2.
841   - *如果需要自定义映射关系,请覆盖该函数。
842   - *@param {String} text 文字。
843   - *@param {Array<IconStyle>} styles 一组图标风格。
844   - *@return {Number} 对应的索引值。
845   - */
846   - TextIconOverlay.prototype.getStyleByText = function(text, styles){
847   - var count = parseInt(text);
848   - if (count < 0) {
849   - count = 0;
850   - }
851   - var index = String(count).length;
852   - return styles[index - 1];
853   - }
854   -
855   - /**
856   - *更新相应的CSS。
857   - *@return 无返回值。
858   - */
859   - TextIconOverlay.prototype._updateCss = function(){
860   - var style = this.getStyleByText(this._text, this._styles);
861   - this._domElement.style.cssText = this._buildCssText(style);
862   - };
863   -
864   - /**
865   - *更新覆盖物的显示文字。
866   - *@return 无返回值。
867   - */
868   - TextIconOverlay.prototype._updateText = function(){
869   - if (this._domElement) {
870   - this._domElement.innerHTML = this._text;
871   - }
872   - };
873   -
874   - /**
875   - *调整覆盖物在地图上的位置更新覆盖物的显示文字。
876   - *@return 无返回值。
877   - */
878   - TextIconOverlay.prototype._updatePosition = function(){
879   - if (this._domElement && this._position) {
880   - var style = this._domElement.style;
881   - var pixelPosition= this._map.pointToOverlayPixel(this._position);
882   - pixelPosition.x -= Math.ceil(parseInt(style.width) / 2);
883   - pixelPosition.y -= Math.ceil(parseInt(style.height) / 2);
884   - style.left = pixelPosition.x + "px";
885   - style.top = pixelPosition.y + "px";
886   - }
887   - };
888   -
889   - /**
890   - * 为该覆盖物的HTML元素构建CSS
891   - * @param {IconStyle} 一个图标的风格。
892   - * @return {String} 构建完成的CSSTEXT。
893   - */
894   - TextIconOverlay.prototype._buildCssText = function(style) {
895   - //根据style来确定一些默认值
896   - var url = style['url'];
897   - var size = style['size'];
898   - var anchor = style['anchor'];
899   - var offset = style['offset'];
900   - var textColor = style['textColor'] || 'black';
901   - var textSize = style['textSize'] || 10;
902   -
903   - var csstext = [];
904   - if (T.browser["ie"] < 7) {
905   - csstext.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(' +
906   - 'sizingMethod=scale,src="' + url + '");');
907   - } else {
908   - if(style['bgColor'] == '' || style['bgColor'] == undefined) {
909   - csstext.push('background-image:url(' + url + ');');
910   - var backgroundPosition = '0 0';
911   - (offset instanceof BMap.Size) && (backgroundPosition = offset.width + 'px' + ' ' + offset.height + 'px');
912   - csstext.push('background-position:' + backgroundPosition + ';');
913   - } else {
914   - var bgColor = style['bgColor'];
915   - csstext.push('background-color:' + bgColor + '; border-radius: 51%; box-shadow:1px 0 38px 3px'+ bgColor + ';');
916   - }
917   - }
918   -
919   - if (size instanceof BMap.Size){
920   - if (anchor instanceof BMap.Size) {
921   - if (anchor.height > 0 && anchor.height < size.height) {
922   - csstext.push('height:' + (size.height - anchor.height) + 'px; padding-top:' + anchor.height + 'px;');
923   - }
924   - if(anchor.width > 0 && anchor.width < size.width){
925   - csstext.push('width:' + (size.width - anchor.width) + 'px; padding-left:' + anchor.width + 'px;');
926   - }
927   - } else {
928   - csstext.push('height:' + size.height + 'px; line-height:' + size.height + 'px;');
929   - csstext.push('width:' + size.width + 'px; text-align:center;');
930   - }
931   - }
932   -
933   - csstext.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' +
934   - textSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
935   - return csstext.join('');
936   - };
937   -
938   -
939   - /**
940   -
941   - * 当鼠标点击该覆盖物时会触发该事件
942   -
943   - * @name TextIconOverlay#click
944   -
945   - * @event
946   -
947   - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
948   -
949   - * <br />"<b>type</b> : {String} 事件类型
950   -
951   - * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
952   -
953   - *
954   -
955   - */
956   -
957   - /**
958   -
959   - * 当鼠标进入该覆盖物区域时会触发该事件
960   -
961   - * @name TextIconOverlay#mouseover
962   -
963   - * @event
964   - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
965   -
966   - * <br />"<b>type</b> : {String} 事件类型
967   -
968   - * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
969   -
970   - * <br />"<b>point</b> : {BMap.Point} 最新添加上的节点BMap.Point对象
971   -
972   - * <br />"<b>pixel</b>:{BMap.pixel} 最新添加上的节点BMap.Pixel对象
973   -
974   - *
975   -
976   - * @example <b>参考示例:</b><br />
977   -
978   - * myTextIconOverlay.addEventListener("mouseover", function(e) { alert(e.point); });
979   -
980   - */
981   -
982   - /**
983   -
984   - * 当鼠标离开该覆盖物区域时会触发该事件
985   -
986   - * @name TextIconOverlay#mouseout
987   -
988   - * @event
989   -
990   - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
991   -
992   - * <br />"<b>type</b> : {String} 事件类型
993   -
994   - * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
995   -
996   - * <br />"<b>point</b> : {BMap.Point} 最新添加上的节点BMap.Point对象
997   -
998   - * <br />"<b>pixel</b>:{BMap.pixel} 最新添加上的节点BMap.Pixel对象
999   -
1000   - *
1001   -
1002   - * @example <b>参考示例:</b><br />
1003   -
1004   - * myTextIconOverlay.addEventListener("mouseout", function(e) { alert(e.point); });
1005   -
1006   - */
1007   -
1008   -
1009   - /**
1010   - * 为该覆盖物绑定一系列事件
1011   - * 当前支持click mouseover mouseout
1012   - * @return 无返回值。
1013   - */
1014   - TextIconOverlay.prototype._bind = function(){
1015   - if (!this._domElement){
1016   - return;
1017   - }
1018   -
1019   - var me = this;
1020   - var map = this._map;
1021   -
1022   - var BaseEvent = T.lang.Event;
1023   - function eventExtend(e, be){
1024   - var elem = e.srcElement || e.target;
1025   - var x = e.clientX || e.pageX;
1026   - var y = e.clientY || e.pageY;
1027   - if (e && be && x && y && elem){
1028   - var offset = T.dom.getPosition(map.getContainer());
1029   - be.pixel = new BMap.Pixel(x - offset.left, y - offset.top);
1030   - be.point = map.pixelToPoint(be.pixel);
1031   - }
1032   - return be;
1033   - }//给事件参数增加pixel和point两个值
1034   -
1035   - T.event.on(this._domElement,"mouseover", function(e){
1036   - me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseover")));
1037   - });
1038   - T.event.on(this._domElement,"mouseout", function(e){
1039   - me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseout")));
1040   - });
1041   - T.event.on(this._domElement,"click", function(e){
1042   - me.dispatchEvent(eventExtend(e, new BaseEvent("onclick")));
1043   - });
1044   - };
1045   -
1046   -})();
1047 0 \ No newline at end of file
app-ht/web/exts-src/dbr_wasm/dbr-6.3.0.1.wasm
No preview for this file type
app-ht/web/exts-src/dbr_wasm/js/dbr.js
... ... @@ -1,46 +0,0 @@
1   -var dynamsoft = self.dynamsoft || {};
2   -var reader;
3   -dynamsoft.dbrEnv = dynamsoft.dbrEnv || {};
4   -dynamsoft.dbrEnv.resourcesPath = resourcesPath;
5   -dynamsoft.dbrEnv.licenseKey = "t0126lQMAABEMyEq5ZCNu4lHp3c1/VEMaWC2WbZJyJxnhsk2pJ9iVDyTo8PzWY8fS6s4m6NWkhssycNi/ERwBjhoAUR5TsuIrS3c5XDC7YHbB7ILZBXMI5hDMIZhDMIdgpmCmYKZgpmDOd82fyM1Cw7wxZE281b9pnda68wJay7Ge"; // 2019-09-21日过期
6   -dynamsoft.dbrEnv.onAutoLoadWasmSuccess = function () {
7   - $(".read_barcode_before").hide();
8   - $(".read_barcode").show();
9   - reader = new dynamsoft.BarcodeReader();
10   -};
11   -dynamsoft.dbrEnv.onAutoLoadWasmError = function (error) {
12   - alert("加载失败: " + error);
13   -};
14   -
15   -function readDynamsoftBarcode() {
16   - $(".show-barcode-name").empty();
17   - var currentShowImage = $("#device_img_list").attr("src");
18   -
19   - if (isDownloadImgToLocalServer == 1) {
20   - var index = currentShowImage .lastIndexOf("\/");
21   - currentShowImage = currentShowImage .substring(index + 1, currentShowImage .length);
22   -
23   - // 可以传入图片域名url
24   - currentShowImage = baseUrl + "/tmp/barcode/" + currentShowImage;
25   - }
26   -
27   - reader.decodeFileInMemory(currentShowImage).then(function (results) {
28   - var txts = [];
29   - for (var i = 0; i < results.length; ++i) {
30   - txts.push(results[i].BarcodeText);
31   - }
32   - if (txts === undefined || txts.length == 0) {
33   - $(".show-barcode-name").append("很抱歉,该图片条码无法识别");
34   - return;
35   - }
36   - $.each(txts, function (i, result) {
37   - item = "<a style='color: blue;' data-rel=" + result + ">" + "序列号" + (i+1) + ":&nbsp;&nbsp;" + result + "&nbsp;&nbsp;&nbsp;&nbsp;→&nbsp;点击使用";
38   - item += "<span style='display: none'>" + result + "</span></a><br>";
39   - $(".show-barcode-name").append(item);
40   - });
41   - $(".show-barcode-name a").bind('click', function () {
42   - var data_rel = $(this).find('span').html();
43   - $("#serial_no").val(data_rel);
44   - });
45   - });
46   -}
47 0 \ No newline at end of file
app-ht/web/exts-src/dbr_wasm/js/dynamsoft.barcodereader.min.js
... ... @@ -1,235 +0,0 @@
1   -var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(f,t,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");f!=Array.prototype&&f!=Object.prototype&&(f[t]=d.value)};$jscomp.getGlobal=function(f){return"undefined"!=typeof window&&window===f?f:"undefined"!=typeof global&&null!=global?global:f};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
2   -$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(f){return $jscomp.SYMBOL_PREFIX+(f||"")+$jscomp.symbolCounter_++};
3   -$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var f=$jscomp.global.Symbol.iterator;f||(f=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[f]&&$jscomp.defineProperty(Array.prototype,f,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(f){var t=0;return $jscomp.iteratorPrototype(function(){return t<f.length?{done:!1,value:f[t++]}:{done:!0}})};
4   -$jscomp.iteratorPrototype=function(f){$jscomp.initSymbolIterator();f={next:f};f[$jscomp.global.Symbol.iterator]=function(){return this};return f};$jscomp.makeIterator=function(f){$jscomp.initSymbolIterator();var t=f[Symbol.iterator];return t?t.call(f):$jscomp.arrayIterator(f)};
5   -$jscomp.polyfill=function(f,t,d,h){if(t){d=$jscomp.global;f=f.split(".");for(h=0;h<f.length-1;h++){var v=f[h];v in d||(d[v]={});d=d[v]}f=f[f.length-1];h=d[f];t=t(h);t!=h&&null!=t&&$jscomp.defineProperty(d,f,{configurable:!0,writable:!0,value:t})}};$jscomp.EXPOSE_ASYNC_EXECUTOR=!0;$jscomp.FORCE_POLYFILL_PROMISE=!1;
6   -$jscomp.polyfill("Promise",function(f){function t(){this.batch_=null}if(f&&!$jscomp.FORCE_POLYFILL_PROMISE)return f;t.prototype.asyncExecute=function(d){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(d);return this};t.prototype.asyncExecuteBatch_=function(){var d=this;this.asyncExecuteFunction(function(){d.executeBatch_()})};var d=$jscomp.global.setTimeout;t.prototype.asyncExecuteFunction=function(h){d(h,0)};t.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var d=
7   -this.batch_;this.batch_=[];for(var h=0;h<d.length;++h){var f=d[h];delete d[h];try{f()}catch(Cb){this.asyncThrow_(Cb)}}}this.batch_=null};t.prototype.asyncThrow_=function(d){this.asyncExecuteFunction(function(){throw d;})};var h=function(d){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var h=this.createResolveAndReject_();try{d(h.resolve,h.reject)}catch(C){h.reject(C)}};h.prototype.createResolveAndReject_=function(){function d(d){return function(r){f||(f=!0,d.call(h,r))}}var h=this,
8   -f=!1;return{resolve:d(this.resolveTo_),reject:d(this.reject_)}};h.prototype.resolveTo_=function(d){if(d===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(d instanceof h)this.settleSameAsPromise_(d);else{var f;a:switch(typeof d){case "object":f=null!=d;break a;case "function":f=!0;break a;default:f=!1}f?this.resolveToNonPromiseObj_(d):this.fulfill_(d)}};h.prototype.resolveToNonPromiseObj_=function(d){var h=void 0;try{h=d.then}catch(C){this.reject_(C);return}"function"==
9   -typeof h?this.settleSameAsThenable_(h,d):this.fulfill_(d)};h.prototype.reject_=function(d){this.settle_(2,d)};h.prototype.fulfill_=function(d){this.settle_(1,d)};h.prototype.settle_=function(d,h){if(0!=this.state_)throw Error("Cannot settle("+d+", "+h|"): Promise already settled in state"+this.state_);this.state_=d;this.result_=h;this.executeOnSettledCallbacks_()};h.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var d=this.onSettledCallbacks_,h=0;h<d.length;++h)d[h].call(),
10   -d[h]=null;this.onSettledCallbacks_=null}};var v=new t;h.prototype.settleSameAsPromise_=function(d){var h=this.createResolveAndReject_();d.callWhenSettled_(h.resolve,h.reject)};h.prototype.settleSameAsThenable_=function(d,h){var f=this.createResolveAndReject_();try{d.call(h,f.resolve,f.reject)}catch(Cb){f.reject(Cb)}};h.prototype.then=function(d,f){function r(d,h){return"function"==typeof d?function(h){try{t(d(h))}catch(wa){v(wa)}}:h}var t,v,K=new h(function(d,h){t=d;v=h});this.callWhenSettled_(r(d,
11   -t),r(f,v));return K};h.prototype["catch"]=function(d){return this.then(void 0,d)};h.prototype.callWhenSettled_=function(d,h){function f(){switch(r.state_){case 1:d(r.result_);break;case 2:h(r.result_);break;default:throw Error("Unexpected state: "+r.state_);}}var r=this;null==this.onSettledCallbacks_?v.asyncExecute(f):this.onSettledCallbacks_.push(function(){v.asyncExecute(f)})};h.resolve=function(d){return d instanceof h?d:new h(function(h,f){h(d)})};h.reject=function(d){return new h(function(h,
12   -f){f(d)})};h.race=function(d){return new h(function(f,r){for(var t=$jscomp.makeIterator(d),v=t.next();!v.done;v=t.next())h.resolve(v.value).callWhenSettled_(f,r)})};h.all=function(d){var f=$jscomp.makeIterator(d),r=f.next();return r.done?h.resolve([]):new h(function(d,t){function v(h){return function(f){C[h]=f;K--;0==K&&d(C)}}var C=[],K=0;do C.push(void 0),K++,h.resolve(r.value).callWhenSettled_(v(C.length-1),t),r=f.next();while(!r.done)})};$jscomp.EXPOSE_ASYNC_EXECUTOR&&(h.$jscomp$new$AsyncExecutor=
13   -function(){return new t});return h},"es6-impl","es3");$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(f,t){$jscomp.initSymbolIterator();f instanceof String&&(f+="");var d=0,h={next:function(){if(d<f.length){var v=d++;return{value:t(v,f[v]),done:!1}}h.next=function(){return{done:!0,value:void 0}};return h.next()}};h[Symbol.iterator]=function(){return h};return h};
14   -$jscomp.polyfill("Array.prototype.keys",function(f){return f?f:function(){return $jscomp.iteratorFromArray(this,function(f){return f})}},"es6-impl","es3");var dynamsoft=self.dynamsoft||{};
15   -dynamsoft.TaskQueue=dynamsoft.TaskQueue||function(){var f=function(){this._queue=[];this.isWorking=!1;this.timeout=100};f.prototype.push=function(f,d,h){this._queue.push({task:f,context:d,args:h});this.isWorking||this.next()};f.prototype.unshift=function(f,d,h){this._queue.unshift({task:f,context:d,args:h});this.isWorking||this.next()};f.prototype.next=function(){if(0==this._queue.length)this.isWorking=!1;else{this.isWorking=!0;var f=this._queue.shift(),d=f.task,h=f.context?f.context:self,v=f.args?
16   -f.args:[];setTimeout(function(){d.apply(h,v)},this.timeout)}};return f}();dynamsoft=self.dynamsoft||{};dynamsoft.dbrEnv=dynamsoft.dbrEnv||{};void 0==dynamsoft.dbrEnv.logLevel&&(dynamsoft.dbrEnv.logLevel=3);
17   -dynamsoft.BarcodeReader=dynamsoft.BarcodeReader||function(){var f=function(d){d=d||dynamsoft.dbrEnv.licenseKey||"";if(!("string"==typeof d||"object"==typeof d&&d instanceof String))throw TypeError("'Constructor BarcodeReader(licenseKey)': Type of 'licenseKey' should be 'String'.");this._licenseKey=d;this._instance=new dynamsoft.BarcodeReader._BarcodeReaderWasm(this._licenseKey);if(0==this._instance)throw new dynamsoft.BarcodeReader.BarcodeReaderException(dynamsoft.BarcodeReader.EnumErrorCode.DBR_NULL_REFERENCE,
18   -"Can't create BarcodeReader instance.");};f._jsVersion="6.3.0.1";f._jsEditVersion="20180802";f.version="loading...(JS "+f._jsVersion+"."+f._jsEditVersion+")";f.prototype.deleteInstance=function(){this._instance["delete"]()};f.prototype._decodeBlob=function(d,h){var f=this;return(new Promise(function(h,f){if(!(d instanceof Blob))throw TypeError("'_decodeBlob(blob, templateName)': Type of 'blob' should be 'Blob'.");var r=URL.createObjectURL(d),v=new Image;v.dbrObjUrl=r;v.src=r;v.onload=function(){h(v)};
19   -v.onerror=function(){f(TypeError("'_decodeBlob(blob, templateName)': Can't convert the blob to image."))}})).then(function(d){return f._decodeImage(d)})};f.prototype._decodeArrayBuffer=function(d,h){var f=this;return(new Promise(function(f){if(!(d instanceof ArrayBuffer))throw TypeError("'_decodeBlob(arrayBuffer, templateName)': Type of 'arrayBuffer' should be 'ArrayBuffer'.");h=h||"";f()})).then(function(){return f._decodeBlob(new Blob(d),h)})};f.prototype._decodeUint8Array=function(d,h){var f=this;
20   -return(new Promise(function(f){if(!(d instanceof Uint8Array||self.Uint8ClampedArray&&d instanceof Uint8ClampedArray))throw TypeError("'_decodeBlob(uint8Array, templateName)': Type of 'uint8Array' should be 'Uint8Array'.");h=h||"";f(d)})).then(function(d){return f._decodeBlob(new Blob(d),h)})};f.prototype._decodeImage=function(d,h){var f=this;return(new Promise(function(f){if(!(d instanceof HTMLImageElement))throw TypeError("'_decodeImage(image, templateName)': Type of 'image' should be 'HTMLImageElement'.");
21   -if(d.crossOrigin&&"anonymous"!=d.crossOrigin)throw"cors";h=h||"";f()})).then(function(){var r=document.createElement("canvas");r.width=d.naturalWidth;r.height=d.naturalHeight;r.getContext("2d").drawImage(d,0,0);d.dbrObjUrl&&URL.revokeObjectURL(d.dbrObjUrl);return f._decodeCanvas(r,h)})};f.prototype._decodeCanvas=function(d,h){var f=this;return(new Promise(function(f){if(!(d instanceof HTMLCanvasElement))throw TypeError("'_decodeCanvas(canvas, templateName)': Type of 'canvas' should be 'HTMLCanvasElement'.");
22   -if(d.crossOrigin&&"anonymous"!=d.crossOrigin)throw"cors";h=h||"";var r=d.getContext("2d").getImageData(0,0,d.width,d.height).data;f(r)})).then(function(r){return f._decodeRawImageUint8Array(r,d.width,d.height,4*d.width,dynamsoft.BarcodeReader.EnumImagePixelFormat.IPF_ARGB_8888,h)})};f.prototype._decodeVideo=f.prototype.decodeVideo=function(d){var h=this,f,r=arguments;return(new Promise(function(h){if(!(d instanceof HTMLVideoElement))throw TypeError("'_decodeVideo(video [ [, sx, sy, sWidth, sHeight], dWidth, dHeight] [, templateName] )': Type of 'video' should be 'HTMLVideoElement'.");
23   -if(d.crossOrigin&&"anonymous"!=d.crossOrigin)throw"cors";var v,t,K,ka,N,W;2>=r.length?(v=t=0,K=N=d.videoWidth,ka=W=d.videoHeight):4>=r.length?(v=t=0,K=d.videoWidth,ka=d.videoHeight,N=r[1],W=r[2]):(v=r[1],t=r[2],K=r[3],ka=r[4],N=r[5],W=r[6]);f="string"==typeof r[r.length-1]?r[r.length-1]:"";var Z=document.createElement("canvas");Z.width=N;Z.height=W;Z.getContext("2d").drawImage(d,v,t,K,ka,0,0,N,W);h(Z)})).then(function(d){return h._decodeCanvas(d,f)})};f.prototype._decodeBase64=f.prototype.decodeBase64String=
24   -function(d,h){var f=this;return(new Promise(function(f){if(!("string"==typeof d||"object"==typeof d&&d instanceof String))throw TypeError("'decodeBase64(base64Str, templateName)': Type of 'base64Str' should be 'String'.");"data:image/"==d.substring(0,11)&&(d=d.substring(d.indexOf(",")+1));h=h||"";for(var r=atob(d),v=r.length,t=new Uint8Array(v);v--;)t[v]=r.charCodeAt(v);f(new Blob([t]))})).then(function(d){return f._decodeBlob(d,h)})};f.prototype._decodeUrl=function(d,h){var f=this;return(new Promise(function(f,
25   -v){if(!("string"==typeof d||"object"==typeof d&&d instanceof String))throw TypeError("'_decodeUrl(url, templateName)': Type of 'url' should be 'String'.");h=h||"";var r=new XMLHttpRequest;r.open("GET",d,!0);r.responseType="blob";r.send();r.onloadend=function(){f(this.response)};r.onerror=function(){v(r.error)}})).then(function(d){return f._decodeBlob(d,h)})};f.prototype._decodeRawImageBlob=function(d,f,v,r,t,C){var h=this;return(new Promise(function(f,h){if(!(d instanceof Blob))throw TypeError("'_decodeRawImageBlob(buffer, width, height, stride, enumImagePixelFormat, templateName)': Type of 'buffer' should be 'Blob'.");
26   -C=C||"";var r=new FileReader;r.readAsArrayBuffer(d);r.onload=function(){f(r.result)};r.onerror=function(){h(r.error)}})).then(function(d){return h._decodeRawImageUint8Array(new Uint8Array(d),f,v,r,t,C)})};f.prototype._decodeRawImageArrayBuffer=function(d,f,v,r,t,C){var h=this;return(new Promise(function(f){if(!(d instanceof ArrayBuffer))throw TypeError("'_decodeRawImageArrayBuffer(buffer, width, height, stride, enumImagePixelFormat, templateName)': Type of 'buffer' should be 'ArrayBuffer'.");C=C||
27   -"";f()})).then(function(){return h._decodeRawImageUint8Array(new Uint8Array(d),f,v,r,t,C)})};f.prototype._decodeRawImageUint8Array=function(d,f,v,r,K,C){var h=this;return new Promise(function(O){if(!(d instanceof Uint8Array||self.Uint8ClampedArray&&d instanceof Uint8ClampedArray))throw TypeError("'_decodeRawImageUint8Array(buffer, width, height, stride, enumImagePixelFormat, templateName)': Type of 'buffer' should be 'Uint8Array'.");C=C||"";O(t(h._instance.DecodeBuffer(d,f,v,r,K,C)))})};f.prototype._decode=
28   -f.prototype.decodeFileInMemory=function(d,f){return Blob&&d instanceof Blob?this._decodeBlob(d,f):self.ArrayBuffer&&d instanceof ArrayBuffer?this._decodeArrayBuffer(d,f):self.Uint8Array&&d instanceof Uint8Array||self.Uint8ClampedArray&&d instanceof Uint8ClampedArray?this._decodeUint8Array(d,f):self.HTMLImageElement&&d instanceof HTMLImageElement?this._decodeImage(d,f):self.HTMLCanvasElement&&d instanceof HTMLCanvasElement?this._decodeCanvas(d,f):self.HTMLVideoElement&&d instanceof HTMLVideoElement?
29   -this._decodeVideo(d,f):"string"==typeof d||d instanceof String?"data:image/"==d.substring(0,11)?this._decodeBase64(d,f):this._decodeUrl(d,f):Promise.reject(TypeError("'_decode(source, templateName)': Type of 'source' should be 'Blob', 'ArrayBuffer', 'Uint8Array', 'HTMLImageElement', 'HTMLCanvasElement', 'HTMLVideoElement', 'String(base64 with image mime)' or 'String(url)'."))};f.prototype._decodeRawImage=f.prototype.decodeBuffer=function(d,f,t,r,K,C){return Blob&&d instanceof Blob?this._decodeRawImageBlob(d,
30   -f,t,r,K,C):ArrayBuffer&&d instanceof ArrayBuffer?this._decodeRawImageArrayBuffer(d,f,t,r,K,C):self.Uint8Array&&d instanceof Uint8Array||self.Uint8ClampedArray&&d instanceof Uint8ClampedArray?this._decodeRawImageUint8Array(d,f,t,r,K,C):Promise.reject(TypeError("'_decodeRawImage(source, width, height, stride, enumImagePixelFormat, templateName)': Type of 'source' should be 'Blob', 'ArrayBuffer' or 'Uint8Array'."))};var t=function(d){d="string"==typeof d||"object"==typeof d&&d instanceof String?JSON.parse(d):
31   -d;var h=f.EnumErrorCode;switch(d.exception){case h.DBR_SUCCESS:case h.DBR_LICENSE_INVALID:case h.DBR_1D_LICENSE_INVALID:case h.DBR_QR_LICENSE_INVALID:case h.DBR_PDF417_LICENSE_INVALID:case h.DBR_DATAMATRIX_LICENSE_INVALID:case h.DBR_DBRERR_AZTEC_LICENSE_INVALID:case h.DBR_RECOGNITION_TIMEOUT:if(d.textResult)for(h=0;h<d.textResult.length;++h){var t=d.textResult[h];try{t.BarcodeText=atob(t.BarcodeText)}catch(r){t.BarcodeText=""}}return d.textResult||d.localizationResultArray||d.Result||d.templateSettings||
32   -d.settings||d.outputSettings||d;default:throw new f.BarcodeReaderException(d.exception,d.description);}};f.prototype.getAllLocalizationResults=function(){return t(this._instance.GetAllLocalizationResults())};f.prototype.getAllParameterTemplateNames=function(){return t(this._instance.GetAllParameterTemplateNames())};f.prototype.getRuntimeSettings=function(){return t(this._instance.GetRuntimeSettings())};f.prototype.updateRuntimeSettings=function(d){if(!("string"==typeof d||"object"==typeof d&&d instanceof
33   -String))if("object"==typeof d)d=JSON.stringify(d);else throw TypeError("'UpdateRuntimeSettings(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");t(this._instance.UpdateRuntimeSettings(d))};f.prototype.resetRuntimeSettings=function(){t(this._instance.ResetRuntimeSettings())};f.prototype.outputSettingsToString=function(d){return t(this._instance.OutputSettingsToString(d||""))};f.prototype.initRuntimeSettingsWithString=function(d,f){if(!("string"==typeof d||"object"==typeof d&&d instanceof
34   -String))if("object"==typeof d)d=JSON.stringify(d);else throw TypeError("'initRuntimeSettingstWithString(template, enumComflictMode)': Type of 'template' should be 'String' or 'PlainObject'.");t(this._instance.InitRuntimeSettingstWithString(d,f?f:2))};f.prototype.appendTplStringToRuntimeSettings=function(d,f){if(!("string"==typeof d||"object"==typeof d&&d instanceof String))if("object"==typeof d)d=JSON.stringify(d);else throw TypeError("'appendTplStringToRuntimeSettings(template, enumComflictMode)': Type of 'template' should be 'String' or 'PlainObject'.");
35   -t(this._instance.AppendTplStringToRuntimeSettings(d,f?f:2))};return f}();dynamsoft.BarcodeReader.EnumBarcodeFormat=dynamsoft.BarcodeReader.EnumBarcodeFormat||function(){return{All:503317503,OneD:1023,CODE_39:1,CODE_128:2,CODE_93:4,CODABAR:8,ITF:16,EAN_13:32,EAN_8:64,UPC_A:128,UPC_E:256,INDUSTRIAL_25:512,PDF417:33554432,QR_CODE:67108864,DATAMATRIX:134217728,AZTEC:268435456}}();
36   -dynamsoft.BarcodeReader.EnumErrorCode=dynamsoft.BarcodeReader.EnumErrorCode||function(){return{DBR_SYSTEM_EXCEPTION:1,DBR_SUCCESS:0,DBR_UNKNOWN:-1E4,DBR_NO_MEMORY:-10001,DBR_NULL_REFERENCE:-10002,DBR_LICENSE_INVALID:-10003,DBR_LICENSE_EXPIRED:-10004,DBR_FILE_NOT_FOUND:-10005,DBR_FILETYPE_NOT_SUPPORTED:-10006,DBR_BPP_NOT_SUPPORTED:-10007,DBR_INDEX_INVALID:-10008,DBR_BARCODE_FORMAT_INVALID:-10009,DBR_CUSTOM_REGION_INVALID:-10010,DBR_MAX_BARCODE_NUMBER_INVALID:-10011,DBR_IMAGE_READ_FAILED:-10012,DBR_TIFF_READ_FAILED:-10013,
37   -DBR_QR_LICENSE_INVALID:-10016,DBR_1D_LICENSE_INVALID:-10017,DBR_DIB_BUFFER_INVALID:-10018,DBR_PDF417_LICENSE_INVALID:10019,DBR_DATAMATRIX_LICENSE_INVALID:-10020,DBR_PDF_READ_FAILED:-10021,DBR_PDF_DLL_MISSING:-10022,DBR_PAGE_NUMBER_INVALID:-10023,DBR_CUSTOM_SIZE_INVALID:-10024,DBR_CUSTOM_MODULESIZE_INVALID:-10025,DBR_RECOGNITION_TIMEOUT:-10026,DBR_JSON_PARSE_FAILED:-10030,DBR_JSON_TYPE_INVALID:-10031,DBR_JSON_KEY_INVALID:-10032,DBR_JSON_VALUE_INVALID:-10033,DBR_JSON_NAME_KEY_MISSING:-10034,DBR_JSON_NAME_VALUE_DUPLICATED:-10035,
38   -DBR_TEMPLATE_NAME_INVALID:-10036,DBR_JSON_NAME_REFERENCE_INVALID:-10037,DBR_PARAMETER_VALUE_INVALID:-10038,DBR_DOMAIN_NOT_MATCHED:-10039,DBR_RESERVEDINFO_NOT_MATCHED:-10040,DBR_DBRERR_AZTEC_LICENSE_INVALID:-10041}}();dynamsoft.BarcodeReader.EnumImagePixelFormat=dynamsoft.BarcodeReader.EnumImagePixelFormat||function(){return{IPF_Binary:0,IPF_BinaryInverted:1,IPF_GrayScaled:2,IPF_NV21:3,IPF_RGB_565:4,IPF_RGB_555:5,IPF_RGB_888:6,IPF_ARGB_8888:7}}();
39   -dynamsoft.BarcodeReader.EnumResultType=dynamsoft.BarcodeReader.EnumResultType||function(){return{EDT_StandardText:0,EDT_RawText:1,EDT_CandidateText:2,EDT_PartialText:3}}();dynamsoft.BarcodeReader.EnumTerminateStage=dynamsoft.BarcodeReader.EnumTerminateStage||function(){return{ETS_Prelocalized:0,ETS_Localized:1,ETS_Recognized:2}}();dynamsoft.BarcodeReader.EnumConflictMode=dynamsoft.BarcodeReader.EnumConflictMode||function(){return{ECM_Ignore:1,ECM_Overwrite:2}}();
40   -dynamsoft.BarcodeReader.BarcodeReaderException=dynamsoft.BarcodeReader.BarcodeReaderException||function(){var f=function(d,f){var h=dynamsoft.BarcodeReader.EnumErrorCode.DBR_UNKNOWN;"number"==typeof d?(h=d,this.message=f):this.message=d;this.code=h},t=function(){};t.prototype=Error.prototype;f.prototype=new t;return f.prototype.constructor=f}();
41   -dynamsoft.BarcodeReader.loadWasm=dynamsoft.BarcodeReader.loadWasm||function(){return new Promise(function(f,t){var d=dynamsoft.BarcodeReader;if("loaded"==d._loadWasmStatus)return f();d._loadWasmTaskQueue=d._loadWasmTaskQueue||function(){var d=new dynamsoft.TaskQueue;d.timeout=0;return d}();d._loadWasmTaskQueue.push(function(h){if("loaded"==d._loadWasmStatus)return d._loadWasmTaskQueue.next(),f();if(h)return d._loadWasmTaskQueue.next(),t(d._loadWasmStatus);d._loadWasmStatus="loading";return(new Promise(function(f,
42   -h){function r(a){O(!Db);var c=G;G=G+a+15&-16;return c}function t(a){O(aa);var c=p[aa>>2];a=c+a+15&-16;p[aa>>2]=a;return a>=H&&!qc()?(p[aa>>2]=c,0):c}function v(a){var c;c||(c=16);return Math.ceil(a/c)*c}function O(a,c){a||E("Assertion failed: "+c)}function ka(a,c){if("number"===typeof a)var b=!0,e=a;else b=!1,e=a.length;c=4==c?k:["function"===typeof da?da:r,ld,r,t][void 0===c?2:c](Math.max(e,1));if(b){var k=c;O(0==(c&3));for(a=c+(e&-4);k<a;k+=4)p[k>>2]=0;for(a=c+e;k<a;)P[k++>>0]=0;return c}a.subarray||
43   -a.slice?I.set(a,c):I.set(new Uint8Array(a),c);return c}function N(a){var c;if(0===c||!a)return"";for(var b=0,e,k=0;;){e=I[a+k>>0];b|=e;if(0==e&&!c)break;k++;if(c&&k==c)break}c||(c=k);e="";if(128>b){for(;0<c;)b=String.fromCharCode.apply(String,I.subarray(a,a+Math.min(c,1024))),e=e?e+b:b,a+=1024,c-=1024;return e}return W(I,a)}function W(a,c){for(var b=c;a[b];)++b;if(16<b-c&&a.subarray&&rc)return rc.decode(a.subarray(c,b));for(b="";;){var e=a[c++];if(!e)return b;if(e&128){var k=a[c++]&63;if(192==(e&
44   -224))b+=String.fromCharCode((e&31)<<6|k);else{var l=a[c++]&63;if(224==(e&240))e=(e&15)<<12|k<<6|l;else{var d=a[c++]&63;if(240==(e&248))e=(e&7)<<18|k<<12|l<<6|d;else{var f=a[c++]&63;if(248==(e&252))e=(e&3)<<24|k<<18|l<<12|d<<6|f;else var h=a[c++]&63,e=(e&1)<<30|k<<24|l<<18|d<<12|f<<6|h}}65536>e?b+=String.fromCharCode(e):(e-=65536,b+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else b+=String.fromCharCode(e)}}function Z(a,c,b,e){if(!(0<e))return 0;var g=b;e=b+e-1;for(var l=0;l<a.length;++l){var d=
45   -a.charCodeAt(l);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++l)&1023);if(127>=d){if(b>=e)break;c[b++]=d}else{if(2047>=d){if(b+1>=e)break;c[b++]=192|d>>6}else{if(65535>=d){if(b+2>=e)break;c[b++]=224|d>>12}else{if(2097151>=d){if(b+3>=e)break;c[b++]=240|d>>18}else{if(67108863>=d){if(b+4>=e)break;c[b++]=248|d>>24}else{if(b+5>=e)break;c[b++]=252|d>>30;c[b++]=128|d>>24&63}c[b++]=128|d>>18&63}c[b++]=128|d>>12&63}c[b++]=128|d>>6&63}c[b++]=128|d&63}}c[b]=0;return b-g}function wa(a){for(var c=
46   -0,b=0;b<a.length;++b){var e=a.charCodeAt(b);55296<=e&&57343>=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++b)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:2097151>=e?c+4:67108863>=e?c+5:c+6}return c}function Eb(a,c){0<a%c&&(a+=c-a%c);return a}function Fb(){b.HEAP8=P=new Int8Array(L);b.HEAP16=Ha=new Int16Array(L);b.HEAP32=p=new Int32Array(L);b.HEAPU8=I=new Uint8Array(L);b.HEAPU16=Gb=new Uint16Array(L);b.HEAPU32=ea=new Uint32Array(L);b.HEAPF32=sc=new Float32Array(L);b.HEAPF64=tc=new Float64Array(L)}function qc(){var a=
47   -b.usingWasm?Hb:uc,c=2147483648-a;if(p[aa>>2]>c)return!1;var g=H;for(H=Math.max(H,md);H<p[aa>>2];)536870912>=H?H=Eb(2*H,a):H=Math.min(Eb((3*H+2147483648)/4,a),c);a=b.reallocBuffer(H);if(!a||a.byteLength!=H)return H=g,!1;b.buffer=L=a;Fb();return!0}function Ia(a){for(;0<a.length;){var c=a.shift();if("function"==typeof c)c();else{var g=c.b;"number"===typeof g?void 0===c.ua?b.dynCall_v(g):b.dynCall_vi(g,c.ua):g(void 0===c.ua?null:c.ua)}}}function nd(){var a=b.preRun.shift();vc.unshift(a)}function $a(a){return String.prototype.startsWith?
48   -a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}function xa(){return!!xa.u}function wc(a){if(!a||X[a])return a;for(var c in X)if(X[c].Ia===a)return c;return a}function xc(a){try{return R(a)}catch(c){}}function Ib(){var a=ya;if(!a)return(ab(0),0)|0;var c=X[a],g=c.type;if(!g)return(ab(0),a)|0;var e=Array.prototype.slice.call(arguments);b.___cxa_is_pointer_type(g);bb||(bb=da(4));p[bb>>2]=a;for(var a=bb,k=0;k<e.length;k++)if(e[k]&&b.___cxa_can_catch(e[k],
49   -g,a))return a=p[a>>2],c.Ia=a,(ab(e[k]),a)|0;a=p[a>>2];return(ab(g),a)|0}function Jb(a){b.___errno_location&&(p[b.___errno_location()>>2]=a);return a}function Kb(a,c){for(var b=0,e=a.length-1;0<=e;e--){var k=a[e];"."===k?a.splice(e,1):".."===k?(a.splice(e,1),b++):b&&(a.splice(e,1),b--)}if(c)for(;b;b--)a.unshift("..");return a}function Lb(a){var c="/"===a.charAt(0),b="/"===a.substr(-1);(a=Kb(a.split("/").filter(function(a){return!!a}),!c).join("/"))||c||(a=".");a&&b&&(a+="/");return(c?"/":"")+a}function od(a){var c=
50   -/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=c[0];c=c[1];if(!a&&!c)return".";c&&(c=c.substr(0,c.length-1));return a+c}function yc(a){if("/"===a)return"/";var c=a.lastIndexOf("/");return-1===c?a:a.substr(c+1)}function pd(){var a=Array.prototype.slice.call(arguments,0);return Lb(a.join("/"))}function qa(a,c){return Lb(a+"/"+c)}function cb(){for(var a="",c=!1,b=arguments.length-1;-1<=b&&!c;b--){c=0<=b?arguments[b]:"/";if("string"!==typeof c)throw new TypeError("Arguments to path.resolve must be strings");
51   -if(!c)return"";a=c+"/"+a;c="/"===c.charAt(0)}a=Kb(a.split("/").filter(function(a){return!!a}),!c).join("/");return(c?"/":"")+a||"."}function zc(a,c){Ac[a]={input:[],output:[],W:c};Mb(a,qd)}function ra(a,c){a=cb("/",a);c=c||{};if(!a)return{path:"",node:null};var b={Qa:!0,Ba:0},e;for(e in b)void 0===c[e]&&(c[e]=b[e]);if(8<c.Ba)throw new q(m.sa);a=Kb(a.split("/").filter(function(a){return!!a}),!1);var k=Nb,b="/";for(e=0;e<a.length;e++){var l=e===a.length-1;if(l&&c.parent)break;k=db(k,a[e]);b=qa(b,a[e]);
52   -k.ma&&(!l||l&&c.Qa)&&(k=k.ma.root);if(!l||c.Pa)for(l=0;40960===(k.mode&61440);)if(k=Bc(b),b=cb(od(b),k),k=ra(b,{Ba:c.Ba}).node,40<l++)throw new q(m.sa);}return{path:b,node:k}}function Cc(a){for(var c;;){if(a===a.parent)return a=a.v.Ua,c?"/"!==a[a.length-1]?a+"/"+c:a+c:a;c=c?a.name+"/"+c:a.name;a=a.parent}}function Dc(a,c){for(var b=0,e=0;e<c.length;e++)b=(b<<5)-b+c.charCodeAt(e)|0;return(a+b>>>0)%Ja.length}function rd(a){var c=Dc(a.parent.id,a.name);a.lb=Ja[c];Ja[c]=a}function db(a,c){var b;if(b=
53   -(b=eb(a,"x"))?b:a.h.lookup?0:m.ra)throw new q(b,a);for(b=Ja[Dc(a.id,c)];b;b=b.lb){var e=b.name;if(b.parent.id===a.id&&e===c)return b}return a.h.lookup(a,c)}function Ob(a,c,b,e){Ka||(Ka=function(a,c,b,g){a||(a=this);this.parent=a;this.v=a.v;this.ma=null;this.id=sd++;this.name=c;this.mode=b;this.h={};this.g={};this.rdev=g},Ka.prototype={},Object.defineProperties(Ka.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===
54   -(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}}));a=new Ka(a,c,b,e);rd(a);return a}function Ec(a){var c=["r","w","rw"][a&3];a&512&&(c+="w");return c}function eb(a,c){if(Fc)return 0;if(-1===c.indexOf("r")||a.mode&292){if(-1!==c.indexOf("w")&&!(a.mode&146)||-1!==c.indexOf("x")&&!(a.mode&73))return m.ra}else return m.ra;return 0}function Gc(a,c){try{return db(a,c),m.Ea}catch(g){}return eb(a,"wx")}function td(a){for(a=a||0;4096>=a;a++)if(!la[a])return a;throw new q(m.Xa);}function ud(a,
55   -c){La||(La=function(){},La.prototype={},Object.defineProperties(La.prototype,{object:{get:function(){return this.node},set:function(a){this.node=a}}}));var b=new La,e;for(e in a)b[e]=a[e];a=b;c=td(c);a.fd=c;return la[c]=a}function Mb(a,c){Hc[a]={g:c}}function Ic(a,c){var b="/"===c,e=!c;if(b&&Nb)throw new q(m.Da);if(!b&&!e){var k=ra(c,{Qa:!1});c=k.path;k=k.node;if(k.ma)throw new q(m.Da);if(16384!==(k.mode&61440))throw new q(m.Fa);}c={type:a,za:{},Ua:c,kb:[]};a=a.v(c);a.v=c;c.root=a;b?Nb=a:k&&(k.ma=
56   -c,k.v&&k.v.kb.push(c))}function Pb(a,c,b){var g=ra(a,{parent:!0}).node;a=yc(a);if(!a||"."===a||".."===a)throw new q(m.m);var k=Gc(g,a);if(k)throw new q(k);if(!g.h.$)throw new q(m.Y);return g.h.$(g,a,c,b)}function fa(a){Pb(a,16895,0)}function fb(a,c,b){"undefined"===typeof b&&(b=c,c=438);Pb(a,c|8192,b)}function Qb(a,c){if(!cb(a))throw new q(m.L);var b=ra(c,{parent:!0}).node;if(!b)throw new q(m.L);c=yc(c);var e=Gc(b,c);if(e)throw new q(e);if(!b.h.symlink)throw new q(m.Y);b.h.symlink(b,c,a)}function Bc(a){a=
57   -ra(a).node;if(!a)throw new q(m.L);if(!a.h.readlink)throw new q(m.m);return cb(Cc(a.parent),a.h.readlink(a))}function Ma(a,c,g,e){if(""===a)throw new q(m.L);if("string"===typeof c){var k=vd[c];if("undefined"===typeof k)throw Error("Unknown file open mode: "+c);c=k}g=c&64?("undefined"===typeof g?438:g)&4095|32768:0;if("object"===typeof a)var l=a;else{a=Lb(a);try{l=ra(a,{Pa:!(c&131072)}).node}catch(n){}}k=!1;if(c&64)if(l){if(c&128)throw new q(m.Ea);}else l=Pb(a,g,0),k=!0;if(!l)throw new q(m.L);8192===
58   -(l.mode&61440)&&(c&=-513);if(c&65536&&16384!==(l.mode&61440))throw new q(m.Fa);if(!k&&(g=l?40960===(l.mode&61440)?m.sa:16384===(l.mode&61440)&&("r"!==Ec(c)||c&512)?m.ga:eb(l,Ec(c)):m.L))throw new q(g);if(c&512){g=l;var d;"string"===typeof g?d=ra(g,{Pa:!0}).node:d=g;if(!d.h.C)throw new q(m.Y);if(16384===(d.mode&61440))throw new q(m.ga);if(32768!==(d.mode&61440))throw new q(m.m);if(g=eb(d,"w"))throw new q(g);d.h.C(d,{size:0,timestamp:Date.now()})}c&=-641;e=ud({node:l,path:Cc(l),flags:c,seekable:!0,
59   -position:0,g:l.g,zb:[],error:!1},e);e.g.open&&e.g.open(e);!b.logReadFiles||c&1||(gb||(gb={}),a in gb||(gb[a]=1,b.printErr("read file: "+a)));try{hb.onOpenFile&&(l=0,1!==(c&2097155)&&(l|=1),0!==(c&2097155)&&(l|=2),hb.onOpenFile(a,l))}catch(n){console.log("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+n.message)}return e}function Jc(a){a.wa&&(a.wa=null);try{a.g.close&&a.g.close(a)}catch(c){throw c;}finally{la[a.fd]=null}}function Kc(a,c,b){if(!a.seekable||!a.g.M)throw new q(m.ha);
60   -a.position=a.g.M(a,c,b);a.zb=[]}function Lc(){q||(q=function(a,c){this.node=c;this.rb=function(a){this.J=a;for(var c in m)if(m[c]===a){this.code=c;break}};this.rb(a);this.message=wd[a];this.stack&&Object.defineProperty(this,"stack",{value:Error().stack,writable:!0})},q.prototype=Error(),q.prototype.constructor=q,[m.L].forEach(function(a){Rb[a]=new q(a);Rb[a].stack="<generic error, no stack>"}))}function xd(a,c){var b=0;a&&(b|=365);c&&(b|=146);return b}function Na(a,c,b){a=qa("/dev",a);var g=xd(!!c,
61   -!!b);Sb||(Sb=64);var k=Sb++<<8|0;Mb(k,{open:function(a){a.seekable=!1},close:function(){b&&b.buffer&&b.buffer.length&&b(10)},read:function(a,b,g,e){for(var k=0,l=0;l<e;l++){try{var d=c()}catch(ma){throw new q(m.fa);}if(void 0===d&&0===k)throw new q(m.Ca);if(null===d||void 0===d)break;k++;b[g+l]=d}k&&(a.node.timestamp=Date.now());return k},write:function(a,c,g,e){for(var k=0;k<e;k++)try{b(c[g+k])}catch(w){throw new q(m.fa);}e&&(a.node.timestamp=Date.now());return k}});fb(a,g,k)}function D(){S+=4;return p[S-
62   -4>>2]}function za(){var a=la[D()];if(!a)throw new q(m.ea);return a}function Tb(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}function T(a){for(var c="";I[a];)c+=Mc[I[a++]];return c}function Ub(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var c=a.charCodeAt(0);return 48<=c&&57>=c?"_"+a:a}function Vb(a,c){a=Ub(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(c)}
63   -function Wb(a){var c=Error,b=Vb(a,function(c){this.name=a;this.message=c;c=Error(c).stack;void 0!==c&&(this.stack=this.toString()+"\n"+c.replace(/^Error(:[^\n]*)?\n/,""))});b.prototype=Object.create(c.prototype);b.prototype.constructor=b;b.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return b}function A(a){throw new Aa(a);}function ib(a){throw new Nc(a);}function Oa(a,c,b){function g(c){c=b(c);c.length!==a.length&&ib("Mismatched type converter count");
64   -for(var g=0;g<a.length;++g)ga(a[g],c[g])}a.forEach(function(a){jb[a]=c});var k=Array(c.length),d=[],x=0;c.forEach(function(a,c){Ba.hasOwnProperty(a)?k[c]=Ba[a]:(d.push(a),Ca.hasOwnProperty(a)||(Ca[a]=[]),Ca[a].push(function(){k[c]=Ba[a];++x;x===d.length&&g(k)}))});0===d.length&&g(k)}function ga(a,c,b){b=b||{};if(!("argPackAdvance"in c))throw new TypeError("registerType registeredInstance requires argPackAdvance");var g=c.name;a||A('type "'+g+'" must have a positive integer typeid pointer');if(Ba.hasOwnProperty(a)){if(b.ib)return;
65   -A("Cannot register type '"+g+"' twice")}Ba[a]=c;delete jb[a];Ca.hasOwnProperty(a)&&(c=Ca[a],delete Ca[a],c.forEach(function(a){a()}))}function Xb(a){A(a.c.o.i.name+" instance already deleted")}function Yb(){for(;Pa.length;){var a=Pa.pop();a.c.U=!1;a["delete"]()}}function na(){}function Oc(a,c,b){if(void 0===a[c].H){var g=a[c];a[c]=function(){a[c].H.hasOwnProperty(arguments.length)||A("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+a[c].H+")!");
66   -return a[c].H[arguments.length].apply(this,arguments)};a[c].H=[];a[c].H[g.ia]=g}}function yd(a,c){b.hasOwnProperty(a)?(A("Cannot register public name '"+a+"' twice"),Oc(b,a,a),b.hasOwnProperty(void 0)&&A("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),b[a].H[void 0]=c):b[a]=c}function zd(a,c,b,e,k,d,x,f){this.name=a;this.constructor=c;this.V=b;this.R=e;this.F=k;this.fb=d;this.da=x;this.cb=f;this.nb=[]}function Zb(a,c,b){for(;c!==b;)c.da||A("Expected null or instance of "+
67   -b.name+", got an instance of "+c.name),a=c.da(a),c=c.F;return a}function Ad(a,c){if(null===c)return this.ya&&A("null is not a valid "+this.name),0;c.c||A('Cannot pass "'+Da(c)+'" as a '+this.name);c.c.j||A("Cannot pass deleted object as a pointer of type "+this.name);return Zb(c.c.j,c.c.o.i,this.i)}function Bd(a,c){if(null===c){this.ya&&A("null is not a valid "+this.name);if(this.ka){var b=this.ob();null!==a&&a.push(this.R,b);return b}return 0}c.c||A('Cannot pass "'+Da(c)+'" as a '+this.name);c.c.j||
68   -A("Cannot pass deleted object as a pointer of type "+this.name);!this.ja&&c.c.o.ja&&A("Cannot convert argument of type "+(c.c.D?c.c.D.name:c.c.o.name)+" to parameter type "+this.name);b=Zb(c.c.j,c.c.o.i,this.i);if(this.ka)switch(void 0===c.c.B&&A("Passing raw pointer to smart pointer is illegal"),this.sb){case 0:c.c.D===this?b=c.c.B:A("Cannot convert argument of type "+(c.c.D?c.c.D.name:c.c.o.name)+" to parameter type "+this.name);break;case 1:b=c.c.B;break;case 2:if(c.c.D===this)b=c.c.B;else{var e=
69   -c.clone(),b=this.pb(b,Pc(function(){e["delete"]()}));null!==a&&a.push(this.R,b)}break;default:A("Unsupporting sharing policy")}return b}function Cd(a,c){if(null===c)return this.ya&&A("null is not a valid "+this.name),0;c.c||A('Cannot pass "'+Da(c)+'" as a '+this.name);c.c.j||A("Cannot pass deleted object as a pointer of type "+this.name);c.c.o.ja&&A("Cannot convert argument of type "+c.c.o.name+" to parameter type "+this.name);return Zb(c.c.j,c.c.o.i,this.i)}function kb(a){return this.fromWireType(ea[a>>
70   -2])}function Qc(a,c,b){if(c===b)return a;if(void 0===b.F)return null;a=Qc(a,c,b.F);return null===a?null:b.cb(a)}function Dd(a,c){for(void 0===c&&A("ptr should not be undefined");a.F;)c=a.da(c),a=a.F;return Qa[c]}function lb(a,c){c.o&&c.j||ib("makeClassHandle requires ptr and ptrType");!!c.D!==!!c.B&&ib("Both smartPtrType and smartPtr must be specified");c.count={value:1};return Object.create(a,{c:{value:c}})}function ha(a,c,b,e,k,d,x,f,h,u,w){this.name=a;this.i=c;this.ya=b;this.ja=e;this.ka=k;this.mb=
71   -d;this.sb=x;this.Va=f;this.ob=h;this.pb=u;this.R=w;k||void 0!==c.F?this.toWireType=Bd:(this.toWireType=e?Ad:Cd,this.I=null)}function Ed(a,c){b.hasOwnProperty(a)||ib("Replacing nonexistant public symbol");b[a]=c;b[a].ia=void 0}function Ea(a,c){a=T(a);if(void 0!==b["FUNCTION_TABLE_"+a])var g=b["FUNCTION_TABLE_"+a][c];else if("undefined"!==typeof FUNCTION_TABLE)g=FUNCTION_TABLE[c];else{g=b.asm["dynCall_"+a];void 0===g&&(g=b.asm["dynCall_"+a.replace(/f/g,"d")],void 0===g&&A("No dynCall invoker for signature: "+
72   -a));for(var e=[],k=1;k<a.length;++k)e.push("a"+k);k="return function "+("dynCall_"+a+"_"+c)+"("+e.join(", ")+") {\n";k+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";g=(new Function("dynCall","rawFunction",k+"};\n"))(g,c)}"function"!==typeof g&&A("unknown function pointer with signature "+a+": "+c);return g}function Fd(a){a=Gd(a);var c=T(a);R(a);return c}function $b(a,c){function b(a){k[a]||Ba[a]||(jb[a]?jb[a].forEach(b):(e.push(a),k[a]=!0))}var e=[],k={};c.forEach(b);throw new Rc(a+
73   -": "+e.map(Fd).join([", "]));}function Sc(a,c){for(var b=[],e=0;e<a;e++)b.push(p[(c>>2)+e]);return b}function Tc(a){for(;a.length;){var c=a.pop();a.pop()(c)}}function Hd(a){var c=Function;if(!(c instanceof Function))throw new TypeError("new_ called with constructor type "+typeof c+" which is not a function");var b=Vb(c.name||"unknownFunctionName",function(){});b.prototype=c.prototype;b=new b;a=c.apply(b,a);return a instanceof Object?a:b}function Pc(a){switch(a){case void 0:return 1;case null:return 2;
74   -case !0:return 3;case !1:return 4;default:var c=ac.length?ac.pop():ba.length;ba[c]={X:1,value:a};return c}}function Da(a){if(null===a)return"null";var c=typeof a;return"object"===c||"array"===c||"function"===c?a.toString():""+a}function Id(a,c){switch(c){case 2:return function(a){return this.fromWireType(sc[a>>2])};case 3:return function(a){return this.fromWireType(tc[a>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Jd(a,c,b){switch(c){case 0:return b?function(a){return P[a]}:
75   -function(a){return I[a]};case 1:return b?function(a){return Ha[a>>1]}:function(a){return Gb[a>>1]};case 2:return b?function(a){return p[a>>2]}:function(a){return ea[a>>2]};default:throw new TypeError("Unknown integer type: "+a);}}function Uc(){function a(a){return(a=a.toTimeString().match(/\(([A-Za-z ]+)\)$/))?a[1]:"GMT"}if(!Vc){Vc=!0;p[Kd>>2]=60*(new Date).getTimezoneOffset();var c=new Date(2E3,0,1),b=new Date(2E3,6,1);p[Ld>>2]=Number(c.getTimezoneOffset()!=b.getTimezoneOffset());var e=a(c),k=a(b),
76   -e=ka(Ra(e),0),k=ka(Ra(k),0);b.getTimezoneOffset()<c.getTimezoneOffset()?(p[Sa>>2]=e,p[Sa+4>>2]=k):(p[Sa>>2]=k,p[Sa+4>>2]=e)}}function mb(){void 0===mb.start&&(mb.start=Date.now());return 1E3*(Date.now()-mb.start)|0}function Y(a){a=eval(N(a))+"";var c=wa(a);if(!Y.u||Y.u<c+1)Y.u&&R(Y.buffer),Y.u=c+1,Y.buffer=da(Y.u);Z(a,I,Y.buffer,Y.u);return Y.buffer}function Ta(a){if(0===a)return 0;a=N(a);if(!U.hasOwnProperty(a))return 0;Ta.va&&R(Ta.va);a=U[a];var c=wa(a)+1,b=da(c);b&&Z(a,P,b,c);Ta.va=b;return Ta.va}
77   -function Md(a){return Math.pow(2,a)}function Wc(a){a/=1E3;if((sa||oa)&&self.performance&&self.performance.now)for(var c=self.performance.now();self.performance.now()-c<a;);else for(c=Date.now();Date.now()-c<a;);return 0}function Ua(a,c){Ua.u||(Ua.u={});a in Ua.u||(b.dynCall_v(c),Ua.u[a]=1)}function nb(a){return 0===a%4&&(0!==a%100||0===a%400)}function bc(a,c){for(var b=0,e=0;e<=c;b+=a[e++]);return b}function ob(a,c){for(a=new Date(a.getTime());0<c;){var b=a.getMonth(),e=(nb(a.getFullYear())?pb:qb)[b];
78   -if(c>e-a.getDate())c-=e-a.getDate()+1,a.setDate(1),11>b?a.setMonth(b+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+c);break}}return a}function Xc(a,c,b,e){function g(a,c,b){for(a="number"===typeof a?a.toString():a||"";a.length<c;)a=b[0]+a;return a}function d(a,c){return g(a,c,"0")}function f(a,c){function b(a){return 0>a?-1:0<a?1:0}var e;0===(e=b(a.getFullYear()-c.getFullYear()))&&0===(e=b(a.getMonth()-c.getMonth()))&&(e=b(a.getDate()-c.getDate()));return e}function n(a){switch(a.getDay()){case 0:return new Date(a.getFullYear()-
79   -1,11,29);case 1:return a;case 2:return new Date(a.getFullYear(),0,3);case 3:return new Date(a.getFullYear(),0,2);case 4:return new Date(a.getFullYear(),0,1);case 5:return new Date(a.getFullYear()-1,11,31);case 6:return new Date(a.getFullYear()-1,11,30)}}function h(a){a=ob(new Date(a.s+1900,0,1),a.qa);var c=n(new Date(a.getFullYear()+1,0,4));return 0>=f(n(new Date(a.getFullYear(),0,4)),a)?0>=f(c,a)?a.getFullYear()+1:a.getFullYear():a.getFullYear()-1}var u=p[e+40>>2];e={wb:p[e>>2],vb:p[e+4>>2],pa:p[e+
80   -8>>2],S:p[e+12>>2],N:p[e+16>>2],s:p[e+20>>2],Wa:p[e+24>>2],qa:p[e+28>>2],Dd:p[e+32>>2],ub:p[e+36>>2],xb:u?N(u):""};b=N(b);var u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"},w;for(w in u)b=b.replace(new RegExp(w,"g"),u[w]);var J="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" "),
81   -u={"%a":function(a){return J[a.Wa].substring(0,3)},"%A":function(a){return J[a.Wa]},"%b":function(a){return m[a.N].substring(0,3)},"%B":function(a){return m[a.N]},"%C":function(a){return d((a.s+1900)/100|0,2)},"%d":function(a){return d(a.S,2)},"%e":function(a){return g(a.S,2," ")},"%g":function(a){return h(a).toString().substring(2)},"%G":function(a){return h(a)},"%H":function(a){return d(a.pa,2)},"%I":function(a){a=a.pa;0==a?a=12:12<a&&(a-=12);return d(a,2)},"%j":function(a){return d(a.S+bc(nb(a.s+
82   -1900)?pb:qb,a.N-1),3)},"%m":function(a){return d(a.N+1,2)},"%M":function(a){return d(a.vb,2)},"%n":function(){return"\n"},"%p":function(a){return 0<=a.pa&&12>a.pa?"AM":"PM"},"%S":function(a){return d(a.wb,2)},"%t":function(){return"\t"},"%u":function(a){return(new Date(a.s+1900,a.N+1,a.S,0,0,0,0)).getDay()||7},"%U":function(a){var c=new Date(a.s+1900,0,1),b=0===c.getDay()?c:ob(c,7-c.getDay());a=new Date(a.s+1900,a.N,a.S);return 0>f(b,a)?d(Math.ceil((31-b.getDate()+(bc(nb(a.getFullYear())?pb:qb,a.getMonth()-
83   -1)-31)+a.getDate())/7),2):0===f(b,c)?"01":"00"},"%V":function(a){var c=n(new Date(a.s+1900,0,4)),b=n(new Date(a.s+1901,0,4)),e=ob(new Date(a.s+1900,0,1),a.qa);return 0>f(e,c)?"53":0>=f(b,e)?"01":d(Math.ceil((c.getFullYear()<a.s+1900?a.qa+32-c.getDate():a.qa+1-c.getDate())/7),2)},"%w":function(a){return(new Date(a.s+1900,a.N+1,a.S,0,0,0,0)).getDay()},"%W":function(a){var c=new Date(a.s,0,1),b=1===c.getDay()?c:ob(c,0===c.getDay()?1:7-c.getDay()+1);a=new Date(a.s+1900,a.N,a.S);return 0>f(b,a)?d(Math.ceil((31-
84   -b.getDate()+(bc(nb(a.getFullYear())?pb:qb,a.getMonth()-1)-31)+a.getDate())/7),2):0===f(b,c)?"01":"00"},"%y":function(a){return(a.s+1900).toString().substring(2)},"%Y":function(a){return a.s+1900},"%z":function(a){a=a.ub;var c=0<=a;a=Math.abs(a)/60;return(c?"+":"-")+String("0000"+(a/60*100+a%60)).slice(-4)},"%Z":function(a){return a.xb},"%%":function(){return"%"}};for(w in u)0<=b.indexOf(w)&&(b=b.replace(new RegExp(w,"g"),u[w](e)));w=Ra(b,!1);if(w.length>c)return 0;P.set(w,a);return w.length-1}function Ra(a,
85   -c){var b=Array(wa(a)+1);a=Z(a,b,0,b.length);c&&(b.length=a);return b}function Va(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}function dc(){function a(){if(!b.calledRun&&(b.calledRun=!0,!Wa)){Yc||(Yc=!0,Ia(rb));Ia(Zc);if(b.onRuntimeInitialized)b.onRuntimeInitialized();if(b.postRun)for("function"==typeof b.postRun&&(b.postRun=[b.postRun]);b.postRun.length;){var a=b.postRun.shift();$c.unshift(a)}Ia($c)}}if(!(0<ta)){if(b.preRun)for("function"==typeof b.preRun&&
86   -(b.preRun=[b.preRun]);b.preRun.length;)nd();Ia(vc);0<ta||b.calledRun||(b.setStatus?(b.setStatus("Running..."),setTimeout(function(){setTimeout(function(){b.setStatus("")},1);a()},1)):a())}}function E(a){if(b.onAbort)b.onAbort(a);void 0!==a?(b.print(a),b.printErr(a),a=JSON.stringify(a)):a="";Wa=!0;throw"abort("+a+"). Build with -s ASSERTIONS=1 for more info.";}d._BarcodeReaderWasm=function(){throw Error("'Constructor BarcodeReader(licenseKey)': The wasm hasn't finish loading.");};if(!self.WebAssembly||
87   -/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&/\(.+\s11_2_([2-6]).*\)/.test(navigator.userAgent))return h("'Constructor BarcodeReader(licenseKey)': The browser doesn't support Webassembly.");var Nd=function(a,c,b){self.kConsoleLog&&kConsoleLog("start handle dbr wasm, version: "+a);var e=(new Date).getTime(),g="dbr-"+a,d=function(a){return new Promise(function(c,b){var e=a.transaction(["wasm"]).objectStore("wasm").get("bSupportStoreModuleInDb"),g=function(){var e=a.transaction(["wasm"],
88   -"readwrite").objectStore("wasm"),g=new Uint8Array([0,97,115,109,1,0,0,0,1,7,1,96,2,127,127,1,127,3,2,1,0,7,7,1,3,88,79,82,0,0,10,9,1,7,0,32,0,32,1,115,11,0,26,4,110,97,109,101,1,10,10,0,7,87,97,115,109,88,79,82,2,7,1,0,2,0,0,1,0]);try{var k=e.put(new WebAssembly.Module(g.buffer),"testStoreModule");k.onsuccess=function(){var a=e.put(!0,"bSupportStoreModuleInDb");a.onsuccess=function(){c("set bSupportStoreModuleInDb = true success")};a.onerror=function(){b("set bSupportStoreModuleInDb = true fail")}};
89   -k.onerror=function(){b("Failed to store [testStoreModule] in wasm cache, bSupportStoreModuleInDb == false: "+(k.error.message||k.error))}}catch(M){return b("Failed to store [testStoreModule] in wasm cache, bSupportStoreModuleInDb == false: "+(M.message||M))}};e.onsuccess=function(){e.result?c("bSupportStoreModuleInDb == true"):g()};e.onerror=g})},f=function(a){return new Promise(function(c,b){var e=a.transaction(["wasm"]).objectStore("wasm").get(g);e.onerror=b.bind(null,"Error getting wasm "+g);e.onsuccess=
90   -function(){e.result?c(e.result):b(g+" was not found in wasm cache")}})},n=function(a,c){return new Promise(function(b,e){var k=a.transaction(["wasm"],"readwrite").objectStore("wasm").put(c,g);k.onerror=function(){e("Failed to store "+g+" in wasm cache: "+(k.error.message||k.error))};k.onsuccess=function(){b("Successfully stored "+g+" in wasm cache")}})};return function(){return new Promise(function(a,c){var b=indexedDB.open("dynamsoft",1);b.onupgradeneeded=function(){b.result.createObjectStore("wasm")};
91   -b.onsuccess=function(){a(b.result)};b.onerror=function(){var e=b.error.message||b.error;-1!=e.indexOf("version")?(b=indexedDB.deleteDatabase("dynamsoft"),b.onsuccess=function(){var b=indexedDB.open("dynamsoft",1);b.onupgradeneeded=function(){b.result.createObjectStore("wasm")};b.onsuccess=function(){a(b.result)};b.onerror=function(){c("open db [dynamsoft] fail")}},b.onerror=function(){c("delete db [dynamsoft] fail")}):c("open db [dynamsoft] fail: "+e)}})}().then(function(a){self.kConsoleLog&&kConsoleLog("open db success");
92   -return d(a).then(function(c){self.kConsoleLog&&kConsoleLog(c);return Promise.resolve([a,!0])})["catch"](function(c){self.kConsoleLog&&kConsoleLog(c.message||c);return Promise.resolve([a,!1])})}).then(function(a){var g=a[0],k=a[1],d=(new Date).getTime();return f(g).then(function(a){if(a instanceof WebAssembly.Module){self.kConsoleLog&&kConsoleLog("get a wasm module from db, timecost:"+((new Date).getTime()-d));var c=(new Date).getTime();return WebAssembly.instantiate(a,b).then(function(b){self.kConsoleLog&&
93   -kConsoleLog("build instance from module timecost: "+((new Date).getTime()-c));self.kConsoleLog&&kConsoleLog("finish handle dbr wasm, total timecost: "+((new Date).getTime()-e));return Promise.resolve({module:a,instance:b})})}self.kConsoleLog&&kConsoleLog("get a wasm binary from db, timecost:"+((new Date).getTime()-d));var l=(new Date).getTime();return WebAssembly.instantiate(a,b).then(function(a){self.kConsoleLog&&kConsoleLog("build instance from binary timecost: "+((new Date).getTime()-l));if(k){var c=
94   -(new Date).getTime();return n(g,a.module).then(function(b){self.kConsoleLog&&kConsoleLog(b+", timecost: "+((new Date).getTime()-c));self.kConsoleLog&&kConsoleLog("finish handle dbr wasm, total timecost: "+((new Date).getTime()-e));return Promise.resolve(a)})}self.kConsoleLog&&kConsoleLog("finish handle dbr wasm, total timecost: "+((new Date).getTime()-e));return Promise.resolve(a)})},function(a){self.kConsoleLog&&kConsoleLog(a.message||a);var d=(new Date).getTime();return k?WebAssembly.instantiateStreaming(fetch(c),
95   -b).then(function(a){self.kConsoleLog&&kConsoleLog("download with build timecost: "+((new Date).getTime()-d));var c=(new Date).getTime();return n(g,a.module).then(function(b){self.kConsoleLog&&kConsoleLog(b+", timecost: "+((new Date).getTime()-c));self.kConsoleLog&&kConsoleLog("finish handle dbr wasm, total timecost: "+((new Date).getTime()-e));return Promise.resolve(a)})}):fetch(c).then(function(a){self.kConsoleLog&&kConsoleLog("download timecost: "+((new Date).getTime()-d));return a.arrayBuffer()}).then(function(a){var c=
96   -(new Date).getTime();return n(g,a).then(function(b){self.kConsoleLog&&kConsoleLog(b+", timecost: "+((new Date).getTime()-c));return Promise.resolve(a)})}).then(function(a){var c=(new Date).getTime();return WebAssembly.instantiate(a,b).then(function(a){self.kConsoleLog&&kConsoleLog("build instance from binary timecost: "+((new Date).getTime()-c));self.kConsoleLog&&kConsoleLog("finish handle dbr wasm, total timecost: "+((new Date).getTime()-e));return Promise.resolve(a)})})})})["catch"](function(a){self.kConsoleLog&&
97   -kConsoleLog(a.message||a);return WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(fetch(c),b).then(function(a){self.kConsoleLog&&kConsoleLog("finish handle dbr wasm, total timecost: "+((new Date).getTime()-e));return Promise.resolve(a)}):fetch(c).then(function(a){return a.arrayBuffer()}).then(function(a){return WebAssembly.instantiate(a,b).then(function(a){self.kConsoleLog&&kConsoleLog("finish handle dbr wasm, total timecost: "+((new Date).getTime()-e));return Promise.resolve(a)})})})},
98   -Fa={locateFile:function(){var a="dbr-"+d._jsVersion+".wasm";if(dynamsoft.dbrEnv.resourcesPath){var c=dynamsoft.dbrEnv.resourcesPath;"/"!=c.charAt(c.length-1)&&(c+="/");return c+a}return a},onRuntimeInitialized:function(){d._BarcodeReaderWasm=Fa.BarcodeReaderWasm;d._loadWasmStatus="loaded";d.version=(new Fa.BarcodeReaderWasm("")).GetVersion()+"(JS "+d._jsVersion+"."+d._jsEditVersion+")";f()}};Fa.onExit=Fa.onAbort=function(a){d._BarcodeReaderWasm=function(){throw Error("'Constructor BarcodeReader(licenseKey)': The wasm load failed. Status: "+
99   -a);};h(a)};var b;b||(b="undefined"!==typeof Fa?Fa:{});var Xa={},pa;for(pa in b)b.hasOwnProperty(pa)&&(Xa[pa]=b[pa]);b.arguments=[];b.thisProgram="./this.program";b.quit=function(a,c){throw c;};b.preRun=[];b.postRun=[];var sa=!1,oa=!1,ia=!1,ec=!1;if(b.ENVIRONMENT)if("WEB"===b.ENVIRONMENT)sa=!0;else if("WORKER"===b.ENVIRONMENT)oa=!0;else if("NODE"===b.ENVIRONMENT)ia=!0;else if("SHELL"===b.ENVIRONMENT)ec=!0;else throw Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.");
100   -else sa="object"===typeof window,oa="function"===typeof importScripts,ia="object"===typeof process&&"function"===typeof require&&!sa&&!oa,ec=!sa&&!ia&&!oa;if(ia){var fc,gc;b.read=function(a,c){fc||(fc=require("fs"));gc||(gc=require("path"));a=gc.normalize(a);a=fc.readFileSync(a);return c?a:a.toString()};b.readBinary=function(a){a=b.read(a,!0);a.buffer||(a=new Uint8Array(a));O(a.buffer);return a};1<process.argv.length&&(b.thisProgram=process.argv[1].replace(/\\/g,"/"));b.arguments=process.argv.slice(2);
101   -"undefined"!==typeof module&&(module.exports=b);process.on("uncaughtException",function(a){if(!(a instanceof Va))throw a;});process.on("unhandledRejection",function(){process.exit(1)});b.inspect=function(){return"[Emscripten Module object]"}}else if(ec)"undefined"!=typeof read&&(b.read=function(a){return read(a)}),b.readBinary=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");O("object"===typeof a);return a},"undefined"!=typeof scriptArgs?b.arguments=
102   -scriptArgs:"undefined"!=typeof arguments&&(b.arguments=arguments),"function"===typeof quit&&(b.quit=function(a){quit(a)});else if(sa||oa)b.read=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.send(null);return c.responseText},oa&&(b.readBinary=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),b.readAsync=function(a,c,b){var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=function(){200==
103   -e.status||0==e.status&&e.response?c(e.response):b()};e.onerror=b;e.send(null)},b.setWindowTitle=function(a){document.title=a};b.print="undefined"!==typeof console?console.log.bind(console):"undefined"!==typeof print?print:null;b.printErr="undefined"!==typeof printErr?printErr:"undefined"!==typeof console&&console.warn.bind(console)||b.print;b.print=b.print;b.printErr=b.printErr;for(pa in Xa)Xa.hasOwnProperty(pa)&&(b[pa]=Xa[pa]);var Xa=void 0,Wa=0,rc="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):
104   -void 0;"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le");var Hb=65536,uc=16777216,md=16777216,L,P,I,Ha,Gb,p,ea,sc,tc,sb,G,Db,hc,tb,ic,jc,aa;sb=G=hc=tb=ic=jc=aa=0;Db=!1;b.reallocBuffer||(b.reallocBuffer=function(a){try{if(ArrayBuffer.yb)var c=ArrayBuffer.yb(L,a);else{var b=P,c=new ArrayBuffer(a);(new Int8Array(c)).set(b)}}catch(e){return!1}return Od(c)?c:!1});var kc;try{kc=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get),kc(new ArrayBuffer(4))}catch(a){kc=
105   -function(a){return a.byteLength}}var lc=b.TOTAL_STACK||5242880,H=b.TOTAL_MEMORY||16777216;H<lc&&b.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+H+"! (TOTAL_STACK="+lc+")");b.buffer?L=b.buffer:("object"===typeof WebAssembly&&"function"===typeof WebAssembly.Memory?(b.wasmMemory=new WebAssembly.Memory({initial:H/Hb}),L=b.wasmMemory.buffer):L=new ArrayBuffer(H),b.buffer=L);Fb();p[0]=1668509029;Ha[1]=25459;if(115!==I[2]||99!==I[3])throw"Runtime error: expected the system to be little-endian!";
106   -var vc=[],rb=[],Zc=[],mc=[],$c=[],Yc=!1,ta=0,nc=null,Ya=null;b.preloadedImages={};b.preloadedAudios={};(function(){function a(){try{if(b.wasmBinary)return new Uint8Array(b.wasmBinary);if(b.readBinary)return b.readBinary(k);throw"on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)";}catch(w){E(w)}}function c(){return b.wasmBinary||!sa&&!oa||"function"!==typeof fetch?new Promise(function(c){c(a())}):fetch(k,
107   -{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+k+"'";return a.arrayBuffer()})["catch"](function(){return a()})}function g(a){function e(a){n=a.exports;if(n.memory){a=n.memory;var c=b.buffer;a.byteLength<c.byteLength&&b.printErr("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here");c=new Int8Array(c);(new Int8Array(a)).set(c);b.buffer=L=a;Fb()}b.asm=n;b.usingWasm=!0;ta--;b.monitorRunDependencies&&
108   -b.monitorRunDependencies(ta);0==ta&&(null!==nc&&(clearInterval(nc),nc=null),Ya&&(a=Ya,Ya=null,a()))}function g(a){e(a.instance)}function l(a){c().then(function(a){return WebAssembly.instantiate(a,f)}).then(a)["catch"](function(a){b.printErr("failed to asynchronously prepare wasm: "+a);E(a)})}if("object"!==typeof WebAssembly)return b.printErr("no native wasm support detected"),!1;if(!(b.wasmMemory instanceof WebAssembly.Memory))return b.printErr("no native wasm Memory in use"),!1;a.memory=b.wasmMemory;
109   -f.global={NaN:NaN,Infinity:Infinity};f["global.Math"]=Math;f.env=a;ta++;b.monitorRunDependencies&&b.monitorRunDependencies(ta);if(b.instantiateWasm)try{return b.instantiateWasm(f,e)}catch(Q){return b.printErr("Module.instantiateWasm callback failed with error: "+Q),!1}b.wasmBinary||$a(k)||"function"!==typeof fetch?l(g):Nd(d._jsVersion,k,f).then(g)["catch"](function(a){b.printErr("wasm streaming compile failed: "+a);b.printErr("falling back to ArrayBuffer instantiation");l(g)});return{}}var e="dbr.min.wast",
110   -k="dbr.min.wasm",l="dbr.min.temp.asm.js";"function"===typeof b.locateFile&&($a(e)||(e=b.locateFile(e)),$a(k)||(k=b.locateFile(k)),$a(l)||(l=b.locateFile(l)));var f={global:null,env:null,asm2wasm:{"f64-rem":function(a,c){return a%c},"debugger":function(){debugger}},parent:b},n=null;b.asmPreload=b.asm;var h=b.reallocBuffer;b.reallocBuffer=function(a){if("asmjs"===u)var c=h(a);else a:{a=Eb(a,b.usingWasm?Hb:uc);var e=b.buffer.byteLength;if(b.usingWasm)try{c=-1!==b.wasmMemory.grow((a-e)/65536)?b.buffer=
111   -b.wasmMemory.buffer:null;break a}catch(ca){c=null;break a}c=void 0}return c};var u="";b.asm=function(a,c){if(!c.table){a=b.wasmTableSize;void 0===a&&(a=1024);var e=b.wasmMaxTableSize;c.table="object"===typeof WebAssembly&&"function"===typeof WebAssembly.Table?void 0!==e?new WebAssembly.Table({initial:a,maximum:e,element:"anyfunc"}):new WebAssembly.Table({initial:a,element:"anyfunc"}):Array(a);b.wasmTable=c.table}c.memoryBase||(c.memoryBase=b.STATIC_BASE);c.tableBase||(c.tableBase=0);(c=g(c))||E("no binaryen method succeeded. consider enabling more options, like interpreting, if you want that: https://github.com/kripken/emscripten/wiki/WebAssembly#binaryen-methods");
112   -return c}})();sb=1024;G=sb+897344;rb.push({b:function(){Pd()}},{b:function(){Qd()}},{b:function(){Rd()}},{b:function(){Sd()}},{b:function(){Td()}},{b:function(){Ud()}},{b:function(){Vd()}},{b:function(){Wd()}},{b:function(){Xd()}},{b:function(){Yd()}},{b:function(){Zd()}},{b:function(){$d()}},{b:function(){ae()}},{b:function(){be()}},{b:function(){ce()}},{b:function(){de()}},{b:function(){ee()}},{b:function(){fe()}},{b:function(){ge()}},{b:function(){he()}},{b:function(){ie()}},{b:function(){je()}},
113   -{b:function(){ke()}},{b:function(){le()}},{b:function(){me()}},{b:function(){ne()}},{b:function(){oe()}},{b:function(){pe()}},{b:function(){qe()}},{b:function(){re()}},{b:function(){se()}},{b:function(){te()}},{b:function(){ue()}},{b:function(){ve()}},{b:function(){we()}},{b:function(){xe()}},{b:function(){ye()}},{b:function(){ze()}},{b:function(){Ae()}},{b:function(){Be()}},{b:function(){Ce()}},{b:function(){De()}},{b:function(){Ee()}},{b:function(){Fe()}},{b:function(){Ge()}},{b:function(){He()}},
114   -{b:function(){Ie()}},{b:function(){Je()}},{b:function(){Ke()}},{b:function(){Le()}},{b:function(){Me()}},{b:function(){Ne()}},{b:function(){Oe()}},{b:function(){Pe()}},{b:function(){Qe()}},{b:function(){Re()}},{b:function(){Se()}},{b:function(){Te()}},{b:function(){Ue()}},{b:function(){Ve()}},{b:function(){We()}},{b:function(){Xe()}},{b:function(){Ye()}},{b:function(){Ze()}},{b:function(){$e()}},{b:function(){af()}},{b:function(){bf()}},{b:function(){cf()}},{b:function(){df()}},{b:function(){ef()}},
115   -{b:function(){ff()}},{b:function(){gf()}},{b:function(){hf()}});b.STATIC_BASE=sb;b.STATIC_BUMP=897344;G+=16;var ya=0,ub=[],X={},bb,m={Y:1,L:2,md:3,hc:4,fa:5,Ha:6,Ab:7,Fc:8,ea:9,Ob:10,Ca:11,wd:11,Ya:12,ra:13,$b:14,Rc:15,Da:16,Ea:17,xd:18,ta:19,Fa:20,ga:21,m:22,Ac:23,Xa:24,T:25,td:26,ac:27,Nc:28,ha:29,jd:30,tc:31,ad:32,Xb:33,ed:34,Jc:42,dc:43,Pb:44,kc:45,lc:46,mc:47,sc:48,ud:49,Dc:50,jc:51,Ub:35,Gc:37,Gb:52,Jb:53,yd:54,Bc:55,Kb:56,Lb:57,Vb:35,Mb:59,Pc:60,Ec:61,qd:62,Oc:63,Kc:64,Lc:65,hd:66,Hc:67,Db:68,
116   -nd:69,Qb:70,bd:71,vc:72,Yb:73,Ib:74,Wc:76,Hb:77,gd:78,nc:79,oc:80,rc:81,qc:82,pc:83,Qc:38,Ga:39,wc:36,sa:40,Xc:95,$c:96,Tb:104,Cc:105,Eb:97,dd:91,Uc:88,Mc:92,kd:108,Sb:111,Bb:98,Rb:103,zc:101,xc:100,rd:110,bc:112,cc:113,fc:115,Fb:114,Wb:89,uc:90,cd:93,ld:94,Cb:99,yc:102,ic:106,Sc:107,sd:109,vd:87,Zb:122,od:116,Vc:95,Ic:123,ec:84,Yc:75,Nb:125,Tc:131,Zc:130,pd:86},wd={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",
117   -7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",
118   -30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",
119   -49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",
120   -70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",
121   -86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",
122   -103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",
123   -131:"State not recoverable"},Ac=[],qd={open:function(a){var c=Ac[a.node.rdev];if(!c)throw new q(m.ta);a.tty=c;a.seekable=!1},close:function(a){a.tty.W.flush(a.tty)},flush:function(a){a.tty.W.flush(a.tty)},read:function(a,c,b,e){if(!a.tty||!a.tty.W.Sa)throw new q(m.Ha);for(var g=0,d=0;d<e;d++){try{var f=a.tty.W.Sa(a.tty)}catch(n){throw new q(m.fa);}if(void 0===f&&0===g)throw new q(m.Ca);if(null===f||void 0===f)break;g++;c[b+d]=f}g&&(a.node.timestamp=Date.now());return g},write:function(a,c,b,e){if(!a.tty||
124   -!a.tty.W.Aa)throw new q(m.Ha);for(var g=0;g<e;g++)try{a.tty.W.Aa(a.tty,c[b+g])}catch(l){throw new q(m.fa);}e&&(a.node.timestamp=Date.now());return g}},jf={Sa:function(a){if(!a.input.length){var c=null;if(ia){var b=new Buffer(256),e=0,k=process.stdin.fd;if("win32"!=process.platform){var d=!1;try{k=F.openSync("/dev/stdin","r"),d=!0}catch(x){}}try{e=F.readSync(k,b,0,256,null)}catch(x){if(-1!=x.toString().indexOf("EOF"))e=0;else throw x;}d&&F.closeSync(k);0<e?c=b.slice(0,e).toString("utf-8"):c=null}else"undefined"!=
125   -typeof window&&"function"==typeof window.prompt?(c=window.prompt("Input: "),null!==c&&(c+="\n")):"function"==typeof readline&&(c=readline(),null!==c&&(c+="\n"));if(!c)return null;a.input=Ra(c,!0)}return a.input.shift()},Aa:function(a,c){null===c||10===c?(b.print(W(a.output,0)),a.output=[]):0!=c&&a.output.push(c)},flush:function(a){a.output&&0<a.output.length&&(b.print(W(a.output,0)),a.output=[])}},kf={Aa:function(a,c){null===c||10===c?(b.printErr(W(a.output,0)),a.output=[]):0!=c&&a.output.push(c)},
126   -flush:function(a){a.output&&0<a.output.length&&(b.printErr(W(a.output,0)),a.output=[])}},y={G:null,v:function(){return y.createNode(null,"/",16895,0)},createNode:function(a,c,b,e){if(24576===(b&61440)||4096===(b&61440))throw new q(m.Y);y.G||(y.G={dir:{node:{K:y.h.K,C:y.h.C,lookup:y.h.lookup,$:y.h.$,rename:y.h.rename,unlink:y.h.unlink,rmdir:y.h.rmdir,readdir:y.h.readdir,symlink:y.h.symlink},stream:{M:y.g.M}},file:{node:{K:y.h.K,C:y.h.C},stream:{M:y.g.M,read:y.g.read,write:y.g.write,Ja:y.g.Ja,Ta:y.g.Ta,
127   -na:y.g.na}},link:{node:{K:y.h.K,C:y.h.C,readlink:y.h.readlink},stream:{}},Ma:{node:{K:y.h.K,C:y.h.C},stream:lf}});b=Ob(a,c,b,e);16384===(b.mode&61440)?(b.h=y.G.dir.node,b.g=y.G.dir.stream,b.f={}):32768===(b.mode&61440)?(b.h=y.G.file.node,b.g=y.G.file.stream,b.l=0,b.f=null):40960===(b.mode&61440)?(b.h=y.G.link.node,b.g=y.G.link.stream):8192===(b.mode&61440)&&(b.h=y.G.Ma.node,b.g=y.G.Ma.stream);b.timestamp=Date.now();a&&(a.f[c]=b);return b},gb:function(a){if(a.f&&a.f.subarray){for(var c=[],b=0;b<a.l;++b)c.push(a.f[b]);
128   -return c}return a.f},zd:function(a){return a.f?a.f.subarray?a.f.subarray(0,a.l):new Uint8Array(a.f):new Uint8Array},Na:function(a,c){a.f&&a.f.subarray&&c>a.f.length&&(a.f=y.gb(a),a.l=a.f.length);if(!a.f||a.f.subarray){var b=a.f?a.f.length:0;b>=c||(c=Math.max(c,b*(1048576>b?2:1.125)|0),0!=b&&(c=Math.max(c,256)),b=a.f,a.f=new Uint8Array(c),0<a.l&&a.f.set(b.subarray(0,a.l),0))}else for(!a.f&&0<c&&(a.f=[]);a.f.length<c;)a.f.push(0)},qb:function(a,c){if(a.l!=c)if(0==c)a.f=null,a.l=0;else{if(!a.f||a.f.subarray){var b=
129   -a.f;a.f=new Uint8Array(new ArrayBuffer(c));b&&a.f.set(b.subarray(0,Math.min(c,a.l)))}else if(a.f||(a.f=[]),a.f.length>c)a.f.length=c;else for(;a.f.length<c;)a.f.push(0);a.l=c}},h:{K:function(a){var c={};c.dev=8192===(a.mode&61440)?a.id:1;c.ino=a.id;c.mode=a.mode;c.nlink=1;c.uid=0;c.gid=0;c.rdev=a.rdev;16384===(a.mode&61440)?c.size=4096:32768===(a.mode&61440)?c.size=a.l:40960===(a.mode&61440)?c.size=a.link.length:c.size=0;c.atime=new Date(a.timestamp);c.mtime=new Date(a.timestamp);c.ctime=new Date(a.timestamp);
130   -c.O=4096;c.blocks=Math.ceil(c.size/c.O);return c},C:function(a,c){void 0!==c.mode&&(a.mode=c.mode);void 0!==c.timestamp&&(a.timestamp=c.timestamp);void 0!==c.size&&y.qb(a,c.size)},lookup:function(){throw Rb[m.L];},$:function(a,c,b,e){return y.createNode(a,c,b,e)},rename:function(a,c,b){if(16384===(a.mode&61440)){try{var e=db(c,b)}catch(l){}if(e)for(var g in e.f)throw new q(m.Ga);}delete a.parent.f[a.name];a.name=b;c.f[b]=a;a.parent=c},unlink:function(a,c){delete a.f[c]},rmdir:function(a,c){var b=
131   -db(a,c),e;for(e in b.f)throw new q(m.Ga);delete a.f[c]},readdir:function(a){var c=[".",".."],b;for(b in a.f)a.f.hasOwnProperty(b)&&c.push(b);return c},symlink:function(a,c,b){a=y.createNode(a,c,41471,0);a.link=b;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new q(m.m);return a.link}},g:{read:function(a,c,b,e,k){var g=a.node.f;if(k>=a.node.l)return 0;a=Math.min(a.node.l-k,e);O(0<=a);if(8<a&&g.subarray)c.set(g.subarray(k,k+a),b);else for(e=0;e<a;e++)c[b+e]=g[k+e];return a},write:function(a,
132   -c,b,e,k,d){if(!e)return 0;a=a.node;a.timestamp=Date.now();if(c.subarray&&(!a.f||a.f.subarray)){if(d)return a.f=c.subarray(b,b+e),a.l=e;if(0===a.l&&0===k)return a.f=new Uint8Array(c.subarray(b,b+e)),a.l=e;if(k+e<=a.l)return a.f.set(c.subarray(b,b+e),k),e}y.Na(a,k+e);if(a.f.subarray&&c.subarray)a.f.set(c.subarray(b,b+e),k);else for(d=0;d<e;d++)a.f[k+d]=c[b+d];a.l=Math.max(a.l,k+e);return e},M:function(a,c,b){1===b?c+=a.position:2===b&&32768===(a.node.mode&61440)&&(c+=a.node.l);if(0>c)throw new q(m.m);
133   -return c},Ja:function(a,c,b){y.Na(a.node,c+b);a.node.l=Math.max(a.node.l,c+b)},Ta:function(a,c,b,e,k,d,f){if(32768!==(a.node.mode&61440))throw new q(m.ta);b=a.node.f;if(f&2||b.buffer!==c&&b.buffer!==c.buffer){if(0<k||k+e<a.node.l)b.subarray?b=b.subarray(k,k+e):b=Array.prototype.slice.call(b,k,k+e);a=!0;e=da(e);if(!e)throw new q(m.Ya);c.set(b,e)}else a=!1,e=b.byteOffset;return{j:e,Za:a}},na:function(a,b,g,e,d){if(32768!==(a.node.mode&61440))throw new q(m.ta);if(d&2)return 0;y.g.write(a,b,0,e,g,!1);
134   -return 0}}},B={la:!1,tb:function(){B.la=!!process.platform.match(/^win/);var a=process.binding("constants");a.fs&&(a=a.fs);B.Oa={1024:a.O_APPEND,64:a.O_CREAT,128:a.O_EXCL,0:a.O_RDONLY,2:a.O_RDWR,4096:a.O_SYNC,512:a.O_TRUNC,1:a.O_WRONLY}},Ka:function(a){return Buffer.u?Buffer.from(a):new Buffer(a)},v:function(a){O(ia);return B.createNode(null,"/",B.Ra(a.za.root),0)},createNode:function(a,b,g){if(16384!==(g&61440)&&32768!==(g&61440)&&40960!==(g&61440))throw new q(m.m);a=Ob(a,b,g);a.h=B.h;a.g=B.g;return a},
135   -Ra:function(a){try{var b=F.lstatSync(a);B.la&&(b.mode|=(b.mode&292)>>2)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);}return b.mode},A:function(a){for(var b=[];a.parent!==a;)b.push(a.name),a=a.parent;b.push(a.v.za.root);b.reverse();return pd.apply(null,b)},eb:function(a){a&=-2656257;var b=0,g;for(g in B.Oa)a&g&&(b|=B.Oa[g],a^=g);if(a)throw new q(m.m);return b},h:{K:function(a){a=B.A(a);try{var b=F.lstatSync(a)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);}B.la&&!b.O&&(b.O=4096);B.la&&
136   -!b.blocks&&(b.blocks=(b.size+b.O-1)/b.O|0);return{dev:b.dev,ino:b.ino,mode:b.mode,nlink:b.nlink,uid:b.uid,gid:b.gid,rdev:b.rdev,size:b.size,atime:b.atime,mtime:b.mtime,ctime:b.ctime,O:b.O,blocks:b.blocks}},C:function(a,b){var c=B.A(a);try{void 0!==b.mode&&(F.chmodSync(c,b.mode),a.mode=b.mode),void 0!==b.size&&F.truncateSync(c,b.size)}catch(e){if(!e.code)throw e;throw new q(m[e.code]);}},lookup:function(a,b){var c=qa(B.A(a),b),c=B.Ra(c);return B.createNode(a,b,c)},$:function(a,b,g,e){a=B.createNode(a,
137   -b,g,e);b=B.A(a);try{16384===(a.mode&61440)?F.mkdirSync(b,a.mode):F.writeFileSync(b,"",{mode:a.mode})}catch(k){if(!k.code)throw k;throw new q(m[k.code]);}return a},rename:function(a,b,g){a=B.A(a);b=qa(B.A(b),g);try{F.renameSync(a,b)}catch(e){if(!e.code)throw e;throw new q(m[e.code]);}},unlink:function(a,b){a=qa(B.A(a),b);try{F.unlinkSync(a)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);}},rmdir:function(a,b){a=qa(B.A(a),b);try{F.rmdirSync(a)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);
138   -}},readdir:function(a){a=B.A(a);try{return F.readdirSync(a)}catch(c){if(!c.code)throw c;throw new q(m[c.code]);}},symlink:function(a,b,g){a=qa(B.A(a),b);try{F.symlinkSync(g,a)}catch(e){if(!e.code)throw e;throw new q(m[e.code]);}},readlink:function(a){var b=B.A(a);try{return b=F.readlinkSync(b),ad.relative(ad.resolve(a.v.za.root),b)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);}}},g:{open:function(a){var b=B.A(a.node);try{32768===(a.node.mode&61440)&&(a.aa=F.openSync(b,B.eb(a.flags)))}catch(g){if(!g.code)throw g;
139   -throw new q(m[g.code]);}},close:function(a){try{32768===(a.node.mode&61440)&&a.aa&&F.closeSync(a.aa)}catch(c){if(!c.code)throw c;throw new q(m[c.code]);}},read:function(a,b,g,e,d){if(0===e)return 0;try{return F.readSync(a.aa,B.Ka(b.buffer),g,e,d)}catch(l){throw new q(m[l.code]);}},write:function(a,b,g,e,d){try{return F.writeSync(a.aa,B.Ka(b.buffer),g,e,d)}catch(l){throw new q(m[l.code]);}},M:function(a,b,g){if(1===g)b+=a.position;else if(2===g&&32768===(a.node.mode&61440))try{b+=F.fstatSync(a.aa).size}catch(e){throw new q(m[e.code]);
140   -}if(0>b)throw new q(m.m);return b}}};G+=16;G+=16;G+=16;var Nb=null,Hc={},la=[],sd=1,Ja=null,Fc=!0,hb={},q=null,Rb={},vd={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},lf={open:function(a){a.g=Hc[a.node.rdev].g;a.g.open&&a.g.open(a)},M:function(){throw new q(m.ha);}},vb,Sb,ja={},Ka,La,gb,bd={},S=0,Mc=void 0,Ca={},Ba={},jb={},Aa=void 0,Nc=void 0,Za=void 0,Pa=[],cd={},Qa={},Rc=void 0,ac=[],ba=[{},{value:void 0},{value:null},
141   -{value:!0},{value:!1}],dd=G,Sa=G+=48,Ld=G+=16,Kd=G+=16;G+=16;var Vc,ed=G;G+=16;var fd,U={},V=G;G+=48;ka(Ra("GMT"),2);var wb={},oc=1,pb=[31,29,31,30,31,30,31,31,30,31,30,31],qb=[31,28,31,30,31,30,31,31,30,31,30,31];Lc();Ja=Array(4096);Ic(y,"/");fa("/tmp");fa("/home");fa("/home/web_user");(function(){fa("/dev");Mb(259,{read:function(){return 0},write:function(a,b,c,d){return d}});fb("/dev/null",259);zc(1280,jf);zc(1536,kf);fb("/dev/tty",1280);fb("/dev/tty1",1536);if("undefined"!==typeof crypto)var a=
142   -new Uint8Array(1),b=function(){crypto.getRandomValues(a);return a[0]};else b=ia?function(){return require("crypto").randomBytes(1)[0]}:function(){return 256*Math.random()|0};Na("random",b);Na("urandom",b);fa("/dev/shm");fa("/dev/shm/tmp")})();fa("/proc");fa("/proc/self");fa("/proc/self/fd");Ic({v:function(){var a=Ob("/proc/self","fd",16895,73);a.h={lookup:function(a,b){var c=la[+b];if(!c)throw new q(m.ea);a={parent:null,v:{Ua:"fake"},h:{readlink:function(){return c.path}}};return a.parent=a}};return a}},
143   -"/proc/self/fd");rb.unshift(function(){if(!b.noFSInit&&!vb){O(!vb,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");vb=!0;Lc();b.stdin=b.stdin;b.stdout=b.stdout;b.stderr=b.stderr;b.stdin?Na("stdin",b.stdin):Qb("/dev/tty","/dev/stdin");b.stdout?Na("stdout",null,b.stdout):Qb("/dev/tty","/dev/stdout");b.stderr?Na("stderr",null,b.stderr):Qb("/dev/tty1","/dev/stderr");var a=Ma("/dev/stdin",
144   -"r");O(0===a.fd,"invalid handle for stdin ("+a.fd+")");a=Ma("/dev/stdout","w");O(1===a.fd,"invalid handle for stdout ("+a.fd+")");a=Ma("/dev/stderr","w");O(2===a.fd,"invalid handle for stderr ("+a.fd+")")}});Zc.push(function(){Fc=!1});mc.push(function(){vb=!1;var a=b._fflush;a&&a(0);for(a=0;a<la.length;a++){var c=la[a];c&&Jc(c)}});rb.unshift(function(){});mc.push(function(){});if(ia){var F=require("fs"),ad=require("path");B.tb()}for(var gd=Array(256),xb=0;256>xb;++xb)gd[xb]=String.fromCharCode(xb);
145   -Mc=gd;Aa=b.BindingError=Wb("BindingError");Nc=b.InternalError=Wb("InternalError");na.prototype.isAliasOf=function(a){if(!(this instanceof na&&a instanceof na))return!1;var b=this.c.o.i,g=this.c.j,e=a.c.o.i;for(a=a.c.j;b.F;)g=b.da(g),b=b.F;for(;e.F;)a=e.da(a),e=e.F;return b===e&&g===a};na.prototype.clone=function(){this.c.j||Xb(this);if(this.c.ba)return this.c.count.value+=1,this;var a=this.c,a=Object.create(Object.getPrototypeOf(this),{c:{value:{count:a.count,U:a.U,ba:a.ba,j:a.j,o:a.o,B:a.B,D:a.D}}});
146   -a.c.count.value+=1;a.c.U=!1;return a};na.prototype["delete"]=function(){this.c.j||Xb(this);this.c.U&&!this.c.ba&&A("Object already scheduled for deletion");--this.c.count.value;if(0===this.c.count.value){var a=this.c;a.B?a.D.R(a.B):a.o.i.R(a.j)}this.c.ba||(this.c.B=void 0,this.c.j=void 0)};na.prototype.isDeleted=function(){return!this.c.j};na.prototype.deleteLater=function(){this.c.j||Xb(this);this.c.U&&!this.c.ba&&A("Object already scheduled for deletion");Pa.push(this);1===Pa.length&&Za&&Za(Yb);
147   -this.c.U=!0;return this};ha.prototype.hb=function(a){this.Va&&(a=this.Va(a));return a};ha.prototype.Z=function(a){this.R&&this.R(a)};ha.prototype.argPackAdvance=8;ha.prototype.readValueFromPointer=kb;ha.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};ha.prototype.fromWireType=function(a){function b(){return this.ka?lb(this.i.V,{o:this.mb,j:g,D:this,B:a}):lb(this.i.V,{o:this,j:a})}var g=this.hb(a);if(!g)return this.Z(a),null;var e=Dd(this.i,g);if(void 0!==e){if(0===e.c.count.value)return e.c.j=
148   -g,e.c.B=a,e.clone();e=e.clone();this.Z(a);return e}e=this.i.fb(g);e=cd[e];if(!e)return b.call(this);var e=this.ja?e.bb:e.pointerType,d=Qc(g,this.i,e.i);return null===d?b.call(this):this.ka?lb(e.i.V,{o:e,j:d,D:this,B:a}):lb(e.i.V,{o:e,j:d})};b.getInheritedInstanceCount=function(){return Object.keys(Qa).length};b.getLiveInheritedInstances=function(){var a=[],b;for(b in Qa)Qa.hasOwnProperty(b)&&a.push(Qa[b]);return a};b.flushPendingDeletes=Yb;b.setDelayFunction=function(a){Za=a;Pa.length&&Za&&Za(Yb)};
149   -Rc=b.UnboundTypeError=Wb("UnboundTypeError");b.count_emval_handles=function(){for(var a=0,b=5;b<ba.length;++b)void 0!==ba[b]&&++a;return a};b.get_first_emval=function(){for(var a=5;a<ba.length;++a)if(void 0!==ba[a])return ba[a];return null};var Ga,ua;fd?(ua=p[ed>>2],Ga=p[ua>>2]):(fd=!0,U.USER=U.LOGNAME="web_user",U.PATH="/",U.PWD="/",U.HOME="/home/web_user",U.LANG="C.UTF-8",U._=b.thisProgram,Ga=r(1024),ua=r(256),p[ua>>2]=Ga,p[ed>>2]=ua);var yb=[],hd=0,zb;for(zb in U)if("string"===typeof U[zb]){var Ab=
150   -zb+"="+U[zb];yb.push(Ab);hd+=Ab.length}if(1024<hd)throw Error("Environment size exceeded TOTAL_ENV_SIZE!");for(var Bb=0;Bb<yb.length;Bb++){for(var id=Ab=yb[Bb],jd=Ga,pc=0;pc<id.length;++pc)P[jd++>>0]=id.charCodeAt(pc);P[jd>>0]=0;p[ua+4*Bb>>2]=Ga;Ga+=Ab.length+1}p[ua+4*yb.length>>2]=0;aa=r(4);hc=tb=v(G);ic=hc+lc;jc=v(ic);p[aa>>2]=jc;Db=!0;b.wasmTableSize=3583;b.wasmMaxTableSize=3583;b.$a={};b.ab={abort:E,enlargeMemory:qc,getTotalMemory:function(){return H},abortOnCannotGrowMemory:function(){E("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+
151   -H+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")},invoke_di:function(a,c){try{return b.dynCall_di(a,c)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},invoke_dii:function(a,c,g){try{return b.dynCall_dii(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_diiii:function(a,c,g,e,d){try{return b.dynCall_diiii(a,
152   -c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_fi:function(a,c){try{return b.dynCall_fi(a,c)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},invoke_fii:function(a,c,g){try{return b.dynCall_fii(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_fiifffi:function(a,c,g,e,d,l,f){try{return b.dynCall_fiifffi(a,c,g,e,d,l,f)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_fiii:function(a,
153   -c,g,e){try{return b.dynCall_fiii(a,c,g,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_i:function(a){try{return b.dynCall_i(a)}catch(c){if("number"!==typeof c&&"longjmp"!==c)throw c;b.setThrew(1,0)}},invoke_ii:function(a,c){try{return b.dynCall_ii(a,c)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},invoke_iid:function(a,c,g){try{return b.dynCall_iid(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_iififi:function(a,
154   -c,g,e,d,l){try{return b.dynCall_iififi(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_iii:function(a,c,g){try{return b.dynCall_iii(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_iiifii:function(a,c,g,e,d,l){try{return b.dynCall_iiifii(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_iiifiiiiiii:function(a,c,g,e,d,l,f,n,h,u,w){try{return b.dynCall_iiifiiiiiii(a,c,g,e,d,
155   -l,f,n,h,u,w)}catch(J){if("number"!==typeof J&&"longjmp"!==J)throw J;b.setThrew(1,0)}},invoke_iiii:function(a,c,g,e){try{return b.dynCall_iiii(a,c,g,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_iiiidi:function(a,c,g,e,d,l){try{return b.dynCall_iiiidi(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_iiiii:function(a,c,g,e,d){try{return b.dynCall_iiiii(a,c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,
156   -0)}},invoke_iiiiifi:function(a,c,g,e,d,l,f){try{return b.dynCall_iiiiifi(a,c,g,e,d,l,f)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_iiiiii:function(a,c,g,e,d,l){try{return b.dynCall_iiiiii(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_iiiiiii:function(a,c,g,e,d,l,f){try{return b.dynCall_iiiiiii(a,c,g,e,d,l,f)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_iiiiiiii:function(a,c,g,e,d,
157   -l,f,h){try{return b.dynCall_iiiiiiii(a,c,g,e,d,l,f,h)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_iiiiiiiif:function(a,c,g,e,d,l,f,h,z){try{return b.dynCall_iiiiiiiif(a,c,g,e,d,l,f,h,z)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_iiiiiiiii:function(a,c,g,e,d,l,f,h,z){try{return b.dynCall_iiiiiiiii(a,c,g,e,d,l,f,h,z)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_iiiiiiiiii:function(a,c,g,e,d,l,
158   -f,h,z,u){try{return b.dynCall_iiiiiiiiii(a,c,g,e,d,l,f,h,z,u)}catch(w){if("number"!==typeof w&&"longjmp"!==w)throw w;b.setThrew(1,0)}},invoke_iiiiiiiiiiii:function(a,c,g,e,d,l,f,h,z,u,w,m){try{return b.dynCall_iiiiiiiiiiii(a,c,g,e,d,l,f,h,z,u,w,m)}catch(ma){if("number"!==typeof ma&&"longjmp"!==ma)throw ma;b.setThrew(1,0)}},invoke_iiiiiiiiiiiiiiii:function(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v){try{return b.dynCall_iiiiiiiiiiiiiiii(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v)}catch(M){if("number"!==typeof M&&"longjmp"!==
159   -M)throw M;b.setThrew(1,0)}},invoke_iiiiiiiiiiiiiiiiii:function(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v,M,y){try{return b.dynCall_iiiiiiiiiiiiiiiiii(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v,M,y)}catch(va){if("number"!==typeof va&&"longjmp"!==va)throw va;b.setThrew(1,0)}},invoke_v:function(a){try{b.dynCall_v(a)}catch(c){if("number"!==typeof c&&"longjmp"!==c)throw c;b.setThrew(1,0)}},invoke_vi:function(a,c){try{b.dynCall_vi(a,c)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},invoke_vidii:function(a,
160   -c,g,e,d){try{b.dynCall_vidii(a,c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_vif:function(a,c,g){try{b.dynCall_vif(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_viffffffff:function(a,c,g,e,d,l,f,h,m,u){try{b.dynCall_viffffffff(a,c,g,e,d,l,f,h,m,u)}catch(w){if("number"!==typeof w&&"longjmp"!==w)throw w;b.setThrew(1,0)}},invoke_viffffffffffffffff:function(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v,M,y){try{b.dynCall_viffffffffffffffff(a,
161   -c,g,e,d,l,f,h,m,u,w,q,p,r,t,v,M,y)}catch(va){if("number"!==typeof va&&"longjmp"!==va)throw va;b.setThrew(1,0)}},invoke_vii:function(a,c,g){try{b.dynCall_vii(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_viid:function(a,c,g,e){try{b.dynCall_viid(a,c,g,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_viiddi:function(a,c,g,e,d,l){try{b.dynCall_viiddi(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,
162   -0)}},invoke_viidi:function(a,c,g,e,d){try{b.dynCall_viidi(a,c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viididii:function(a,c,g,e,d,l,f,h){try{b.dynCall_viididii(a,c,g,e,d,l,f,h)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_viif:function(a,c,g,e){try{b.dynCall_viif(a,c,g,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_viiffff:function(a,c,g,e,d,f,h){try{b.dynCall_viiffff(a,c,g,e,d,f,
163   -h)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viifi:function(a,c,g,e,d){try{b.dynCall_viifi(a,c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viifii:function(a,c,g,e,d,f){try{b.dynCall_viifii(a,c,g,e,d,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viifiif:function(a,c,g,e,d,f,h){try{b.dynCall_viifiif(a,c,g,e,d,f,h)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},
164   -invoke_viii:function(a,c,d,e){try{b.dynCall_viii(a,c,d,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_viiid:function(a,c,d,e,k){try{b.dynCall_viiid(a,c,d,e,k)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viiidd:function(a,c,d,e,k,f){try{b.dynCall_viiidd(a,c,d,e,k,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viiiddi:function(a,c,d,e,k,f,h){try{b.dynCall_viiiddi(a,c,d,e,k,f,h)}catch(n){if("number"!==
165   -typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viiidi:function(a,c,d,e,k,f){try{b.dynCall_viiidi(a,c,d,e,k,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viiidii:function(a,c,d,e,k,f,h){try{b.dynCall_viiidii(a,c,d,e,k,f,h)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viiif:function(a,c,d,e,k){try{b.dynCall_viiif(a,c,d,e,k)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viiifiii:function(a,
166   -c,d,e,k,f,h,n){try{b.dynCall_viiifiii(a,c,d,e,k,f,h,n)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_viiii:function(a,c,d,e,k){try{b.dynCall_viiii(a,c,d,e,k)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viiiid:function(a,c,d,e,k,f){try{b.dynCall_viiiid(a,c,d,e,k,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viiiidi:function(a,c,d,e,k,f,h){try{b.dynCall_viiiidi(a,c,d,e,k,f,h)}catch(n){if("number"!==
167   -typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viiiidiii:function(a,c,d,e,k,f,h,n,m){try{b.dynCall_viiiidiii(a,c,d,e,k,f,h,n,m)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_viiiii:function(a,c,d,e,k,f){try{b.dynCall_viiiii(a,c,d,e,k,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viiiiidi:function(a,c,d,e,k,f,h,n){try{b.dynCall_viiiiidi(a,c,d,e,k,f,h,n)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,
168   -0)}},invoke_viiiiifi:function(a,c,d,e,k,f,h,n){try{b.dynCall_viiiiifi(a,c,d,e,k,f,h,n)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_viiiiii:function(a,c,d,e,k,f,h){try{b.dynCall_viiiiii(a,c,d,e,k,f,h)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viiiiiiddi:function(a,c,d,e,f,l,h,n,m,u){try{b.dynCall_viiiiiiddi(a,c,d,e,f,l,h,n,m,u)}catch(w){if("number"!==typeof w&&"longjmp"!==w)throw w;b.setThrew(1,0)}},invoke_viiiiiidi:function(a,
169   -c,d,e,f,l,h,n,m){try{b.dynCall_viiiiiidi(a,c,d,e,f,l,h,n,m)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_viiiiiii:function(a,c,d,e,f,l,h,n){try{b.dynCall_viiiiiii(a,c,d,e,f,l,h,n)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_viiiiiiiddi:function(a,c,d,e,f,l,h,n,m,u,w){try{b.dynCall_viiiiiiiddi(a,c,d,e,f,l,h,n,m,u,w)}catch(J){if("number"!==typeof J&&"longjmp"!==J)throw J;b.setThrew(1,0)}},invoke_viiiiiiii:function(a,c,d,e,f,l,h,
170   -n,m){try{b.dynCall_viiiiiiii(a,c,d,e,f,l,h,n,m)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_viiiiiiiifi:function(a,c,d,e,f,l,h,n,m,u,w){try{b.dynCall_viiiiiiiifi(a,c,d,e,f,l,h,n,m,u,w)}catch(J){if("number"!==typeof J&&"longjmp"!==J)throw J;b.setThrew(1,0)}},invoke_viiiiiiiii:function(a,c,d,e,f,l,h,n,m,u){try{b.dynCall_viiiiiiiii(a,c,d,e,f,l,h,n,m,u)}catch(w){if("number"!==typeof w&&"longjmp"!==w)throw w;b.setThrew(1,0)}},invoke_viiiiiiiiii:function(a,c,d,e,f,l,
171   -h,n,m,u,w){try{b.dynCall_viiiiiiiiii(a,c,d,e,f,l,h,n,m,u,w)}catch(J){if("number"!==typeof J&&"longjmp"!==J)throw J;b.setThrew(1,0)}},invoke_viiiiiiiiiiddi:function(a,c,d,e,f,l,h,n,m,u,w,q,p,r){try{b.dynCall_viiiiiiiiiiddi(a,c,d,e,f,l,h,n,m,u,w,q,p,r)}catch(Q){if("number"!==typeof Q&&"longjmp"!==Q)throw Q;b.setThrew(1,0)}},invoke_viiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,w,q){try{b.dynCall_viiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,w,q)}catch(ma){if("number"!==typeof ma&&"longjmp"!==ma)throw ma;b.setThrew(1,
172   -0)}},invoke_viiiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,w,q,p){try{b.dynCall_viiiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,w,q,p)}catch(ca){if("number"!==typeof ca&&"longjmp"!==ca)throw ca;b.setThrew(1,0)}},invoke_viiiiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,w,q,p,r){try{b.dynCall_viiiiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,w,q,p,r)}catch(Q){if("number"!==typeof Q&&"longjmp"!==Q)throw Q;b.setThrew(1,0)}},invoke_viiiiiiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,q,p,r,t,v,y){try{b.dynCall_viiiiiiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,
173   -q,p,r,t,v,y)}catch(M){if("number"!==typeof M&&"longjmp"!==M)throw M;b.setThrew(1,0)}},invoke_viiiiiiiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,q,p,r,t,v,y,M){try{b.dynCall_viiiiiiiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,q,p,r,t,v,y,M)}catch(cc){if("number"!==typeof cc&&"longjmp"!==cc)throw cc;b.setThrew(1,0)}},invoke_vij:function(a,c,d,e){try{b.dynCall_vij(a,c,d,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},_DMImage_Save:function(){b.printErr("missing function: DMImage_Save");E(-1)},
174   -__ZSt18uncaught_exceptionv:xa,___assert_fail:function(a,b,d,e){E("Assertion failed: "+N(a)+", at: "+[b?N(b):"unknown filename",d,e?N(e):"unknown function"])},___cxa_allocate_exception:function(a){return da(a)},___cxa_begin_catch:function(a){var b=X[a];b&&!b.La&&(b.La=!0,xa.u--);b&&(b.oa=!1);ub.push(a);(b=wc(a))&&X[b].X++;return a},___cxa_call_unexpected:function(a){b.printErr("Unexpected exception thrown, this is not properly supported - aborting");Wa=!0;throw a;},___cxa_end_catch:function(){b.setThrew(0);
175   -var a=ub.pop();if(a){if(a=wc(a)){var c=X[a];O(0<c.X);c.X--;0!==c.X||c.oa||(c.Z&&b.dynCall_vi(c.Z,a),delete X[a],xc(a))}ya=0}},___cxa_find_matching_catch_2:function(){return Ib.apply(null,arguments)},___cxa_find_matching_catch_3:function(){return Ib.apply(null,arguments)},___cxa_find_matching_catch_4:function(){return Ib.apply(null,arguments)},___cxa_free_exception:xc,___cxa_get_exception_ptr:function(a){return a},___cxa_pure_virtual:function(){Wa=!0;throw"Pure virtual function called!";},___cxa_rethrow:function(){var a=
176   -ub.pop();X[a].oa||(ub.push(a),X[a].oa=!0);ya=a;throw a;},___cxa_throw:function(a,b,d){X[a]={j:a,Ia:a,type:b,Z:d,X:0,La:!1,oa:!1};ya=a;"uncaught_exception"in xa?xa.u++:xa.u=1;throw a;},___lock:function(){},___map_file:function(){Jb(m.Y);return-1},___resumeException:function(a){ya||(ya=a);throw a;},___setErrNo:Jb,___syscall140:function(a,b){S=b;try{var c=za();D();var e=D(),d=D(),f=D();Kc(c,e,f);p[d>>2]=c.position;c.wa&&0===e&&0===f&&(c.wa=null);return 0}catch(x){return"undefined"!==typeof ja&&x instanceof
177   -q||E(x),-x.J}},___syscall145:function(a,b){S=b;try{var c=za(),e=D();a:{var d=D();for(b=a=0;b<d;b++){var f=p[e+(8*b+4)>>2],h=c,n=p[e+8*b>>2],r=f,u=void 0,w=P;if(0>r||0>u)throw new q(m.m);if(1===(h.flags&2097155))throw new q(m.ea);if(16384===(h.node.mode&61440))throw new q(m.ga);if(!h.g.read)throw new q(m.m);var t="undefined"!==typeof u;if(!t)u=h.position;else if(!h.seekable)throw new q(m.ha);var v=h.g.read(h,w,n,r,u);t||(h.position+=v);h=v;if(0>h){var y=-1;break a}a+=h;if(h<f)break}y=a}return y}catch(Q){return"undefined"!==
178   -typeof ja&&Q instanceof q||E(Q),-Q.J}},___syscall146:function(a,b){S=b;try{var c=za(),e=D();a:{var d=D();for(b=a=0;b<d;b++){var f=c,h=p[e+8*b>>2],n=p[e+(8*b+4)>>2],r=P,u=void 0;if(0>n||0>u)throw new q(m.m);if(0===(f.flags&2097155))throw new q(m.ea);if(16384===(f.node.mode&61440))throw new q(m.ga);if(!f.g.write)throw new q(m.m);f.flags&1024&&Kc(f,0,2);var w="undefined"!==typeof u;if(!w)u=f.position;else if(!f.seekable)throw new q(m.ha);var t=f.g.write(f,r,h,n,u,void 0);w||(f.position+=t);try{if(f.path&&
179   -hb.onWriteToFile)hb.onWriteToFile(f.path)}catch(ca){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+ca.message)}f=t;if(0>f){var v=-1;break a}a+=f}v=a}return v}catch(ca){return"undefined"!==typeof ja&&ca instanceof q||E(ca),-ca.J}},___syscall20:function(a,b){S=b;return 42},___syscall221:function(a,b){S=b;try{var c=za();switch(D()){case 0:var e=D();return 0>e?-m.m:Ma(c.path,c.flags,0,e).fd;case 1:case 2:return 0;case 3:return c.flags;case 4:return e=D(),c.flags|=
180   -e,0;case 12:case 12:return e=D(),Ha[e+0>>1]=2,0;case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-m.m;case 9:return Jb(m.m),-1;default:return-m.m}}catch(k){return"undefined"!==typeof ja&&k instanceof q||E(k),-k.J}},___syscall5:function(a,b){S=b;try{var c=N(D()),e=D(),d=D();return Ma(c,e,d).fd}catch(l){return"undefined"!==typeof ja&&l instanceof q||E(l),-l.J}},___syscall54:function(a,b){S=b;try{var c=za(),e=D();switch(e){case 21509:case 21505:return c.tty?0:-m.T;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return c.tty?
181   -0:-m.T;case 21519:if(!c.tty)return-m.T;var d=D();return p[d>>2]=0;case 21520:return c.tty?-m.m:-m.T;case 21531:a=D();if(!c.g.jb)throw new q(m.T);return c.g.jb(c,e,a);case 21523:return c.tty?0:-m.T;default:E("bad ioctl syscall "+e)}}catch(l){return"undefined"!==typeof ja&&l instanceof q||E(l),-l.J}},___syscall6:function(a,b){S=b;try{var c=za();Jc(c);return 0}catch(e){return"undefined"!==typeof ja&&e instanceof q||E(e),-e.J}},___syscall85:function(a,b){S=b;try{var c=N(D()),e=D(),d=D();if(0>=d)var f=
182   --m.m;else{var h=Bc(c),n=Math.min(d,wa(h)),p=P[e+n];Z(h,I,e,d+1);P[e+n]=p;f=n}return f}catch(u){return"undefined"!==typeof ja&&u instanceof q||E(u),-u.J}},___syscall91:function(a,b){S=b;try{var c=D(),e=D(),d=bd[c];if(!d)return 0;if(e===d.Bd){var f=la[d.fd],h=d.flags,n=new Uint8Array(I.subarray(c,c+e));f&&f.g.na&&f.g.na(f,n,0,e,h);bd[c]=null;d.Za&&R(d.Cd)}return 0}catch(z){return"undefined"!==typeof ja&&z instanceof q||E(z),-z.J}},___unlock:function(){},__embind_register_bool:function(a,b,d,e,f){var c=
183   -Tb(d);b=T(b);ga(a,{name:b,fromWireType:function(a){return!!a},toWireType:function(a,b){return b?e:f},argPackAdvance:8,readValueFromPointer:function(a){if(1===d)var e=P;else if(2===d)e=Ha;else if(4===d)e=p;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(e[a>>c])},I:null})},__embind_register_class:function(a,b,d,e,f,h,m,n,q,u,p,r,t){p=T(p);h=Ea(f,h);n&&(n=Ea(m,n));u&&(u=Ea(q,u));t=Ea(r,t);var c=Ub(p);yd(c,function(){$b("Cannot construct "+p+" due to unbound types",
184   -[e])});Oa([a,b,d],e?[e]:[],function(b){b=b[0];if(e)var d=b.i,f=d.V;else f=na.prototype;b=Vb(c,function(){if(Object.getPrototypeOf(this)!==g)throw new Aa("Use 'new' to construct "+p);if(void 0===k.P)throw new Aa(p+" has no accessible constructor");var a=k.P[arguments.length];if(void 0===a)throw new Aa("Tried to invoke ctor of "+p+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(k.P).toString()+") parameters instead!");return a.apply(this,arguments)});var g=Object.create(f,
185   -{constructor:{value:b}});b.prototype=g;var k=new zd(p,b,g,t,d,h,n,u),d=new ha(p,k,!0,!1,!1),f=new ha(p+"*",k,!1,!1,!1),l=new ha(p+" const*",k,!1,!0,!1);cd[a]={pointerType:f,bb:l};Ed(c,b);return[d,f,l]})},__embind_register_class_constructor:function(a,b,d,e,f,h){var c=Sc(b,d);f=Ea(e,f);Oa([],[a],function(a){a=a[0];var e="constructor "+a.name;void 0===a.i.P&&(a.i.P=[]);if(void 0!==a.i.P[b-1])throw new Aa("Cannot register multiple constructors with identical number of parameters ("+(b-1)+") for class '"+
186   -a.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");a.i.P[b-1]=function(){$b("Cannot construct "+a.name+" due to unbound types",c)};Oa([],c,function(c){a.i.P[b-1]=function(){arguments.length!==b-1&&A(e+" called with "+arguments.length+" arguments, expected "+(b-1));var a=[],d=Array(b);d[0]=h;for(var g=1;g<b;++g)d[g]=c[g].toWireType(a,arguments[g-1]);d=f.apply(null,d);Tc(a);return c[0].fromWireType(d)};return[]});return[]})},__embind_register_class_function:function(a,
187   -b,d,e,f,h,m,n){var c=Sc(d,e);b=T(b);h=Ea(f,h);Oa([],[a],function(a){function e(){$b("Cannot call "+f+" due to unbound types",c)}a=a[0];var f=a.name+"."+b;n&&a.i.nb.push(b);var g=a.i.V,k=g[b];void 0===k||void 0===k.H&&k.className!==a.name&&k.ia===d-2?(e.ia=d-2,e.className=a.name,g[b]=e):(Oc(g,b,f),g[b].H[d-2]=e);Oa([],c,function(c){var e=f,k=a,l=h,n=c.length;2>n&&A("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var p=null!==c[1]&&null!==k,q=!1,k=1;k<c.length;++k)if(null!==
188   -c[k]&&void 0===c[k].I){q=!0;break}for(var u="void"!==c[0].name,r="",t="",k=0;k<n-2;++k)r+=(0!==k?", ":"")+"arg"+k,t+=(0!==k?", ":"")+"arg"+k+"Wired";e="return function "+Ub(e)+"("+r+") {\nif (arguments.length !== "+(n-2)+") {\nthrowBindingError('function "+e+" called with ' + arguments.length + ' arguments, expected "+(n-2)+" args!');\n}\n";q&&(e+="var destructors = [];\n");var w=q?"destructors":"null",r="throwBindingError invoker fn runDestructors retType classParam".split(" "),l=[A,l,m,Tc,c[0],
189   -c[1]];p&&(e+="var thisWired = classParam.toWireType("+w+", this);\n");for(k=0;k<n-2;++k)e+="var arg"+k+"Wired = argType"+k+".toWireType("+w+", arg"+k+"); // "+c[k+2].name+"\n",r.push("argType"+k),l.push(c[k+2]);p&&(t="thisWired"+(0<t.length?", ":"")+t);e+=(u?"var rv = ":"")+"invoker(fn"+(0<t.length?", ":"")+t+");\n";if(q)e+="runDestructors(destructors);\n";else for(k=p?1:2;k<c.length;++k)n=1===k?"thisWired":"arg"+(k-2)+"Wired",null!==c[k].I&&(e+=n+"_dtor("+n+"); // "+c[k].name+"\n",r.push(n+"_dtor"),
190   -l.push(c[k].I));u&&(e+="var ret = retType.fromWireType(rv);\nreturn ret;\n");r.push(e+"}\n");c=Hd(r).apply(null,l);void 0===g[b].H?(c.ia=d-2,g[b]=c):g[b].H[d-2]=c;return[]});return[]})},__embind_register_emval:function(a,b){b=T(b);ga(a,{name:b,fromWireType:function(a){var b=ba[a].value;4<a&&0===--ba[a].X&&(ba[a]=void 0,ac.push(a));return b},toWireType:function(a,b){return Pc(b)},argPackAdvance:8,readValueFromPointer:kb,I:null})},__embind_register_float:function(a,b,d){d=Tb(d);b=T(b);ga(a,{name:b,
191   -fromWireType:function(a){return a},toWireType:function(a,b){if("number"!==typeof b&&"boolean"!==typeof b)throw new TypeError('Cannot convert "'+Da(b)+'" to '+this.name);return b},argPackAdvance:8,readValueFromPointer:Id(b,d),I:null})},__embind_register_integer:function(a,b,d,e,f){function c(a){return a}b=T(b);-1===f&&(f=4294967295);var g=Tb(d);if(0===e)var k=32-8*d,c=function(a){return a<<k>>>k};var h=-1!=b.indexOf("unsigned");ga(a,{name:b,fromWireType:c,toWireType:function(a,c){if("number"!==typeof c&&
192   -"boolean"!==typeof c)throw new TypeError('Cannot convert "'+Da(c)+'" to '+this.name);if(c<e||c>f)throw new TypeError('Passing a number "'+Da(c)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?c>>>0:c|0},argPackAdvance:8,readValueFromPointer:Jd(b,g,0!==e),I:null})},__embind_register_memory_view:function(a,b,d){function c(a){a>>=2;var b=ea;return new f(b.buffer,b[a+1],b[a])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
193   -Uint32Array,Float32Array,Float64Array][b];d=T(d);ga(a,{name:d,fromWireType:c,argPackAdvance:8,readValueFromPointer:c},{ib:!0})},__embind_register_std_string:function(a,b){b=T(b);ga(a,{name:b,fromWireType:function(a){for(var b=ea[a>>2],c=Array(b),d=0;d<b;++d)c[d]=String.fromCharCode(I[a+4+d]);R(a);return c.join("")},toWireType:function(a,b){function c(a,b){return a[b]}function d(a,b){return a.charCodeAt(b)}b instanceof ArrayBuffer&&(b=new Uint8Array(b));var e;b instanceof Uint8Array?e=c:b instanceof
194   -Uint8ClampedArray?e=c:b instanceof Int8Array?e=c:"string"===typeof b?e=d:A("Cannot pass non-string to std::string");var f=b.length,g=da(4+f);ea[g>>2]=f;for(var h=0;h<f;++h){var m=e(b,h);255<m&&(R(g),A("String has UTF-16 code units that do not fit in 8 bits"));I[g+4+h]=m}null!==a&&a.push(R,g);return g},argPackAdvance:8,readValueFromPointer:kb,I:function(a){R(a)}})},__embind_register_std_wstring:function(a,b,d){d=T(d);if(2===b)var c=function(){return Gb},f=1;else 4===b&&(c=function(){return ea},f=2);
195   -ga(a,{name:d,fromWireType:function(a){for(var b=c(),d=ea[a>>2],e=Array(d),g=a+4>>f,h=0;h<d;++h)e[h]=String.fromCharCode(b[g+h]);R(a);return e.join("")},toWireType:function(a,d){var e=c(),g=d.length,h=da(4+g*b);ea[h>>2]=g;for(var k=h+4>>f,l=0;l<g;++l)e[k+l]=d.charCodeAt(l);null!==a&&a.push(R,h);return h},argPackAdvance:8,readValueFromPointer:kb,I:function(a){R(a)}})},__embind_register_void:function(a,b){b=T(b);ga(a,{Ad:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},
196   -_abort:function(){b.abort()},_asctime:function(a){var b=p[a>>2],d=p[a+4>>2],e=p[a+8>>2],f=p[a+12>>2];Z("Sun Mon Tue Wed Thu Fri Sat".split(" ")[p[a+24>>2]]+" "+"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")[p[a+16>>2]]+(10>f?" ":" ")+f+(10>e?" 0":" ")+e+(10>d?":0":":")+d+(10>b?":0":":")+b+" "+(1900+p[a+20>>2])+"\n",I,dd,26);return dd},_clock:mb,_emscripten_memcpy_big:function(a,b,d){I.set(I.subarray(b,b+d),a);return a},_emscripten_run_script_string:Y,_getenv:Ta,_llvm_eh_typeid_for:function(a){return a},
197   -_llvm_exp2_f64:function(){return Md.apply(null,arguments)},_llvm_trap:function(){E("trap!")},_localtime:function(a){Uc();a=new Date(1E3*p[a>>2]);p[V>>2]=a.getSeconds();p[V+4>>2]=a.getMinutes();p[V+8>>2]=a.getHours();p[V+12>>2]=a.getDate();p[V+16>>2]=a.getMonth();p[V+20>>2]=a.getFullYear()-1900;p[V+24>>2]=a.getDay();var b=new Date(a.getFullYear(),0,1);p[V+28>>2]=(a.getTime()-b.getTime())/864E5|0;p[V+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(2E3,6,1)).getTimezoneOffset(),b=b.getTimezoneOffset();
198   -a=(d!=b&&a.getTimezoneOffset()==Math.min(b,d))|0;p[V+32>>2]=a;p[V+40>>2]=p[Sa+(a?4:0)>>2];return V},_mktime:function(a){Uc();var b=new Date(p[a+20>>2]+1900,p[a+16>>2],p[a+12>>2],p[a+8>>2],p[a+4>>2],p[a>>2],0),d=p[a+32>>2],e=b.getTimezoneOffset(),f=new Date(b.getFullYear(),0,1),h=(new Date(2E3,6,1)).getTimezoneOffset(),m=f.getTimezoneOffset(),n=Math.min(m,h);0>d?p[a+32>>2]=Number(h!=m&&n==e):0<d!=(n==e)&&(h=Math.max(m,h),b.setTime(b.getTime()+6E4*((0<d?n:h)-e)));p[a+24>>2]=b.getDay();p[a+28>>2]=(b.getTime()-
199   -f.getTime())/864E5|0;return b.getTime()/1E3|0},_nanosleep:function(a,b){var c=p[a>>2];a=p[a+4>>2];0!==b&&(p[b>>2]=0,p[b+4>>2]=0);return Wc(1E6*c+a/1E3)},_pthread_cond_wait:function(){return 0},_pthread_detach:function(){},_pthread_getspecific:function(a){return wb[a]||0},_pthread_key_create:function(a){if(0==a)return m.m;p[a>>2]=oc;wb[oc]=0;oc++;return 0},_pthread_mutex_destroy:function(){},_pthread_mutex_init:function(){},_pthread_mutexattr_destroy:function(){},_pthread_mutexattr_init:function(){},
200   -_pthread_mutexattr_settype:function(){},_pthread_once:Ua,_pthread_setspecific:function(a,b){if(!(a in wb))return m.m;wb[a]=b;return 0},_pthread_spin_destroy:function(){return 0},_pthread_spin_init:function(){return 0},_pthread_spin_lock:function(){return 0},_pthread_spin_unlock:function(){return 0},_sem_close:function(){b.printErr("missing function: sem_close");E(-1)},_sem_destroy:function(){},_sem_open:function(){b.printErr("missing function: sem_open");E(-1)},_sem_post:function(){},_sem_trywait:function(){},
201   -_sem_unlink:function(){b.printErr("missing function: sem_unlink");E(-1)},_strftime:Xc,_strftime_l:function(a,b,d,e){return Xc(a,b,d,e)},_time:function(a){var b=Date.now()/1E3|0;a&&(p[a>>2]=b);return b},_usleep:Wc,DYNAMICTOP_PTR:aa,STACKTOP:tb};var kd=b.asm(b.$a,b.ab,L);b.asm=kd;var Pd=b.__GLOBAL__I_000101=function(){return b.asm.__GLOBAL__I_000101.apply(null,arguments)},Ke=b.__GLOBAL__sub_I_AztecReader_cpp=function(){return b.asm.__GLOBAL__sub_I_AztecReader_cpp.apply(null,arguments)},Qe=b.__GLOBAL__sub_I_BarcodeLocationOnSite_cpp=
202   -function(){return b.asm.__GLOBAL__sub_I_BarcodeLocationOnSite_cpp.apply(null,arguments)},$e=b.__GLOBAL__sub_I_BarcodeLocation_cpp=function(){return b.asm.__GLOBAL__sub_I_BarcodeLocation_cpp.apply(null,arguments)},Rd=b.__GLOBAL__sub_I_BarcodeReaderCore_cpp=function(){return b.asm.__GLOBAL__sub_I_BarcodeReaderCore_cpp.apply(null,arguments)},Td=b.__GLOBAL__sub_I_BarcodeReaderInner_cpp=function(){return b.asm.__GLOBAL__sub_I_BarcodeReaderInner_cpp.apply(null,arguments)},af=b.__GLOBAL__sub_I_CharacterSetECI_cpp=
203   -function(){return b.asm.__GLOBAL__sub_I_CharacterSetECI_cpp.apply(null,arguments)},Ge=b.__GLOBAL__sub_I_CodaBarReader_cpp=function(){return b.asm.__GLOBAL__sub_I_CodaBarReader_cpp.apply(null,arguments)},Fe=b.__GLOBAL__sub_I_Code128Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Code128Reader_cpp.apply(null,arguments)},Ee=b.__GLOBAL__sub_I_Code39Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Code39Reader_cpp.apply(null,arguments)},De=b.__GLOBAL__sub_I_Code93Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Code93Reader_cpp.apply(null,
204   -arguments)},ee=b.__GLOBAL__sub_I_Common_cpp=function(){return b.asm.__GLOBAL__sub_I_Common_cpp.apply(null,arguments)},Pe=b.__GLOBAL__sub_I_CropImage_cpp=function(){return b.asm.__GLOBAL__sub_I_CropImage_cpp.apply(null,arguments)},Sd=b.__GLOBAL__sub_I_DMBarcodeDecoder_cpp=function(){return b.asm.__GLOBAL__sub_I_DMBarcodeDecoder_cpp.apply(null,arguments)},Wd=b.__GLOBAL__sub_I_DMFindlineByContours_cpp=function(){return b.asm.__GLOBAL__sub_I_DMFindlineByContours_cpp.apply(null,arguments)},Xd=b.__GLOBAL__sub_I_DMFindline_cpp=
205   -function(){return b.asm.__GLOBAL__sub_I_DMFindline_cpp.apply(null,arguments)},de=b.__GLOBAL__sub_I_DMLicenseInfo_cpp=function(){return b.asm.__GLOBAL__sub_I_DMLicenseInfo_cpp.apply(null,arguments)},se=b.__GLOBAL__sub_I_DMLog_cpp=function(){return b.asm.__GLOBAL__sub_I_DMLog_cpp.apply(null,arguments)},Ye=b.__GLOBAL__sub_I_DMVersion_cpp=function(){return b.asm.__GLOBAL__sub_I_DMVersion_cpp.apply(null,arguments)},Se=b.__GLOBAL__sub_I_DataMask_cpp=function(){return b.asm.__GLOBAL__sub_I_DataMask_cpp.apply(null,
206   -arguments)},Ze=b.__GLOBAL__sub_I_DataMatrixReader_cpp=function(){return b.asm.__GLOBAL__sub_I_DataMatrixReader_cpp.apply(null,arguments)},Je=b.__GLOBAL__sub_I_Deblur_cpp=function(){return b.asm.__GLOBAL__sub_I_Deblur_cpp.apply(null,arguments)},Vd=b.__GLOBAL__sub_I_DecodeInner_cpp=function(){return b.asm.__GLOBAL__sub_I_DecodeInner_cpp.apply(null,arguments)},ke=b.__GLOBAL__sub_I_DynamsoftBarcodeReader_wasm_cpp=function(){return b.asm.__GLOBAL__sub_I_DynamsoftBarcodeReader_wasm_cpp.apply(null,arguments)},
207   -Ce=b.__GLOBAL__sub_I_EAN13Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_EAN13Reader_cpp.apply(null,arguments)},Be=b.__GLOBAL__sub_I_EAN8Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_EAN8Reader_cpp.apply(null,arguments)},ye=b.__GLOBAL__sub_I_ErrorCorrectionLevel_cpp=function(){return b.asm.__GLOBAL__sub_I_ErrorCorrectionLevel_cpp.apply(null,arguments)},Oe=b.__GLOBAL__sub_I_FindBound_cpp=function(){return b.asm.__GLOBAL__sub_I_FindBound_cpp.apply(null,arguments)},Ne=b.__GLOBAL__sub_I_Fluctuation_cpp=
208   -function(){return b.asm.__GLOBAL__sub_I_Fluctuation_cpp.apply(null,arguments)},ce=b.__GLOBAL__sub_I_FormatParameters_cpp=function(){return b.asm.__GLOBAL__sub_I_FormatParameters_cpp.apply(null,arguments)},Re=b.__GLOBAL__sub_I_GenericGF_cpp=function(){return b.asm.__GLOBAL__sub_I_GenericGF_cpp.apply(null,arguments)},be=b.__GLOBAL__sub_I_GlobalParameters_cpp=function(){return b.asm.__GLOBAL__sub_I_GlobalParameters_cpp.apply(null,arguments)},Ae=b.__GLOBAL__sub_I_ITFReader_cpp=function(){return b.asm.__GLOBAL__sub_I_ITFReader_cpp.apply(null,
209   -arguments)},ae=b.__GLOBAL__sub_I_ImageParameters_cpp=function(){return b.asm.__GLOBAL__sub_I_ImageParameters_cpp.apply(null,arguments)},Ie=b.__GLOBAL__sub_I_Industry2of5Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Industry2of5Reader_cpp.apply(null,arguments)},qe=b.__GLOBAL__sub_I_JsonParser_cpp=function(){return b.asm.__GLOBAL__sub_I_JsonParser_cpp.apply(null,arguments)},Qd=b.__GLOBAL__sub_I_JsonReader_cpp=function(){return b.asm.__GLOBAL__sub_I_JsonReader_cpp.apply(null,arguments)},Me=b.__GLOBAL__sub_I_LineStatistics_cpp=
210   -function(){return b.asm.__GLOBAL__sub_I_LineStatistics_cpp.apply(null,arguments)},$d=b.__GLOBAL__sub_I_LogParamUtil_cpp=function(){return b.asm.__GLOBAL__sub_I_LogParamUtil_cpp.apply(null,arguments)},ge=b.__GLOBAL__sub_I_Mode_cpp=function(){return b.asm.__GLOBAL__sub_I_Mode_cpp.apply(null,arguments)},Ue=b.__GLOBAL__sub_I_ModulusGF_cpp=function(){return b.asm.__GLOBAL__sub_I_ModulusGF_cpp.apply(null,arguments)},hf=b.__GLOBAL__sub_I_MultiFormatOneDReader_cpp=function(){return b.asm.__GLOBAL__sub_I_MultiFormatOneDReader_cpp.apply(null,
211   -arguments)},Ud=b.__GLOBAL__sub_I_MultiFormatReader_cpp=function(){return b.asm.__GLOBAL__sub_I_MultiFormatReader_cpp.apply(null,arguments)},gf=b.__GLOBAL__sub_I_MultiFormatUPCEANReader_cpp=function(){return b.asm.__GLOBAL__sub_I_MultiFormatUPCEANReader_cpp.apply(null,arguments)},ff=b.__GLOBAL__sub_I_OneDReader_cpp=function(){return b.asm.__GLOBAL__sub_I_OneDReader_cpp.apply(null,arguments)},xe=b.__GLOBAL__sub_I_OneD_StandardLization_cpp=function(){return b.asm.__GLOBAL__sub_I_OneD_StandardLization_cpp.apply(null,
212   -arguments)},We=b.__GLOBAL__sub_I_PDF417CodewordDecoder_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417CodewordDecoder_cpp.apply(null,arguments)},Ve=b.__GLOBAL__sub_I_PDF417DecodedBitStreamParser_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417DecodedBitStreamParser_cpp.apply(null,arguments)},Xe=b.__GLOBAL__sub_I_PDF417Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417Reader_cpp.apply(null,arguments)},He=b.__GLOBAL__sub_I_PDF417_Deblur_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417_Deblur_cpp.apply(null,
213   -arguments)},we=b.__GLOBAL__sub_I_PDF417_standardLization_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417_standardLization_cpp.apply(null,arguments)},Zd=b.__GLOBAL__sub_I_ParameterPool_cpp=function(){return b.asm.__GLOBAL__sub_I_ParameterPool_cpp.apply(null,arguments)},Le=b.__GLOBAL__sub_I_QRBarcodeLocation_cpp=function(){return b.asm.__GLOBAL__sub_I_QRBarcodeLocation_cpp.apply(null,arguments)},Te=b.__GLOBAL__sub_I_QRCodeReader_cpp=function(){return b.asm.__GLOBAL__sub_I_QRCodeReader_cpp.apply(null,
214   -arguments)},fe=b.__GLOBAL__sub_I_QRVersion_cpp=function(){return b.asm.__GLOBAL__sub_I_QRVersion_cpp.apply(null,arguments)},ve=b.__GLOBAL__sub_I_QR_StandardLization_cpp=function(){return b.asm.__GLOBAL__sub_I_QR_StandardLization_cpp.apply(null,arguments)},bf=b.__GLOBAL__sub_I_Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Reader_cpp.apply(null,arguments)},Yd=b.__GLOBAL__sub_I_RegionDefinition_cpp=function(){return b.asm.__GLOBAL__sub_I_RegionDefinition_cpp.apply(null,arguments)},ze=b.__GLOBAL__sub_I_RestoreColor_cpp=
215   -function(){return b.asm.__GLOBAL__sub_I_RestoreColor_cpp.apply(null,arguments)},ue=b.__GLOBAL__sub_I_TextFilter_cpp=function(){return b.asm.__GLOBAL__sub_I_TextFilter_cpp.apply(null,arguments)},ef=b.__GLOBAL__sub_I_UPCAReader_cpp=function(){return b.asm.__GLOBAL__sub_I_UPCAReader_cpp.apply(null,arguments)},df=b.__GLOBAL__sub_I_UPCEANReader_cpp=function(){return b.asm.__GLOBAL__sub_I_UPCEANReader_cpp.apply(null,arguments)},cf=b.__GLOBAL__sub_I_UPCEReader_cpp=function(){return b.asm.__GLOBAL__sub_I_UPCEReader_cpp.apply(null,
216   -arguments)},je=b.__GLOBAL__sub_I_bind_cpp=function(){return b.asm.__GLOBAL__sub_I_bind_cpp.apply(null,arguments)},oe=b.__GLOBAL__sub_I_clahe_cpp=function(){return b.asm.__GLOBAL__sub_I_clahe_cpp.apply(null,arguments)},re=b.__GLOBAL__sub_I_dsGlobalMem_cpp=function(){return b.asm.__GLOBAL__sub_I_dsGlobalMem_cpp.apply(null,arguments)},ne=b.__GLOBAL__sub_I_generalized_hough_cpp=function(){return b.asm.__GLOBAL__sub_I_generalized_hough_cpp.apply(null,arguments)},me=b.__GLOBAL__sub_I_histogram_cpp=function(){return b.asm.__GLOBAL__sub_I_histogram_cpp.apply(null,
217   -arguments)},le=b.__GLOBAL__sub_I_imgwarp_cpp=function(){return b.asm.__GLOBAL__sub_I_imgwarp_cpp.apply(null,arguments)},ie=b.__GLOBAL__sub_I_iostream_cpp=function(){return b.asm.__GLOBAL__sub_I_iostream_cpp.apply(null,arguments)},te=b.__GLOBAL__sub_I_json_value_cpp=function(){return b.asm.__GLOBAL__sub_I_json_value_cpp.apply(null,arguments)},he=b.__GLOBAL__sub_I_persistence_cpp=function(){return b.asm.__GLOBAL__sub_I_persistence_cpp.apply(null,arguments)},pe=b.__GLOBAL__sub_I_system_cpp=function(){return b.asm.__GLOBAL__sub_I_system_cpp.apply(null,
218   -arguments)};b.___cxa_can_catch=function(){return b.asm.___cxa_can_catch.apply(null,arguments)};b.___cxa_is_pointer_type=function(){return b.asm.___cxa_is_pointer_type.apply(null,arguments)};b.___errno_location=function(){return b.asm.___errno_location.apply(null,arguments)};var Gd=b.___getTypeName=function(){return b.asm.___getTypeName.apply(null,arguments)},Od=b._emscripten_replace_memory=function(){return b.asm._emscripten_replace_memory.apply(null,arguments)},R=b._free=function(){return b.asm._free.apply(null,
219   -arguments)},da=b._malloc=function(){return b.asm._malloc.apply(null,arguments)},ab=b.setTempRet0=function(){return b.asm.setTempRet0.apply(null,arguments)};b.setThrew=function(){return b.asm.setThrew.apply(null,arguments)};var ld=b.stackAlloc=function(){return b.asm.stackAlloc.apply(null,arguments)};b.dynCall_di=function(){return b.asm.dynCall_di.apply(null,arguments)};b.dynCall_dii=function(){return b.asm.dynCall_dii.apply(null,arguments)};b.dynCall_diiid=function(){return b.asm.dynCall_diiid.apply(null,
220   -arguments)};b.dynCall_diiii=function(){return b.asm.dynCall_diiii.apply(null,arguments)};b.dynCall_fi=function(){return b.asm.dynCall_fi.apply(null,arguments)};b.dynCall_fii=function(){return b.asm.dynCall_fii.apply(null,arguments)};b.dynCall_fiifffi=function(){return b.asm.dynCall_fiifffi.apply(null,arguments)};b.dynCall_fiii=function(){return b.asm.dynCall_fiii.apply(null,arguments)};b.dynCall_i=function(){return b.asm.dynCall_i.apply(null,arguments)};b.dynCall_idd=function(){return b.asm.dynCall_idd.apply(null,
221   -arguments)};b.dynCall_ii=function(){return b.asm.dynCall_ii.apply(null,arguments)};b.dynCall_iid=function(){return b.asm.dynCall_iid.apply(null,arguments)};b.dynCall_iififi=function(){return b.asm.dynCall_iififi.apply(null,arguments)};b.dynCall_iii=function(){return b.asm.dynCall_iii.apply(null,arguments)};b.dynCall_iiifii=function(){return b.asm.dynCall_iiifii.apply(null,arguments)};b.dynCall_iiifiiiiiii=function(){return b.asm.dynCall_iiifiiiiiii.apply(null,arguments)};b.dynCall_iiii=function(){return b.asm.dynCall_iiii.apply(null,
222   -arguments)};b.dynCall_iiiidi=function(){return b.asm.dynCall_iiiidi.apply(null,arguments)};b.dynCall_iiiii=function(){return b.asm.dynCall_iiiii.apply(null,arguments)};b.dynCall_iiiiid=function(){return b.asm.dynCall_iiiiid.apply(null,arguments)};b.dynCall_iiiiifi=function(){return b.asm.dynCall_iiiiifi.apply(null,arguments)};b.dynCall_iiiiii=function(){return b.asm.dynCall_iiiiii.apply(null,arguments)};b.dynCall_iiiiiid=function(){return b.asm.dynCall_iiiiiid.apply(null,arguments)};b.dynCall_iiiiiii=
223   -function(){return b.asm.dynCall_iiiiiii.apply(null,arguments)};b.dynCall_iiiiiiii=function(){return b.asm.dynCall_iiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiif=function(){return b.asm.dynCall_iiiiiiiif.apply(null,arguments)};b.dynCall_iiiiiiiii=function(){return b.asm.dynCall_iiiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiiii=function(){return b.asm.dynCall_iiiiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiiiiii=function(){return b.asm.dynCall_iiiiiiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiiiiiiiiii=
224   -function(){return b.asm.dynCall_iiiiiiiiiiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiiiiiiiiiiii=function(){return b.asm.dynCall_iiiiiiiiiiiiiiiiii.apply(null,arguments)};b.dynCall_iiiiij=function(){return b.asm.dynCall_iiiiij.apply(null,arguments)};b.dynCall_ji=function(){return b.asm.dynCall_ji.apply(null,arguments)};b.dynCall_v=function(){return b.asm.dynCall_v.apply(null,arguments)};b.dynCall_vi=function(){return b.asm.dynCall_vi.apply(null,arguments)};b.dynCall_vid=function(){return b.asm.dynCall_vid.apply(null,
225   -arguments)};b.dynCall_vidii=function(){return b.asm.dynCall_vidii.apply(null,arguments)};b.dynCall_vif=function(){return b.asm.dynCall_vif.apply(null,arguments)};b.dynCall_viffffffff=function(){return b.asm.dynCall_viffffffff.apply(null,arguments)};b.dynCall_viffffffffffffffff=function(){return b.asm.dynCall_viffffffffffffffff.apply(null,arguments)};b.dynCall_vii=function(){return b.asm.dynCall_vii.apply(null,arguments)};b.dynCall_viid=function(){return b.asm.dynCall_viid.apply(null,arguments)};b.dynCall_viiddi=
226   -function(){return b.asm.dynCall_viiddi.apply(null,arguments)};b.dynCall_viidi=function(){return b.asm.dynCall_viidi.apply(null,arguments)};b.dynCall_viididii=function(){return b.asm.dynCall_viididii.apply(null,arguments)};b.dynCall_viif=function(){return b.asm.dynCall_viif.apply(null,arguments)};b.dynCall_viiffff=function(){return b.asm.dynCall_viiffff.apply(null,arguments)};b.dynCall_viiffi=function(){return b.asm.dynCall_viiffi.apply(null,arguments)};b.dynCall_viifi=function(){return b.asm.dynCall_viifi.apply(null,
227   -arguments)};b.dynCall_viifii=function(){return b.asm.dynCall_viifii.apply(null,arguments)};b.dynCall_viifiif=function(){return b.asm.dynCall_viifiif.apply(null,arguments)};b.dynCall_viii=function(){return b.asm.dynCall_viii.apply(null,arguments)};b.dynCall_viiid=function(){return b.asm.dynCall_viiid.apply(null,arguments)};b.dynCall_viiidd=function(){return b.asm.dynCall_viiidd.apply(null,arguments)};b.dynCall_viiiddi=function(){return b.asm.dynCall_viiiddi.apply(null,arguments)};b.dynCall_viiidi=
228   -function(){return b.asm.dynCall_viiidi.apply(null,arguments)};b.dynCall_viiidii=function(){return b.asm.dynCall_viiidii.apply(null,arguments)};b.dynCall_viiif=function(){return b.asm.dynCall_viiif.apply(null,arguments)};b.dynCall_viiifiii=function(){return b.asm.dynCall_viiifiii.apply(null,arguments)};b.dynCall_viiii=function(){return b.asm.dynCall_viiii.apply(null,arguments)};b.dynCall_viiiid=function(){return b.asm.dynCall_viiiid.apply(null,arguments)};b.dynCall_viiiidi=function(){return b.asm.dynCall_viiiidi.apply(null,
229   -arguments)};b.dynCall_viiiidiii=function(){return b.asm.dynCall_viiiidiii.apply(null,arguments)};b.dynCall_viiiii=function(){return b.asm.dynCall_viiiii.apply(null,arguments)};b.dynCall_viiiiidi=function(){return b.asm.dynCall_viiiiidi.apply(null,arguments)};b.dynCall_viiiiifi=function(){return b.asm.dynCall_viiiiifi.apply(null,arguments)};b.dynCall_viiiiii=function(){return b.asm.dynCall_viiiiii.apply(null,arguments)};b.dynCall_viiiiiiddi=function(){return b.asm.dynCall_viiiiiiddi.apply(null,arguments)};
230   -b.dynCall_viiiiiidi=function(){return b.asm.dynCall_viiiiiidi.apply(null,arguments)};b.dynCall_viiiiiii=function(){return b.asm.dynCall_viiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiddi=function(){return b.asm.dynCall_viiiiiiiddi.apply(null,arguments)};b.dynCall_viiiiiiii=function(){return b.asm.dynCall_viiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiifi=function(){return b.asm.dynCall_viiiiiiiifi.apply(null,arguments)};b.dynCall_viiiiiiiii=function(){return b.asm.dynCall_viiiiiiiii.apply(null,
231   -arguments)};b.dynCall_viiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiddi=function(){return b.asm.dynCall_viiiiiiiiiiddi.apply(null,arguments)};b.dynCall_viiiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiiiiii=
232   -function(){return b.asm.dynCall_viiiiiiiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiiiiiiiii.apply(null,arguments)};b.dynCall_viijii=function(){return b.asm.dynCall_viijii.apply(null,arguments)};b.dynCall_vij=function(){return b.asm.dynCall_vij.apply(null,arguments)};b.asm=kd;Va.prototype=Error();Va.prototype.constructor=Va;Ya=function c(){b.calledRun||dc();b.calledRun||(Ya=c)};b.run=dc;b.exit=function(c,d){if(!d||!b.noExitRuntime||0!==c){if(!b.noExitRuntime&&
233   -(Wa=!0,tb=void 0,Ia(mc),b.onExit))b.onExit(c);ia&&process.exit(c);b.quit(c,new Va(c))}};b.abort=E;if(b.preInit)for("function"==typeof b.preInit&&(b.preInit=[b.preInit]);0<b.preInit.length;)b.preInit.pop()();b.noExitRuntime=!0;dc()})).then(function(){d._loadWasmStatus="loaded";d._loadWasmTaskQueue.next();f()})["catch"](function(f){d._loadWasmStatus=f;d._loadWasmTaskQueue.next();t(f)})},null,["loading"==d._loadWasmStatus])})};
234   -dynamsoft.dbrEnv.bAutoLoadWasm=dynamsoft.dbrEnv.bAutoLoadWasm||void 0===dynamsoft.dbrEnv.bAutoLoadWasm?!0:!1;
235   -dynamsoft.dbrEnv.bAutoLoadWasm&&!dynamsoft.BarcodeReader._BarcodeReaderWasm&&(dynamsoft.BarcodeReader._BarcodeReaderWasm=function(){throw Error("'Constructor BarcodeReader(licenseKey)': The wasm hasn't finish loading.");},dynamsoft.BarcodeReader.loadWasm().then(function(){dynamsoft.dbrEnv.onAutoLoadWasmSuccess&&setTimeout(dynamsoft.dbrEnv.onAutoLoadWasmSuccess)},function(f){dynamsoft.dbrEnv.onAutoLoadWasmError&&setTimeout(function(){dynamsoft.dbrEnv.onAutoLoadWasmError(f)},0)}));
app-ht/web/exts/baidumap/MarkerClusterer.js
... ... @@ -1 +0,0 @@
1   -var BMapLib=window.BMapLib=BMapLib||{};!function(){function Cluster(markerClusterer){this._markerClusterer=markerClusterer,this._map=markerClusterer.getMap(),this._minClusterSize=markerClusterer.getMinClusterSize(),this._isAverageCenter=markerClusterer.isAverageCenter(),this._center=null,this._markers=[],this._gridBounds=null,this._isReal=!1,this._clusterMarker=new BMapLib.TextIconOverlay(this._center,this._markers.length,{styles:this._markerClusterer.getStyles()})}var getExtendedBounds=function(map,bounds,gridSize){bounds=cutBoundsInRange(bounds);var pixelNE=map.pointToPixel(bounds.getNorthEast()),pixelSW=map.pointToPixel(bounds.getSouthWest());pixelNE.x+=gridSize,pixelNE.y-=gridSize,pixelSW.x-=gridSize,pixelSW.y+=gridSize;var newNE=map.pixelToPoint(pixelNE),newSW=map.pixelToPoint(pixelSW);return new BMap.Bounds(newSW,newNE)},cutBoundsInRange=function(bounds){var maxX=getRange(bounds.getNorthEast().lng,-180,180),minX=getRange(bounds.getSouthWest().lng,-180,180),maxY=getRange(bounds.getNorthEast().lat,-74,74),minY=getRange(bounds.getSouthWest().lat,-74,74);return new BMap.Bounds(new BMap.Point(minX,minY),new BMap.Point(maxX,maxY))},getRange=function(i,mix,max){return mix&&(i=Math.max(i,mix)),max&&(i=Math.min(i,max)),i},isArray=function(source){return"[object Array]"===Object.prototype.toString.call(source)},indexOf=function(item,source){var index=-1;if(isArray(source))if(source.indexOf)index=source.indexOf(item);else for(var m,i=0;m=source[i];i++)if(m===item){index=i;break}return index},MarkerClusterer=BMapLib.MarkerClusterer=function(map,options){if(map){this._map=map,this._markers=[],this._clusters=[];var opts=options||{};this._gridSize=opts.gridSize||60,this._maxZoom=opts.maxZoom||18,this._minClusterSize=opts.minClusterSize||2,this._isAverageCenter=!1,void 0!=opts.isAverageCenter&&(this._isAverageCenter=opts.isAverageCenter),this._styles=opts.styles||[];var that=this;this._map.addEventListener("zoomend",function(){that._redraw()}),this._map.addEventListener("moveend",function(){that._redraw()});var mkrs=opts.markers;isArray(mkrs)&&this.addMarkers(mkrs)}};MarkerClusterer.prototype.addMarkers=function(markers){for(var i=0,len=markers.length;i<len;i++)this._pushMarkerTo(markers[i]);this._createClusters()},MarkerClusterer.prototype._pushMarkerTo=function(marker){var index=indexOf(marker,this._markers);index===-1&&(marker.isInCluster=!1,this._markers.push(marker))},MarkerClusterer.prototype.addMarker=function(marker){this._pushMarkerTo(marker),this._createClusters()},MarkerClusterer.prototype._createClusters=function(){for(var marker,mapBounds=this._map.getBounds(),extendedBounds=getExtendedBounds(this._map,mapBounds,this._gridSize),i=0;marker=this._markers[i];i++)!marker.isInCluster&&extendedBounds.containsPoint(marker.getPosition())&&this._addToClosestCluster(marker);for(var len=this._markers.length,i=0;i<len;i++)this._clusters[i]&&this._clusters[i].render()},MarkerClusterer.prototype._addToClosestCluster=function(marker){for(var cluster,distance=4e6,clusterToAddTo=null,i=(marker.getPosition(),0);cluster=this._clusters[i];i++){var center=cluster.getCenter();if(center){var d=this._map.getDistance(center,marker.getPosition());d<distance&&(distance=d,clusterToAddTo=cluster)}}if(clusterToAddTo&&clusterToAddTo.isMarkerInClusterBounds(marker))clusterToAddTo.addMarker(marker);else{var cluster=new Cluster(this);cluster.addMarker(marker),this._clusters.push(cluster)}},MarkerClusterer.prototype._clearLastClusters=function(){for(var cluster,i=0;cluster=this._clusters[i];i++)cluster.remove();this._clusters=[],this._removeMarkersFromCluster()},MarkerClusterer.prototype._removeMarkersFromCluster=function(){for(var marker,i=0;marker=this._markers[i];i++)marker.isInCluster=!1},MarkerClusterer.prototype._removeMarkersFromMap=function(){for(var marker,i=0;marker=this._markers[i];i++)marker.isInCluster=!1,this._map.removeOverlay(marker)},MarkerClusterer.prototype._removeMarker=function(marker){var index=indexOf(marker,this._markers);return index!==-1&&(this._map.removeOverlay(marker),this._markers.splice(index,1),!0)},MarkerClusterer.prototype.removeMarker=function(marker){var success=this._removeMarker(marker);return success&&(this._clearLastClusters(),this._createClusters()),success},MarkerClusterer.prototype.removeMarkers=function(markers){for(var success=!1,i=0;i<markers.length;i++){var r=this._removeMarker(markers[i]);success=success||r}return success&&(this._clearLastClusters(),this._createClusters()),success},MarkerClusterer.prototype.clearMarkers=function(){this._clearLastClusters(),this._removeMarkersFromMap(),this._markers=[]},MarkerClusterer.prototype._redraw=function(){this._clearLastClusters(),this._createClusters()},MarkerClusterer.prototype.getGridSize=function(){return this._gridSize},MarkerClusterer.prototype.setGridSize=function(size){this._gridSize=size,this._redraw()},MarkerClusterer.prototype.getMaxZoom=function(){return this._maxZoom},MarkerClusterer.prototype.setMaxZoom=function(maxZoom){this._maxZoom=maxZoom,this._redraw()},MarkerClusterer.prototype.getStyles=function(){return this._styles},MarkerClusterer.prototype.setStyles=function(styles){this._styles=styles,this._redraw()},MarkerClusterer.prototype.getMinClusterSize=function(){return this._minClusterSize},MarkerClusterer.prototype.setMinClusterSize=function(size){this._minClusterSize=size,this._redraw()},MarkerClusterer.prototype.isAverageCenter=function(){return this._isAverageCenter},MarkerClusterer.prototype.getMap=function(){return this._map},MarkerClusterer.prototype.getMarkers=function(){return this._markers},MarkerClusterer.prototype.getClustersCount=function(){for(var cluster,count=0,i=0;cluster=this._clusters[i];i++)cluster.isReal()&&count++;return count},Cluster.prototype.addMarker=function(marker){if(this.isMarkerInCluster(marker))return!1;if(this._center){if(this._isAverageCenter){var l=this._markers.length+1,lat=(this._center.lat*(l-1)+marker.getPosition().lat)/l,lng=(this._center.lng*(l-1)+marker.getPosition().lng)/l;this._center=new BMap.Point(lng,lat),this.updateGridBounds()}}else this._center=marker.getPosition(),this.updateGridBounds();marker.isInCluster=!0,this._markers.push(marker)},Cluster.prototype.render=function(){var len=this._markers.length;if(len<this._minClusterSize)for(var i=0;i<len;i++)this._map.addOverlay(this._markers[i]);else this._map.addOverlay(this._clusterMarker),this._isReal=!0,this.updateClusterMarker()},Cluster.prototype.isMarkerInCluster=function(marker){if(this._markers.indexOf)return this._markers.indexOf(marker)!=-1;for(var m,i=0;m=this._markers[i];i++)if(m===marker)return!0;return!1},Cluster.prototype.isMarkerInClusterBounds=function(marker){return this._gridBounds.containsPoint(marker.getPosition())},Cluster.prototype.isReal=function(marker){return this._isReal},Cluster.prototype.updateGridBounds=function(){var bounds=new BMap.Bounds(this._center,this._center);this._gridBounds=getExtendedBounds(this._map,bounds,this._markerClusterer.getGridSize())},Cluster.prototype.updateClusterMarker=function(){if(this._map.getZoom()>this._markerClusterer.getMaxZoom()){this._clusterMarker&&this._map.removeOverlay(this._clusterMarker);for(var marker,i=0;marker=this._markers[i];i++)this._map.addOverlay(marker)}else{if(this._markers.length<this._minClusterSize)return void this._clusterMarker.hide();this._clusterMarker.setPosition(this._center),this._clusterMarker.setText(this._markers.length);var thatMap=this._map,thatBounds=this.getBounds();this._clusterMarker.addEventListener("click",function(event){thatMap.setViewport(thatBounds)})}},Cluster.prototype.remove=function(){for(var m,i=0;m=this._markers[i];i++)this._markers[i].getMap()&&this._map.removeOverlay(this._markers[i]);this._map.removeOverlay(this._clusterMarker),this._markers.length=0,delete this._markers},Cluster.prototype.getBounds=function(){for(var marker,bounds=new BMap.Bounds(this._center,this._center),i=0;marker=this._markers[i];i++)bounds.extend(marker.getPosition());return bounds},Cluster.prototype.getCenter=function(){return this._center}}();
2 0 \ No newline at end of file
app-ht/web/exts/baidumap/TextIconOverlay.js
... ... @@ -1,1046 +0,0 @@
1   -/**
2   - * @fileoverview 此类表示地图上的一个覆盖物,该覆盖物由文字和图标组成,从Overlay继承。
3   - * 主入口类是<a href="symbols/BMapLib.TextIconOverlay.html">TextIconOverlay</a>,
4   - * 基于Baidu Map API 1.2。
5   - *
6   - * @author Baidu Map Api Group
7   - * @version 1.2
8   - */
9   -
10   -
11   -/**
12   - * @namespace BMap的所有library类均放在BMapLib命名空间下
13   - */
14   -var BMapLib = window.BMapLib = BMapLib || {};
15   -
16   -(function () {
17   -
18   - /**
19   - * 声明baidu包
20   - */
21   - var T,
22   - baidu = T = baidu || {version: "1.3.8"};
23   -
24   - (function (){
25   - //提出guid,防止在与老版本Tangram混用时
26   - //在下一行错误的修改window[undefined]
27   - baidu.guid = "$BAIDU$";
28   -
29   - //Tangram可能被放在闭包中
30   - //一些页面级别唯一的属性,需要挂载在window[baidu.guid]上
31   - window[baidu.guid] = window[baidu.guid] || {};
32   -
33   - /**
34   - * @ignore
35   - * @namespace baidu.dom 操作dom的方法。
36   - */
37   - baidu.dom = baidu.dom || {};
38   -
39   -
40   - /**
41   - * 从文档中获取指定的DOM元素
42   - * @name baidu.dom.g
43   - * @function
44   - * @grammar baidu.dom.g(id)
45   - * @param {string|HTMLElement} id 元素的id或DOM元素
46   - * @shortcut g,T.G
47   - * @meta standard
48   - * @see baidu.dom.q
49   - *
50   - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数
51   - */
52   - baidu.dom.g = function (id) {
53   - if ('string' == typeof id || id instanceof String) {
54   - return document.getElementById(id);
55   - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) {
56   - return id;
57   - }
58   - return null;
59   - };
60   -
61   - // 声明快捷方法
62   - baidu.g = baidu.G = baidu.dom.g;
63   -
64   - /**
65   - * 获取目标元素所属的document对象
66   - * @name baidu.dom.getDocument
67   - * @function
68   - * @grammar baidu.dom.getDocument(element)
69   - * @param {HTMLElement|string} element 目标元素或目标元素的id
70   - * @meta standard
71   - * @see baidu.dom.getWindow
72   - *
73   - * @returns {HTMLDocument} 目标元素所属的document对象
74   - */
75   - baidu.dom.getDocument = function (element) {
76   - element = baidu.dom.g(element);
77   - return element.nodeType == 9 ? element : element.ownerDocument || element.document;
78   - };
79   -
80   - /**
81   - * @ignore
82   - * @namespace baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。
83   - */
84   - baidu.lang = baidu.lang || {};
85   -
86   - /**
87   - * 判断目标参数是否string类型或String对象
88   - * @name baidu.lang.isString
89   - * @function
90   - * @grammar baidu.lang.isString(source)
91   - * @param {Any} source 目标参数
92   - * @shortcut isString
93   - * @meta standard
94   - * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
95   - *
96   - * @returns {boolean} 类型判断结果
97   - */
98   - baidu.lang.isString = function (source) {
99   - return '[object String]' == Object.prototype.toString.call(source);
100   - };
101   -
102   - // 声明快捷方法
103   - baidu.isString = baidu.lang.isString;
104   -
105   - /**
106   - * 从文档中获取指定的DOM元素
107   - * **内部方法**
108   - *
109   - * @param {string|HTMLElement} id 元素的id或DOM元素
110   - * @meta standard
111   - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数
112   - */
113   - baidu.dom._g = function (id) {
114   - if (baidu.lang.isString(id)) {
115   - return document.getElementById(id);
116   - }
117   - return id;
118   - };
119   -
120   - // 声明快捷方法
121   - baidu._g = baidu.dom._g;
122   -
123   - /**
124   - * @ignore
125   - * @namespace baidu.browser 判断浏览器类型和特性的属性。
126   - */
127   - baidu.browser = baidu.browser || {};
128   -
129   - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) {
130   - //IE 8下,以documentMode为准
131   - //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241
132   - /**
133   - * 判断是否为ie浏览器
134   - * @property ie ie版本号
135   - * @grammar baidu.browser.ie
136   - * @meta standard
137   - * @shortcut ie
138   - * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon
139   - */
140   - baidu.browser.ie = baidu.ie = document.documentMode || + RegExp['\x241'];
141   - }
142   -
143   - /**
144   - * 获取目标元素的computed style值。如果元素的样式值不能被浏览器计算,则会返回空字符串(IE)
145   - *
146   - * @author berg
147   - * @name baidu.dom.getComputedStyle
148   - * @function
149   - * @grammar baidu.dom.getComputedStyle(element, key)
150   - * @param {HTMLElement|string} element 目标元素或目标元素的id
151   - * @param {string} key 要获取的样式名
152   - *
153   - * @see baidu.dom.getStyle
154   - *
155   - * @returns {string} 目标元素的computed style值
156   - */
157   -
158   - baidu.dom.getComputedStyle = function(element, key){
159   - element = baidu.dom._g(element);
160   - var doc = baidu.dom.getDocument(element),
161   - styles;
162   - if (doc.defaultView && doc.defaultView.getComputedStyle) {
163   - styles = doc.defaultView.getComputedStyle(element, null);
164   - if (styles) {
165   - return styles[key] || styles.getPropertyValue(key);
166   - }
167   - }
168   - return '';
169   - };
170   -
171   - /**
172   - * 提供给setStyle与getStyle使用
173   - */
174   - baidu.dom._styleFixer = baidu.dom._styleFixer || {};
175   -
176   - /**
177   - * 提供给setStyle与getStyle使用
178   - */
179   - baidu.dom._styleFilter = baidu.dom._styleFilter || [];
180   -
181   - /**
182   - * 为获取和设置样式的过滤器
183   - * @private
184   - * @meta standard
185   - */
186   - baidu.dom._styleFilter.filter = function (key, value, method) {
187   - for (var i = 0, filters = baidu.dom._styleFilter, filter; filter = filters[i]; i++) {
188   - if (filter = filter[method]) {
189   - value = filter(key, value);
190   - }
191   - }
192   - return value;
193   - };
194   -
195   - /**
196   - * @ignore
197   - * @namespace baidu.string 操作字符串的方法。
198   - */
199   - baidu.string = baidu.string || {};
200   -
201   - /**
202   - * 将目标字符串进行驼峰化处理
203   - * @name baidu.string.toCamelCase
204   - * @function
205   - * @grammar baidu.string.toCamelCase(source)
206   - * @param {string} source 目标字符串
207   - * @remark
208   - * 支持单词以“-_”分隔
209   - * @meta standard
210   - *
211   - * @returns {string} 驼峰化处理后的字符串
212   - */
213   - baidu.string.toCamelCase = function (source) {
214   - //提前判断,提高getStyle等的效率 thanks xianwei
215   - if (source.indexOf('-') < 0 && source.indexOf('_') < 0) {
216   - return source;
217   - }
218   - return source.replace(/[-_][^-_]/g, function (match) {
219   - return match.charAt(1).toUpperCase();
220   - });
221   - };
222   -
223   - /**
224   - * 获取目标元素的样式值
225   - * @name baidu.dom.getStyle
226   - * @function
227   - * @grammar baidu.dom.getStyle(element, key)
228   - * @param {HTMLElement|string} element 目标元素或目标元素的id
229   - * @param {string} key 要获取的样式名
230   - * @remark
231   - *
232   - * 为了精简代码,本模块默认不对任何浏览器返回值进行归一化处理(如使用getStyle时,不同浏览器下可能返回rgb颜色或hex颜色),也不会修复浏览器的bug和差异性(如设置IE的float属性叫styleFloat,firefox则是cssFloat)。<br />
233   - * baidu.dom._styleFixer和baidu.dom._styleFilter可以为本模块提供支持。<br />
234   - * 其中_styleFilter能对颜色和px进行归一化处理,_styleFixer能对display,float,opacity,textOverflow的浏览器兼容性bug进行处理。
235   - * @shortcut getStyle
236   - * @meta standard
237   - * @see baidu.dom.setStyle,baidu.dom.setStyles, baidu.dom.getComputedStyle
238   - *
239   - * @returns {string} 目标元素的样式值
240   - */
241   - baidu.dom.getStyle = function (element, key) {
242   - var dom = baidu.dom;
243   -
244   - element = dom.g(element);
245   - key = baidu.string.toCamelCase(key);
246   - //computed style, then cascaded style, then explicitly set style.
247   - var value = element.style[key] ||
248   - (element.currentStyle ? element.currentStyle[key] : "") ||
249   - dom.getComputedStyle(element, key);
250   -
251   - // 在取不到值的时候,用fixer进行修正
252   - if (!value) {
253   - var fixer = dom._styleFixer[key];
254   - if(fixer){
255   - value = fixer.get ? fixer.get(element) : baidu.dom.getStyle(element, fixer);
256   - }
257   - }
258   -
259   - /* 检查结果过滤器 */
260   - if (fixer = dom._styleFilter) {
261   - value = fixer.filter(key, value, 'get');
262   - }
263   -
264   - return value;
265   - };
266   -
267   - // 声明快捷方法
268   - baidu.getStyle = baidu.dom.getStyle;
269   -
270   -
271   - if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) {
272   - /**
273   - * 判断是否为opera浏览器
274   - * @property opera opera版本号
275   - * @grammar baidu.browser.opera
276   - * @meta standard
277   - * @see baidu.browser.ie,baidu.browser.firefox,baidu.browser.safari,baidu.browser.chrome
278   - */
279   - baidu.browser.opera = + RegExp['\x241'];
280   - }
281   -
282   - /**
283   - * 判断是否为webkit内核
284   - * @property isWebkit
285   - * @grammar baidu.browser.isWebkit
286   - * @meta standard
287   - * @see baidu.browser.isGecko
288   - */
289   - baidu.browser.isWebkit = /webkit/i.test(navigator.userAgent);
290   -
291   - /**
292   - * 判断是否为gecko内核
293   - * @property isGecko
294   - * @grammar baidu.browser.isGecko
295   - * @meta standard
296   - * @see baidu.browser.isWebkit
297   - */
298   - baidu.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent);
299   -
300   - /**
301   - * 判断是否严格标准的渲染模式
302   - * @property isStrict
303   - * @grammar baidu.browser.isStrict
304   - * @meta standard
305   - */
306   - baidu.browser.isStrict = document.compatMode == "CSS1Compat";
307   -
308   - /**
309   - * 获取目标元素相对于整个文档左上角的位置
310   - * @name baidu.dom.getPosition
311   - * @function
312   - * @grammar baidu.dom.getPosition(element)
313   - * @param {HTMLElement|string} element 目标元素或目标元素的id
314   - * @meta standard
315   - *
316   - * @returns {Object} 目标元素的位置,键值为top和left的Object。
317   - */
318   - baidu.dom.getPosition = function (element) {
319   - element = baidu.dom.g(element);
320   - var doc = baidu.dom.getDocument(element),
321   - browser = baidu.browser,
322   - getStyle = baidu.dom.getStyle,
323   - // Gecko 1.9版本以下用getBoxObjectFor计算位置
324   - // 但是某些情况下是有bug的
325   - // 对于这些有bug的情况
326   - // 使用递归查找的方式
327   - BUGGY_GECKO_BOX_OBJECT = browser.isGecko > 0 &&
328   - doc.getBoxObjectFor &&
329   - getStyle(element, 'position') == 'absolute' &&
330   - (element.style.top === '' || element.style.left === ''),
331   - pos = {"left":0,"top":0},
332   - viewport = (browser.ie && !browser.isStrict) ? doc.body : doc.documentElement,
333   - parent,
334   - box;
335   -
336   - if(element == viewport){
337   - return pos;
338   - }
339   -
340   - if(element.getBoundingClientRect){ // IE and Gecko 1.9+
341   -
342   - //当HTML或者BODY有border width时, 原生的getBoundingClientRect返回值是不符合预期的
343   - //考虑到通常情况下 HTML和BODY的border只会设成0px,所以忽略该问题.
344   - box = element.getBoundingClientRect();
345   -
346   - pos.left = Math.floor(box.left) + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
347   - pos.top = Math.floor(box.top) + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
348   -
349   - // IE会给HTML元素添加一个border,默认是medium(2px)
350   - // 但是在IE 6 7 的怪异模式下,可以被html { border: 0; } 这条css规则覆盖
351   - // 在IE7的标准模式下,border永远是2px,这个值通过clientLeft 和 clientTop取得
352   - // 但是。。。在IE 6 7的怪异模式,如果用户使用css覆盖了默认的medium
353   - // clientTop和clientLeft不会更新
354   - pos.left -= doc.documentElement.clientLeft;
355   - pos.top -= doc.documentElement.clientTop;
356   -
357   - var htmlDom = doc.body,
358   - // 在这里,不使用element.style.borderLeftWidth,只有computedStyle是可信的
359   - htmlBorderLeftWidth = parseInt(getStyle(htmlDom, 'borderLeftWidth')),
360   - htmlBorderTopWidth = parseInt(getStyle(htmlDom, 'borderTopWidth'));
361   - if(browser.ie && !browser.isStrict){
362   - pos.left -= isNaN(htmlBorderLeftWidth) ? 2 : htmlBorderLeftWidth;
363   - pos.top -= isNaN(htmlBorderTopWidth) ? 2 : htmlBorderTopWidth;
364   - }
365   - } else {
366   - // safari/opera/firefox
367   - parent = element;
368   -
369   - do {
370   - pos.left += parent.offsetLeft;
371   - pos.top += parent.offsetTop;
372   -
373   - // safari里面,如果遍历到了一个fixed的元素,后面的offset都不准了
374   - if (browser.isWebkit > 0 && getStyle(parent, 'position') == 'fixed') {
375   - pos.left += doc.body.scrollLeft;
376   - pos.top += doc.body.scrollTop;
377   - break;
378   - }
379   -
380   - parent = parent.offsetParent;
381   - } while (parent && parent != element);
382   -
383   - // 对body offsetTop的修正
384   - if(browser.opera > 0 || (browser.isWebkit > 0 && getStyle(element, 'position') == 'absolute')){
385   - pos.top -= doc.body.offsetTop;
386   - }
387   -
388   - // 计算除了body的scroll
389   - parent = element.offsetParent;
390   - while (parent && parent != doc.body) {
391   - pos.left -= parent.scrollLeft;
392   - // see https://bugs.opera.com/show_bug.cgi?id=249965
393   - if (!browser.opera || parent.tagName != 'TR') {
394   - pos.top -= parent.scrollTop;
395   - }
396   - parent = parent.offsetParent;
397   - }
398   - }
399   -
400   - return pos;
401   - };
402   -
403   - /**
404   - * @ignore
405   - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。
406   - * @property target 事件的触发元素
407   - * @property pageX 鼠标事件的鼠标x坐标
408   - * @property pageY 鼠标事件的鼠标y坐标
409   - * @property keyCode 键盘事件的键值
410   - */
411   - baidu.event = baidu.event || {};
412   -
413   - /**
414   - * 事件监听器的存储表
415   - * @private
416   - * @meta standard
417   - */
418   - baidu.event._listeners = baidu.event._listeners || [];
419   -
420   - /**
421   - * 为目标元素添加事件监听器
422   - * @name baidu.event.on
423   - * @function
424   - * @grammar baidu.event.on(element, type, listener)
425   - * @param {HTMLElement|string|window} element 目标元素或目标元素id
426   - * @param {string} type 事件类型
427   - * @param {Function} listener 需要添加的监听器
428   - * @remark
429   - *
430   - 1. 不支持跨浏览器的鼠标滚轮事件监听器添加<br>
431   - 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败
432   -
433   - * @shortcut on
434   - * @meta standard
435   - * @see baidu.event.un
436   - *
437   - * @returns {HTMLElement|window} 目标元素
438   - */
439   - baidu.event.on = function (element, type, listener) {
440   - type = type.replace(/^on/i, '');
441   - element = baidu.dom._g(element);
442   -
443   - var realListener = function (ev) {
444   - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载
445   - // 2. element是为了修正this
446   - listener.call(element, ev);
447   - },
448   - lis = baidu.event._listeners,
449   - filter = baidu.event._eventFilter,
450   - afterFilter,
451   - realType = type;
452   - type = type.toLowerCase();
453   - // filter过滤
454   - if(filter && filter[type]){
455   - afterFilter = filter[type](element, type, realListener);
456   - realType = afterFilter.type;
457   - realListener = afterFilter.listener;
458   - }
459   -
460   - // 事件监听器挂载
461   - if (element.addEventListener) {
462   - element.addEventListener(realType, realListener, false);
463   - } else if (element.attachEvent) {
464   - element.attachEvent('on' + realType, realListener);
465   - }
466   -
467   - // 将监听器存储到数组中
468   - lis[lis.length] = [element, type, listener, realListener, realType];
469   - return element;
470   - };
471   -
472   - // 声明快捷方法
473   - baidu.on = baidu.event.on;
474   -
475   - /**
476   - * 返回一个当前页面的唯一标识字符串。
477   - * @name baidu.lang.guid
478   - * @function
479   - * @grammar baidu.lang.guid()
480   - * @version 1.1.1
481   - * @meta standard
482   - *
483   - * @returns {String} 当前页面的唯一标识字符串
484   - */
485   -
486   - (function(){
487   - //不直接使用window,可以提高3倍左右性能
488   - var guid = window[baidu.guid];
489   -
490   - baidu.lang.guid = function() {
491   - return "TANGRAM__" + (guid._counter ++).toString(36);
492   - };
493   -
494   - guid._counter = guid._counter || 1;
495   - })();
496   -
497   - /**
498   - * 所有类的实例的容器
499   - * key为每个实例的guid
500   - * @meta standard
501   - */
502   -
503   - window[baidu.guid]._instances = window[baidu.guid]._instances || {};
504   -
505   - /**
506   - * 判断目标参数是否为function或Function实例
507   - * @name baidu.lang.isFunction
508   - * @function
509   - * @grammar baidu.lang.isFunction(source)
510   - * @param {Any} source 目标参数
511   - * @version 1.2
512   - * @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
513   - * @meta standard
514   - * @returns {boolean} 类型判断结果
515   - */
516   - baidu.lang.isFunction = function (source) {
517   - // chrome下,'function' == typeof /a/ 为true.
518   - return '[object Function]' == Object.prototype.toString.call(source);
519   - };
520   -
521   - /**
522   - *
523   - * @ignore
524   - * @class Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。
525   - * @name baidu.lang.Class
526   - * @grammar baidu.lang.Class(guid)
527   - * @param {string} guid 对象的唯一标识
528   - * @meta standard
529   - * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。<br>baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。
530   - * @meta standard
531   - * @see baidu.lang.inherits,baidu.lang.Event
532   - */
533   - baidu.lang.Class = function(guid) {
534   - this.guid = guid || baidu.lang.guid();
535   - window[baidu.guid]._instances[this.guid] = this;
536   - };
537   - window[baidu.guid]._instances = window[baidu.guid]._instances || {};
538   -
539   - /**
540   - * 释放对象所持有的资源,主要是自定义事件。
541   - * @name dispose
542   - * @grammar obj.dispose()
543   - */
544   - baidu.lang.Class.prototype.dispose = function(){
545   - delete window[baidu.guid]._instances[this.guid];
546   -
547   - for(var property in this){
548   - if (!baidu.lang.isFunction(this[property])) {
549   - delete this[property];
550   - }
551   - }
552   - this.disposed = true;
553   - };
554   -
555   - /**
556   - * 重载了默认的toString方法,使得返回信息更加准确一些。
557   - * @return {string} 对象的String表示形式
558   - */
559   - baidu.lang.Class.prototype.toString = function(){
560   - return "[object " + (this._className || "Object" ) + "]";
561   - };
562   -
563   - /**
564   - * @ignore
565   - * @class 自定义的事件对象。
566   - * @name baidu.lang.Event
567   - * @grammar baidu.lang.Event(type[, target])
568   - * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。
569   - * @param {Object} [target]触发事件的对象
570   - * @meta standard
571   - * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。
572   - * @meta standard
573   - * @see baidu.lang.Class
574   - */
575   - baidu.lang.Event = function (type, target) {
576   - this.type = type;
577   - this.returnValue = true;
578   - this.target = target || null;
579   - this.currentTarget = null;
580   - };
581   -
582   - /**
583   - * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
584   - * @grammar obj.addEventListener(type, handler[, key])
585   - * @param {string} type 自定义事件的名称
586   - * @param {Function} handler 自定义事件被触发时应该调用的回调函数
587   - * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。
588   - * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。
589   - */
590   - baidu.lang.Class.prototype.addEventListener = function (type, handler, key) {
591   - if (!baidu.lang.isFunction(handler)) {
592   - return;
593   - }
594   -
595   - !this.__listeners && (this.__listeners = {});
596   -
597   - var t = this.__listeners, id;
598   - if (typeof key == "string" && key) {
599   - if (/[^\w\-]/.test(key)) {
600   - throw("nonstandard key:" + key);
601   - } else {
602   - handler.hashCode = key;
603   - id = key;
604   - }
605   - }
606   - type.indexOf("on") != 0 && (type = "on" + type);
607   -
608   - typeof t[type] != "object" && (t[type] = {});
609   - id = id || baidu.lang.guid();
610   - handler.hashCode = id;
611   - t[type][id] = handler;
612   - };
613   -
614   - /**
615   - * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
616   - * @grammar obj.removeEventListener(type, handler)
617   - * @param {string} type 事件类型
618   - * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key
619   - * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。
620   - */
621   - baidu.lang.Class.prototype.removeEventListener = function (type, handler) {
622   - if (typeof handler != "undefined") {
623   - if ( (baidu.lang.isFunction(handler) && ! (handler = handler.hashCode))
624   - || (! baidu.lang.isString(handler))
625   - ){
626   - return;
627   - }
628   - }
629   -
630   - !this.__listeners && (this.__listeners = {});
631   -
632   - type.indexOf("on") != 0 && (type = "on" + type);
633   -
634   - var t = this.__listeners;
635   - if (!t[type]) {
636   - return;
637   - }
638   - if (typeof handler != "undefined") {
639   - t[type][handler] && delete t[type][handler];
640   - } else {
641   - for(var guid in t[type]){
642   - delete t[type][guid];
643   - }
644   - }
645   - };
646   -
647   - /**
648   - * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
649   - * @grammar obj.dispatchEvent(event, options)
650   - * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持)
651   - * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持)
652   - * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。例如:<br>
653   - myobj.onMyEvent = function(){}<br>
654   - myobj.addEventListener("onMyEvent", function(){});
655   - */
656   - baidu.lang.Class.prototype.dispatchEvent = function (event, options) {
657   - if (baidu.lang.isString(event)) {
658   - event = new baidu.lang.Event(event);
659   - }
660   - !this.__listeners && (this.__listeners = {});
661   -
662   - // 20100603 添加本方法的第二个参数,将 options extend到event中去传递
663   - options = options || {};
664   - for (var i in options) {
665   - event[i] = options[i];
666   - }
667   -
668   - var i, t = this.__listeners, p = event.type;
669   - event.target = event.target || this;
670   - event.currentTarget = this;
671   -
672   - p.indexOf("on") != 0 && (p = "on" + p);
673   -
674   - baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments);
675   -
676   - if (typeof t[p] == "object") {
677   - for (i in t[p]) {
678   - t[p][i].apply(this, arguments);
679   - }
680   - }
681   - return event.returnValue;
682   - };
683   -
684   -
685   - baidu.lang.inherits = function (subClass, superClass, className) {
686   - var key, proto,
687   - selfProps = subClass.prototype,
688   - clazz = new Function();
689   -
690   - clazz.prototype = superClass.prototype;
691   - proto = subClass.prototype = new clazz();
692   - for (key in selfProps) {
693   - proto[key] = selfProps[key];
694   - }
695   - subClass.prototype.constructor = subClass;
696   - subClass.superClass = superClass.prototype;
697   -
698   - // 类名标识,兼容Class的toString,基本没用
699   - if ("string" == typeof className) {
700   - proto._className = className;
701   - }
702   - };
703   - // 声明快捷方法
704   - baidu.inherits = baidu.lang.inherits;
705   - })();
706   -
707   -
708   - /**
709   -
710   - * 图片的路径
711   -
712   - * @private
713   - * @type {String}
714   -
715   - */
716   - var _IMAGE_PATH = 'http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m';
717   -
718   - /**
719   -
720   - * 图片的后缀名
721   -
722   - * @private
723   - * @type {String}
724   -
725   - */
726   - var _IMAGE_EXTENSION = 'png';
727   -
728   - /**
729   - *@exports TextIconOverlay as BMapLib.TextIconOverlay
730   - */
731   - var TextIconOverlay =
732   - /**
733   - * TextIconOverlay
734   - * @class 此类表示地图上的一个覆盖物,该覆盖物由文字和图标组成,从Overlay继承。文字通常是数字(0-9)或字母(A-Z ),而文字与图标之间有一定的映射关系。
735   - *该覆盖物适用于以下类似的场景:需要在地图上添加一系列覆盖物,这些覆盖物之间用不同的图标和文字来区分,文字可能表示了该覆盖物的某一属性值,根据该文字和一定的映射关系,自动匹配相应颜色和大小的图标。
736   - *
737   - *@constructor
738   - *@param {Point} position 表示一个经纬度坐标位置。
739   - *@param {String} text 表示该覆盖物显示的文字信息。
740   - *@param {Json Object} options 可选参数,可选项包括:<br />
741   - *"<b>styles</b>":{Array<IconStyle>} 一组图标风格。单个图表风格包括以下几个属性:<br />
742   - * url {String} 图片的url地址。(必选)<br />
743   - * size {Size} 图片的大小。(必选)<br />
744   - * anchor {Size} 图标定位在地图上的位置相对于图标左上角的偏移值,默认偏移值为图标的中心位置。(可选)<br />
745   - * offset {Size} 图片相对于可视区域的偏移值,此功能的作用等同于CSS中的background-position属性。(可选)<br />
746   - * textSize {Number} 文字的大小。(可选,默认10)<br />
747   - * textColor {String} 文字的颜色。(可选,默认black)<br />
748   - */
749   - BMapLib.TextIconOverlay = function(position, text, options){
750   - this._position = position;
751   - this._text = text;
752   - this._options = options || {};
753   - this._styles = this._options['styles'] || [];
754   - (!this._styles.length) && this._setupDefaultStyles();
755   - };
756   -
757   - T.lang.inherits(TextIconOverlay, BMap.Overlay, "TextIconOverlay");
758   -
759   - TextIconOverlay.prototype._setupDefaultStyles = function(){
760   - var sizes = [53, 56, 66, 78, 90];
761   - for(var i = 0, size; size = sizes[i]; i++){
762   - this._styles.push({
763   - url:_IMAGE_PATH + i + '.' + _IMAGE_EXTENSION,
764   - size: new BMap.Size(size, size)
765   - });
766   - }//for循环的简洁写法
767   - };
768   -
769   - /**
770   - *继承Overlay的intialize方法,自定义覆盖物时必须。
771   - *@param {Map} map BMap.Map的实例化对象。
772   - *@return {HTMLElement} 返回覆盖物对应的HTML元素。
773   - */
774   - TextIconOverlay.prototype.initialize = function(map){
775   - this._map = map;
776   -
777   - this._domElement = document.createElement('div');
778   - this._updateCss();
779   - this._updateText();
780   - this._updatePosition();
781   -
782   - this._bind();
783   -
784   - this._map.getPanes().markerMouseTarget.appendChild(this._domElement);
785   - return this._domElement;
786   - };
787   -
788   - /**
789   - *继承Overlay的draw方法,自定义覆盖物时必须。
790   - *@return 无返回值。
791   - */
792   - TextIconOverlay.prototype.draw = function(){
793   - this._map && this._updatePosition();
794   - };
795   -
796   - /**
797   - *获取该覆盖物上的文字。
798   - *@return {String} 该覆盖物上的文字。
799   - */
800   - TextIconOverlay.prototype.getText = function(){
801   - return this._text;
802   - };
803   -
804   - /**
805   - *设置该覆盖物上的文字。
806   - *@param {String} text 要设置的文字,通常是字母A-Z或数字0-9。
807   - *@return 无返回值。
808   - */
809   - TextIconOverlay.prototype.setText = function(text){
810   - if(text && (!this._text || (this._text.toString() != text.toString()))){
811   - this._text = text;
812   - this._updateText();
813   - this._updateCss();
814   - this._updatePosition();
815   - }
816   - };
817   -
818   - /**
819   - *获取该覆盖物的位置。
820   - *@return {Point} 该覆盖物的经纬度坐标。
821   - */
822   - TextIconOverlay.prototype.getPosition = function () {
823   - return this._position;
824   - };
825   -
826   - /**
827   - *设置该覆盖物的位置。
828   - *@param {Point} position 要设置的经纬度坐标。
829   - *@return 无返回值。
830   - */
831   - TextIconOverlay.prototype.setPosition = function (position) {
832   - if(position && (!this._position || !this._position.equals(position))){
833   - this._position = position;
834   - this._updatePosition();
835   - }
836   - };
837   -
838   - /**
839   - *由文字信息获取风格数组的对应索引值。
840   - *内部默认的对应函数为文字转换为数字除以10的结果,比如文字8返回索引0,文字25返回索引2.
841   - *如果需要自定义映射关系,请覆盖该函数。
842   - *@param {String} text 文字。
843   - *@param {Array<IconStyle>} styles 一组图标风格。
844   - *@return {Number} 对应的索引值。
845   - */
846   - TextIconOverlay.prototype.getStyleByText = function(text, styles){
847   - var count = parseInt(text);
848   - if (count < 0) {
849   - count = 0;
850   - }
851   - var index = String(count).length;
852   - return styles[index-1];
853   - }
854   -
855   - /**
856   - *更新相应的CSS。
857   - *@return 无返回值。
858   - */
859   - TextIconOverlay.prototype._updateCss = function(){
860   - var style = this.getStyleByText(this._text, this._styles);
861   - this._domElement.style.cssText = this._buildCssText(style);
862   - };
863   -
864   - /**
865   - *更新覆盖物的显示文字。
866   - *@return 无返回值。
867   - */
868   - TextIconOverlay.prototype._updateText = function(){
869   - if (this._domElement) {
870   - this._domElement.innerHTML = this._text;
871   - }
872   - };
873   -
874   - /**
875   - *调整覆盖物在地图上的位置更新覆盖物的显示文字。
876   - *@return 无返回值。
877   - */
878   - TextIconOverlay.prototype._updatePosition = function(){
879   - if (this._domElement && this._position) {
880   - var style = this._domElement.style;
881   - var pixelPosition= this._map.pointToOverlayPixel(this._position);
882   - pixelPosition.x -= Math.ceil(parseInt(style.width) / 2);
883   - pixelPosition.y -= Math.ceil(parseInt(style.height) / 2);
884   - style.left = pixelPosition.x + "px";
885   - style.top = pixelPosition.y + "px";
886   - }
887   - };
888   -
889   - /**
890   - * 为该覆盖物的HTML元素构建CSS
891   - * @param {IconStyle} 一个图标的风格。
892   - * @return {String} 构建完成的CSSTEXT。
893   - */
894   - TextIconOverlay.prototype._buildCssText = function(style) {
895   - //根据style来确定一些默认值
896   - var url = style['url'];
897   - var size = style['size'];
898   - var anchor = style['anchor'];
899   - var offset = style['offset'];
900   - var textColor = style['textColor'] || 'black';
901   - var textSize = style['textSize'] || 10;
902   -
903   - var csstext = [];
904   - if (T.browser["ie"] < 7) {
905   - csstext.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(' +
906   - 'sizingMethod=scale,src="' + url + '");');
907   - } else {
908   - if(style['bgColor'] == '' || style['bgColor'] == undefined) {
909   - csstext.push('background-image:url(' + url + ');');
910   - var backgroundPosition = '0 0';
911   - (offset instanceof BMap.Size) && (backgroundPosition = offset.width + 'px' + ' ' + offset.height + 'px');
912   - csstext.push('background-position:' + backgroundPosition + ';');
913   - } else {
914   - var bgColor = style['bgColor'];
915   - csstext.push('background-color:' + bgColor + '; border-radius: 51%;');
916   - }
917   - }
918   -
919   - if (size instanceof BMap.Size){
920   - if (anchor instanceof BMap.Size) {
921   - if (anchor.height > 0 && anchor.height < size.height) {
922   - csstext.push('height:' + (size.height - anchor.height) + 'px; padding-top:' + anchor.height + 'px;');
923   - }
924   - if(anchor.width > 0 && anchor.width < size.width){
925   - csstext.push('width:' + (size.width - anchor.width) + 'px; padding-left:' + anchor.width + 'px;');
926   - }
927   - } else {
928   - csstext.push('height:' + size.height + 'px; line-height:' + size.height + 'px;');
929   - csstext.push('width:' + size.width + 'px; text-align:center;');
930   - }
931   - }
932   -
933   - csstext.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' +
934   - textSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
935   - return csstext.join('');
936   - };
937   -
938   -
939   - /**
940   -
941   - * 当鼠标点击该覆盖物时会触发该事件
942   -
943   - * @name TextIconOverlay#click
944   -
945   - * @event
946   -
947   - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
948   -
949   - * <br />"<b>type</b> : {String} 事件类型
950   -
951   - * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
952   -
953   - *
954   -
955   - */
956   -
957   - /**
958   -
959   - * 当鼠标进入该覆盖物区域时会触发该事件
960   -
961   - * @name TextIconOverlay#mouseover
962   -
963   - * @event
964   - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
965   -
966   - * <br />"<b>type</b> : {String} 事件类型
967   -
968   - * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
969   -
970   - * <br />"<b>point</b> : {BMap.Point} 最新添加上的节点BMap.Point对象
971   -
972   - * <br />"<b>pixel</b>:{BMap.pixel} 最新添加上的节点BMap.Pixel对象
973   -
974   - *
975   -
976   - * @example <b>参考示例:</b><br />
977   -
978   - * myTextIconOverlay.addEventListener("mouseover", function(e) { alert(e.point); });
979   -
980   - */
981   -
982   - /**
983   -
984   - * 当鼠标离开该覆盖物区域时会触发该事件
985   -
986   - * @name TextIconOverlay#mouseout
987   -
988   - * @event
989   -
990   - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
991   -
992   - * <br />"<b>type</b> : {String} 事件类型
993   -
994   - * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
995   -
996   - * <br />"<b>point</b> : {BMap.Point} 最新添加上的节点BMap.Point对象
997   -
998   - * <br />"<b>pixel</b>:{BMap.pixel} 最新添加上的节点BMap.Pixel对象
999   -
1000   - *
1001   -
1002   - * @example <b>参考示例:</b><br />
1003   -
1004   - * myTextIconOverlay.addEventListener("mouseout", function(e) { alert(e.point); });
1005   -
1006   - */
1007   -
1008   -
1009   - /**
1010   - * 为该覆盖物绑定一系列事件
1011   - * 当前支持click mouseover mouseout
1012   - * @return 无返回值。
1013   - */
1014   - TextIconOverlay.prototype._bind = function(){
1015   - if (!this._domElement){
1016   - return;
1017   - }
1018   -
1019   - var me = this;
1020   - var map = this._map;
1021   -
1022   - var BaseEvent = T.lang.Event;
1023   - function eventExtend(e, be){
1024   - var elem = e.srcElement || e.target;
1025   - var x = e.clientX || e.pageX;
1026   - var y = e.clientY || e.pageY;
1027   - if (e && be && x && y && elem){
1028   - var offset = T.dom.getPosition(map.getContainer());
1029   - be.pixel = new BMap.Pixel(x - offset.left, y - offset.top);
1030   - be.point = map.pixelToPoint(be.pixel);
1031   - }
1032   - return be;
1033   - }//给事件参数增加pixel和point两个值
1034   -
1035   - T.event.on(this._domElement,"mouseover", function(e){
1036   - me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseover")));
1037   - });
1038   - T.event.on(this._domElement,"mouseout", function(e){
1039   - me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseout")));
1040   - });
1041   - T.event.on(this._domElement,"click", function(e){
1042   - me.dispatchEvent(eventExtend(e, new BaseEvent("onclick")));
1043   - });
1044   - };
1045   -
1046   -})();
1047 0 \ No newline at end of file
common/helpers/Utils.php
... ... @@ -2,7 +2,7 @@
2 2  
3 3 namespace common\helpers;
4 4  
5   -use common\exts\wechat\Http;
  5 +use common\exts\Http;
6 6 use Faker\Provider\Uuid;
7 7  
8 8 class Utils
... ... @@ -169,22 +169,6 @@ class Utils
169 169 return round($number ,2);
170 170 }
171 171  
172   - /**
173   - * @param $avatar
174   - * @return bool|string
175   - */
176   - public static function getUserAvatar($avatar, $WX_STYLE = 96 )
177   - {
178   - if(false !== strpos($avatar,'http')){
179   - if(false !== strpos($avatar,'.jpg')){
180   - return $avatar;
181   - } else {
182   - return \common\helpers\WxHelper::exchangeHeadImgSize($avatar, $WX_STYLE);
183   - }
184   - }else{
185   - return $avatar;
186   - }
187   - }
188 172  
189 173 /** 经纬度检测是否合格
190 174 * @param $latitude
... ...
console/controllers/TestController.php
... ... @@ -8,7 +8,9 @@ namespace console\controllers;
8 8 */
9 9  
10 10  
  11 +use app\api\helpers\Aes;
11 12 use common\exts\Http;
  13 +use domain\device\Device;
12 14 use GuzzleHttp\Psr7;
13 15 use yii\console\Controller;
14 16 use GuzzleHttp\Psr7\Request;
... ... @@ -27,7 +29,7 @@ class TestController extends Controller
27 29 {
28 30 $url = 'http://kingb:8012/app-api/web/authDevice';
29 31 $manufactureNo = '0002';
30   - $device_id = 'SZDEVICE000036';
  32 + $device_id = 'SZDEVICE000037';
31 33 $projectNo = '002';
32 34 $modelNo = '002';
33 35 $productionNo = '0001';
... ... @@ -49,5 +51,59 @@ class TestController extends Controller
49 51  
50 52 }
51 53  
  54 + public function actionUpgrade()
  55 + {
  56 + $url = 'http://kingb:8012/app-api/web/reportDeviceVersion';
  57 + $params = [
  58 + 'barcode' => '00001',
  59 + 'device_id' => 'DEVICE001',
  60 + 'software_version' => 'V1.0.1',
  61 + 'hardware_version' => 'V1.0.2',
  62 + 'timestamp' => 1500000000
  63 + ];
  64 +
  65 + $postResult = Http::POST($url, $params);
  66 + echo $postResult;
  67 + }
  68 +
  69 + public function actionAec()
  70 + {
  71 + $aes = new Aes('12345678');
  72 + $encrypted = $aes->encrypt('this is en AES testing');
  73 + echo '要加密的字符串:this is en AES testing<br>加密后的字符串:'. $encrypted. '<hr>';
  74 + $decrypted = $aes->decrypt($encrypted);
  75 + echo '要解密的字符串:'. $encrypted, '<br>解密后的字符串:'. $decrypted;
  76 + }
  77 +
  78 + public function actionDeviceSt()
  79 + {
  80 + $url = 'http://kingb:8012/app-api/web/reportDeviceVersion';
  81 + $params = [
  82 + 'barcode' => '0001000100010001',
  83 + 'device_id' => 'DEVICE003',
  84 + 'software_version' => 'V1.0.1',
  85 + 'hardware_version' => 'V1.0.2',
  86 + 'timestamp' => 1500000000
  87 + ];
  88 +
  89 + $postResult = Http::POST($url, json_encode($params));
  90 + echo $postResult;
  91 + }
  92 +
  93 + public function actionCheckAppUpdate()
  94 + {
  95 + //actionCheckAppVersion
  96 + $url = 'http://kingb:8012/app-api/web/checkAppVersion';
  97 + $params = [
  98 + 'barcode' => '0001000100010001',
  99 + 'device_id' => 'DEVICE000001',
  100 + 'current_version' => 'V1.0.1',
  101 + 'package_name' => 'com.ota.app.pro',
  102 + ];
  103 +
  104 + $postResult = Http::POST($url, json_encode($params));
  105 + echo $postResult;
  106 + }
  107 +
52 108 }
53 109  
... ...
domain/device/Device.php
... ... @@ -18,6 +18,22 @@ class Device
18 18 return $manufacture. $project. $model. $production;
19 19 }
20 20  
  21 + static function explodeBarcode($barcode)
  22 + {
  23 + //建议格式: 0001 0001 0001 0001
  24 + //供参考 厂商ID 项目ID 型号ID 生产日期ID
  25 + $len = mb_strlen($barcode);
  26 + if ($len != 16) {
  27 + return null;
  28 + }
  29 + $manufactureNo = mb_substr($barcode, 0, 4, 'utf-8');
  30 + $projectNo = mb_substr($barcode, 4, 4, 'utf-8');
  31 + $modelNo = mb_substr($barcode, 8, 4, 'utf-8');
  32 + $productionNo = mb_substr($barcode, 12, 4, 'utf-8');
  33 +
  34 + return [$manufactureNo, $projectNo, $modelNo, $productionNo];
  35 + }
  36 +
21 37 /**
22 38 * @param $deviceId
23 39 * @param $manufactureNo
... ... @@ -41,7 +57,7 @@ class Device
41 57 return $e;
42 58 }
43 59 $batchId = $batchModel->id;
44   - $count = DeviceRepository::rowsCount(['batch_id' => $batchId, 'is_delete' => 0]);
  60 + $count = DeviceRepository::rowsCount(['batch_id' => $batchId, 'status' => DeviceStatus::HAS_AUTH, 'is_delete' => 0]);
45 61  
46 62 if (($count *1) >= ($batchModel->num * 1)) {
47 63 // 超过了限制数,记录到另外一个表里面
... ...
domain/device/DeviceAuthFailRepository.php
... ... @@ -16,4 +16,50 @@ class DeviceAuthFailRepository
16 16 return DeviceAuthFailModel::findOne($condition);
17 17 }
18 18  
  19 +
  20 + /**
  21 + * @param $where
  22 + * @return array|\yii\db\ActiveRecord[]
  23 + */
  24 + static function getList($where, $limit = 0, $offset = 0)
  25 + {
  26 + $deviceFind = DeviceAuthFailModel::find();
  27 + $deviceFind->alias('a');
  28 + $deviceFind->select(['a.*', 'm.name as manufacture','p.name as project','pd.name as production','mo.name as model']);
  29 + $deviceFind->leftJoin('manufacture as m', 'm.manufacture_no = a.manufacture_no');
  30 + $deviceFind->leftJoin('project as p', 'p.project_no = a.project_no');
  31 + $deviceFind->leftJoin('model as mo', 'mo.model_no = a.model_no');
  32 + $deviceFind->leftJoin('production as pd', 'pd.production_no = a.production_no');
  33 +
  34 + $deviceFind->where($where);
  35 + $deviceFind->orderBy('created_at desc');
  36 + $deviceFind->asArray();
  37 + if ($offset) {
  38 + $deviceFind->offset($offset);
  39 + }
  40 + if ($limit) {
  41 + $deviceFind->limit($limit);
  42 + }
  43 + $all = $deviceFind->all();
  44 +
  45 + return $all;
  46 + }
  47 +
  48 + /**
  49 + * @param $where
  50 + * @return int|string
  51 + */
  52 + static function getListCount($where)
  53 + {
  54 + $deviceFind = DeviceAuthFailModel::find();
  55 + $deviceFind->alias('a');
  56 + $deviceFind->leftJoin('manufacture as m', 'm.manufacture_no = a.manufacture_no');
  57 + $deviceFind->leftJoin('project as p', 'p.project_no = a.project_no');
  58 + $deviceFind->leftJoin('model as mo', 'mo.model_no = a.model_no');
  59 + $deviceFind->leftJoin('production as pd', 'pd.production_no = a.production_no');
  60 + $deviceFind->where($where);
  61 + $all = $deviceFind->count();
  62 +
  63 + return $all;
  64 + }
19 65 }
20 66 \ No newline at end of file
... ...
domain/device/DeviceRepository.php
... ... @@ -23,6 +23,7 @@ class DeviceRepository
23 23 $deviceFind->leftJoin('production as pd', 'pd.id = b.production_id');
24 24  
25 25 $deviceFind->where($where);
  26 + $deviceFind->orderBy('created_at desc');
26 27 $deviceFind->asArray();
27 28 if ($offset) {
28 29 $deviceFind->offset($offset);
... ...
domain/device/DeviceStats.php 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +<?php
  2 +
  3 +namespace domain\device;
  4 +
  5 +use Yii;
  6 +use domain\device\models\DeviceStats as DeviceStatsModel;
  7 +
  8 +class DeviceStats
  9 +{
  10 + /**
  11 + * @param $item
  12 + * @return null
  13 + */
  14 + static function create($item)
  15 + {
  16 + $createModel = Yii::createObject([
  17 + 'class' => DeviceStatsModel::className(),
  18 + 'barcode' => $item['barcode'],
  19 + 'device_id' => $item['device_id'],
  20 + 'manufacture_id' => $item['manufacture_id'],
  21 + 'project_id' => $item['project_id'],
  22 + 'model_id' => $item['model_id'],
  23 + 'software_version' => $item['software_version'],
  24 + 'hardware_version' => $item['hardware_version'],
  25 + 'timestamp' => $item['timestamp'],
  26 + 'city' => $item['city'],
  27 + 'ip' => $item['ip']
  28 + ]);
  29 + if ($createModel->save()) {
  30 + return $createModel;
  31 + } else {
  32 + return null;
  33 + }
  34 + }
  35 +}
0 36 \ No newline at end of file
... ...
domain/device/DeviceStatsRepository.php 0 → 100644
... ... @@ -0,0 +1,81 @@
  1 +<?php
  2 +
  3 +namespace domain\device;
  4 +
  5 +use domain\device\models\Device as DeviceModel;
  6 +use domain\device\models\DeviceStats as DeviceStatsModel;
  7 +use domain\manufacturer\models\Manufacturer as ManufacturerModel;
  8 +use domain\model\models\Model as ModelModel;
  9 +use domain\project\models\Project as ProjectModel;
  10 +use yii\db\Query;
  11 +
  12 +class DeviceStatsRepository
  13 +{
  14 + /**
  15 + * @param $condition
  16 + * @return null|static
  17 + */
  18 + static function findOne($condition)
  19 + {
  20 + return DeviceStatsModel::findOne($condition);
  21 + }
  22 +
  23 + /**
  24 + * 获取分页数据
  25 + * @param $where
  26 + * @param $offset
  27 + * @param $limit
  28 + * @return array|\yii\db\ActiveRecord[]
  29 + */
  30 + static function getPageList($where, $offset, $limit)
  31 + {
  32 + $upgradeFind = DeviceStatsModel::find()->alias("ds")
  33 + ->select([
  34 + "ds.*",
  35 + "mf.name as manufacture_name",
  36 + 'de.serial_no',
  37 + 'de.device_id as device_device_id',
  38 + 'pj.name as project_name',
  39 + 'md.name as model_name',
  40 + ]);
  41 + $upgradeFind->leftJoin(ManufacturerModel::tableName() . " mf", "mf.id = ds.manufacture_id");
  42 + $upgradeFind->leftJoin(DeviceModel::tableName() . " de", "de.id = ds.device_id");
  43 + $upgradeFind->leftJoin(ProjectModel::tableName() . " pj", "pj.id = ds.project_id");
  44 + $upgradeFind->leftJoin(ModelModel::tableName() . " md", "md.id = ds.model_id");
  45 +
  46 + if (!empty($where)) {
  47 + $upgradeFind->where($where);
  48 + }
  49 + if ($offset) {
  50 + $upgradeFind->offset($offset);
  51 + }
  52 + if ($limit) {
  53 + $upgradeFind->limit($limit);
  54 + }
  55 + $upgradeFind->orderBy("ds.id desc");
  56 + $upgradeFind->asArray();
  57 + $dataList = $upgradeFind->all();
  58 +
  59 + return $dataList;
  60 + }
  61 +
  62 + /**
  63 + * 列表页面分页器数量
  64 + * @param string $map
  65 + */
  66 + static function getPageCount($map = '')
  67 + {
  68 + $DeviceStatsFind = DeviceStatsModel::find()->alias("ds");
  69 + $DeviceStatsFind->leftJoin(ManufacturerModel::tableName() . " mf", "mf.id = ds.manufacture_id");
  70 + $DeviceStatsFind->leftJoin(DeviceModel::tableName() . " de", "de.id = ds.device_id");
  71 + $DeviceStatsFind->leftJoin(ProjectModel::tableName() . " pj", "pj.id = ds.project_id");
  72 + $DeviceStatsFind->leftJoin(ModelModel::tableName() . " md", "md.id = ds.model_id");
  73 + if (!empty($map)) {
  74 + $DeviceStatsFind->where($map);
  75 + }
  76 + $pageCount = $DeviceStatsFind->count();
  77 +
  78 + return $pageCount;
  79 + }
  80 +
  81 +}
0 82 \ No newline at end of file
... ...
domain/device/models/DeviceStats.php 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<?php
  2 +
  3 +namespace domain\device\models;
  4 +
  5 +use yii\behaviors\TimestampBehavior;
  6 +use yii\db\ActiveRecord;
  7 +
  8 +class DeviceStats extends ActiveRecord
  9 +{
  10 + /**
  11 + * @inheritdoc
  12 + */
  13 + public static function tableName()
  14 + {
  15 + return '{{%device_stats}}';
  16 + }
  17 +
  18 + public function behaviors()
  19 + {
  20 + return [
  21 + 'time' => [
  22 + 'class' => TimestampBehavior::className(),
  23 + 'createdAtAttribute' => 'created_at',
  24 + 'updatedAtAttribute' => 'updated_at',
  25 + ]
  26 + ];
  27 + }
  28 +}
0 29 \ No newline at end of file
... ...
domain/upgrade/Upgrade.php
... ... @@ -20,7 +20,7 @@ class Upgrade
20 20 static function create($item)
21 21 {
22 22 try {
23   - $findUpgradeModel = UpgradeModel::findOne(['version' => $item["version"], 'type' => $item["type"]]);
  23 + $findUpgradeModel = UpgradeModel::findOne(['version' => $item["version"], 'manufacture_id' => $item["manufacture_id"], 'type' => $item["type"]]);
24 24 if (!empty($findUpgradeModel)) {
25 25 return -1;
26 26 }
... ...
domain/upgrade/UpgradeLog.php
... ... @@ -48,6 +48,9 @@ class UpgradeLog
48 48 if (isset($item["error_code"])) {
49 49 $upgradeLogModel->error_code = $item["error_code"]; // 错误码
50 50 }
  51 + if (isset($item["timestamp"])) {
  52 + $upgradeLogModel->timestamp = $item["timestamp"]; //
  53 + }
51 54 if (isset($item["type"])) {
52 55 $upgradeLogModel->type = $item["type"]; // 日志类型 1 app 2.ota整机
53 56 }
... ...