├── dump-api-v1.0.1-band7 ├── app.js ├── assets │ └── 194x368-amazfit-band-7 │ │ └── icon.png ├── .gitignore ├── app.json └── page │ └── index.js ├── dump-api-v2.0.0-gtr4 ├── app.js ├── global.d.ts ├── assets │ └── 466x466-gtr-4 │ │ └── icon.png ├── .gitignore ├── jsconfig.json ├── package.json ├── app.json └── page │ └── index.js ├── README.md ├── dump.sh ├── LICENSE ├── .gitignore ├── api-v1.0.1-band7.js ├── api-v1.0.1-gtr4.js ├── api-v2.0.0-gtr4.js └── api-v1.0.0-leaked-framework.js /dump-api-v1.0.1-band7/app.js: -------------------------------------------------------------------------------- 1 | App({ 2 | onCreate() { }, 3 | onDestroy() { } 4 | }); -------------------------------------------------------------------------------- /dump-api-v2.0.0-gtr4/app.js: -------------------------------------------------------------------------------- 1 | App({ 2 | onCreate(options) { }, 3 | onDestroy(options) { } 4 | }) -------------------------------------------------------------------------------- /dump-api-v2.0.0-gtr4/global.d.ts: -------------------------------------------------------------------------------- 1 | /// -------------------------------------------------------------------------------- /dump-api-v2.0.0-gtr4/assets/466x466-gtr-4/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tytydraco/zepp-dump-api/HEAD/dump-api-v2.0.0-gtr4/assets/466x466-gtr-4/icon.png -------------------------------------------------------------------------------- /dump-api-v1.0.1-band7/assets/194x368-amazfit-band-7/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tytydraco/zepp-dump-api/HEAD/dump-api-v1.0.1-band7/assets/194x368-amazfit-band-7/icon.png -------------------------------------------------------------------------------- /dump-api-v1.0.1-band7/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/** 3 | dist/* 4 | npm-debug.log 5 | yarn-debug.log* 6 | yarn-error.log* 7 | yarn.lock 8 | package-lock.json 9 | selenium-debug.log 10 | .idea 11 | .vscode 12 | *.suo 13 | *.ntvs* 14 | *.njsproj 15 | *.sln -------------------------------------------------------------------------------- /dump-api-v2.0.0-gtr4/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/** 3 | dist/* 4 | npm-debug.log 5 | yarn-debug.log* 6 | yarn-error.log* 7 | yarn.lock 8 | package-lock.json 9 | selenium-debug.log 10 | .idea 11 | .vscode 12 | *.suo 13 | *.ntvs* 14 | *.njsproj 15 | *.sln -------------------------------------------------------------------------------- /dump-api-v2.0.0-gtr4/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "checkJs": true 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | "**/node_modules/*" 10 | ], 11 | "files": [ 12 | "node_modules/@zeppos/device-types/index.d.ts" 13 | ] 14 | } -------------------------------------------------------------------------------- /dump-api-v2.0.0-gtr4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "empty", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "@zeppos/device-types": "^2.0.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zepp-dump-api 2 | Tools to dump the ZeppOS internal device APIs. 3 | 4 | # How 5 | There are two programs here that print out all the internally accessible global methods and fields. The script `dump.sh` starts the simulator and pulls the logs, then parses them. It is a bit finnicky. 6 | 7 | # API Dumps 8 | * [API v1.0.1 from Band-7](api-v1.0.1-band7.js) 9 | * [API v1.0.1 backwards-compatible from GTR-4](api-v1.0.1-gtr4.js) 10 | * [API v2.0.0 from GTR-4](api-v2.0.0-gtr4.js) 11 | -------------------------------------------------------------------------------- /dump.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd "$1" || exit 1 4 | 5 | rm -f out.txt 6 | pkill -9 node 7 | ( 8 | echo "uninstall" 9 | sleep 3 10 | echo "connect" 11 | sleep 5 12 | echo "install" 13 | ) | zeus bridge > out.txt & 14 | 15 | while true; do 16 | ! grep -q "|---DONE---|" out.txt && sleep 5 && continue 17 | break 18 | done 19 | 20 | while IFS= read -r line; do 21 | if [[ "$line" == *"|---DONE---|"* ]]; then 22 | pkill -9 node 23 | rm out.txt 24 | exit 0 25 | fi 26 | 27 | if [[ "$line" == *"|"* ]]; then 28 | echo "$line" | awk -F'|' '{ print $2 }' | sed 's/.$//; s/^.//' | awk -F'"' '{ print $2 }' >> api.js 29 | fi 30 | done < out.txt -------------------------------------------------------------------------------- /dump-api-v2.0.0-gtr4/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "configVersion": "v2", 3 | "app": { 4 | "appId": 12345, 5 | "appName": "DumpAPI", 6 | "appType": "app", 7 | "version": { 8 | "code": 1, 9 | "name": "1.0.0" 10 | }, 11 | "icon": "icon.png", 12 | "vender": "tytydraco", 13 | "description": "Dump internal API." 14 | }, 15 | "permissions": [ 16 | "data:os.device.info", 17 | "device:os.local_storage", 18 | "data:user.hd.calorie" 19 | ], 20 | "runtime": { 21 | "apiVersion": { 22 | "compatible": "2.0.0", 23 | "target": "2.0.0", 24 | "minVersion": "2.0.0" 25 | } 26 | }, 27 | "targets": { 28 | "466x466-gtr-4": { 29 | "module": { 30 | "page": { 31 | "pages": [ 32 | "page/index" 33 | ] 34 | } 35 | }, 36 | "platforms": [ 37 | { 38 | "name": "gtr4", 39 | "deviceSource": 7930112 40 | }, 41 | { 42 | "name": "gtr4-w", 43 | "deviceSource": 7930113 44 | } 45 | ], 46 | "designWidth": 466 47 | } 48 | }, 49 | "i18n": { 50 | "en-US": { 51 | "appName": "DumpAPI" 52 | } 53 | }, 54 | "defaultLanguage": "en-US" 55 | } 56 | -------------------------------------------------------------------------------- /dump-api-v1.0.1-band7/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "configVersion": "v2", 3 | "app": { 4 | "appId": 99999, 5 | "appName": "DumpAPI", 6 | "appType": "app", 7 | "version": { 8 | "code": 1, 9 | "name": "1.0.0" 10 | }, 11 | "icon": "icon.png", 12 | "vender": "tytydraco", 13 | "description": "Dump internal API." 14 | }, 15 | "permissions": [], 16 | "runtime": { 17 | "apiVersion": { 18 | "compatible": "1.0.0", 19 | "target": "1.0.1", 20 | "minVersion": "1.0.0" 21 | } 22 | }, 23 | "targets": { 24 | "194x368-amazfit-band-7": { 25 | "module": { 26 | "page": { 27 | "pages": [ 28 | "page/index" 29 | ] 30 | } 31 | }, 32 | "platforms": [ 33 | { 34 | "name": "amazfit-band7-nfc", 35 | "deviceSource": 252 36 | }, 37 | { 38 | "name": "amazfit-band7", 39 | "deviceSource": 253 40 | }, 41 | { 42 | "name": "amazfit-band7-w", 43 | "deviceSource": 254 44 | } 45 | ], 46 | "designWidth": 194 47 | } 48 | }, 49 | "i18n": { 50 | "en-US": { 51 | "appName": "DumpAPI" 52 | } 53 | }, 54 | "defaultLanguage": "en-US" 55 | } 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2022, Tyler Nijmeh 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /dump-api-v1.0.1-band7/page/index.js: -------------------------------------------------------------------------------- 1 | let seen = [] 2 | function foreachAttribute(object, handleAttributeName, handleAttributeValue) { 3 | var attributeNames = []; 4 | function recursion(object) { 5 | if (seen.indexOf(object) > -1 || object == undefined) { 6 | return 7 | } 8 | seen.push(object) 9 | for (var attribute of Object.getOwnPropertyNames(object)) { 10 | if (typeof object[attribute] == 'object') { 11 | attributeNames.push(attribute); 12 | recursion(object[attribute]); 13 | attributeNames = attributeNames.slice(0, attributeNames.length - 1); 14 | } 15 | else { 16 | handleAttributeName(attributeNames.join(".") + "." + attribute); 17 | handleAttributeValue(object[attribute]); 18 | } 19 | } 20 | } 21 | recursion(object); 22 | } 23 | var apiSyms = []; 24 | 25 | var attributeName = ""; 26 | var handleAttributeName = function (name) { 27 | attributeName = name; 28 | }; 29 | var handleAttributeValue = function (value) { 30 | if (typeof value == 'function') { 31 | apiSyms.push(attributeName + "=function() {}"); 32 | } else { 33 | apiSyms.push(attributeName + "=" + value); 34 | } 35 | 36 | }; 37 | foreachAttribute(globalThis, handleAttributeName, handleAttributeValue); 38 | 39 | let index = 0 40 | var x = JSON.stringify(apiSyms, undefined, 1) 41 | let array = x.split("\n") 42 | 43 | Page({ 44 | build() { 45 | let id = timer.createTimer( 46 | 50, 47 | 50, 48 | () => { 49 | if (index == 0) { 50 | console.log("|---START---|"); 51 | } 52 | 53 | console.log("|" + array[index] + "|"); 54 | index++ 55 | 56 | if (index == array.length) { 57 | console.log("|---DONE---|"); 58 | timer.stopTimer(id) 59 | } 60 | }, 61 | {}, 62 | ) 63 | } 64 | }); 65 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /dump-api-v2.0.0-gtr4/page/index.js: -------------------------------------------------------------------------------- 1 | import * as app from '@zos/app' 2 | import * as device from '@zos/device' 3 | import * as display from '@zos/display' 4 | import * as fs from '@zos/fs' 5 | import * as i18n from '@zos/i18n' 6 | import * as interaction from '@zos/interaction' 7 | import * as page from '@zos/page' 8 | import * as router from '@zos/router' 9 | import * as sensor from '@zos/sensor' 10 | import * as settings from '@zos/settings' 11 | import * as storage from '@zos/storage' 12 | import * as user from '@zos/user' 13 | import * as utils from '@zos/utils' 14 | import * as ui from '@zos/ui' 15 | import * as ble from '@zos/ble' 16 | 17 | globalThis.app = app 18 | globalThis.device = device 19 | globalThis.display = display 20 | globalThis.fs = fs 21 | globalThis.i18n = i18n 22 | globalThis.interaction = interaction 23 | globalThis.page = page 24 | globalThis.router = router 25 | globalThis.sensor = sensor 26 | globalThis.settings = settings 27 | globalThis.storage = storage 28 | globalThis.user = user 29 | globalThis.utils = utils 30 | globalThis.ui = ui 31 | globalThis.ble = ble 32 | 33 | let seen = [] 34 | function foreachAttribute(object, handleAttributeName, handleAttributeValue) { 35 | var attributeNames = []; 36 | function recursion(object) { 37 | if (seen.indexOf(object) > -1 || object == undefined) { 38 | return 39 | } 40 | seen.push(object) 41 | for (var attribute of Object.getOwnPropertyNames(object)) { 42 | if (typeof object[attribute] == 'object') { 43 | attributeNames.push(attribute); 44 | recursion(object[attribute]); 45 | attributeNames = attributeNames.slice(0, attributeNames.length - 1); 46 | } 47 | else { 48 | handleAttributeName(attributeNames.join(".") + "." + attribute); 49 | handleAttributeValue(object[attribute]); 50 | } 51 | } 52 | } 53 | recursion(object); 54 | } 55 | var apiSyms = []; 56 | 57 | var attributeName = ""; 58 | var handleAttributeName = function (name) { 59 | attributeName = name; 60 | }; 61 | var handleAttributeValue = function (value) { 62 | if (typeof value == 'function') { 63 | apiSyms.push(attributeName + "=function() {}"); 64 | } else { 65 | apiSyms.push(attributeName + "=" + value); 66 | } 67 | 68 | }; 69 | foreachAttribute(globalThis, handleAttributeName, handleAttributeValue); 70 | // foreachAttribute(app, handleAttributeName, handleAttributeValue); 71 | // foreachAttribute(device, handleAttributeName, handleAttributeValue); 72 | // foreachAttribute(display, handleAttributeName, handleAttributeValue); 73 | // foreachAttribute(i18n, handleAttributeName, handleAttributeValue); 74 | // foreachAttribute(interaction, handleAttributeName, handleAttributeValue); 75 | // foreachAttribute(page, handleAttributeName, handleAttributeValue); 76 | // foreachAttribute(router, handleAttributeName, handleAttributeValue); 77 | // foreachAttribute(sensor, handleAttributeName, handleAttributeValue); 78 | // foreachAttribute(settings, handleAttributeName, handleAttributeValue); 79 | // foreachAttribute(storage, handleAttributeName, handleAttributeValue); 80 | // foreachAttribute(user, handleAttributeName, handleAttributeValue); 81 | // foreachAttribute(utils, handleAttributeName, handleAttributeValue); 82 | // foreachAttribute(ui, handleAttributeName, handleAttributeValue); 83 | // foreachAttribute(ble, handleAttributeName, handleAttributeValue); 84 | 85 | let index = 0 86 | var x = JSON.stringify(apiSyms, undefined, 1) 87 | let array = x.split("\n") 88 | 89 | Page({ 90 | build() { 91 | let id = setInterval( 92 | () => { 93 | if (index == 0) { 94 | console.log("|---START---|"); 95 | } 96 | 97 | console.log("|" + array[index] + "|"); 98 | index++ 99 | 100 | if (index == array.length) { 101 | console.log("|---DONE---|"); 102 | clearInterval(id) 103 | } 104 | }, 105 | 50, 106 | ) 107 | } 108 | }); 109 | -------------------------------------------------------------------------------- /api-v1.0.1-band7.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | .Object=function() {} 5 | .Function=function() {} 6 | .Error=function() {} 7 | .EvalError=function() {} 8 | .RangeError=function() {} 9 | .ReferenceError=function() {} 10 | .SyntaxError=function() {} 11 | .TypeError=function() {} 12 | .URIError=function() {} 13 | .InternalError=function() {} 14 | .AggregateError=function() {} 15 | .Array=function() {} 16 | .parseInt=function() {} 17 | .parseFloat=function() {} 18 | .isNaN=function() {} 19 | .isFinite=function() {} 20 | .decodeURI=function() {} 21 | .decodeURIComponent=function() {} 22 | .encodeURI=function() {} 23 | .encodeURIComponent=function() {} 24 | .escape=function() {} 25 | .unescape=function() {} 26 | .Infinity=Infinity 27 | .NaN=NaN 28 | .undefined=undefined 29 | .__date_clock=function() {} 30 | .Number=function() {} 31 | .Boolean=function() {} 32 | .String=function() {} 33 | Math.min=function() {} 34 | Math.max=function() {} 35 | Math.abs=function() {} 36 | Math.floor=function() {} 37 | Math.ceil=function() {} 38 | Math.round=function() {} 39 | Math.sqrt=function() {} 40 | Math.acos=function() {} 41 | Math.asin=function() {} 42 | Math.atan=function() {} 43 | Math.atan2=function() {} 44 | Math.cos=function() {} 45 | Math.exp=function() {} 46 | Math.log=function() {} 47 | Math.pow=function() {} 48 | Math.sin=function() {} 49 | Math.tan=function() {} 50 | Math.trunc=function() {} 51 | Math.sign=function() {} 52 | Math.cosh=function() {} 53 | Math.sinh=function() {} 54 | Math.tanh=function() {} 55 | Math.acosh=function() {} 56 | Math.asinh=function() {} 57 | Math.atanh=function() {} 58 | Math.expm1=function() {} 59 | Math.log1p=function() {} 60 | Math.log2=function() {} 61 | Math.log10=function() {} 62 | Math.cbrt=function() {} 63 | Math.hypot=function() {} 64 | Math.random=function() {} 65 | Math.fround=function() {} 66 | Math.imul=function() {} 67 | Math.clz32=function() {} 68 | Math.E=2.718281828459045 69 | Math.LN10=2.302585092994046 70 | Math.LN2=0.6931471805599453 71 | Math.LOG2E=1.4426950408889634 72 | Math.LOG10E=0.4342944819032518 73 | Math.PI=3.141592653589793 74 | Math.SQRT1_2=0.7071067811865476 75 | Math.SQRT2=1.4142135623730951 76 | Reflect.apply=function() {} 77 | Reflect.construct=function() {} 78 | Reflect.defineProperty=function() {} 79 | Reflect.deleteProperty=function() {} 80 | Reflect.get=function() {} 81 | Reflect.getOwnPropertyDescriptor=function() {} 82 | Reflect.getPrototypeOf=function() {} 83 | Reflect.has=function() {} 84 | Reflect.isExtensible=function() {} 85 | Reflect.ownKeys=function() {} 86 | Reflect.preventExtensions=function() {} 87 | Reflect.set=function() {} 88 | Reflect.setPrototypeOf=function() {} 89 | .Symbol=function() {} 90 | .eval=function() {} 91 | .Date=function() {} 92 | .RegExp=function() {} 93 | JSON.parse=function() {} 94 | JSON.stringify=function() {} 95 | .Proxy=function() {} 96 | .Map=function() {} 97 | .Set=function() {} 98 | .WeakMap=function() {} 99 | .WeakSet=function() {} 100 | .ArrayBuffer=function() {} 101 | .SharedArrayBuffer=function() {} 102 | .Uint8ClampedArray=function() {} 103 | .Int8Array=function() {} 104 | .Uint8Array=function() {} 105 | .Int16Array=function() {} 106 | .Uint16Array=function() {} 107 | .Int32Array=function() {} 108 | .Uint32Array=function() {} 109 | .Float32Array=function() {} 110 | .Float64Array=function() {} 111 | .DataView=function() {} 112 | Atomics.add=function() {} 113 | Atomics.and=function() {} 114 | Atomics.or=function() {} 115 | Atomics.sub=function() {} 116 | Atomics.xor=function() {} 117 | Atomics.exchange=function() {} 118 | Atomics.compareExchange=function() {} 119 | Atomics.load=function() {} 120 | Atomics.store=function() {} 121 | Atomics.isLockFree=function() {} 122 | .Promise=function() {} 123 | console.log=function() {} 124 | .print=function() {} 125 | .__loadScript=function() {} 126 | timer.createTimer=function() {} 127 | timer.stopTimer=function() {} 128 | hmApp.action.CLICK=1 129 | hmApp.action.LONG_PRESS=2 130 | hmApp.action.DOUBLE_CLICK=4 131 | hmApp.action.RELEASE=8 132 | hmApp.action.PRESS=16 133 | hmApp.addStatistic=function() {} 134 | hmApp.alarmCancel=function() {} 135 | hmApp.alarmNew=function() {} 136 | hmApp.cancelAlarm=function() {} 137 | hmApp.exit=function() {} 138 | hmApp.gesture.UP=3 139 | hmApp.gesture.DOWN=4 140 | hmApp.gesture.LEFT=2 141 | hmApp.gesture.RIGHT=1 142 | hmApp.getLayerY=function() {} 143 | hmApp.getPackageInfo=function() {} 144 | hmApp.goBack=function() {} 145 | hmApp.gotoHome=function() {} 146 | hmApp.gotoPage=function() {} 147 | hmApp.key.BACK=8 148 | hmApp.key.SELECT=13 149 | hmApp.key.HOME=36 150 | hmApp.key.UP=38 151 | hmApp.key.DOWN=40 152 | hmApp.key.SHORTCUT=93 153 | hmApp.newAlarm=function() {} 154 | hmApp.packageInfo=function() {} 155 | hmApp.redirectPage=function() {} 156 | hmApp.registGestureEvent=function() {} 157 | hmApp.registKeyEvent=function() {} 158 | hmApp.registSpinEvent=function() {} 159 | hmApp.registerGestureEvent=function() {} 160 | hmApp.registerKeyEvent=function() {} 161 | hmApp.registerSpinEvent=function() {} 162 | hmApp.reloadPage=function() {} 163 | hmApp.setFadeTransition=function() {} 164 | hmApp.setLayerY=function() {} 165 | hmApp.setPathTransition=function() {} 166 | hmApp.setScreenKeep=function() {} 167 | hmApp.startApp=function() {} 168 | hmApp.unregistGestureEvent=function() {} 169 | hmApp.unregistKeyEvent=function() {} 170 | hmApp.unregistSpinEvent=function() {} 171 | hmApp.unregisterGestureEvent=function() {} 172 | hmApp.unregisterKeyEvent=function() {} 173 | hmApp.unregisterSpinEvent=function() {} 174 | hmSetting.getBrightness=function() {} 175 | hmSetting.getDateFormat=function() {} 176 | hmSetting.getDeviceInfo=function() {} 177 | hmSetting.getDiskInfo=function() {} 178 | hmSetting.getLanguage=function() {} 179 | hmSetting.getMileageUnit=function() {} 180 | hmSetting.getScreenAutoBright=function() {} 181 | hmSetting.getScreenType=function() {} 182 | hmSetting.getSleepTarget=function() {} 183 | hmSetting.getTimeFormat=function() {} 184 | hmSetting.getUserData=function() {} 185 | hmSetting.getWeightTarget=function() {} 186 | hmSetting.getWeightUnit=function() {} 187 | hmSetting.releasePalmOff=function() {} 188 | hmSetting.releaseWristDownOff=function() {} 189 | hmSetting.screen_type.APP=0 190 | hmSetting.screen_type.WATCHFACE=1 191 | hmSetting.screen_type.SETTINGS=2 192 | hmSetting.screen_type.AOD=3 193 | hmSetting.setBrightScreen=function() {} 194 | hmSetting.setBrightScreenCancel=function() {} 195 | hmSetting.setBrightness=function() {} 196 | hmSetting.setScreenAutoBright=function() {} 197 | hmSetting.setScreenOff=function() {} 198 | hmSetting.setUserDataListener=function() {} 199 | hmSetting.stopPalmOff=function() {} 200 | hmSetting.stopWristDownOff=function() {} 201 | hmUI.align.LEFT=1 202 | hmUI.align.RIGHT=2 203 | hmUI.align.CENTER_H=16 204 | hmUI.align.TOP=4 205 | hmUI.align.BOTTOM=8 206 | hmUI.align.CENTER_V=32 207 | hmUI.anim_status.START=1 208 | hmUI.anim_status.PAUSE=2 209 | hmUI.anim_status.STOP=3 210 | hmUI.anim_status.RESUME=4 211 | hmUI.checkDataType=function() {} 212 | hmUI.createDialog=function() {} 213 | hmUI.createWidget=function() {} 214 | hmUI.data_type.STEP=1 215 | hmUI.data_type.STEP_TARGET=2 216 | hmUI.data_type.CAL=3 217 | hmUI.data_type.CAL_TARGET=4 218 | hmUI.data_type.HEART=5 219 | hmUI.data_type.PAI_DAILY=6 220 | hmUI.data_type.PAI_WEEKLY=7 221 | hmUI.data_type.HUMIDITY=8 222 | hmUI.data_type.SMS=9 223 | hmUI.data_type.BATTERY=10 224 | hmUI.data_type.WEATHER=11 225 | hmUI.data_type.WEATHER_HIGH_LOW=12 226 | hmUI.data_type.WEATHER_HIGH=13 227 | hmUI.data_type.WEATHER_LOW=14 228 | hmUI.data_type.SUN_SET=16 229 | hmUI.data_type.SUN_RISE=17 230 | hmUI.data_type.SUN_CURRENT=19 231 | hmUI.data_type.SUN_TIME=20 232 | hmUI.data_type.MOON_SET=21 233 | hmUI.data_type.MOON_RISE=22 234 | hmUI.data_type.MOON_CURRENT=23 235 | hmUI.data_type.WIND=24 236 | hmUI.data_type.WIND_DIRECTION=25 237 | hmUI.data_type.TIME=26 238 | hmUI.data_type.UVI=27 239 | hmUI.data_type.BODY_TEMP=28 240 | hmUI.data_type.WEATHER_CURRENT=15 241 | hmUI.data_type.DISTANCE=29 242 | hmUI.data_type.STAND=30 243 | hmUI.data_type.STAND_TARGET=31 244 | hmUI.data_type.SPO2=32 245 | hmUI.data_type.AQI=33 246 | hmUI.data_type.ALTIMETER=34 247 | hmUI.data_type.MOON=35 248 | hmUI.data_type.SUN=18 249 | hmUI.data_type.STRESS=36 250 | hmUI.data_type.FAT_BURN=37 251 | hmUI.data_type.FAT_BURN_TARGET=38 252 | hmUI.data_type.FLOOR=39 253 | hmUI.data_type.COUNT_DOWN=40 254 | hmUI.data_type.STOP_WATCH=41 255 | hmUI.data_type.ALARM_CLOCK=43 256 | hmUI.data_type.SLEEP=42 257 | hmUI.data_type.MENSYRUAL_LEVEL=44 258 | hmUI.data_type.MENSYRUAL=45 259 | hmUI.data_type.OUTDOOR_RUNNING=46 260 | hmUI.data_type.WALKING=47 261 | hmUI.data_type.OUTDOOR_CYCLING=48 262 | hmUI.data_type.FREE_TRAINING=49 263 | hmUI.data_type.POOL_SWIMMING=50 264 | hmUI.data_type.OPEN_WATER_SWIMMING=51 265 | hmUI.data_type.TRAINING_LOAD=52 266 | hmUI.data_type.VO2MAX=53 267 | hmUI.data_type.RECOVERY_TIME=54 268 | hmUI.data_type.ACTIVITY=55 269 | hmUI.data_type.ALEXA=56 270 | hmUI.data_type.FAT_BURNING=37 271 | hmUI.data_type.FAT_BURNING_TARGET=38 272 | hmUI.date.MONTH=0 273 | hmUI.date.DAY=1 274 | hmUI.date.WEEK=2 275 | hmUI.deleteWidget=function() {} 276 | hmUI.edit_type.STEP=10000 277 | hmUI.edit_type.BATTERY=11001 278 | hmUI.edit_type.HEART=10001 279 | hmUI.edit_type.CAL=10006 280 | hmUI.edit_type.DISTANCE=10009 281 | hmUI.edit_type.AQI=10405 282 | hmUI.edit_type.HUMIDITY=10406 283 | hmUI.edit_type.UVI=10407 284 | hmUI.edit_type.DATE=11002 285 | hmUI.edit_type.WEEK=11003 286 | hmUI.edit_type.WEATHER=10401 287 | hmUI.edit_type.TEMPERATURE=10400 288 | hmUI.edit_type.SUN=10408 289 | hmUI.edit_type.STAND=10007 290 | hmUI.edit_type.SUN_RISE=10600 291 | hmUI.edit_type.SUN_SET=10601 292 | hmUI.edit_type.WIND=10409 293 | hmUI.edit_type.SPO2=10002 294 | hmUI.edit_type.STRESS=10003 295 | hmUI.edit_type.FAT_BURN=10008 296 | hmUI.edit_type.FLOOR=10010 297 | hmUI.edit_type.ALTIMETER=10411 298 | hmUI.edit_type.BODY_TEMP=10011 299 | hmUI.edit_type.MOON=10602 300 | hmUI.edit_type.PAI_DAILY=10014 301 | hmUI.edit_type.PAI=10014 302 | hmUI.edit_type.PAI_WEEKLY=10012 303 | hmUI.edit_type.APP_PAI=10013 304 | hmUI.edit_type.SMS=10800 305 | hmUI.edit_type.TIME=11000 306 | hmUI.edit_type.WEATHER_CURRENT=10402 307 | hmUI.edit_type.WEATHER_HIGH=10403 308 | hmUI.edit_type.WEATHER_LOW=10404 309 | hmUI.edit_type.WIND_DIRECTION=10410 310 | hmUI.edit_type.COUNT_DOWN=10801 311 | hmUI.edit_type.STOP_WATCH=10802 312 | hmUI.edit_type.SLEEP=10004 313 | hmUI.edit_type.ALARM_CLOCK=10803 314 | hmUI.edit_type.MENSYRUAL=10005 315 | hmUI.edit_type.TRAINING_LOAD=10200 316 | hmUI.edit_type.VO2MAX=10201 317 | hmUI.edit_type.RECOVERY_TIME=10202 318 | hmUI.edit_type.INVALID=11004 319 | hmUI.event.MOVE=1 320 | hmUI.event.CLICK_DOWN=2 321 | hmUI.event.CLICK_UP=3 322 | hmUI.event.MOVE_IN=4 323 | hmUI.event.MOVE_OUT=5 324 | hmUI.event.SELECT=6 325 | hmUI.event.GESTURE_RIGHT=257 326 | hmUI.event.GESTURE_LEFT=258 327 | hmUI.event.GESTURE_UP=259 328 | hmUI.event.GESTURE_DOWN=260 329 | hmUI.event.KEY_UP=550 330 | hmUI.event.KEY_DOWN=552 331 | hmUI.getImageInfo=function() {} 332 | hmUI.getRtlLayout=function() {} 333 | hmUI.getScrollCurrentPage=function() {} 334 | hmUI.getTextLayout=function() {} 335 | hmUI.prop.MORE=0 336 | hmUI.prop.X=1 337 | hmUI.prop.Y=2 338 | hmUI.prop.W=3 339 | hmUI.prop.H=4 340 | hmUI.prop.POS_X=5 341 | hmUI.prop.POS_Y=6 342 | hmUI.prop.ANGLE=7 343 | hmUI.prop.CENTER_X=8 344 | hmUI.prop.CENTER_Y=9 345 | hmUI.prop.SRC=10 346 | hmUI.prop.TEXT=11 347 | hmUI.prop.COLOR=12 348 | hmUI.prop.START_ANGLE=13 349 | hmUI.prop.END_ANGLE=14 350 | hmUI.prop.LINE_WIDTH=15 351 | hmUI.prop.LINE_START_X=16 352 | hmUI.prop.LINE_START_Y=17 353 | hmUI.prop.LINE_END_X=18 354 | hmUI.prop.LINE_END_Y=19 355 | hmUI.prop.LINE_PROGRESS=20 356 | hmUI.prop.SRC_BG=21 357 | hmUI.prop.SRC_PROGRESS=22 358 | hmUI.prop.SRC_INDICATOR=23 359 | hmUI.prop.ALIGN_H=24 360 | hmUI.prop.ALIGN_V=25 361 | hmUI.prop.IMAGE_ARRAY=26 362 | hmUI.prop.IMAGE_LENGTH=27 363 | hmUI.prop.LEVEL=28 364 | hmUI.prop.TYPE=29 365 | hmUI.prop.TEXT_SIZE=30 366 | hmUI.prop.FONT=31 367 | hmUI.prop.ID=32 368 | hmUI.prop.DATASET=33 369 | hmUI.prop.ANIM_STATUS=34 370 | hmUI.prop.ANIM_IS_RUNINNG=35 371 | hmUI.prop.ANIM_IS_PAUSE=36 372 | hmUI.prop.ANIM_IS_STOP=37 373 | hmUI.prop.ANIM=38 374 | hmUI.prop.RADIUS=39 375 | hmUI.prop.ALPHA=40 376 | hmUI.prop.VISIBLE=41 377 | hmUI.prop.INIT=42 378 | hmUI.prop.CHECKED=43 379 | hmUI.prop.SHOW=44 380 | hmUI.prop.UNCHECKED=45 381 | hmUI.prop.CURRENT_SELECT=46 382 | hmUI.prop.TEXT_STYLE=47 383 | hmUI.prop.CHAR_SPACE=48 384 | hmUI.prop.LINE_SPACE=49 385 | hmUI.prop.END_X=50 386 | hmUI.prop.CURRENT_TYPE=51 387 | hmUI.prop.UPDATE_DATA=52 388 | hmUI.prop.SELECT_INDEX=53 389 | hmUI.prop.CURRENT_CONFIG=54 390 | hmUI.prop.ITEM_MORE=55 391 | hmUI.prop.ITEM_REFRESH=56 392 | hmUI.prop.LIST_TOP=57 393 | hmUI.redraw=function() {} 394 | hmUI.relayoutRtl=function() {} 395 | hmUI.scrollToPage=function() {} 396 | hmUI.setLayerScrolling=function() {} 397 | hmUI.setScrollView=function() {} 398 | hmUI.setStatusBarVisible=function() {} 399 | hmUI.showToast=function() {} 400 | hmUI.show_level.ALL=7 401 | hmUI.show_level.ONLY_NORMAL=1 402 | hmUI.show_level.ONAL_AOD=2 403 | hmUI.show_level.ONLY_AOD=2 404 | hmUI.show_level.ONLY_EDIT=4 405 | hmUI.system_status.DISCONNECT=0 406 | hmUI.system_status.DISTURB=1 407 | hmUI.system_status.LOCK=2 408 | hmUI.system_status.CLOCK=3 409 | hmUI.text_style.CHAR_WRAP=0 410 | hmUI.text_style.WRAP=1 411 | hmUI.text_style.ELLIPSIS=2 412 | hmUI.text_style.NONE=3 413 | hmUI.updateStatusBarTitle=function() {} 414 | hmUI.widget.IMG=1 415 | hmUI.widget.GROUP=65536 416 | hmUI.widget.TEXT=2 417 | hmUI.widget.ARC=3 418 | hmUI.widget.FILL_RECT=4 419 | hmUI.widget.STROKE_RECT=5 420 | hmUI.widget.TEXT_IMG=6 421 | hmUI.widget.ARC_PROGRESS=7 422 | hmUI.widget.LINE_PROGRESS=8 423 | hmUI.widget.IMG_PROGRESS=9 424 | hmUI.widget.IMG_LEVEL=10 425 | hmUI.widget.IMG_GROUP=41 426 | hmUI.widget.IMG_POINTER=11 427 | hmUI.widget.IMG_DATE=13 428 | hmUI.widget.IMG_WEEK=14 429 | hmUI.widget.IMG_TIME=12 430 | hmUI.widget.IMG_ANIM=15 431 | hmUI.widget.IMG_STATUS=16 432 | hmUI.widget.IMG_CLICK=17 433 | hmUI.widget.TEXT_TIME=18 434 | hmUI.widget.TIME_NUM=19 435 | hmUI.widget.CYCLE_LIST=20 436 | hmUI.widget.CIRCLE=21 437 | hmUI.widget.STATE_BUTTON=22 438 | hmUI.widget.RADIO_GROUP=65537 439 | hmUI.widget.CHECKBOX_GROUP=65538 440 | hmUI.widget.BUTTON=23 441 | hmUI.widget.SLIDE_SWITCH=24 442 | hmUI.widget.DIALOG=25 443 | hmUI.widget.SCROLL_LIST=26 444 | hmUI.widget.CYCLE_IMAGE_TEXT_LIST=27 445 | hmUI.widget.TIME_POINTER=28 446 | hmUI.widget.WATCHFACE_EDIT_MASK=29 447 | hmUI.widget.WATCHFACE_EDIT_FG_MASK=30 448 | hmUI.widget.WATCHFACE_EDIT_GROUP=65539 449 | hmUI.widget.WATCHFACE_EDIT_BG=31 450 | hmUI.widget.HISTOGRAM=32 451 | hmUI.widget.DATE_POINTER=33 452 | hmUI.widget.TEXT_FONT=34 453 | hmUI.widget.WIDGET_DELEGATE=35 454 | hmUI.widget.GRADKIENT_POLYLINE=36 455 | hmUI.widget.PICK_TIME=512 456 | hmUI.widget.PICK_DATE=513 457 | hmUI.widget.WATCHFACE_EDIT_POINTER=65540 458 | hmUI.widget.ARC_PROGRESS_FILL=37 459 | hmUI.widget.QRCODE=38 460 | hmUI.widget.BARCODE=39 461 | hmSensor.createSensor=function() {} 462 | hmSensor.event.DELAY=0 463 | hmSensor.event.CHANGE=1 464 | hmSensor.id.BATTERY=10 465 | hmSensor.id.STEP=11 466 | hmSensor.id.CALORIE=12 467 | hmSensor.id.HEART=13 468 | hmSensor.id.PAI=14 469 | hmSensor.id.DISTANCE=15 470 | hmSensor.id.STAND=16 471 | hmSensor.id.WEATHER=17 472 | hmSensor.id.ACTIVITY=18 473 | hmSensor.id.FAT_BURRING=19 474 | hmSensor.id.FAT_BURNING=19 475 | hmSensor.id.SUN=20 476 | hmSensor.id.WIND=21 477 | hmSensor.id.STRESS=22 478 | hmSensor.id.SPO2=23 479 | hmSensor.id.BODY_TEMP=24 480 | hmSensor.id.PRESS=25 481 | hmSensor.id.TIME=26 482 | hmSensor.id.VIBRATE=27 483 | hmSensor.id.WEAR=28 484 | hmSensor.id.WORLD_CLOCK=29 485 | hmSensor.id.MUSIC=30 486 | hmSensor.id.SLEEP=31 487 | hmSensor.id.SPORT=32 488 | hmSensor.id.BPRESSURE=33 489 | hmSensor.id.RECORDER=34 490 | hmSensor.id.PLAYER=35 491 | hmFS.O_APPEND=1024 492 | hmFS.O_CREAT=64 493 | hmFS.O_EXCL=128 494 | hmFS.O_RDONLY=0 495 | hmFS.O_RDWR=2 496 | hmFS.O_TRUNC=512 497 | hmFS.O_WRONLY=1 498 | hmFS.SEEK_CUR=1 499 | hmFS.SEEK_END=2 500 | hmFS.SEEK_SET=0 501 | hmFS.SharedpAppend=function() {} 502 | hmFS.SharedpClose=function() {} 503 | hmFS.SharedpDeleteKey=function() {} 504 | hmFS.SharedpGet=function() {} 505 | hmFS.SharedpGetSize=function() {} 506 | hmFS.SharedpOpen=function() {} 507 | hmFS.SharedpSet=function() {} 508 | hmFS.SharedpUpdate=function() {} 509 | hmFS.SysProGetBool=function() {} 510 | hmFS.SysProGetChars=function() {} 511 | hmFS.SysProGetDouble=function() {} 512 | hmFS.SysProGetInt=function() {} 513 | hmFS.SysProGetInt64=function() {} 514 | hmFS.SysProSetBool=function() {} 515 | hmFS.SysProSetChars=function() {} 516 | hmFS.SysProSetDouble=function() {} 517 | hmFS.SysProSetInt=function() {} 518 | hmFS.SysProSetInt64=function() {} 519 | hmFS.close=function() {} 520 | hmFS.mkdir=function() {} 521 | hmFS.open=function() {} 522 | hmFS.open_asset=function() {} 523 | hmFS.read=function() {} 524 | hmFS.readdir=function() {} 525 | hmFS.remove=function() {} 526 | hmFS.rename=function() {} 527 | hmFS.seek=function() {} 528 | hmFS.stat=function() {} 529 | hmFS.stat_asset=function() {} 530 | hmFS.write=function() {} 531 | hmBle.addListener=function() {} 532 | hmBle.cancelTransferFile=function() {} 533 | hmBle.connectStatus=function() {} 534 | hmBle.createConnect=function() {} 535 | hmBle.disConnect=function() {} 536 | hmBle.getAddress=function() {} 537 | hmBle.mstBuildProfile=function() {} 538 | hmBle.mstConnect=function() {} 539 | hmBle.mstDestoryProfileInstance=function() {} 540 | hmBle.mstDisconnect=function() {} 541 | hmBle.mstOnCharaNotification=function() {} 542 | hmBle.mstOnCharaReadComplete=function() {} 543 | hmBle.mstOnCharaValueArrived=function() {} 544 | hmBle.mstOnCharaWriteComplete=function() {} 545 | hmBle.mstOnDescReadComplete=function() {} 546 | hmBle.mstOnDescValueArrived=function() {} 547 | hmBle.mstOnDescWriteComplete=function() {} 548 | hmBle.mstOnPrepare=function() {} 549 | hmBle.mstOnServiceChangeBegin=function() {} 550 | hmBle.mstOnServiceChangeEnd=function() {} 551 | hmBle.mstPair=function() {} 552 | hmBle.mstPrepare=function() {} 553 | hmBle.mstReadCharacteristic=function() {} 554 | hmBle.mstReadDescriptor=function() {} 555 | hmBle.mstStartScan=function() {} 556 | hmBle.mstStopScan=function() {} 557 | hmBle.mstWriteCharacteristic=function() {} 558 | hmBle.mstWriteDescriptor=function() {} 559 | hmBle.removeListener=function() {} 560 | hmBle.send=function() {} 561 | hmBle.transferFile=function() {} 562 | __$$hmAppManager$$__.currentApp.pid=4 563 | __$$hmAppManager$$__.currentApp.__globals__.lang.lang=en-US 564 | __$$hmAppManager$$__.currentApp.__globals__.px=function() {} 565 | __$$hmAppManager$$__.currentApp.__globals__.gettext=function() {} 566 | __$$hmAppManager$$__.currentApp.app._options.onCreate=function() {} 567 | __$$hmAppManager$$__.currentApp.app._options.onDestroy=function() {} 568 | __$$hmAppManager$$__.currentApp.app.onCreate=function() {} 569 | __$$hmAppManager$$__.currentApp.app.onDestroy=function() {} 570 | __$$hmAppManager$$__.currentApp.app.onError=function() {} 571 | __$$hmAppManager$$__.currentApp.app.onPageNotFound=function() {} 572 | __$$hmAppManager$$__.currentApp.app.onUnhandledRejection=function() {} 573 | __$$hmAppManager$$__.currentApp.current.id=0 574 | DeviceRuntimeCore.App=function() {} 575 | DeviceRuntimeCore.AppWidget=function() {} 576 | DeviceRuntimeCore.Buffer=function() {} 577 | DeviceRuntimeCore.HmDomApi=function() {} 578 | DeviceRuntimeCore.HmLogger=function() {} 579 | DeviceRuntimeCore.HmSensorApi=function() {} 580 | DeviceRuntimeCore.HmSetting.getLanguage=function() {} 581 | DeviceRuntimeCore.HmUtils.noop=function() {} 582 | DeviceRuntimeCore.HmUtils.mergeProps=function() {} 583 | DeviceRuntimeCore.HmUtils.isArray=function() {} 584 | DeviceRuntimeCore.HmUtils.isString=function() {} 585 | DeviceRuntimeCore.HmUtils.isObjectLike=function() {} 586 | DeviceRuntimeCore.HmUtils.isPlainObject=function() {} 587 | DeviceRuntimeCore.HmUtils.isBuffer=function() {} 588 | DeviceRuntimeCore.HmUtils.isFunction=function() {} 589 | DeviceRuntimeCore.HmUtils.getTextHeight=function() {} 590 | DeviceRuntimeCore.HmUtils.measureTextWidth=function() {} 591 | DeviceRuntimeCore.HmUtils.urlEncode=function() {} 592 | DeviceRuntimeCore.HmUtils.urlDecode=function() {} 593 | DeviceRuntimeCore.HmUtils.getPx=function() {} 594 | DeviceRuntimeCore.HmUtils.format=function() {} 595 | DeviceRuntimeCore.HmUtils.gettextFactory=function() {} 596 | DeviceRuntimeCore.HmUtils.Lang=function() {} 597 | DeviceRuntimeCore.HmUtils.getLanguage=function() {} 598 | DeviceRuntimeCore.LifeCycle.beforeAppCreate=function() {} 599 | DeviceRuntimeCore.LifeCycle.afterAppCreate=function() {} 600 | DeviceRuntimeCore.LifeCycle.beforeModuleCreate=function() {} 601 | DeviceRuntimeCore.LifeCycle.afterModuleCreate=function() {} 602 | DeviceRuntimeCore.LifeCycle.beforePageCreate=function() {} 603 | DeviceRuntimeCore.LifeCycle.afterPageCreate=function() {} 604 | DeviceRuntimeCore.Page=function() {} 605 | DeviceRuntimeCore.Router=function() {} 606 | DeviceRuntimeCore.SecondaryWidget=function() {} 607 | DeviceRuntimeCore.SensorWidgetFactory=function() {} 608 | DeviceRuntimeCore.WatchFace=function() {} 609 | DeviceRuntimeCore.WatchWidget=function() {} 610 | DeviceRuntimeCore.WidgetFactory=function() {} 611 | DeviceRuntimeCore.buildDate=2021-12-02T11:47:07.248Z 612 | DeviceRuntimeCore.commit=06c1611 613 | DeviceRuntimeCore.version=1.0.8 614 | DeviceRuntimeCore.__esModule=true 615 | .App=function() {} 616 | .Page=function() {} 617 | editGroup.setProperty=function() {} 618 | editGroup.getProperty=function() {} 619 | editGroup.getId=function() {} 620 | editGroup.getType=function() {} 621 | editGroup.addEventListener=function() {} 622 | editGroup.removeEventListener=function() {} 623 | editGroup.layoutChange=function() {} 624 | editGroup.setEnable=function() {} 625 | editGroup.setColor=function() {} 626 | editGroup.createWidget=function() {} 627 | editGroupRight.setProperty=function() {} 628 | editGroupRight.getProperty=function() {} 629 | editGroupRight.getId=function() {} 630 | editGroupRight.getType=function() {} 631 | editGroupRight.addEventListener=function() {} 632 | editGroupRight.removeEventListener=function() {} 633 | editGroupRight.layoutChange=function() {} 634 | editGroupRight.setEnable=function() {} 635 | editGroupRight.setColor=function() {} 636 | editGroupRight.createWidget=function() {} 637 | -------------------------------------------------------------------------------- /api-v1.0.1-gtr4.js: -------------------------------------------------------------------------------- 1 | .Function=function() {} 2 | .Error=function() {} 3 | .EvalError=function() {} 4 | .RangeError=function() {} 5 | .ReferenceError=function() {} 6 | .SyntaxError=function() {} 7 | .TypeError=function() {} 8 | .URIError=function() {} 9 | .InternalError=function() {} 10 | .AggregateError=function() {} 11 | .Array=function() {} 12 | .parseInt=function() {} 13 | .parseFloat=function() {} 14 | .isNaN=function() {} 15 | .isFinite=function() {} 16 | .decodeURI=function() {} 17 | .decodeURIComponent=function() {} 18 | .encodeURI=function() {} 19 | .encodeURIComponent=function() {} 20 | .escape=function() {} 21 | .unescape=function() {} 22 | .Infinity=Infinity 23 | .NaN=NaN 24 | .undefined=undefined 25 | .__date_clock=function() {} 26 | .Number=function() {} 27 | .Boolean=function() {} 28 | .String=function() {} 29 | Math.min=function() {} 30 | Math.max=function() {} 31 | Math.abs=function() {} 32 | Math.floor=function() {} 33 | Math.ceil=function() {} 34 | Math.round=function() {} 35 | Math.sqrt=function() {} 36 | Math.acos=function() {} 37 | Math.asin=function() {} 38 | Math.atan=function() {} 39 | Math.atan2=function() {} 40 | Math.cos=function() {} 41 | Math.exp=function() {} 42 | Math.log=function() {} 43 | Math.pow=function() {} 44 | Math.sin=function() {} 45 | Math.tan=function() {} 46 | Math.trunc=function() {} 47 | Math.sign=function() {} 48 | Math.cosh=function() {} 49 | Math.sinh=function() {} 50 | Math.tanh=function() {} 51 | Math.acosh=function() {} 52 | Math.asinh=function() {} 53 | Math.atanh=function() {} 54 | Math.expm1=function() {} 55 | Math.log1p=function() {} 56 | Math.log2=function() {} 57 | Math.log10=function() {} 58 | Math.cbrt=function() {} 59 | Math.hypot=function() {} 60 | Math.random=function() {} 61 | Math.fround=function() {} 62 | Math.imul=function() {} 63 | Math.clz32=function() {} 64 | Math.E=2.718281828459045 65 | Math.LN10=2.302585092994046 66 | Math.LN2=0.6931471805599453 67 | Math.LOG2E=1.4426950408889634 68 | Math.LOG10E=0.4342944819032518 69 | Math.PI=3.141592653589793 70 | Math.SQRT1_2=0.7071067811865476 71 | Math.SQRT2=1.4142135623730951 72 | Reflect.apply=function() {} 73 | Reflect.construct=function() {} 74 | Reflect.defineProperty=function() {} 75 | Reflect.deleteProperty=function() {} 76 | Reflect.get=function() {} 77 | Reflect.getOwnPropertyDescriptor=function() {} 78 | Reflect.getPrototypeOf=function() {} 79 | Reflect.has=function() {} 80 | Reflect.isExtensible=function() {} 81 | Reflect.ownKeys=function() {} 82 | Reflect.preventExtensions=function() {} 83 | Reflect.set=function() {} 84 | Reflect.setPrototypeOf=function() {} 85 | .Symbol=function() {} 86 | .eval=function() {} 87 | .Date=function() {} 88 | .RegExp=function() {} 89 | JSON.parse=function() {} 90 | JSON.stringify=function() {} 91 | .Proxy=function() {} 92 | .Map=function() {} 93 | .Set=function() {} 94 | .WeakMap=function() {} 95 | .WeakSet=function() {} 96 | .ArrayBuffer=function() {} 97 | .SharedArrayBuffer=function() {} 98 | .Uint8ClampedArray=function() {} 99 | .Int8Array=function() {} 100 | .Uint8Array=function() {} 101 | .Int16Array=function() {} 102 | .Uint16Array=function() {} 103 | .Int32Array=function() {} 104 | .Uint32Array=function() {} 105 | .Float32Array=function() {} 106 | .Float64Array=function() {} 107 | .DataView=function() {} 108 | Atomics.add=function() {} 109 | Atomics.and=function() {} 110 | Atomics.or=function() {} 111 | Atomics.sub=function() {} 112 | Atomics.xor=function() {} 113 | Atomics.exchange=function() {} 114 | Atomics.compareExchange=function() {} 115 | Atomics.load=function() {} 116 | Atomics.store=function() {} 117 | Atomics.isLockFree=function() {} 118 | .Promise=function() {} 119 | console.log=function() {} 120 | .print=function() {} 121 | .__loadScript=function() {} 122 | timer.createTimer=function() {} 123 | timer.stopTimer=function() {} 124 | hmApp.action.CLICK=1 125 | hmApp.action.LONG_PRESS=2 126 | hmApp.action.DOUBLE_CLICK=4 127 | hmApp.action.RELEASE=8 128 | hmApp.action.PRESS=16 129 | hmApp.addStatistic=function() {} 130 | hmApp.alarmCancel=function() {} 131 | hmApp.alarmNew=function() {} 132 | hmApp.cancelAlarm=function() {} 133 | hmApp.exit=function() {} 134 | hmApp.gesture.UP=3 135 | hmApp.gesture.DOWN=4 136 | hmApp.gesture.LEFT=2 137 | hmApp.gesture.RIGHT=1 138 | hmApp.getLayerY=function() {} 139 | hmApp.getMemUsage=function() {} 140 | hmApp.getPackageInfo=function() {} 141 | hmApp.goBack=function() {} 142 | hmApp.gotoHome=function() {} 143 | hmApp.gotoPage=function() {} 144 | hmApp.key.BACK=8 145 | hmApp.key.SELECT=13 146 | hmApp.key.HOME=36 147 | hmApp.key.UP=38 148 | hmApp.key.DOWN=40 149 | hmApp.key.SHORTCUT=93 150 | hmApp.newAlarm=function() {} 151 | hmApp.packageInfo=function() {} 152 | hmApp.redirectPage=function() {} 153 | hmApp.registGestureEvent=function() {} 154 | hmApp.registKeyEvent=function() {} 155 | hmApp.registSpinEvent=function() {} 156 | hmApp.registerGestureEvent=function() {} 157 | hmApp.registerKeyEvent=function() {} 158 | hmApp.registerSpinEvent=function() {} 159 | hmApp.reloadPage=function() {} 160 | hmApp.runGC=function() {} 161 | hmApp.setFadeTransition=function() {} 162 | hmApp.setLayerY=function() {} 163 | hmApp.setPathTransition=function() {} 164 | hmApp.setScreenKeep=function() {} 165 | hmApp.startApp=function() {} 166 | hmApp.unregistGestureEvent=function() {} 167 | hmApp.unregistKeyEvent=function() {} 168 | hmApp.unregistSpinEvent=function() {} 169 | hmApp.unregisterGestureEvent=function() {} 170 | hmApp.unregisterKeyEvent=function() {} 171 | hmApp.unregisterSpinEvent=function() {} 172 | hmSetting.getBrightness=function() {} 173 | hmSetting.getDateFormat=function() {} 174 | hmSetting.getDeviceInfo=function() {} 175 | hmSetting.getDiskInfo=function() {} 176 | hmSetting.getLanguage=function() {} 177 | hmSetting.getMileageUnit=function() {} 178 | hmSetting.getRtlLayout=function() {} 179 | hmSetting.getScreenAutoBright=function() {} 180 | hmSetting.getScreenType=function() {} 181 | hmSetting.getSleepTarget=function() {} 182 | hmSetting.getSystemInfo=function() {} 183 | hmSetting.getTemperatureUnit=function() {} 184 | hmSetting.getTimeFormat=function() {} 185 | hmSetting.getUserData=function() {} 186 | hmSetting.getWeightTarget=function() {} 187 | hmSetting.getWeightUnit=function() {} 188 | hmSetting.releasePalmOff=function() {} 189 | hmSetting.releaseWristDownOff=function() {} 190 | hmSetting.screen_type.APP=0 191 | hmSetting.screen_type.WATCHFACE=1 192 | hmSetting.screen_type.SETTINGS=2 193 | hmSetting.screen_type.AOD=3 194 | hmSetting.setBrightScreen=function() {} 195 | hmSetting.setBrightScreenCancel=function() {} 196 | hmSetting.setBrightness=function() {} 197 | hmSetting.setScreenAutoBright=function() {} 198 | hmSetting.setScreenOff=function() {} 199 | hmSetting.setUserDataListener=function() {} 200 | hmSetting.stopPalmOff=function() {} 201 | hmSetting.stopWristDownOff=function() {} 202 | hmUI.align.LEFT=1 203 | hmUI.align.RIGHT=2 204 | hmUI.align.CENTER_H=16 205 | hmUI.align.TOP=4 206 | hmUI.align.BOTTOM=8 207 | hmUI.align.CENTER_V=32 208 | hmUI.anim_status.UNKNOW=0 209 | hmUI.anim_status.START=1 210 | hmUI.anim_status.PAUSE=2 211 | hmUI.anim_status.STOP=3 212 | hmUI.anim_status.RESUME=4 213 | hmUI.checkDataType=function() {} 214 | hmUI.createDialog=function() {} 215 | hmUI.createWidget=function() {} 216 | hmUI.data_type.STEP=1 217 | hmUI.data_type.STEP_TARGET=2 218 | hmUI.data_type.CAL=3 219 | hmUI.data_type.CAL_TARGET=4 220 | hmUI.data_type.HEART=5 221 | hmUI.data_type.PAI_DAILY=6 222 | hmUI.data_type.PAI_WEEKLY=7 223 | hmUI.data_type.HUMIDITY=8 224 | hmUI.data_type.SMS=9 225 | hmUI.data_type.BATTERY=10 226 | hmUI.data_type.WEATHER=11 227 | hmUI.data_type.WEATHER_HIGH_LOW=12 228 | hmUI.data_type.WEATHER_HIGH=13 229 | hmUI.data_type.WEATHER_LOW=14 230 | hmUI.data_type.SUN_SET=16 231 | hmUI.data_type.SUN_RISE=17 232 | hmUI.data_type.SUN_CURRENT=19 233 | hmUI.data_type.SUN_TIME=20 234 | hmUI.data_type.MOON_SET=21 235 | hmUI.data_type.MOON_RISE=22 236 | hmUI.data_type.MOON_CURRENT=23 237 | hmUI.data_type.WIND=24 238 | hmUI.data_type.WIND_DIRECTION=25 239 | hmUI.data_type.TIME=26 240 | hmUI.data_type.UVI=27 241 | hmUI.data_type.BODY_TEMP=28 242 | hmUI.data_type.WEATHER_CURRENT=15 243 | hmUI.data_type.DISTANCE=29 244 | hmUI.data_type.STAND=30 245 | hmUI.data_type.STAND_TARGET=31 246 | hmUI.data_type.SPO2=32 247 | hmUI.data_type.AQI=33 248 | hmUI.data_type.ALTIMETER=34 249 | hmUI.data_type.MOON=35 250 | hmUI.data_type.SUN=18 251 | hmUI.data_type.STRESS=36 252 | hmUI.data_type.FAT_BURN=37 253 | hmUI.data_type.FAT_BURN_TARGET=38 254 | hmUI.data_type.FLOOR=39 255 | hmUI.data_type.COUNT_DOWN=40 256 | hmUI.data_type.STOP_WATCH=41 257 | hmUI.data_type.ALARM_CLOCK=43 258 | hmUI.data_type.SLEEP=42 259 | hmUI.data_type.MENSYRUAL_LEVEL=44 260 | hmUI.data_type.MENSYRUAL=45 261 | hmUI.data_type.WEEK=46 262 | hmUI.data_type.MONTH=47 263 | hmUI.data_type.DAYS_PER_MONTH=48 264 | hmUI.data_type.SYSTEM_STATUS=51 265 | hmUI.data_type.ALTITUDE=53 266 | hmUI.data_type.BARO=52 267 | hmUI.data_type.FATIGUE=54 268 | hmUI.data_type.OUTDOOR_RUNNING=55 269 | hmUI.data_type.WALKING=56 270 | hmUI.data_type.OUTDOOR_CYCLING=57 271 | hmUI.data_type.FREE_TRAINING=58 272 | hmUI.data_type.POOL_SWIMMING=59 273 | hmUI.data_type.OPEN_WATER_SWIMMING=60 274 | hmUI.data_type.TRAINING_LOAD=61 275 | hmUI.data_type.VO2MAX=62 276 | hmUI.data_type.RECOVERY_TIME=63 277 | hmUI.data_type.ACTIVITY=64 278 | hmUI.data_type.ALEXA=65 279 | hmUI.data_type.SBPRESSURE=49 280 | hmUI.data_type.DBPRESSURE=50 281 | hmUI.data_type.FAT_BURNING=37 282 | hmUI.data_type.FAT_BURNING_TARGET=38 283 | hmUI.date.MONTH=0 284 | hmUI.date.DAY=1 285 | hmUI.date.WEEK=2 286 | hmUI.deleteWidget=function() {} 287 | hmUI.edit_type.STEP=10000 288 | hmUI.edit_type.BATTERY=11001 289 | hmUI.edit_type.HEART=10001 290 | hmUI.edit_type.CAL=10006 291 | hmUI.edit_type.DISTANCE=10009 292 | hmUI.edit_type.AQI=10405 293 | hmUI.edit_type.HUMIDITY=10406 294 | hmUI.edit_type.UVI=10407 295 | hmUI.edit_type.DATE=11002 296 | hmUI.edit_type.WEEK=11003 297 | hmUI.edit_type.WEATHER=10401 298 | hmUI.edit_type.TEMPERATURE=10400 299 | hmUI.edit_type.SUN=10408 300 | hmUI.edit_type.STAND=10007 301 | hmUI.edit_type.SUN_RISE=10600 302 | hmUI.edit_type.SUN_SET=10601 303 | hmUI.edit_type.WIND=10409 304 | hmUI.edit_type.SPO2=10002 305 | hmUI.edit_type.STRESS=10003 306 | hmUI.edit_type.FAT_BURN=10008 307 | hmUI.edit_type.FLOOR=10010 308 | hmUI.edit_type.ALTIMETER=10411 309 | hmUI.edit_type.BODY_TEMP=10011 310 | hmUI.edit_type.MOON=10602 311 | hmUI.edit_type.PAI_DAILY=10015 312 | hmUI.edit_type.PAI=10015 313 | hmUI.edit_type.PAI_WEEKLY=10012 314 | hmUI.edit_type.APP_PAI=10013 315 | hmUI.edit_type.SMS=10800 316 | hmUI.edit_type.TIME=11000 317 | hmUI.edit_type.WEATHER_CURRENT=10402 318 | hmUI.edit_type.WEATHER_HIGH=10403 319 | hmUI.edit_type.WEATHER_LOW=10404 320 | hmUI.edit_type.WIND_DIRECTION=10410 321 | hmUI.edit_type.COUNT_DOWN=10801 322 | hmUI.edit_type.STOP_WATCH=10802 323 | hmUI.edit_type.SLEEP=10004 324 | hmUI.edit_type.ALARM_CLOCK=10803 325 | hmUI.edit_type.MENSYRUAL=10005 326 | hmUI.edit_type.TRAINING_LOAD=10200 327 | hmUI.edit_type.VO2MAX=10201 328 | hmUI.edit_type.RECOVERY_TIME=10202 329 | hmUI.edit_type.ALTITUDE=10603 330 | hmUI.edit_type.FATIGUE=10014 331 | hmUI.edit_type.INVALID=11004 332 | hmUI.edit_widget_group_type.FOUNDATION=11000 333 | hmUI.edit_widget_group_type.OUTDOORS=10600 334 | hmUI.edit_widget_group_type.TOOLS=10800 335 | hmUI.edit_widget_group_type.MULTIMEDIA=11200 336 | hmUI.edit_widget_group_type.PAY=11400 337 | hmUI.edit_widget_group_type.HEALTH=10000 338 | hmUI.edit_widget_group_type.SPORTS=10200 339 | hmUI.edit_widget_group_type.WEATHER=10400 340 | hmUI.edit_widget_group_type.OTHERS=11600 341 | hmUI.edit_widget_group_type.INVALID=11800 342 | hmUI.event.MOVE=1 343 | hmUI.event.CLICK_DOWN=2 344 | hmUI.event.CLICK_UP=3 345 | hmUI.event.MOVE_IN=4 346 | hmUI.event.MOVE_OUT=5 347 | hmUI.event.SELECT=6 348 | hmUI.event.GESTURE_RIGHT=257 349 | hmUI.event.GESTURE_LEFT=258 350 | hmUI.event.GESTURE_UP=259 351 | hmUI.event.GESTURE_DOWN=260 352 | hmUI.event.KEY_UP=550 353 | hmUI.event.KEY_DOWN=552 354 | hmUI.getAppWidgetSize=function() {} 355 | hmUI.getImageInfo=function() {} 356 | hmUI.getRtlLayout=function() {} 357 | hmUI.getScrollCurrentPage=function() {} 358 | hmUI.getTextLayout=function() {} 359 | hmUI.prop.MORE=0 360 | hmUI.prop.X=1 361 | hmUI.prop.Y=2 362 | hmUI.prop.W=3 363 | hmUI.prop.H=4 364 | hmUI.prop.POS_X=5 365 | hmUI.prop.POS_Y=6 366 | hmUI.prop.ANGLE=7 367 | hmUI.prop.CENTER_X=8 368 | hmUI.prop.CENTER_Y=9 369 | hmUI.prop.SRC=10 370 | hmUI.prop.TEXT=11 371 | hmUI.prop.COLOR=12 372 | hmUI.prop.COLOR_BG=64 373 | hmUI.prop.START_ANGLE=13 374 | hmUI.prop.END_ANGLE=14 375 | hmUI.prop.LINE_WIDTH=15 376 | hmUI.prop.LINE_START_X=16 377 | hmUI.prop.LINE_START_Y=17 378 | hmUI.prop.LINE_END_X=18 379 | hmUI.prop.LINE_END_Y=19 380 | hmUI.prop.LINE_PROGRESS=20 381 | hmUI.prop.SRC_BG=21 382 | hmUI.prop.SRC_PROGRESS=22 383 | hmUI.prop.SRC_INDICATOR=23 384 | hmUI.prop.ALIGN_H=24 385 | hmUI.prop.ALIGN_V=25 386 | hmUI.prop.IMAGE_ARRAY=26 387 | hmUI.prop.IMAGE_LENGTH=27 388 | hmUI.prop.LEVEL=28 389 | hmUI.prop.TYPE=29 390 | hmUI.prop.TEXT_SIZE=30 391 | hmUI.prop.FONT=31 392 | hmUI.prop.ID=32 393 | hmUI.prop.DATASET=33 394 | hmUI.prop.ANIM_STATUS=34 395 | hmUI.prop.ANIM_IS_RUNINNG=35 396 | hmUI.prop.ANIM_IS_RUNNING=35 397 | hmUI.prop.ANIM_IS_PAUSE=36 398 | hmUI.prop.ANIM_IS_STOP=37 399 | hmUI.prop.ANIM=38 400 | hmUI.prop.RADIUS=39 401 | hmUI.prop.ALPHA=40 402 | hmUI.prop.VISIBLE=41 403 | hmUI.prop.INIT=42 404 | hmUI.prop.CHECKED=43 405 | hmUI.prop.SHOW=44 406 | hmUI.prop.UNCHECKED=45 407 | hmUI.prop.CURRENT_SELECT=46 408 | hmUI.prop.TEXT_STYLE=47 409 | hmUI.prop.CHAR_SPACE=48 410 | hmUI.prop.LINE_SPACE=49 411 | hmUI.prop.END_X=50 412 | hmUI.prop.CURRENT_TYPE=51 413 | hmUI.prop.UPDATE_DATA=52 414 | hmUI.prop.SELECT_INDEX=53 415 | hmUI.prop.CURRENT_CONFIG=54 416 | hmUI.prop.ITEM_MORE=55 417 | hmUI.prop.ITEM_REFRESH=56 418 | hmUI.prop.LIST_TOP=57 419 | hmUI.prop.CORNER_RADIUS=58 420 | hmUI.prop.AUTO_SCALE=59 421 | hmUI.prop.AUTO_SCALE_OBJ_FIT=60 422 | hmUI.prop.ANIM_STEP=61 423 | hmUI.prop.ANIM_FRAME_CUR_INDEX=62 424 | hmUI.prop.ANIM_PLAY_BACK=63 425 | hmUI.prop.UPDATE_ITEM=65 426 | hmUI.prop.DELETE_ITEM=66 427 | hmUI.prop.MOVE_ITEM=67 428 | hmUI.redraw=function() {} 429 | hmUI.relayoutRtl=function() {} 430 | hmUI.scrollToPage=function() {} 431 | hmUI.setAppWidgetSize=function() {} 432 | hmUI.setLayerScrolling=function() {} 433 | hmUI.setScrollView=function() {} 434 | hmUI.setStatusBarVisible=function() {} 435 | hmUI.showToast=function() {} 436 | hmUI.show_level.ALL=7 437 | hmUI.show_level.ONLY_NORMAL=1 438 | hmUI.show_level.ONAL_AOD=2 439 | hmUI.show_level.ONLY_AOD=2 440 | hmUI.show_level.ONLY_EDIT=4 441 | hmUI.system_status.DISCONNECT=0 442 | hmUI.system_status.DISTURB=1 443 | hmUI.system_status.LOCK=2 444 | hmUI.system_status.CLOCK=3 445 | hmUI.text_style.CHAR_WRAP=0 446 | hmUI.text_style.WRAP=1 447 | hmUI.text_style.ELLIPSIS=2 448 | hmUI.text_style.NONE=3 449 | hmUI.updateStatusBarTitle=function() {} 450 | hmUI.widget.IMG=1 451 | hmUI.widget.GROUP=65536 452 | hmUI.widget.TEXT=2 453 | hmUI.widget.ARC=3 454 | hmUI.widget.FILL_RECT=4 455 | hmUI.widget.STROKE_RECT=5 456 | hmUI.widget.TEXT_IMG=6 457 | hmUI.widget.ARC_PROGRESS=7 458 | hmUI.widget.LINE_PROGRESS=8 459 | hmUI.widget.IMG_PROGRESS=9 460 | hmUI.widget.IMG_LEVEL=10 461 | hmUI.widget.IMG_GROUP=41 462 | hmUI.widget.IMG_POINTER=11 463 | hmUI.widget.IMG_DATE=13 464 | hmUI.widget.IMG_WEEK=14 465 | hmUI.widget.IMG_TIME=12 466 | hmUI.widget.IMG_ANIM=15 467 | hmUI.widget.IMG_STATUS=16 468 | hmUI.widget.IMG_CLICK=17 469 | hmUI.widget.IMG_FILL=42 470 | hmUI.widget.TEXT_TIME=18 471 | hmUI.widget.TIME_NUM=19 472 | hmUI.widget.CYCLE_LIST=20 473 | hmUI.widget.CIRCLE=21 474 | hmUI.widget.STATE_BUTTON=22 475 | hmUI.widget.RADIO_GROUP=65537 476 | hmUI.widget.CHECKBOX_GROUP=65538 477 | hmUI.widget.BUTTON=23 478 | hmUI.widget.SLIDE_SWITCH=24 479 | hmUI.widget.DIALOG=25 480 | hmUI.widget.SCROLL_LIST=26 481 | hmUI.widget.VIEW_CONTAINER=768 482 | hmUI.widget.CYCLE_IMAGE_TEXT_LIST=27 483 | hmUI.widget.TIME_POINTER=28 484 | hmUI.widget.WATCHFACE_EDIT_MASK=29 485 | hmUI.widget.WATCHFACE_EDIT_FG_MASK=30 486 | hmUI.widget.WATCHFACE_EDIT_GROUP=65539 487 | hmUI.widget.WATCHFACE_EDIT_BG=31 488 | hmUI.widget.HISTOGRAM=32 489 | hmUI.widget.DATE_POINTER=33 490 | hmUI.widget.TEXT_FONT=34 491 | hmUI.widget.WIDGET_DELEGATE=35 492 | hmUI.widget.GRADKIENT_POLYLINE=36 493 | hmUI.widget.PICK_TIME=512 494 | hmUI.widget.PICK_DATE=513 495 | hmUI.widget.WATCHFACE_EDIT_POINTER=65540 496 | hmUI.widget.ARC_PROGRESS_FILL=37 497 | hmUI.widget.QRCODE=38 498 | hmUI.widget.BARCODE=39 499 | hmUI.widget.PAGE_INDICATOR=40 500 | hmUI.widget.WATCHFACE_EDIT_TIME=65541 501 | hmSensor.createSensor=function() {} 502 | hmSensor.event.DELAY=0 503 | hmSensor.event.CHANGE=1 504 | hmSensor.id.BATTERY=10 505 | hmSensor.id.STEP=11 506 | hmSensor.id.CALORIE=12 507 | hmSensor.id.HEART=13 508 | hmSensor.id.PAI=14 509 | hmSensor.id.DISTANCE=15 510 | hmSensor.id.STAND=16 511 | hmSensor.id.WEATHER=17 512 | hmSensor.id.ACTIVITY=18 513 | hmSensor.id.FAT_BURRING=19 514 | hmSensor.id.FAT_BURNING=19 515 | hmSensor.id.SUN=20 516 | hmSensor.id.WIND=21 517 | hmSensor.id.STRESS=22 518 | hmSensor.id.SPO2=23 519 | hmSensor.id.BODY_TEMP=24 520 | hmSensor.id.PRESS=25 521 | hmSensor.id.TIME=26 522 | hmSensor.id.VIBRATE=27 523 | hmSensor.id.WEAR=28 524 | hmSensor.id.WORLD_CLOCK=29 525 | hmSensor.id.MUSIC=30 526 | hmSensor.id.SLEEP=31 527 | hmSensor.id.SPORT=32 528 | hmSensor.id.BPRESSURE=33 529 | hmFS.O_APPEND=1024 530 | hmFS.O_CREAT=64 531 | hmFS.O_EXCL=128 532 | hmFS.O_RDONLY=0 533 | hmFS.O_RDWR=2 534 | hmFS.O_TRUNC=512 535 | hmFS.O_WRONLY=1 536 | hmFS.SEEK_CUR=1 537 | hmFS.SEEK_END=2 538 | hmFS.SEEK_SET=0 539 | hmFS.SharedpAppend=function() {} 540 | hmFS.SharedpClose=function() {} 541 | hmFS.SharedpDeleteKey=function() {} 542 | hmFS.SharedpGet=function() {} 543 | hmFS.SharedpGetSize=function() {} 544 | hmFS.SharedpOpen=function() {} 545 | hmFS.SharedpSet=function() {} 546 | hmFS.SharedpUpdate=function() {} 547 | hmFS.SysProGetBool=function() {} 548 | hmFS.SysProGetChars=function() {} 549 | hmFS.SysProGetDouble=function() {} 550 | hmFS.SysProGetInt=function() {} 551 | hmFS.SysProGetInt64=function() {} 552 | hmFS.SysProSetBool=function() {} 553 | hmFS.SysProSetChars=function() {} 554 | hmFS.SysProSetDouble=function() {} 555 | hmFS.SysProSetInt=function() {} 556 | hmFS.SysProSetInt64=function() {} 557 | hmFS.close=function() {} 558 | hmFS.mkdir=function() {} 559 | hmFS.open=function() {} 560 | hmFS.open_asset=function() {} 561 | hmFS.read=function() {} 562 | hmFS.readdir=function() {} 563 | hmFS.remove=function() {} 564 | hmFS.rename=function() {} 565 | hmFS.seek=function() {} 566 | hmFS.stat=function() {} 567 | hmFS.stat_asset=function() {} 568 | hmFS.write=function() {} 569 | hmBle.addFWListener=function() {} 570 | hmBle.addListener=function() {} 571 | hmBle.cancelTransferFile=function() {} 572 | hmBle.connectStatus=function() {} 573 | hmBle.createConnect=function() {} 574 | hmBle.disConnect=function() {} 575 | hmBle.getAddress=function() {} 576 | hmBle.mstBuildProfile=function() {} 577 | hmBle.mstConnect=function() {} 578 | hmBle.mstDestoryProfileInstance=function() {} 579 | hmBle.mstDisconnect=function() {} 580 | hmBle.mstOffAllCb=function() {} 581 | hmBle.mstOnCharaNotification=function() {} 582 | hmBle.mstOnCharaReadComplete=function() {} 583 | hmBle.mstOnCharaValueArrived=function() {} 584 | hmBle.mstOnCharaWriteComplete=function() {} 585 | hmBle.mstOnDescReadComplete=function() {} 586 | hmBle.mstOnDescValueArrived=function() {} 587 | hmBle.mstOnDescWriteComplete=function() {} 588 | hmBle.mstOnPrepare=function() {} 589 | hmBle.mstOnServiceChangeBegin=function() {} 590 | hmBle.mstOnServiceChangeEnd=function() {} 591 | hmBle.mstPair=function() {} 592 | hmBle.mstPrepare=function() {} 593 | hmBle.mstReadCharacteristic=function() {} 594 | hmBle.mstReadDescriptor=function() {} 595 | hmBle.mstStartScan=function() {} 596 | hmBle.mstStopScan=function() {} 597 | hmBle.mstWriteCharacteristic=function() {} 598 | hmBle.mstWriteDescriptor=function() {} 599 | hmBle.removeFWListener=function() {} 600 | hmBle.removeListener=function() {} 601 | hmBle.send=function() {} 602 | hmBle.transferFile=function() {} 603 | hmMedia.codec.SILK=0 604 | hmMedia.codec.OPUS=1 605 | hmMedia.create=function() {} 606 | hmMedia.id.RECORDER=1 607 | hmMedia.id.PLAYER=2 608 | __$$hmAppManager$$__.currentApp.pid=3 609 | __$$hmAppManager$$__.currentApp.__globals__.lang.lang=en-US 610 | __$$hmAppManager$$__.currentApp.__globals__.px=function() {} 611 | __$$hmAppManager$$__.currentApp.__globals__.gettext=function() {} 612 | __$$hmAppManager$$__.currentApp.app._options.onCreate=function() {} 613 | __$$hmAppManager$$__.currentApp.app._options.onDestroy=function() {} 614 | __$$hmAppManager$$__.currentApp.app.onCreate=function() {} 615 | __$$hmAppManager$$__.currentApp.app.onDestroy=function() {} 616 | __$$hmAppManager$$__.currentApp.app.onError=function() {} 617 | __$$hmAppManager$$__.currentApp.app.onPageNotFound=function() {} 618 | __$$hmAppManager$$__.currentApp.app.onUnhandledRejection=function() {} 619 | __$$hmAppManager$$__.currentApp.current.id=1 620 | DeviceRuntimeCore.App=function() {} 621 | DeviceRuntimeCore.AppEvent=function() {} 622 | DeviceRuntimeCore.AppWidget=function() {} 623 | DeviceRuntimeCore.Buffer=function() {} 624 | DeviceRuntimeCore.Build.version=2.0 625 | DeviceRuntimeCore.Build.compareVersion=function() {} 626 | DeviceRuntimeCore.Build.runtime.version=2.0.0-200 627 | DeviceRuntimeCore.Build.runtime.buildDate=2022-08-19T15:02:21.162Z 628 | DeviceRuntimeCore.Build.runtime.commit=5584bae 629 | DeviceRuntimeCore.FileTransfer=function() {} 630 | DeviceRuntimeCore.Globals.getGlobalObject=function() {} 631 | DeviceRuntimeCore.Globals.extensibleFreeze=function() {} 632 | DeviceRuntimeCore.Globals.freezeGlobal=function() {} 633 | DeviceRuntimeCore.HmDomApi=function() {} 634 | DeviceRuntimeCore.HmLogger.prefix=jsrt-2.0.0-200 635 | DeviceRuntimeCore.HmLogger.appId=-1 636 | DeviceRuntimeCore.HmLogger.tag=- 637 | DeviceRuntimeCore.HmLogger.levels.all=5e-324 638 | DeviceRuntimeCore.HmLogger.levels.log=1 639 | DeviceRuntimeCore.HmLogger.levels.debug=2 640 | DeviceRuntimeCore.HmLogger.levels.info=3 641 | DeviceRuntimeCore.HmLogger.levels.warn=4 642 | DeviceRuntimeCore.HmLogger.levels.error=5 643 | DeviceRuntimeCore.HmLogger.levels.off=1.7976931348623157e+308 644 | DeviceRuntimeCore.HmLogger.line=1 645 | DeviceRuntimeCore.HmLogger._loggerMap.file-transfer.prefix=jsrt-2.0.0-200 646 | DeviceRuntimeCore.HmLogger._loggerMap.file-transfer.appId=-1 647 | DeviceRuntimeCore.HmLogger._loggerMap.file-transfer.tag=- 648 | DeviceRuntimeCore.HmLogger._loggerMap.file-transfer.line=1 649 | DeviceRuntimeCore.HmLogger._loggerMap.file-transfer.name=file-transfer 650 | DeviceRuntimeCore.HmLogger._loggerMap.file-transfer._level=5e-324 651 | DeviceRuntimeCore.HmLogger._loggerMap.file-transfer._log=function() {} 652 | DeviceRuntimeCore.HmLogger._loggerMap.hmble-dispatch.prefix=jsrt-2.0.0-200 653 | DeviceRuntimeCore.HmLogger._loggerMap.hmble-dispatch.appId=-1 654 | DeviceRuntimeCore.HmLogger._loggerMap.hmble-dispatch.tag=- 655 | DeviceRuntimeCore.HmLogger._loggerMap.hmble-dispatch.line=1 656 | DeviceRuntimeCore.HmLogger._loggerMap.hmble-dispatch.name=hmble-dispatch 657 | DeviceRuntimeCore.HmLogger._loggerMap.hmble-dispatch._level=5e-324 658 | DeviceRuntimeCore.HmLogger._loggerMap.hmble-dispatch._log=function() {} 659 | DeviceRuntimeCore.HmLogger._loggerMap.framework.prefix=jsrt-2.0.0-200 660 | DeviceRuntimeCore.HmLogger._loggerMap.framework.appId=-1 661 | DeviceRuntimeCore.HmLogger._loggerMap.framework.tag=- 662 | DeviceRuntimeCore.HmLogger._loggerMap.framework.line=1 663 | DeviceRuntimeCore.HmLogger._loggerMap.framework.name=framework 664 | DeviceRuntimeCore.HmLogger._loggerMap.framework._level=5e-324 665 | DeviceRuntimeCore.HmLogger._loggerMap.framework._log=function() {} 666 | DeviceRuntimeCore.HmLogger._loggerMap.__invoke__.prefix=jsrt-2.0.0-200 667 | DeviceRuntimeCore.HmLogger._loggerMap.__invoke__.appId=-1 668 | DeviceRuntimeCore.HmLogger._loggerMap.__invoke__.tag=- 669 | DeviceRuntimeCore.HmLogger._loggerMap.__invoke__.line=1 670 | DeviceRuntimeCore.HmLogger._loggerMap.__invoke__.name=__invoke__ 671 | DeviceRuntimeCore.HmLogger._loggerMap.__invoke__._level=5e-324 672 | DeviceRuntimeCore.HmLogger._loggerMap.__invoke__._log=function() {} 673 | DeviceRuntimeCore.HmLogger._loggerMap.sanjiao.prefix=jsrt-2.0.0-200 674 | DeviceRuntimeCore.HmLogger._loggerMap.sanjiao.appId=-1 675 | DeviceRuntimeCore.HmLogger._loggerMap.sanjiao.tag=- 676 | DeviceRuntimeCore.HmLogger._loggerMap.sanjiao.line=1 677 | DeviceRuntimeCore.HmLogger._loggerMap.sanjiao.name=sanjiao 678 | DeviceRuntimeCore.HmLogger._loggerMap.sanjiao._level=5e-324 679 | DeviceRuntimeCore.HmLogger._loggerMap.sanjiao._log=function() {} 680 | DeviceRuntimeCore.HmLogger.name=js-app 681 | DeviceRuntimeCore.HmLogger._level=5e-324 682 | DeviceRuntimeCore.HmLogger._log=function() {} 683 | DeviceRuntimeCore.HmSensorApi=function() {} 684 | DeviceRuntimeCore.HmSetting.getLanguage=function() {} 685 | DeviceRuntimeCore.HmUtils.noop=function() {} 686 | DeviceRuntimeCore.HmUtils.mergeProps=function() {} 687 | DeviceRuntimeCore.HmUtils.isDef=function() {} 688 | DeviceRuntimeCore.HmUtils.isArray=function() {} 689 | DeviceRuntimeCore.HmUtils.isString=function() {} 690 | DeviceRuntimeCore.HmUtils.isInteger=function() {} 691 | DeviceRuntimeCore.HmUtils.isObjectLike=function() {} 692 | DeviceRuntimeCore.HmUtils.isPlainObject=function() {} 693 | DeviceRuntimeCore.HmUtils.isBuffer=function() {} 694 | DeviceRuntimeCore.HmUtils.isFunction=function() {} 695 | DeviceRuntimeCore.HmUtils.getTextHeight=function() {} 696 | DeviceRuntimeCore.HmUtils.measureTextWidth=function() {} 697 | DeviceRuntimeCore.HmUtils.urlEncode=function() {} 698 | DeviceRuntimeCore.HmUtils.urlDecode=function() {} 699 | DeviceRuntimeCore.HmUtils.getAppJson=function() {} 700 | DeviceRuntimeCore.HmUtils.getDeviceInfo=function() {} 701 | DeviceRuntimeCore.HmUtils.getPx=function() {} 702 | DeviceRuntimeCore.HmUtils.toHexAppId=function() {} 703 | DeviceRuntimeCore.HmUtils.pipe=function() {} 704 | DeviceRuntimeCore.HmUtils.partialRight=function() {} 705 | DeviceRuntimeCore.HmUtils.getContext=function() {} 706 | DeviceRuntimeCore.HmUtils.convertMileSecondToSecond=function() {} 707 | DeviceRuntimeCore.HmUtils.processStringObj=function() {} 708 | DeviceRuntimeCore.HmUtils.processConstants=function() {} 709 | DeviceRuntimeCore.HmUtils.isArrayBuffer=function() {} 710 | DeviceRuntimeCore.HmUtils.ab2str=function() {} 711 | DeviceRuntimeCore.HmUtils.memoize=function() {} 712 | DeviceRuntimeCore.HmUtils.uniq=function() {} 713 | DeviceRuntimeCore.HmUtils.format=function() {} 714 | DeviceRuntimeCore.HmUtils.gettextFactory=function() {} 715 | DeviceRuntimeCore.HmUtils.Lang=function() {} 716 | DeviceRuntimeCore.HmUtils.getLanguage=function() {} 717 | DeviceRuntimeCore.LifeCycle.beforeAppCreate=function() {} 718 | DeviceRuntimeCore.LifeCycle.afterAppCreate=function() {} 719 | DeviceRuntimeCore.LifeCycle.beforeModuleCreate=function() {} 720 | DeviceRuntimeCore.LifeCycle.afterModuleCreate=function() {} 721 | DeviceRuntimeCore.LifeCycle.beforePageCreate=function() {} 722 | DeviceRuntimeCore.LifeCycle.afterPageCreate=function() {} 723 | DeviceRuntimeCore.LifeCycle.onAppError=function() {} 724 | DeviceRuntimeCore.Page=function() {} 725 | DeviceRuntimeCore.ProxySandbox=function() {} 726 | DeviceRuntimeCore.SecondaryWidget=function() {} 727 | DeviceRuntimeCore.SensorWidgetFactory=function() {} 728 | DeviceRuntimeCore.WatchFace=function() {} 729 | DeviceRuntimeCore.WatchWidget=function() {} 730 | DeviceRuntimeCore.WidgetFactory=function() {} 731 | DeviceRuntimeCore.__init__=function() {} 732 | DeviceRuntimeCore.__invoke__=function() {} 733 | DeviceRuntimeCore.buildDate=2022-08-19T15:02:21.077Z 734 | DeviceRuntimeCore.commit=5584bae 735 | DeviceRuntimeCore.executeScript=function() {} 736 | DeviceRuntimeCore.version=2.0.0-200 737 | DeviceRuntimeCore.__esModule=true 738 | .Buffer=function() {} 739 | .clearTimeout=function() {} 740 | .setTimeout=function() {} 741 | .clearImmediate=function() {} 742 | .setImmediate=function() {} 743 | .clearInterval=function() {} 744 | .setInterval=function() {} 745 | .App=function() {} 746 | .Page=function() {} 747 | mask.setProperty=function() {} 748 | mask.getProperty=function() {} 749 | mask.getId=function() {} 750 | mask.getType=function() {} 751 | mask.getPropertyKey=function() {} 752 | mask.addEventListener=function() {} 753 | mask.removeEventListener=function() {} 754 | mask.layoutChange=function() {} 755 | mask.setEnable=function() {} 756 | mask.setColor=function() {} 757 | mask.setAlpha=function() {} 758 | 759 | -------------------------------------------------------------------------------- /api-v2.0.0-gtr4.js: -------------------------------------------------------------------------------- 1 | .Object=function() {} 2 | .Function=function() {} 3 | .Error=function() {} 4 | .EvalError=function() {} 5 | .RangeError=function() {} 6 | .ReferenceError=function() {} 7 | .SyntaxError=function() {} 8 | .TypeError=function() {} 9 | .URIError=function() {} 10 | .InternalError=function() {} 11 | .AggregateError=function() {} 12 | .Array=function() {} 13 | .parseInt=function() {} 14 | .parseFloat=function() {} 15 | .isNaN=function() {} 16 | .isFinite=function() {} 17 | .decodeURI=function() {} 18 | .decodeURIComponent=function() {} 19 | .encodeURI=function() {} 20 | .encodeURIComponent=function() {} 21 | .escape=function() {} 22 | .unescape=function() {} 23 | .Infinity=Infinity 24 | .NaN=NaN 25 | .undefined=undefined 26 | .__date_clock=function() {} 27 | .Number=function() {} 28 | .Boolean=function() {} 29 | .String=function() {} 30 | Math.min=function() {} 31 | Math.max=function() {} 32 | Math.abs=function() {} 33 | Math.floor=function() {} 34 | Math.ceil=function() {} 35 | Math.round=function() {} 36 | Math.sqrt=function() {} 37 | Math.acos=function() {} 38 | Math.asin=function() {} 39 | Math.atan=function() {} 40 | Math.atan2=function() {} 41 | Math.cos=function() {} 42 | Math.exp=function() {} 43 | Math.log=function() {} 44 | Math.pow=function() {} 45 | Math.sin=function() {} 46 | Math.tan=function() {} 47 | Math.trunc=function() {} 48 | Math.sign=function() {} 49 | Math.cosh=function() {} 50 | Math.sinh=function() {} 51 | Math.tanh=function() {} 52 | Math.acosh=function() {} 53 | Math.asinh=function() {} 54 | Math.atanh=function() {} 55 | Math.expm1=function() {} 56 | Math.log1p=function() {} 57 | Math.log2=function() {} 58 | Math.log10=function() {} 59 | Math.cbrt=function() {} 60 | Math.hypot=function() {} 61 | Math.random=function() {} 62 | Math.fround=function() {} 63 | Math.imul=function() {} 64 | Math.clz32=function() {} 65 | Math.E=2.718281828459045 66 | Math.LN10=2.302585092994046 67 | Math.LN2=0.6931471805599453 68 | Math.LOG2E=1.4426950408889634 69 | Math.LOG10E=0.4342944819032518 70 | Math.PI=3.141592653589793 71 | Math.SQRT1_2=0.7071067811865476 72 | Math.SQRT2=1.4142135623730951 73 | Reflect.apply=function() {} 74 | Reflect.construct=function() {} 75 | Reflect.defineProperty=function() {} 76 | Reflect.deleteProperty=function() {} 77 | Reflect.get=function() {} 78 | Reflect.getOwnPropertyDescriptor=function() {} 79 | Reflect.getPrototypeOf=function() {} 80 | Reflect.has=function() {} 81 | Reflect.isExtensible=function() {} 82 | Reflect.ownKeys=function() {} 83 | Reflect.preventExtensions=function() {} 84 | Reflect.set=function() {} 85 | Reflect.setPrototypeOf=function() {} 86 | .Symbol=function() {} 87 | .Date=function() {} 88 | .RegExp=function() {} 89 | JSON.parse=function() {} 90 | JSON.stringify=function() {} 91 | .Proxy=function() {} 92 | .Map=function() {} 93 | .Set=function() {} 94 | .WeakMap=function() {} 95 | .WeakSet=function() {} 96 | .ArrayBuffer=function() {} 97 | .SharedArrayBuffer=function() {} 98 | .Uint8ClampedArray=function() {} 99 | .Int8Array=function() {} 100 | .Uint8Array=function() {} 101 | .Int16Array=function() {} 102 | .Uint16Array=function() {} 103 | .Int32Array=function() {} 104 | .Uint32Array=function() {} 105 | .Float32Array=function() {} 106 | .Float64Array=function() {} 107 | .DataView=function() {} 108 | Atomics.add=function() {} 109 | Atomics.and=function() {} 110 | Atomics.or=function() {} 111 | Atomics.sub=function() {} 112 | Atomics.xor=function() {} 113 | Atomics.exchange=function() {} 114 | Atomics.compareExchange=function() {} 115 | Atomics.load=function() {} 116 | Atomics.store=function() {} 117 | Atomics.isLockFree=function() {} 118 | .Promise=function() {} 119 | console.log=function() {} 120 | timer.createTimer=function() {} 121 | timer.stopTimer=function() {} 122 | .Buffer=function() {} 123 | .clearTimeout=function() {} 124 | .setTimeout=function() {} 125 | .clearImmediate=function() {} 126 | .setImmediate=function() {} 127 | .clearInterval=function() {} 128 | .setInterval=function() {} 129 | .App=function() {} 130 | .Page=function() {} 131 | mask.setProperty=function() {} 132 | mask.getProperty=function() {} 133 | mask.getId=function() {} 134 | mask.getType=function() {} 135 | mask.getPropertyKey=function() {} 136 | mask.addEventListener=function() {} 137 | mask.removeEventListener=function() {} 138 | mask.layoutChange=function() {} 139 | mask.setEnable=function() {} 140 | mask.setColor=function() {} 141 | mask.setAlpha=function() {} 142 | .__ZEPPOS__=1 143 | app.getPackageInfo=function() {} 144 | app.getScene=function() {} 145 | app.SCENE_APP=0 146 | app.SCENE_WATCHFACE=1 147 | app.SCENE_SETTINGS=2 148 | app.SCENE_AOD=3 149 | device.getDiskInfo=function() {} 150 | device.getDeviceInfo=function() {} 151 | device.SCREEN_SHAPE_SQUARE=0 152 | device.SCREEN_SHAPE_ROUND=1 153 | display.setWakeUpRelaunch=function() {} 154 | display.setAutoBrightness=function() {} 155 | display.getAutoBrightness=function() {} 156 | display.setBrightness=function() {} 157 | display.getBrightness=function() {} 158 | display.setScreenOff=function() {} 159 | display.setPageBrightTime=function() {} 160 | display.resetPageBrightTime=function() {} 161 | fs.statAssetsSync=function() {} 162 | fs.statSync=function() {} 163 | fs.openAssetsSync=function() {} 164 | fs.openSync=function() {} 165 | fs.closeSync=function() {} 166 | fs.readSync=function() {} 167 | fs.writeSync=function() {} 168 | fs.rmSync=function() {} 169 | fs.renameSync=function() {} 170 | fs.mkdirSync=function() {} 171 | fs.readdirSync=function() {} 172 | fs.readFileSync=function() {} 173 | fs.writeFileSync=function() {} 174 | fs.O_APPEND=1024 175 | fs.O_CREAT=64 176 | fs.O_EXCL=128 177 | fs.O_RDONLY=0 178 | fs.O_RDWR=2 179 | fs.O_TRUNC=512 180 | fs.O_WRONLY=1 181 | i18n.getText=function() {} 182 | interaction.showToast=function() {} 183 | interaction.createModal=function() {} 184 | interaction.onGesture=function() {} 185 | interaction.offGesture=function() {} 186 | interaction.onKey=function() {} 187 | interaction.offKey=function() {} 188 | interaction.onDigitalCrown=function() {} 189 | interaction.offDigitalCrown=function() {} 190 | interaction.GESTURE_UP=3 191 | interaction.GESTURE_DOWN=4 192 | interaction.GESTURE_LEFT=2 193 | interaction.GESTURE_RIGHT=1 194 | interaction.KEY_BACK=8 195 | interaction.KEY_SELECT=13 196 | interaction.KEY_HOME=36 197 | interaction.KEY_UP=38 198 | interaction.KEY_DOWN=40 199 | interaction.KEY_SHORTCUT=93 200 | interaction.KEY_EVENT_CLICK=1 201 | interaction.KEY_EVENT_LONG_PRESS=2 202 | interaction.KEY_EVENT_DOUBLE_CLICK=4 203 | interaction.KEY_EVENT_RELEASE=8 204 | interaction.KEY_EVENT_PRESS=16 205 | interaction.MODAL_CANCEL=0 206 | interaction.MODAL_CONFIRM=1 207 | page.scrollTo=function() {} 208 | page.getScrollTop=function() {} 209 | page.getSwiperIndex=function() {} 210 | page.swipeToIndex=function() {} 211 | page.setScrollMode=function() {} 212 | page.setScrollLock=function() {} 213 | page.SCROLL_MODE_FREE=FREE 214 | page.SCROLL_MODE_SWIPER=SWIPER 215 | page.SCROLL_ANIMATION_SMOOTH=SMOOTH 216 | page.SCROLL_ANIMATION_NONE=NONE 217 | router.launchApp=function() {} 218 | router.push=function() {} 219 | router.replace=function() {} 220 | router.home=function() {} 221 | router.back=function() {} 222 | router.exit=function() {} 223 | router.setLaunchAppTimeout=function() {} 224 | router.clearLaunchAppTimeout=function() {} 225 | sensor.VIBRATOR_SCENE_SHORT_LIGHT=23 226 | sensor.VIBRATOR_SCENE_SHORT_MIDDLE=24 227 | sensor.VIBRATOR_SCENE_SHORT_STRONG=25 228 | sensor.VIBRATOR_SCENE_DURATION=27 229 | sensor.VIBRATOR_SCENE_DURATION_LONG=28 230 | sensor.VIBRATOR_SCENE_STRONG_REMINDER=9 231 | sensor.VIBRATOR_SCENE_NOTIFICATION=0 232 | sensor.VIBRATOR_SCENE_CALL=1 233 | sensor.VIBRATOR_SCENE_TIMER=5 234 | sensor.Battery=function() {} 235 | sensor.BloodOxygen=function() {} 236 | sensor.BodyTemperature=function() {} 237 | sensor.Calorie=function() {} 238 | sensor.Distance=function() {} 239 | sensor.FatBurning=function() {} 240 | sensor.HeartRate=function() {} 241 | sensor.Music=function() {} 242 | sensor.Pai=function() {} 243 | sensor.Sleep=function() {} 244 | sensor.Stand=function() {} 245 | sensor.Step=function() {} 246 | sensor.Stress=function() {} 247 | sensor.Time=function() {} 248 | sensor.Vibrator=function() {} 249 | sensor.Wear=function() {} 250 | sensor.WorldClock=function() {} 251 | sensor.Weather=function() {} 252 | settings.getLanguage=function() {} 253 | settings.getDateFormat=function() {} 254 | settings.getDistanceUnit=function() {} 255 | settings.getWeightUnit=function() {} 256 | settings.getWeightTarget=function() {} 257 | settings.getSleepTarget=function() {} 258 | settings.DATE_FORMAT_YMD=0 259 | settings.DATE_FORMAT_DMY=1 260 | settings.DATE_FORMAT_MDY=2 261 | settings.DISTANCE_UNIT_METRIC=0 262 | settings.DISTANCE_UNIT_IMPERIAL=1 263 | settings.WEIGHT_UNIT_KILOGRAM=0 264 | settings.WEIGHT_UNIT_JIN=1 265 | settings.WEIGHT_UNIT_POUND=2 266 | settings.WEIGHT_UNIT_STONE=3 267 | user.getProfile=function() {} 268 | user.GENDER_MALE=0 269 | user.GENDER_FEMALE=1 270 | user.GENDER_UNSPECIFIED=2 271 | utils.px=function() {} 272 | utils.assets=function() {} 273 | utils.log.prefix=jsrt-2.0.0-200 274 | utils.log.appId=-1 275 | utils.log.tag=- 276 | utils.log.levels.all=5e-324 277 | utils.log.levels.log=1 278 | utils.log.levels.debug=2 279 | utils.log.levels.info=3 280 | utils.log.levels.warn=4 281 | utils.log.levels.error=5 282 | utils.log.levels.off=1.7976931348623157e+308 283 | utils.log.line=1 284 | utils.log.name=js-app 285 | utils.log._level=5e-324 286 | utils.log._log=function() {} 287 | utils.EventBus=function() {} 288 | utils.FileTransfer=function() {} 289 | utils.BleConnector.bleFramework.addFWListener=function() {} 290 | utils.BleConnector.bleFramework.addListener=function() {} 291 | utils.BleConnector.bleFramework.cancelTransferFile=function() {} 292 | utils.BleConnector.bleFramework.connectStatus=function() {} 293 | utils.BleConnector.bleFramework.createConnect=function() {} 294 | utils.BleConnector.bleFramework.disConnect=function() {} 295 | utils.BleConnector.bleFramework.getAddress=function() {} 296 | utils.BleConnector.bleFramework.mstBuildProfile=function() {} 297 | utils.BleConnector.bleFramework.mstConnect=function() {} 298 | utils.BleConnector.bleFramework.mstDestoryProfileInstance=function() {} 299 | utils.BleConnector.bleFramework.mstDisconnect=function() {} 300 | utils.BleConnector.bleFramework.mstOffAllCb=function() {} 301 | utils.BleConnector.bleFramework.mstOnCharaNotification=function() {} 302 | utils.BleConnector.bleFramework.mstOnCharaReadComplete=function() {} 303 | utils.BleConnector.bleFramework.mstOnCharaValueArrived=function() {} 304 | utils.BleConnector.bleFramework.mstOnCharaWriteComplete=function() {} 305 | utils.BleConnector.bleFramework.mstOnDescReadComplete=function() {} 306 | utils.BleConnector.bleFramework.mstOnDescValueArrived=function() {} 307 | utils.BleConnector.bleFramework.mstOnDescWriteComplete=function() {} 308 | utils.BleConnector.bleFramework.mstOnPrepare=function() {} 309 | utils.BleConnector.bleFramework.mstOnServiceChangeBegin=function() {} 310 | utils.BleConnector.bleFramework.mstOnServiceChangeEnd=function() {} 311 | utils.BleConnector.bleFramework.mstPair=function() {} 312 | utils.BleConnector.bleFramework.mstPrepare=function() {} 313 | utils.BleConnector.bleFramework.mstReadCharacteristic=function() {} 314 | utils.BleConnector.bleFramework.mstReadDescriptor=function() {} 315 | utils.BleConnector.bleFramework.mstStartScan=function() {} 316 | utils.BleConnector.bleFramework.mstStopScan=function() {} 317 | utils.BleConnector.bleFramework.mstWriteCharacteristic=function() {} 318 | utils.BleConnector.bleFramework.mstWriteDescriptor=function() {} 319 | utils.BleConnector.bleFramework.removeFWListener=function() {} 320 | utils.BleConnector.bleFramework.removeListener=function() {} 321 | utils.BleConnector.bleFramework.send=function() {} 322 | utils.BleConnector.bleFramework.transferFile=function() {} 323 | utils.color.AliceBlue=15792383 324 | utils.color.AntiqueWhite=16444375 325 | utils.color.Aqua=65535 326 | utils.color.Aquamarine=8388564 327 | utils.color.Azure=15794175 328 | utils.color.Beige=16119260 329 | utils.color.Bisque=16770244 330 | utils.color.Black=0 331 | utils.color.BlanchedAlmond=16772045 332 | utils.color.Blue=255 333 | utils.color.BlueViolet=9055202 334 | utils.color.Brown=10824234 335 | utils.color.BurlyWood=14596231 336 | utils.color.CadetBlue=6266528 337 | utils.color.Chartreuse=8388352 338 | utils.color.Chocolate=13789470 339 | utils.color.Coral=16744272 340 | utils.color.CornflowerBlue=6591981 341 | utils.color.Cornsilk=16775388 342 | utils.color.Crimson=14423100 343 | utils.color.Cyan=65535 344 | utils.color.DarkBlue=139 345 | utils.color.DarkCyan=35723 346 | utils.color.DarkGoldenRod=12092939 347 | utils.color.DarkGray=11119017 348 | utils.color.DarkGrey=11119017 349 | utils.color.DarkGreen=25600 350 | utils.color.DarkKhaki=12433259 351 | utils.color.DarkMagenta=9109643 352 | utils.color.DarkOliveGreen=5597999 353 | utils.color.DarkOrange=16747520 354 | utils.color.DarkOrchid=10040012 355 | utils.color.DarkRed=9109504 356 | utils.color.DarkSalmon=15308410 357 | utils.color.DarkSeaGreen=9419919 358 | utils.color.DarkSlateBlue=4734347 359 | utils.color.DarkSlateGray=3100495 360 | utils.color.DarkSlateGrey=3100495 361 | utils.color.DarkTurquoise=52945 362 | utils.color.DarkViolet=9699539 363 | utils.color.DeepPink=16716947 364 | utils.color.DeepSkyBlue=49151 365 | utils.color.DimGray=6908265 366 | utils.color.DimGrey=6908265 367 | utils.color.DodgerBlue=2003199 368 | utils.color.FireBrick=11674146 369 | utils.color.FloralWhite=16775920 370 | utils.color.ForestGreen=2263842 371 | utils.color.Fuchsia=16711935 372 | utils.color.Gainsboro=14474460 373 | utils.color.GhostWhite=16316671 374 | utils.color.Gold=16766720 375 | utils.color.GoldenRod=14329120 376 | utils.color.Gray=8421504 377 | utils.color.Grey=8421504 378 | utils.color.Green=32768 379 | utils.color.GreenYellow=11403055 380 | utils.color.HoneyDew=15794160 381 | utils.color.HotPink=16738740 382 | utils.color.IndianRed=13458524 383 | utils.color.Indigo=4915330 384 | utils.color.Ivory=16777200 385 | utils.color.Khaki=15787660 386 | utils.color.Lavender=15132410 387 | utils.color.LavenderBlush=16773365 388 | utils.color.LawnGreen=8190976 389 | utils.color.LemonChiffon=16775885 390 | utils.color.LightBlue=11393254 391 | utils.color.LightCoral=15761536 392 | utils.color.LightCyan=14745599 393 | utils.color.LightGoldenRodYellow=16448210 394 | utils.color.LightGray=13882323 395 | utils.color.LightGrey=13882323 396 | utils.color.LightGreen=9498256 397 | utils.color.LightPink=16758465 398 | utils.color.LightSalmon=16752762 399 | utils.color.LightSeaGreen=2142890 400 | utils.color.LightSkyBlue=8900346 401 | utils.color.LightSlateGray=7833753 402 | utils.color.LightSlateGrey=7833753 403 | utils.color.LightSteelBlue=11584734 404 | utils.color.LightYellow=16777184 405 | utils.color.Lime=65280 406 | utils.color.LimeGreen=3329330 407 | utils.color.Linen=16445670 408 | utils.color.Magenta=16711935 409 | utils.color.Maroon=8388608 410 | utils.color.MediumAquaMarine=6737322 411 | utils.color.MediumBlue=205 412 | utils.color.MediumOrchid=12211667 413 | utils.color.MediumPurple=9662683 414 | utils.color.MediumSeaGreen=3978097 415 | utils.color.MediumSlateBlue=8087790 416 | utils.color.MediumSpringGreen=64154 417 | utils.color.MediumTurquoise=4772300 418 | utils.color.MediumVioletRed=13047173 419 | utils.color.MidnightBlue=1644912 420 | utils.color.MintCream=16121850 421 | utils.color.MistyRose=16770273 422 | utils.color.Moccasin=16770229 423 | utils.color.NavajoWhite=16768685 424 | utils.color.Navy=128 425 | utils.color.OldLace=16643558 426 | utils.color.Olive=8421376 427 | utils.color.OliveDrab=7048739 428 | utils.color.Orange=16753920 429 | utils.color.OrangeRed=16729344 430 | utils.color.Orchid=14315734 431 | utils.color.PaleGoldenRod=15657130 432 | utils.color.PaleGreen=10025880 433 | utils.color.PaleTurquoise=11529966 434 | utils.color.PaleVioletRed=14381203 435 | utils.color.PapayaWhip=16773077 436 | utils.color.PeachPuff=16767673 437 | utils.color.Peru=13468991 438 | utils.color.Pink=16761035 439 | utils.color.Plum=14524637 440 | utils.color.PowderBlue=11591910 441 | utils.color.Purple=8388736 442 | utils.color.RebeccaPurple=6697881 443 | utils.color.Red=16711680 444 | utils.color.RosyBrown=12357519 445 | utils.color.RoyalBlue=4286945 446 | utils.color.SaddleBrown=9127187 447 | utils.color.Salmon=16416882 448 | utils.color.SandyBrown=16032864 449 | utils.color.SeaGreen=3050327 450 | utils.color.SeaShell=16774638 451 | utils.color.Sienna=10506797 452 | utils.color.Silver=12632256 453 | utils.color.SkyBlue=8900331 454 | utils.color.SlateBlue=6970061 455 | utils.color.SlateGray=7372944 456 | utils.color.SlateGrey=7372944 457 | utils.color.Snow=16775930 458 | utils.color.SpringGreen=65407 459 | utils.color.SteelBlue=4620980 460 | utils.color.Tan=13808780 461 | utils.color.Teal=32896 462 | utils.color.Thistle=14204888 463 | utils.color.Tomato=16737095 464 | utils.color.Turquoise=4251856 465 | utils.color.Violet=15631086 466 | utils.color.Wheat=16113331 467 | utils.color.White=16777215 468 | utils.color.WhiteSmoke=16119285 469 | utils.color.Yellow=16776960 470 | utils.color.YellowGreen=10145074 471 | utils.color.aliceblue=15792383 472 | utils.color.antiquewhite=16444375 473 | utils.color.aqua=65535 474 | utils.color.aquamarine=8388564 475 | utils.color.azure=15794175 476 | utils.color.beige=16119260 477 | utils.color.bisque=16770244 478 | utils.color.black=0 479 | utils.color.blanchedalmond=16772045 480 | utils.color.blue=255 481 | utils.color.blueviolet=9055202 482 | utils.color.brown=10824234 483 | utils.color.burlywood=14596231 484 | utils.color.cadetblue=6266528 485 | utils.color.chartreuse=8388352 486 | utils.color.chocolate=13789470 487 | utils.color.coral=16744272 488 | utils.color.cornflowerblue=6591981 489 | utils.color.cornsilk=16775388 490 | utils.color.crimson=14423100 491 | utils.color.cyan=65535 492 | utils.color.darkblue=139 493 | utils.color.darkcyan=35723 494 | utils.color.darkgoldenrod=12092939 495 | utils.color.darkgray=11119017 496 | utils.color.darkgrey=11119017 497 | utils.color.darkgreen=25600 498 | utils.color.darkkhaki=12433259 499 | utils.color.darkmagenta=9109643 500 | utils.color.darkolivegreen=5597999 501 | utils.color.darkorange=16747520 502 | utils.color.darkorchid=10040012 503 | utils.color.darkred=9109504 504 | utils.color.darksalmon=15308410 505 | utils.color.darkseagreen=9419919 506 | utils.color.darkslateblue=4734347 507 | utils.color.darkslategray=3100495 508 | utils.color.darkslategrey=3100495 509 | utils.color.darkturquoise=52945 510 | utils.color.darkviolet=9699539 511 | utils.color.deeppink=16716947 512 | utils.color.deepskyblue=49151 513 | utils.color.dimgray=6908265 514 | utils.color.dimgrey=6908265 515 | utils.color.dodgerblue=2003199 516 | utils.color.firebrick=11674146 517 | utils.color.floralwhite=16775920 518 | utils.color.forestgreen=2263842 519 | utils.color.fuchsia=16711935 520 | utils.color.gainsboro=14474460 521 | utils.color.ghostwhite=16316671 522 | utils.color.gold=16766720 523 | utils.color.goldenrod=14329120 524 | utils.color.gray=8421504 525 | utils.color.grey=8421504 526 | utils.color.green=32768 527 | utils.color.greenyellow=11403055 528 | utils.color.honeydew=15794160 529 | utils.color.hotpink=16738740 530 | utils.color.indianred=13458524 531 | utils.color.indigo=4915330 532 | utils.color.ivory=16777200 533 | utils.color.khaki=15787660 534 | utils.color.lavender=15132410 535 | utils.color.lavenderblush=16773365 536 | utils.color.lawngreen=8190976 537 | utils.color.lemonchiffon=16775885 538 | utils.color.lightblue=11393254 539 | utils.color.lightcoral=15761536 540 | utils.color.lightcyan=14745599 541 | utils.color.lightgoldenrodyellow=16448210 542 | utils.color.lightgray=13882323 543 | utils.color.lightgrey=13882323 544 | utils.color.lightgreen=9498256 545 | utils.color.lightpink=16758465 546 | utils.color.lightsalmon=16752762 547 | utils.color.lightseagreen=2142890 548 | utils.color.lightskyblue=8900346 549 | utils.color.lightslategray=7833753 550 | utils.color.lightslategrey=7833753 551 | utils.color.lightsteelblue=11584734 552 | utils.color.lightyellow=16777184 553 | utils.color.lime=65280 554 | utils.color.limegreen=3329330 555 | utils.color.linen=16445670 556 | utils.color.magenta=16711935 557 | utils.color.maroon=8388608 558 | utils.color.mediumaquamarine=6737322 559 | utils.color.mediumblue=205 560 | utils.color.mediumorchid=12211667 561 | utils.color.mediumpurple=9662683 562 | utils.color.mediumseagreen=3978097 563 | utils.color.mediumslateblue=8087790 564 | utils.color.mediumspringgreen=64154 565 | utils.color.mediumturquoise=4772300 566 | utils.color.mediumvioletred=13047173 567 | utils.color.midnightblue=1644912 568 | utils.color.mintcream=16121850 569 | utils.color.mistyrose=16770273 570 | utils.color.moccasin=16770229 571 | utils.color.navajowhite=16768685 572 | utils.color.navy=128 573 | utils.color.oldlace=16643558 574 | utils.color.olive=8421376 575 | utils.color.olivedrab=7048739 576 | utils.color.orange=16753920 577 | utils.color.orangered=16729344 578 | utils.color.orchid=14315734 579 | utils.color.palegoldenrod=15657130 580 | utils.color.palegreen=10025880 581 | utils.color.paleturquoise=11529966 582 | utils.color.palevioletred=14381203 583 | utils.color.papayawhip=16773077 584 | utils.color.peachpuff=16767673 585 | utils.color.peru=13468991 586 | utils.color.pink=16761035 587 | utils.color.plum=14524637 588 | utils.color.powderblue=11591910 589 | utils.color.purple=8388736 590 | utils.color.rebeccapurple=6697881 591 | utils.color.red=16711680 592 | utils.color.rosybrown=12357519 593 | utils.color.royalblue=4286945 594 | utils.color.saddlebrown=9127187 595 | utils.color.salmon=16416882 596 | utils.color.sandybrown=16032864 597 | utils.color.seagreen=3050327 598 | utils.color.seashell=16774638 599 | utils.color.sienna=10506797 600 | utils.color.silver=12632256 601 | utils.color.skyblue=8900331 602 | utils.color.slateblue=6970061 603 | utils.color.slategray=7372944 604 | utils.color.slategrey=7372944 605 | utils.color.snow=16775930 606 | utils.color.springgreen=65407 607 | utils.color.steelblue=4620980 608 | utils.color.tan=13808780 609 | utils.color.teal=32896 610 | utils.color.thistle=14204888 611 | utils.color.tomato=16737095 612 | utils.color.turquoise=4251856 613 | utils.color.violet=15631086 614 | utils.color.wheat=16113331 615 | utils.color.white=16777215 616 | utils.color.whitesmoke=16119285 617 | utils.color.yellow=16776960 618 | utils.color.yellowgreen=10145074 619 | ui.align.LEFT=1 620 | ui.align.RIGHT=2 621 | ui.align.CENTER_H=16 622 | ui.align.TOP=4 623 | ui.align.BOTTOM=8 624 | ui.align.CENTER_V=32 625 | ui.anim_status.UNKNOW=0 626 | ui.anim_status.START=1 627 | ui.anim_status.PAUSE=2 628 | ui.anim_status.STOP=3 629 | ui.anim_status.RESUME=4 630 | ui.checkDataType=function() {} 631 | ui.createDialog=function() {} 632 | ui.createWidget=function() {} 633 | ui.data_type.STEP=1 634 | ui.data_type.STEP_TARGET=2 635 | ui.data_type.CAL=3 636 | ui.data_type.CAL_TARGET=4 637 | ui.data_type.HEART=5 638 | ui.data_type.PAI_DAILY=6 639 | ui.data_type.PAI_WEEKLY=7 640 | ui.data_type.HUMIDITY=8 641 | ui.data_type.SMS=9 642 | ui.data_type.BATTERY=10 643 | ui.data_type.WEATHER=11 644 | ui.data_type.WEATHER_HIGH_LOW=12 645 | ui.data_type.WEATHER_HIGH=13 646 | ui.data_type.WEATHER_LOW=14 647 | ui.data_type.SUN_SET=16 648 | ui.data_type.SUN_RISE=17 649 | ui.data_type.SUN_CURRENT=19 650 | ui.data_type.SUN_TIME=20 651 | ui.data_type.MOON_SET=21 652 | ui.data_type.MOON_RISE=22 653 | ui.data_type.MOON_CURRENT=23 654 | ui.data_type.WIND=24 655 | ui.data_type.WIND_DIRECTION=25 656 | ui.data_type.TIME=26 657 | ui.data_type.UVI=27 658 | ui.data_type.BODY_TEMP=28 659 | ui.data_type.WEATHER_CURRENT=15 660 | ui.data_type.DISTANCE=29 661 | ui.data_type.STAND=30 662 | ui.data_type.STAND_TARGET=31 663 | ui.data_type.SPO2=32 664 | ui.data_type.AQI=33 665 | ui.data_type.ALTIMETER=34 666 | ui.data_type.MOON=35 667 | ui.data_type.SUN=18 668 | ui.data_type.STRESS=36 669 | ui.data_type.FAT_BURN=37 670 | ui.data_type.FAT_BURN_TARGET=38 671 | ui.data_type.FLOOR=39 672 | ui.data_type.COUNT_DOWN=40 673 | ui.data_type.STOP_WATCH=41 674 | ui.data_type.ALARM_CLOCK=43 675 | ui.data_type.SLEEP=42 676 | ui.data_type.MENSYRUAL_LEVEL=44 677 | ui.data_type.MENSYRUAL=45 678 | ui.data_type.WEEK=46 679 | ui.data_type.MONTH=47 680 | ui.data_type.DAYS_PER_MONTH=48 681 | ui.data_type.SYSTEM_STATUS=51 682 | ui.data_type.ALTITUDE=53 683 | ui.data_type.BARO=52 684 | ui.data_type.FATIGUE=54 685 | ui.data_type.OUTDOOR_RUNNING=55 686 | ui.data_type.WALKING=56 687 | ui.data_type.OUTDOOR_CYCLING=57 688 | ui.data_type.FREE_TRAINING=58 689 | ui.data_type.POOL_SWIMMING=59 690 | ui.data_type.OPEN_WATER_SWIMMING=60 691 | ui.data_type.TRAINING_LOAD=61 692 | ui.data_type.VO2MAX=62 693 | ui.data_type.RECOVERY_TIME=63 694 | ui.data_type.ACTIVITY=64 695 | ui.data_type.ALEXA=65 696 | ui.data_type.SBPRESSURE=49 697 | ui.data_type.DBPRESSURE=50 698 | ui.data_type.FAT_BURNING=37 699 | ui.data_type.FAT_BURNING_TARGET=38 700 | ui.date.MONTH=0 701 | ui.date.DAY=1 702 | ui.date.WEEK=2 703 | ui.deleteWidget=function() {} 704 | ui.edit_type.STEP=10000 705 | ui.edit_type.BATTERY=11001 706 | ui.edit_type.HEART=10001 707 | ui.edit_type.CAL=10006 708 | ui.edit_type.DISTANCE=10009 709 | ui.edit_type.AQI=10405 710 | ui.edit_type.HUMIDITY=10406 711 | ui.edit_type.UVI=10407 712 | ui.edit_type.DATE=11002 713 | ui.edit_type.WEEK=11003 714 | ui.edit_type.WEATHER=10401 715 | ui.edit_type.TEMPERATURE=10400 716 | ui.edit_type.SUN=10408 717 | ui.edit_type.STAND=10007 718 | ui.edit_type.SUN_RISE=10600 719 | ui.edit_type.SUN_SET=10601 720 | ui.edit_type.WIND=10409 721 | ui.edit_type.SPO2=10002 722 | ui.edit_type.STRESS=10003 723 | ui.edit_type.FAT_BURN=10008 724 | ui.edit_type.FLOOR=10010 725 | ui.edit_type.ALTIMETER=10411 726 | ui.edit_type.BODY_TEMP=10011 727 | ui.edit_type.MOON=10602 728 | ui.edit_type.PAI_DAILY=10015 729 | ui.edit_type.PAI=10015 730 | ui.edit_type.PAI_WEEKLY=10012 731 | ui.edit_type.APP_PAI=10013 732 | ui.edit_type.SMS=10800 733 | ui.edit_type.TIME=11000 734 | ui.edit_type.WEATHER_CURRENT=10402 735 | ui.edit_type.WEATHER_HIGH=10403 736 | ui.edit_type.WEATHER_LOW=10404 737 | ui.edit_type.WIND_DIRECTION=10410 738 | ui.edit_type.COUNT_DOWN=10801 739 | ui.edit_type.STOP_WATCH=10802 740 | ui.edit_type.SLEEP=10004 741 | ui.edit_type.ALARM_CLOCK=10803 742 | ui.edit_type.MENSYRUAL=10005 743 | ui.edit_type.TRAINING_LOAD=10200 744 | ui.edit_type.VO2MAX=10201 745 | ui.edit_type.RECOVERY_TIME=10202 746 | ui.edit_type.ALTITUDE=10603 747 | ui.edit_type.FATIGUE=10014 748 | ui.edit_type.INVALID=11004 749 | ui.edit_widget_group_type.FOUNDATION=11000 750 | ui.edit_widget_group_type.OUTDOORS=10600 751 | ui.edit_widget_group_type.TOOLS=10800 752 | ui.edit_widget_group_type.MULTIMEDIA=11200 753 | ui.edit_widget_group_type.PAY=11400 754 | ui.edit_widget_group_type.HEALTH=10000 755 | ui.edit_widget_group_type.SPORTS=10200 756 | ui.edit_widget_group_type.WEATHER=10400 757 | ui.edit_widget_group_type.OTHERS=11600 758 | ui.edit_widget_group_type.INVALID=11800 759 | ui.event.MOVE=1 760 | ui.event.CLICK_DOWN=2 761 | ui.event.CLICK_UP=3 762 | ui.event.MOVE_IN=4 763 | ui.event.MOVE_OUT=5 764 | ui.event.SELECT=6 765 | ui.event.GESTURE_RIGHT=257 766 | ui.event.GESTURE_LEFT=258 767 | ui.event.GESTURE_UP=259 768 | ui.event.GESTURE_DOWN=260 769 | ui.event.KEY_UP=550 770 | ui.event.KEY_DOWN=552 771 | ui.getAppWidgetSize=function() {} 772 | ui.getImageInfo=function() {} 773 | ui.getRtlLayout=function() {} 774 | ui.getScrollCurrentPage=function() {} 775 | ui.getTextLayout=function() {} 776 | ui.prop.MORE=0 777 | ui.prop.X=1 778 | ui.prop.Y=2 779 | ui.prop.W=3 780 | ui.prop.H=4 781 | ui.prop.POS_X=5 782 | ui.prop.POS_Y=6 783 | ui.prop.ANGLE=7 784 | ui.prop.CENTER_X=8 785 | ui.prop.CENTER_Y=9 786 | ui.prop.SRC=10 787 | ui.prop.TEXT=11 788 | ui.prop.COLOR=12 789 | ui.prop.COLOR_BG=64 790 | ui.prop.START_ANGLE=13 791 | ui.prop.END_ANGLE=14 792 | ui.prop.LINE_WIDTH=15 793 | ui.prop.LINE_START_X=16 794 | ui.prop.LINE_START_Y=17 795 | ui.prop.LINE_END_X=18 796 | ui.prop.LINE_END_Y=19 797 | ui.prop.LINE_PROGRESS=20 798 | ui.prop.SRC_BG=21 799 | ui.prop.SRC_PROGRESS=22 800 | ui.prop.SRC_INDICATOR=23 801 | ui.prop.ALIGN_H=24 802 | ui.prop.ALIGN_V=25 803 | ui.prop.IMAGE_ARRAY=26 804 | ui.prop.IMAGE_LENGTH=27 805 | ui.prop.LEVEL=28 806 | ui.prop.TYPE=29 807 | ui.prop.TEXT_SIZE=30 808 | ui.prop.FONT=31 809 | ui.prop.ID=32 810 | ui.prop.DATASET=33 811 | ui.prop.ANIM_STATUS=34 812 | ui.prop.ANIM_IS_RUNINNG=35 813 | ui.prop.ANIM_IS_RUNNING=35 814 | ui.prop.ANIM_IS_PAUSE=36 815 | ui.prop.ANIM_IS_STOP=37 816 | ui.prop.ANIM=38 817 | ui.prop.RADIUS=39 818 | ui.prop.ALPHA=40 819 | ui.prop.VISIBLE=41 820 | ui.prop.INIT=42 821 | ui.prop.CHECKED=43 822 | ui.prop.SHOW=44 823 | ui.prop.UNCHECKED=45 824 | ui.prop.CURRENT_SELECT=46 825 | ui.prop.TEXT_STYLE=47 826 | ui.prop.CHAR_SPACE=48 827 | ui.prop.LINE_SPACE=49 828 | ui.prop.END_X=50 829 | ui.prop.CURRENT_TYPE=51 830 | ui.prop.UPDATE_DATA=52 831 | ui.prop.SELECT_INDEX=53 832 | ui.prop.CURRENT_CONFIG=54 833 | ui.prop.ITEM_MORE=55 834 | ui.prop.ITEM_REFRESH=56 835 | ui.prop.LIST_TOP=57 836 | ui.prop.CORNER_RADIUS=58 837 | ui.prop.AUTO_SCALE=59 838 | ui.prop.AUTO_SCALE_OBJ_FIT=60 839 | ui.prop.ANIM_STEP=61 840 | ui.prop.ANIM_FRAME_CUR_INDEX=62 841 | ui.prop.ANIM_PLAY_BACK=63 842 | ui.prop.UPDATE_ITEM=65 843 | ui.prop.DELETE_ITEM=66 844 | ui.prop.MOVE_ITEM=67 845 | ui.redraw=function() {} 846 | ui.relayoutRtl=function() {} 847 | ui.scrollToPage=function() {} 848 | ui.setAppWidgetSize=function() {} 849 | ui.setLayerScrolling=function() {} 850 | ui.setScrollView=function() {} 851 | ui.setStatusBarVisible=function() {} 852 | ui.showToast=function() {} 853 | ui.show_level.ALL=7 854 | ui.show_level.ONLY_NORMAL=1 855 | ui.show_level.ONAL_AOD=2 856 | ui.show_level.ONLY_AOD=2 857 | ui.show_level.ONLY_EDIT=4 858 | ui.system_status.DISCONNECT=0 859 | ui.system_status.DISTURB=1 860 | ui.system_status.LOCK=2 861 | ui.system_status.CLOCK=3 862 | ui.text_style.CHAR_WRAP=0 863 | ui.text_style.WRAP=1 864 | ui.text_style.ELLIPSIS=2 865 | ui.text_style.NONE=3 866 | ui.updateStatusBarTitle=function() {} 867 | ui.widget.IMG=1 868 | ui.widget.GROUP=65536 869 | ui.widget.TEXT=2 870 | ui.widget.ARC=3 871 | ui.widget.FILL_RECT=4 872 | ui.widget.STROKE_RECT=5 873 | ui.widget.TEXT_IMG=6 874 | ui.widget.ARC_PROGRESS=7 875 | ui.widget.LINE_PROGRESS=8 876 | ui.widget.IMG_PROGRESS=9 877 | ui.widget.IMG_LEVEL=10 878 | ui.widget.IMG_GROUP=41 879 | ui.widget.IMG_POINTER=11 880 | ui.widget.IMG_DATE=13 881 | ui.widget.IMG_WEEK=14 882 | ui.widget.IMG_TIME=12 883 | ui.widget.IMG_ANIM=15 884 | ui.widget.IMG_STATUS=16 885 | ui.widget.IMG_CLICK=17 886 | ui.widget.IMG_FILL=42 887 | ui.widget.TEXT_TIME=18 888 | ui.widget.TIME_NUM=19 889 | ui.widget.CYCLE_LIST=20 890 | ui.widget.CIRCLE=21 891 | ui.widget.STATE_BUTTON=22 892 | ui.widget.RADIO_GROUP=65537 893 | ui.widget.CHECKBOX_GROUP=65538 894 | ui.widget.BUTTON=23 895 | ui.widget.SLIDE_SWITCH=24 896 | ui.widget.DIALOG=25 897 | ui.widget.SCROLL_LIST=26 898 | ui.widget.VIEW_CONTAINER=768 899 | ui.widget.CYCLE_IMAGE_TEXT_LIST=27 900 | ui.widget.TIME_POINTER=28 901 | ui.widget.WATCHFACE_EDIT_MASK=29 902 | ui.widget.WATCHFACE_EDIT_FG_MASK=30 903 | ui.widget.WATCHFACE_EDIT_GROUP=65539 904 | ui.widget.WATCHFACE_EDIT_BG=31 905 | ui.widget.HISTOGRAM=32 906 | ui.widget.DATE_POINTER=33 907 | ui.widget.TEXT_FONT=34 908 | ui.widget.WIDGET_DELEGATE=35 909 | ui.widget.GRADKIENT_POLYLINE=36 910 | ui.widget.PICK_TIME=512 911 | ui.widget.PICK_DATE=513 912 | ui.widget.WATCHFACE_EDIT_POINTER=65540 913 | ui.widget.ARC_PROGRESS_FILL=37 914 | ui.widget.QRCODE=38 915 | ui.widget.BARCODE=39 916 | ui.widget.PAGE_INDICATOR=40 917 | ui.widget.WATCHFACE_EDIT_TIME=65541 918 | .attributeName=.attributeName 919 | .handleAttributeName=function() {} 920 | .handleAttributeValue=function() {} 921 | 922 | -------------------------------------------------------------------------------- /api-v1.0.0-leaked-framework.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * @huamios-js-framework v1.0.0 3 | * (c) 2020-2021 TaoHuang 4 | */ 5 | (function (global, factory) { 6 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 7 | typeof define === 'function' && define.amd ? define(['exports'], factory) : 8 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.DeviceRuntimeCore = {})); 9 | }(this, (function (exports) { 'use strict'; 10 | 11 | function initProxy(target, ...source) { 12 | if (!target) { 13 | throw Error('target not undefined'); 14 | } 15 | return new Proxy(target, { 16 | get(target, p) { 17 | for (const s of [target, ...source].reverse()) { 18 | if (!s) 19 | continue; 20 | if (p in s) 21 | return s[p]; 22 | } 23 | }, 24 | set(target, p, value) { 25 | target[p] = value; 26 | return true; 27 | }, 28 | }); 29 | } 30 | // BFS 广度优先算法,遍历所有的 weight 31 | // export function walk(weightTree?: IWidget, handler?: (w: IWidget) => void): IWidget[] { 32 | // if (!weightTree) return [] 33 | // const renderObjects: IWidget[] = [] 34 | // const widgetList = [] 35 | // widgetList.push(weightTree) 36 | // while (!widgetList.length) { 37 | // const currentWidget = widgetList.shift() 38 | // if (!currentWidget) continue 39 | // handler?.(currentWidget) 40 | // renderObjects.push(currentWidget) 41 | // if (currentWidget.children && currentWidget.children.length) { 42 | // widgetList.push(...currentWidget.children) 43 | // } 44 | // } 45 | // return renderObjects 46 | // } 47 | // const defaultStyle = { 48 | // x: 0, 49 | // y: 0, 50 | // color: '#00000', 51 | // } 52 | // export function mergeDefault( 53 | // target?: Record, 54 | // defaultVal?: Record, 55 | // ): Record { 56 | // return { ...defaultVal, ...target } 57 | // } 58 | // export function normalizeStyle(w: IWidget): void { 59 | // w.styles = mergeDefault(w.styles, mergeDefault(w.parent?.styles, defaultStyle)) 60 | // } 61 | // export function handlerWidget(w: IWidget): void { 62 | // normalizeStyle(w) 63 | // if (!w.parent) return 64 | // w._worldX = function (): string { 65 | // return ( 66 | // parseInt(w.parent?._worldX?.() ?? '0', 10) + 67 | // parseInt((isFunction(w.styles?.x) ? w.styles?.x?.() : w.styles?.x) ?? '0', 10) + 68 | // 'px' 69 | // ) 70 | // } 71 | // w._worldY = function (): string { 72 | // return ( 73 | // parseInt(w.parent?._worldY?.() ?? '0', 10) + 74 | // parseInt((isFunction(w.styles?.y) ? w.styles?.y?.() : w.styles?.y) ?? '0', 10) + 75 | // 'px' 76 | // ) 77 | // } 78 | // } 79 | 80 | /*! ***************************************************************************** 81 | Copyright (c) Microsoft Corporation. 82 | 83 | Permission to use, copy, modify, and/or distribute this software for any 84 | purpose with or without fee is hereby granted. 85 | 86 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 87 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 88 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 89 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 90 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 91 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 92 | PERFORMANCE OF THIS SOFTWARE. 93 | ***************************************************************************** */ 94 | 95 | function __rest(s, e) { 96 | var t = {}; 97 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 98 | t[p] = s[p]; 99 | if (s != null && typeof Object.getOwnPropertySymbols === "function") 100 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 101 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 102 | t[p[i]] = s[p[i]]; 103 | } 104 | return t; 105 | } 106 | 107 | function noop() { 108 | // pass 109 | } 110 | function mergeProps(_a) { 111 | var { attrs, on, styles } = _a, rest = __rest(_a, ["attrs", "on", "styles"]); 112 | return Object.assign(Object.assign(Object.assign(Object.assign({}, rest), attrs), on), styles); 113 | } 114 | 115 | function App(options) { 116 | const app = { 117 | _options: options, 118 | onCreate: noop, 119 | onDestroy: noop, 120 | onError: noop, 121 | onPageNotFound: noop, 122 | onUnhandledRejection: noop, 123 | }; 124 | return initProxy(app, options); 125 | } 126 | 127 | function Page(options) { 128 | const page = { 129 | _options: options, 130 | onInit: noop, 131 | onDataRestore: noop, 132 | build: noop, 133 | onDataSave: noop, 134 | onDestroy: noop, 135 | state: {}, 136 | }; 137 | return initProxy(page, options, options.state); 138 | } 139 | 140 | function AppWidget(options) { 141 | const appWidget = { 142 | _options: options, 143 | onInit: noop, 144 | onDataRestore: noop, 145 | build: noop, 146 | onDataSave: noop, 147 | onDestroy: noop, 148 | state: {}, 149 | }; 150 | return initProxy(appWidget, options, options.state); 151 | } 152 | 153 | function WatchFace(options) { 154 | const watchFace = { 155 | _options: options, 156 | onInit: noop, 157 | onDataRestore: noop, 158 | build: noop, 159 | onDataSave: noop, 160 | onDestroy: noop, 161 | state: {}, 162 | }; 163 | return initProxy(watchFace, options, options.state); 164 | } 165 | 166 | function WatchWidget(options) { 167 | const watchWidget = { 168 | _options: options, 169 | onInit: noop, 170 | onDataRestore: noop, 171 | build: noop, 172 | onDataSave: noop, 173 | onDestroy: noop, 174 | state: {}, 175 | }; 176 | return initProxy(watchWidget, options, options.state); 177 | } 178 | 179 | const DEFAULT = '__default__'; 180 | class HmDomApi { 181 | constructor(appContext, moduleContext, createApi = hmUI) { 182 | this._idWidgetMap = new Map([[DEFAULT, []]]); 183 | this.projectName = ''; 184 | this.appContext = appContext; 185 | this.createApi = createApi; 186 | this.moduleContext = moduleContext; 187 | } 188 | createWidget(id, opts) { 189 | if (!opts.__pid__) { 190 | opts.__pid__ = this.appContext.pid; 191 | opts.__mid__ = this.moduleContext.id; 192 | } 193 | const widget = this.createApi.createWidget(id, mergeProps(opts)); 194 | return new Proxy(widget, { 195 | get(target, key) { 196 | if (key.toUpperCase() in hmUI.prop) { 197 | return target.getProperty(hmUI.prop[key.toUpperCase()]); 198 | } 199 | return Reflect.get(target, key).bind(target); 200 | }, 201 | set(target, key, value) { 202 | if (key.toUpperCase() in hmUI.prop) { 203 | target.setProperty(hmUI.prop[key.toUpperCase()], value); 204 | return false; 205 | } 206 | else { 207 | return false; 208 | } 209 | }, 210 | }); 211 | } 212 | getWidgetsById(id) { 213 | var _a; 214 | if (!id) 215 | return []; 216 | return (_a = this._idWidgetMap.get(id)) !== null && _a !== void 0 ? _a : []; 217 | } 218 | match(reg) { 219 | const result = []; 220 | if (!reg) 221 | return result; 222 | for (const [k, v] of this._idWidgetMap.entries()) { 223 | if (reg.test(k.toString().toLowerCase())) { 224 | result.push(...v); 225 | } 226 | } 227 | return result; 228 | } 229 | deleteWidget(widget) { 230 | var _a, _b, _c; 231 | const id = (_a = widget.getProperty(hmUI.prop.ID)) !== null && _a !== void 0 ? _a : DEFAULT; 232 | if (id && this._idWidgetMap.has(id)) { 233 | const index = (_b = this._idWidgetMap.get(id)) === null || _b === void 0 ? void 0 : _b.indexOf(widget); 234 | if (index !== -1 && index !== undefined) { 235 | (_c = this._idWidgetMap.get(id)) === null || _c === void 0 ? void 0 : _c.splice(index, 1); 236 | } 237 | } 238 | return this.createApi.deleteWidget(widget); 239 | } 240 | destory() { 241 | Object.values(this._idWidgetMap).forEach((ws) => { 242 | ws && 243 | ws.forEach((w) => { 244 | this.createApi.deleteWidget(w); 245 | }); 246 | }); 247 | this._idWidgetMap.clear(); 248 | this._idWidgetMap.set(DEFAULT, []); 249 | } 250 | } 251 | 252 | class HmSensorApi { 253 | constructor(appContext, moduleContext, createApi = hmSensor) { 254 | this.appContext = appContext; 255 | this.createApi = createApi; 256 | this.moduleContext = moduleContext; 257 | } 258 | createSensor(id, opts) { 259 | if (!opts.__pid__) { 260 | opts.__pid__ = this.appContext.pid; 261 | opts.__mid__ = this.moduleContext.id; 262 | } 263 | return this.createApi.createSensor(id, opts); 264 | } 265 | deleteSensor(sensor) { 266 | // todo 未知API 267 | this.createApi.deleteSensor(sensor); 268 | } 269 | } 270 | 271 | function print(...args) { 272 | console.log(args.join(' ')); 273 | } 274 | class HmLogger { 275 | constructor(tag = '') { 276 | this.tag = `[${tag}]`; 277 | } 278 | static getLogger(tag) { 279 | return new HmLogger(tag); 280 | } 281 | info(...args) { 282 | print('[jsfwk.info ]', this.tag, ...args); 283 | } 284 | error(...args) { 285 | print('[jsfwk.error]', this.tag, ...args); 286 | } 287 | debug(...args) { 288 | print('[jsfwk.debug]', this.tag, ...args); 289 | } 290 | warn(...args) { 291 | print('[jsfwk.warn ]', this.tag, ...args); 292 | } 293 | log(...args) { 294 | print('[jsfwk.log ]', this.tag, ...args); 295 | } 296 | } 297 | 298 | class Router { 299 | push(location) { 300 | let params = ''; 301 | const { path: file, params: lParams } = location; 302 | for (const k in lParams) { 303 | params = `${params}${params !== '' ? '&' : ''}${k}=${lParams[k]}`; 304 | } 305 | hmApp.gotoPage({ file, params }); 306 | } 307 | replace(location) { 308 | // 309 | let params = ''; 310 | const { path: file, params: lParams } = location; 311 | for (const k in lParams) { 312 | params = `${params}${params !== '' ? '&' : ''}${k}=${lParams[k]}`; 313 | } 314 | hmApp.gotoPage({ file, params }); 315 | } 316 | go() { 317 | hmApp.goBack(); 318 | } 319 | } 320 | 321 | class Color { 322 | constructor() { 323 | this.AliceBlue = 0xf0f8ff; 324 | this.AntiqueWhite = 0xfaebd7; 325 | this.Aqua = 0x00ffff; 326 | this.Aquamarine = 0x7fffd4; 327 | this.Azure = 0xf0ffff; 328 | this.Beige = 0xf5f5dc; 329 | this.Bisque = 0xffe4c4; 330 | this.Black = 0x000000; 331 | this.BlanchedAlmond = 0xffebcd; 332 | this.Blue = 0x0000ff; 333 | this.BlueViolet = 0x8a2be2; 334 | this.Brown = 0xa52a2a; 335 | this.BurlyWood = 0xdeb887; 336 | this.CadetBlue = 0x5f9ea0; 337 | this.Chartreuse = 0x7fff00; 338 | this.Chocolate = 0xd2691e; 339 | this.Coral = 0xff7f50; 340 | this.CornflowerBlue = 0x6495ed; 341 | this.Cornsilk = 0xfff8dc; 342 | this.Crimson = 0xdc143c; 343 | this.Cyan = 0x00ffff; 344 | this.DarkBlue = 0x00008b; 345 | this.DarkCyan = 0x008b8b; 346 | this.DarkGoldenRod = 0xb8860b; 347 | this.DarkGray = 0xa9a9a9; 348 | this.DarkGrey = 0xa9a9a9; 349 | this.DarkGreen = 0x006400; 350 | this.DarkKhaki = 0xbdb76b; 351 | this.DarkMagenta = 0x8b008b; 352 | this.DarkOliveGreen = 0x556b2f; 353 | this.DarkOrange = 0xff8c00; 354 | this.DarkOrchid = 0x9932cc; 355 | this.DarkRed = 0x8b0000; 356 | this.DarkSalmon = 0xe9967a; 357 | this.DarkSeaGreen = 0x8fbc8f; 358 | this.DarkSlateBlue = 0x483d8b; 359 | this.DarkSlateGray = 0x2f4f4f; 360 | this.DarkSlateGrey = 0x2f4f4f; 361 | this.DarkTurquoise = 0x00ced1; 362 | this.DarkViolet = 0x9400d3; 363 | this.DeepPink = 0xff1493; 364 | this.DeepSkyBlue = 0x00bfff; 365 | this.DimGray = 0x696969; 366 | this.DimGrey = 0x696969; 367 | this.DodgerBlue = 0x1e90ff; 368 | this.FireBrick = 0xb22222; 369 | this.FloralWhite = 0xfffaf0; 370 | this.ForestGreen = 0x228b22; 371 | this.Fuchsia = 0xff00ff; 372 | this.Gainsboro = 0xdcdcdc; 373 | this.GhostWhite = 0xf8f8ff; 374 | this.Gold = 0xffd700; 375 | this.GoldenRod = 0xdaa520; 376 | this.Gray = 0x808080; 377 | this.Grey = 0x808080; 378 | this.Green = 0x008000; 379 | this.GreenYellow = 0xadff2f; 380 | this.HoneyDew = 0xf0fff0; 381 | this.HotPink = 0xff69b4; 382 | this.IndianRed = 0xcd5c5c; 383 | this.Indigo = 0x4b0082; 384 | this.Ivory = 0xfffff0; 385 | this.Khaki = 0xf0e68c; 386 | this.Lavender = 0xe6e6fa; 387 | this.LavenderBlush = 0xfff0f5; 388 | this.LawnGreen = 0x7cfc00; 389 | this.LemonChiffon = 0xfffacd; 390 | this.LightBlue = 0xadd8e6; 391 | this.LightCoral = 0xf08080; 392 | this.LightCyan = 0xe0ffff; 393 | this.LightGoldenRodYellow = 0xfafad2; 394 | this.LightGray = 0xd3d3d3; 395 | this.LightGrey = 0xd3d3d3; 396 | this.LightGreen = 0x90ee90; 397 | this.LightPink = 0xffb6c1; 398 | this.LightSalmon = 0xffa07a; 399 | this.LightSeaGreen = 0x20b2aa; 400 | this.LightSkyBlue = 0x87cefa; 401 | this.LightSlateGray = 0x778899; 402 | this.LightSlateGrey = 0x778899; 403 | this.LightSteelBlue = 0xb0c4de; 404 | this.LightYellow = 0xffffe0; 405 | this.Lime = 0x00ff00; 406 | this.LimeGreen = 0x32cd32; 407 | this.Linen = 0xfaf0e6; 408 | this.Magenta = 0xff00ff; 409 | this.Maroon = 0x800000; 410 | this.MediumAquaMarine = 0x66cdaa; 411 | this.MediumBlue = 0x0000cd; 412 | this.MediumOrchid = 0xba55d3; 413 | this.MediumPurple = 0x9370db; 414 | this.MediumSeaGreen = 0x3cb371; 415 | this.MediumSlateBlue = 0x7b68ee; 416 | this.MediumSpringGreen = 0x00fa9a; 417 | this.MediumTurquoise = 0x48d1cc; 418 | this.MediumVioletRed = 0xc71585; 419 | this.MidnightBlue = 0x191970; 420 | this.MintCream = 0xf5fffa; 421 | this.MistyRose = 0xffe4e1; 422 | this.Moccasin = 0xffe4b5; 423 | this.NavajoWhite = 0xffdead; 424 | this.Navy = 0x000080; 425 | this.OldLace = 0xfdf5e6; 426 | this.Olive = 0x808000; 427 | this.OliveDrab = 0x6b8e23; 428 | this.Orange = 0xffa500; 429 | this.OrangeRed = 0xff4500; 430 | this.Orchid = 0xda70d6; 431 | this.PaleGoldenRod = 0xeee8aa; 432 | this.PaleGreen = 0x98fb98; 433 | this.PaleTurquoise = 0xafeeee; 434 | this.PaleVioletRed = 0xdb7093; 435 | this.PapayaWhip = 0xffefd5; 436 | this.PeachPuff = 0xffdab9; 437 | this.Peru = 0xcd853f; 438 | this.Pink = 0xffc0cb; 439 | this.Plum = 0xdda0dd; 440 | this.PowderBlue = 0xb0e0e6; 441 | this.Purple = 0x800080; 442 | this.RebeccaPurple = 0x663399; 443 | this.Red = 0xff0000; 444 | this.RosyBrown = 0xbc8f8f; 445 | this.RoyalBlue = 0x4169e1; 446 | this.SaddleBrown = 0x8b4513; 447 | this.Salmon = 0xfa8072; 448 | this.SandyBrown = 0xf4a460; 449 | this.SeaGreen = 0x2e8b57; 450 | this.SeaShell = 0xfff5ee; 451 | this.Sienna = 0xa0522d; 452 | this.Silver = 0xc0c0c0; 453 | this.SkyBlue = 0x87ceeb; 454 | this.SlateBlue = 0x6a5acd; 455 | this.SlateGray = 0x708090; 456 | this.SlateGrey = 0x708090; 457 | this.Snow = 0xfffafa; 458 | this.SpringGreen = 0x00ff7f; 459 | this.SteelBlue = 0x4682b4; 460 | this.Tan = 0xd2b48c; 461 | this.Teal = 0x008080; 462 | this.Thistle = 0xd8bfd8; 463 | this.Tomato = 0xff6347; 464 | this.Turquoise = 0x40e0d0; 465 | this.Violet = 0xee82ee; 466 | this.Wheat = 0xf5deb3; 467 | this.White = 0xffffff; 468 | this.WhiteSmoke = 0xf5f5f5; 469 | this.Yellow = 0xffff00; 470 | this.YellowGreen = 0x9acd32; 471 | this.aliceblue = 0xf0f8ff; 472 | this.antiquewhite = 0xfaebd7; 473 | this.aqua = 0x00ffff; 474 | this.aquamarine = 0x7fffd4; 475 | this.azure = 0xf0ffff; 476 | this.beige = 0xf5f5dc; 477 | this.bisque = 0xffe4c4; 478 | this.black = 0x000000; 479 | this.blanchedalmond = 0xffebcd; 480 | this.blue = 0x0000ff; 481 | this.blueviolet = 0x8a2be2; 482 | this.brown = 0xa52a2a; 483 | this.burlywood = 0xdeb887; 484 | this.cadetblue = 0x5f9ea0; 485 | this.chartreuse = 0x7fff00; 486 | this.chocolate = 0xd2691e; 487 | this.coral = 0xff7f50; 488 | this.cornflowerblue = 0x6495ed; 489 | this.cornsilk = 0xfff8dc; 490 | this.crimson = 0xdc143c; 491 | this.cyan = 0x00ffff; 492 | this.darkblue = 0x00008b; 493 | this.darkcyan = 0x008b8b; 494 | this.darkgoldenrod = 0xb8860b; 495 | this.darkgray = 0xa9a9a9; 496 | this.darkgrey = 0xa9a9a9; 497 | this.darkgreen = 0x006400; 498 | this.darkkhaki = 0xbdb76b; 499 | this.darkmagenta = 0x8b008b; 500 | this.darkolivegreen = 0x556b2f; 501 | this.darkorange = 0xff8c00; 502 | this.darkorchid = 0x9932cc; 503 | this.darkred = 0x8b0000; 504 | this.darksalmon = 0xe9967a; 505 | this.darkseagreen = 0x8fbc8f; 506 | this.darkslateblue = 0x483d8b; 507 | this.darkslategray = 0x2f4f4f; 508 | this.darkslategrey = 0x2f4f4f; 509 | this.darkturquoise = 0x00ced1; 510 | this.darkviolet = 0x9400d3; 511 | this.deeppink = 0xff1493; 512 | this.deepskyblue = 0x00bfff; 513 | this.dimgray = 0x696969; 514 | this.dimgrey = 0x696969; 515 | this.dodgerblue = 0x1e90ff; 516 | this.firebrick = 0xb22222; 517 | this.floralwhite = 0xfffaf0; 518 | this.forestgreen = 0x228b22; 519 | this.fuchsia = 0xff00ff; 520 | this.gainsboro = 0xdcdcdc; 521 | this.ghostwhite = 0xf8f8ff; 522 | this.gold = 0xffd700; 523 | this.goldenrod = 0xdaa520; 524 | this.gray = 0x808080; 525 | this.grey = 0x808080; 526 | this.green = 0x008000; 527 | this.greenyellow = 0xadff2f; 528 | this.honeydew = 0xf0fff0; 529 | this.hotpink = 0xff69b4; 530 | this.indianred = 0xcd5c5c; 531 | this.indigo = 0x4b0082; 532 | this.ivory = 0xfffff0; 533 | this.khaki = 0xf0e68c; 534 | this.lavender = 0xe6e6fa; 535 | this.lavenderblush = 0xfff0f5; 536 | this.lawngreen = 0x7cfc00; 537 | this.lemonchiffon = 0xfffacd; 538 | this.lightblue = 0xadd8e6; 539 | this.lightcoral = 0xf08080; 540 | this.lightcyan = 0xe0ffff; 541 | this.lightgoldenrodyellow = 0xfafad2; 542 | this.lightgray = 0xd3d3d3; 543 | this.lightgrey = 0xd3d3d3; 544 | this.lightgreen = 0x90ee90; 545 | this.lightpink = 0xffb6c1; 546 | this.lightsalmon = 0xffa07a; 547 | this.lightseagreen = 0x20b2aa; 548 | this.lightskyblue = 0x87cefa; 549 | this.lightslategray = 0x778899; 550 | this.lightslategrey = 0x778899; 551 | this.lightsteelblue = 0xb0c4de; 552 | this.lightyellow = 0xffffe0; 553 | this.lime = 0x00ff00; 554 | this.limegreen = 0x32cd32; 555 | this.linen = 0xfaf0e6; 556 | this.magenta = 0xff00ff; 557 | this.maroon = 0x800000; 558 | this.mediumaquamarine = 0x66cdaa; 559 | this.mediumblue = 0x0000cd; 560 | this.mediumorchid = 0xba55d3; 561 | this.mediumpurple = 0x9370db; 562 | this.mediumseagreen = 0x3cb371; 563 | this.mediumslateblue = 0x7b68ee; 564 | this.mediumspringgreen = 0x00fa9a; 565 | this.mediumturquoise = 0x48d1cc; 566 | this.mediumvioletred = 0xc71585; 567 | this.midnightblue = 0x191970; 568 | this.mintcream = 0xf5fffa; 569 | this.mistyrose = 0xffe4e1; 570 | this.moccasin = 0xffe4b5; 571 | this.navajowhite = 0xffdead; 572 | this.navy = 0x000080; 573 | this.oldlace = 0xfdf5e6; 574 | this.olive = 0x808000; 575 | this.olivedrab = 0x6b8e23; 576 | this.orange = 0xffa500; 577 | this.orangered = 0xff4500; 578 | this.orchid = 0xda70d6; 579 | this.palegoldenrod = 0xeee8aa; 580 | this.palegreen = 0x98fb98; 581 | this.paleturquoise = 0xafeeee; 582 | this.palevioletred = 0xdb7093; 583 | this.papayawhip = 0xffefd5; 584 | this.peachpuff = 0xffdab9; 585 | this.peru = 0xcd853f; 586 | this.pink = 0xffc0cb; 587 | this.plum = 0xdda0dd; 588 | this.powderblue = 0xb0e0e6; 589 | this.purple = 0x800080; 590 | this.rebeccapurple = 0x663399; 591 | this.red = 0xff0000; 592 | this.rosybrown = 0xbc8f8f; 593 | this.royalblue = 0x4169e1; 594 | this.saddlebrown = 0x8b4513; 595 | this.salmon = 0xfa8072; 596 | this.sandybrown = 0xf4a460; 597 | this.seagreen = 0x2e8b57; 598 | this.seashell = 0xfff5ee; 599 | this.sienna = 0xa0522d; 600 | this.silver = 0xc0c0c0; 601 | this.skyblue = 0x87ceeb; 602 | this.slateblue = 0x6a5acd; 603 | this.slategray = 0x708090; 604 | this.slategrey = 0x708090; 605 | this.snow = 0xfffafa; 606 | this.springgreen = 0x00ff7f; 607 | this.steelblue = 0x4682b4; 608 | this.tan = 0xd2b48c; 609 | this.teal = 0x008080; 610 | this.thistle = 0xd8bfd8; 611 | this.tomato = 0xff6347; 612 | this.turquoise = 0x40e0d0; 613 | this.violet = 0xee82ee; 614 | this.wheat = 0xf5deb3; 615 | this.white = 0xffffff; 616 | this.whitesmoke = 0xf5f5f5; 617 | this.yellow = 0xffff00; 618 | this.yellowgreen = 0x9acd32; 619 | } 620 | hexStr(s) { 621 | if (s[0] === '#') { 622 | return Number(s.substr(1)); 623 | } 624 | return Number(s); 625 | } 626 | rgb(r, g, b) { 627 | return (r << 16) + (g << 8) + b; 628 | } 629 | rgba(r, g, b, a) { 630 | return (a << 24) + (r << 16) + (g << 8) + b; 631 | } 632 | } 633 | 634 | class WidgetFactory { 635 | constructor(createApi, projectName) { 636 | this.props = mergeProps; 637 | this.ALIGN = hmUI.align; 638 | this.WRAPTEXT = hmUI.text_style; 639 | this.EVENT = hmUI.event; 640 | this.WIDGET = hmUI.widget; 641 | this.PROP = hmUI.prop; 642 | this.COLOR = new Color(); 643 | this.createApi = createApi; 644 | createApi.projectName = projectName; 645 | this.projectName = projectName; 646 | } 647 | group(opts) { 648 | const group = this.createApi.createWidget(hmUI.widget.GROUP, opts); 649 | const groupContext = new WidgetFactory(new HmDomApi(this.createApi.appContext, this.createApi.moduleContext, group), this.projectName); 650 | return new Proxy(group, { 651 | get(target, key, receiver) { 652 | if (key in groupContext) { 653 | return groupContext[key].bind(groupContext); 654 | } 655 | return Reflect.get(target, key, receiver).bind(target); 656 | }, 657 | }); 658 | } 659 | checkbox(opts) { 660 | return this.createApi.createWidget(hmUI.widget.STATE_BUTTON, opts); 661 | } 662 | checkboxGroup(opts) { 663 | const group = this.createApi.createWidget(hmUI.widget.CHECKBOX_GROUP, opts); 664 | const groupContext = new WidgetFactory(new HmDomApi(this.createApi.appContext, this.createApi.moduleContext, group), this.projectName); 665 | return new Proxy(group, { 666 | get(target, key, receiver) { 667 | if (key === 'checkbox') { 668 | return groupContext[key].bind(groupContext); 669 | } 670 | return Reflect.get(target, key, receiver).bind(target); 671 | }, 672 | }); 673 | } 674 | radio(opts) { 675 | return this.createApi.createWidget(hmUI.widget.STATE_BUTTON, opts); 676 | } 677 | radioGroup(opts) { 678 | const group = this.createApi.createWidget(hmUI.widget.RADIO_GROUP, opts); 679 | const groupContext = new WidgetFactory(new HmDomApi(this.createApi.appContext, this.createApi.moduleContext, group), this.projectName); 680 | return new Proxy(group, { 681 | get(target, key, receiver) { 682 | if (key === 'radio') { 683 | return groupContext[key].bind(groupContext); 684 | } 685 | return Reflect.get(target, key, receiver).bind(target); 686 | }, 687 | }); 688 | } 689 | text(opts) { 690 | return this.createApi.createWidget(hmUI.widget.TEXT, opts); 691 | } 692 | image(opts) { 693 | return this.createApi.createWidget(hmUI.widget.IMG, opts); 694 | } 695 | arc(opts) { 696 | return this.createApi.createWidget(hmUI.widget.ARC, opts); 697 | } 698 | fillRect(opts) { 699 | return this.createApi.createWidget(hmUI.widget.FILL_RECT, opts); 700 | } 701 | strokeRect(opts) { 702 | return this.createApi.createWidget(hmUI.widget.STROKE_RECT, opts); 703 | } 704 | imgText(opts) { 705 | return this.createApi.createWidget(hmUI.widget.STROKE_RECT, opts); 706 | } 707 | arcProgress(opts) { 708 | return this.createApi.createWidget(hmUI.widget.ARC_PROGRESS, opts); 709 | } 710 | imgProgress(opts) { 711 | return this.createApi.createWidget(hmUI.widget.IMG_PROGRESS, opts); 712 | } 713 | imgProgressLevel(opts) { 714 | return this.createApi.createWidget(hmUI.widget.IMG_LEVEL, opts); 715 | } 716 | imgAnimation(opts) { 717 | return this.createApi.createWidget(hmUI.widget.IMG_ANIM, opts); 718 | } 719 | button(opts) { 720 | return this.createApi.createWidget(hmUI.widget.BUTTON, opts); 721 | } 722 | circle(opts) { 723 | return this.createApi.createWidget(hmUI.widget.CIRCLE, opts); 724 | } 725 | dialog(opts) { 726 | return this.createApi.createWidget(hmUI.widget.DIALOG, opts); 727 | } 728 | scrollList(opts) { 729 | return this.createApi.createWidget(hmUI.widget.SCROLL_LIST, opts); 730 | } 731 | slideSwitch(opts) { 732 | return this.createApi.createWidget(hmUI.widget.SLIDE_SWITCH, opts); 733 | } 734 | cycleImageList(opts) { 735 | return this.createApi.createWidget(hmUI.widget.CYCLE_LIST, opts); 736 | } 737 | cycleList(opts) { 738 | return this.createApi.createWidget(hmUI.widget.CYCLE_IMAGE_TEXT_LIST, opts); 739 | } 740 | pointer(opts) { 741 | return this.createApi.createWidget(hmUI.widget.IMG_POINTER, opts); 742 | } 743 | textImg(opts) { 744 | return this.createApi.createWidget(hmUI.widget.TEXT_IMG, opts); 745 | } 746 | } 747 | class SensorWidgetFactory { 748 | constructor(createApi) { 749 | this.createApi = createApi; 750 | } 751 | time(opts) { 752 | return this.createApi.createSensor(hmSensor.id.TIME, opts); 753 | } 754 | battery(opts) { 755 | return this.createApi.createSensor(hmSensor.id.BATTERY, opts); 756 | } 757 | step(opts) { 758 | return this.createApi.createSensor(hmSensor.id.STEP, opts); 759 | } 760 | calories(opts) { 761 | return this.createApi.createSensor(hmSensor.id.CALORIE, opts); 762 | } 763 | heart(opts) { 764 | return this.createApi.createSensor(hmSensor.id.HEART, opts); 765 | } 766 | PAI(opts) { 767 | return this.createApi.createSensor(hmSensor.id.PAI, opts); 768 | } 769 | distance(opts) { 770 | return this.createApi.createSensor(hmSensor.id.DISTANCE, opts); 771 | } 772 | stand(opts) { 773 | return this.createApi.createSensor(hmSensor.id.STAND, opts); 774 | } 775 | weather(opts) { 776 | return this.createApi.createSensor(hmSensor.id.WEATHER, opts); 777 | } 778 | activity(opts) { 779 | return this.createApi.createSensor(hmSensor.id.ACTIVITY, opts); 780 | } 781 | fatButting(opts) { 782 | return this.createApi.createSensor(hmSensor.id.FAT_BURRING, opts); 783 | } 784 | sun(opts) { 785 | return this.createApi.createSensor(hmSensor.id.SUN, opts); 786 | } 787 | wind(opts) { 788 | return this.createApi.createSensor(hmSensor.id.WIND, opts); 789 | } 790 | pressure(opts) { 791 | return this.createApi.createSensor(hmSensor.id.PRESSURE, opts); 792 | } 793 | spo2(opts) { 794 | return this.createApi.createSensor(hmSensor.id.SPO2, opts); 795 | } 796 | bodyTemp(opts) { 797 | return this.createApi.createSensor(hmSensor.id.BODY_TEMP, opts); 798 | } 799 | stress(opts) { 800 | return this.createApi.createSensor(hmSensor.id.STRESS, opts); 801 | } 802 | } 803 | 804 | function createCommonjsModule(fn) { 805 | var module = { exports: {} }; 806 | return fn(module, module.exports), module.exports; 807 | } 808 | 809 | var byteLength_1 = byteLength; 810 | var toByteArray_1 = toByteArray; 811 | var fromByteArray_1 = fromByteArray; 812 | 813 | var lookup = []; 814 | var revLookup = []; 815 | var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; 816 | 817 | var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; 818 | for (var i = 0, len = code.length; i < len; ++i) { 819 | lookup[i] = code[i]; 820 | revLookup[code.charCodeAt(i)] = i; 821 | } 822 | 823 | // Support decoding URL-safe base64 strings, as Node.js does. 824 | // See: https://en.wikipedia.org/wiki/Base64#URL_applications 825 | revLookup['-'.charCodeAt(0)] = 62; 826 | revLookup['_'.charCodeAt(0)] = 63; 827 | 828 | function getLens (b64) { 829 | var len = b64.length; 830 | 831 | if (len % 4 > 0) { 832 | throw new Error('Invalid string. Length must be a multiple of 4') 833 | } 834 | 835 | // Trim off extra bytes after placeholder bytes are found 836 | // See: https://github.com/beatgammit/base64-js/issues/42 837 | var validLen = b64.indexOf('='); 838 | if (validLen === -1) validLen = len; 839 | 840 | var placeHoldersLen = validLen === len 841 | ? 0 842 | : 4 - (validLen % 4); 843 | 844 | return [validLen, placeHoldersLen] 845 | } 846 | 847 | // base64 is 4/3 + up to two characters of the original data 848 | function byteLength (b64) { 849 | var lens = getLens(b64); 850 | var validLen = lens[0]; 851 | var placeHoldersLen = lens[1]; 852 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 853 | } 854 | 855 | function _byteLength (b64, validLen, placeHoldersLen) { 856 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 857 | } 858 | 859 | function toByteArray (b64) { 860 | var tmp; 861 | var lens = getLens(b64); 862 | var validLen = lens[0]; 863 | var placeHoldersLen = lens[1]; 864 | 865 | var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); 866 | 867 | var curByte = 0; 868 | 869 | // if there are placeholders, only get up to the last complete 4 chars 870 | var len = placeHoldersLen > 0 871 | ? validLen - 4 872 | : validLen; 873 | 874 | var i; 875 | for (i = 0; i < len; i += 4) { 876 | tmp = 877 | (revLookup[b64.charCodeAt(i)] << 18) | 878 | (revLookup[b64.charCodeAt(i + 1)] << 12) | 879 | (revLookup[b64.charCodeAt(i + 2)] << 6) | 880 | revLookup[b64.charCodeAt(i + 3)]; 881 | arr[curByte++] = (tmp >> 16) & 0xFF; 882 | arr[curByte++] = (tmp >> 8) & 0xFF; 883 | arr[curByte++] = tmp & 0xFF; 884 | } 885 | 886 | if (placeHoldersLen === 2) { 887 | tmp = 888 | (revLookup[b64.charCodeAt(i)] << 2) | 889 | (revLookup[b64.charCodeAt(i + 1)] >> 4); 890 | arr[curByte++] = tmp & 0xFF; 891 | } 892 | 893 | if (placeHoldersLen === 1) { 894 | tmp = 895 | (revLookup[b64.charCodeAt(i)] << 10) | 896 | (revLookup[b64.charCodeAt(i + 1)] << 4) | 897 | (revLookup[b64.charCodeAt(i + 2)] >> 2); 898 | arr[curByte++] = (tmp >> 8) & 0xFF; 899 | arr[curByte++] = tmp & 0xFF; 900 | } 901 | 902 | return arr 903 | } 904 | 905 | function tripletToBase64 (num) { 906 | return lookup[num >> 18 & 0x3F] + 907 | lookup[num >> 12 & 0x3F] + 908 | lookup[num >> 6 & 0x3F] + 909 | lookup[num & 0x3F] 910 | } 911 | 912 | function encodeChunk (uint8, start, end) { 913 | var tmp; 914 | var output = []; 915 | for (var i = start; i < end; i += 3) { 916 | tmp = 917 | ((uint8[i] << 16) & 0xFF0000) + 918 | ((uint8[i + 1] << 8) & 0xFF00) + 919 | (uint8[i + 2] & 0xFF); 920 | output.push(tripletToBase64(tmp)); 921 | } 922 | return output.join('') 923 | } 924 | 925 | function fromByteArray (uint8) { 926 | var tmp; 927 | var len = uint8.length; 928 | var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes 929 | var parts = []; 930 | var maxChunkLength = 16383; // must be multiple of 3 931 | 932 | // go through the array every three bytes, we'll deal with trailing stuff later 933 | for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { 934 | parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))); 935 | } 936 | 937 | // pad the end with zeros, but make sure to not forget the extra bytes 938 | if (extraBytes === 1) { 939 | tmp = uint8[len - 1]; 940 | parts.push( 941 | lookup[tmp >> 2] + 942 | lookup[(tmp << 4) & 0x3F] + 943 | '==' 944 | ); 945 | } else if (extraBytes === 2) { 946 | tmp = (uint8[len - 2] << 8) + uint8[len - 1]; 947 | parts.push( 948 | lookup[tmp >> 10] + 949 | lookup[(tmp >> 4) & 0x3F] + 950 | lookup[(tmp << 2) & 0x3F] + 951 | '=' 952 | ); 953 | } 954 | 955 | return parts.join('') 956 | } 957 | 958 | var base64Js = { 959 | byteLength: byteLength_1, 960 | toByteArray: toByteArray_1, 961 | fromByteArray: fromByteArray_1 962 | }; 963 | 964 | /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ 965 | var read = function (buffer, offset, isLE, mLen, nBytes) { 966 | var e, m; 967 | var eLen = (nBytes * 8) - mLen - 1; 968 | var eMax = (1 << eLen) - 1; 969 | var eBias = eMax >> 1; 970 | var nBits = -7; 971 | var i = isLE ? (nBytes - 1) : 0; 972 | var d = isLE ? -1 : 1; 973 | var s = buffer[offset + i]; 974 | 975 | i += d; 976 | 977 | e = s & ((1 << (-nBits)) - 1); 978 | s >>= (-nBits); 979 | nBits += eLen; 980 | for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} 981 | 982 | m = e & ((1 << (-nBits)) - 1); 983 | e >>= (-nBits); 984 | nBits += mLen; 985 | for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} 986 | 987 | if (e === 0) { 988 | e = 1 - eBias; 989 | } else if (e === eMax) { 990 | return m ? NaN : ((s ? -1 : 1) * Infinity) 991 | } else { 992 | m = m + Math.pow(2, mLen); 993 | e = e - eBias; 994 | } 995 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen) 996 | }; 997 | 998 | var write = function (buffer, value, offset, isLE, mLen, nBytes) { 999 | var e, m, c; 1000 | var eLen = (nBytes * 8) - mLen - 1; 1001 | var eMax = (1 << eLen) - 1; 1002 | var eBias = eMax >> 1; 1003 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0); 1004 | var i = isLE ? 0 : (nBytes - 1); 1005 | var d = isLE ? 1 : -1; 1006 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; 1007 | 1008 | value = Math.abs(value); 1009 | 1010 | if (isNaN(value) || value === Infinity) { 1011 | m = isNaN(value) ? 1 : 0; 1012 | e = eMax; 1013 | } else { 1014 | e = Math.floor(Math.log(value) / Math.LN2); 1015 | if (value * (c = Math.pow(2, -e)) < 1) { 1016 | e--; 1017 | c *= 2; 1018 | } 1019 | if (e + eBias >= 1) { 1020 | value += rt / c; 1021 | } else { 1022 | value += rt * Math.pow(2, 1 - eBias); 1023 | } 1024 | if (value * c >= 2) { 1025 | e++; 1026 | c /= 2; 1027 | } 1028 | 1029 | if (e + eBias >= eMax) { 1030 | m = 0; 1031 | e = eMax; 1032 | } else if (e + eBias >= 1) { 1033 | m = ((value * c) - 1) * Math.pow(2, mLen); 1034 | e = e + eBias; 1035 | } else { 1036 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); 1037 | e = 0; 1038 | } 1039 | } 1040 | 1041 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} 1042 | 1043 | e = (e << mLen) | m; 1044 | eLen += mLen; 1045 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} 1046 | 1047 | buffer[offset + i - d] |= s * 128; 1048 | }; 1049 | 1050 | var ieee754 = { 1051 | read: read, 1052 | write: write 1053 | }; 1054 | 1055 | /*! 1056 | * The buffer module from node.js, for the browser. 1057 | * 1058 | * @author Feross Aboukhadijeh 1059 | * @license MIT 1060 | */ 1061 | 1062 | var buffer = createCommonjsModule(function (module, exports) { 1063 | 1064 | 1065 | 1066 | const customInspectSymbol = 1067 | (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation 1068 | ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation 1069 | : null; 1070 | 1071 | exports.Buffer = Buffer; 1072 | exports.SlowBuffer = SlowBuffer; 1073 | exports.INSPECT_MAX_BYTES = 50; 1074 | 1075 | const K_MAX_LENGTH = 0x7fffffff; 1076 | exports.kMaxLength = K_MAX_LENGTH; 1077 | 1078 | /** 1079 | * If `Buffer.TYPED_ARRAY_SUPPORT`: 1080 | * === true Use Uint8Array implementation (fastest) 1081 | * === false Print warning and recommend using `buffer` v4.x which has an Object 1082 | * implementation (most compatible, even IE6) 1083 | * 1084 | * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, 1085 | * Opera 11.6+, iOS 4.2+. 1086 | * 1087 | * We report that the browser does not support typed arrays if the are not subclassable 1088 | * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` 1089 | * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support 1090 | * for __proto__ and has a buggy typed array implementation. 1091 | */ 1092 | Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); 1093 | 1094 | if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && 1095 | typeof console.error === 'function') { 1096 | console.error( 1097 | 'This browser lacks typed array (Uint8Array) support which is required by ' + 1098 | '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' 1099 | ); 1100 | } 1101 | 1102 | function typedArraySupport () { 1103 | // Can typed array instances can be augmented? 1104 | try { 1105 | const arr = new Uint8Array(1); 1106 | const proto = { foo: function () { return 42 } }; 1107 | Object.setPrototypeOf(proto, Uint8Array.prototype); 1108 | Object.setPrototypeOf(arr, proto); 1109 | return arr.foo() === 42 1110 | } catch (e) { 1111 | return false 1112 | } 1113 | } 1114 | 1115 | Object.defineProperty(Buffer.prototype, 'parent', { 1116 | enumerable: true, 1117 | get: function () { 1118 | if (!Buffer.isBuffer(this)) return undefined 1119 | return this.buffer 1120 | } 1121 | }); 1122 | 1123 | Object.defineProperty(Buffer.prototype, 'offset', { 1124 | enumerable: true, 1125 | get: function () { 1126 | if (!Buffer.isBuffer(this)) return undefined 1127 | return this.byteOffset 1128 | } 1129 | }); 1130 | 1131 | function createBuffer (length) { 1132 | if (length > K_MAX_LENGTH) { 1133 | throw new RangeError('The value "' + length + '" is invalid for option "size"') 1134 | } 1135 | // Return an augmented `Uint8Array` instance 1136 | const buf = new Uint8Array(length); 1137 | Object.setPrototypeOf(buf, Buffer.prototype); 1138 | return buf 1139 | } 1140 | 1141 | /** 1142 | * The Buffer constructor returns instances of `Uint8Array` that have their 1143 | * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of 1144 | * `Uint8Array`, so the returned instances will have all the node `Buffer` methods 1145 | * and the `Uint8Array` methods. Square bracket notation works as expected -- it 1146 | * returns a single octet. 1147 | * 1148 | * The `Uint8Array` prototype remains unmodified. 1149 | */ 1150 | 1151 | function Buffer (arg, encodingOrOffset, length) { 1152 | // Common case. 1153 | if (typeof arg === 'number') { 1154 | if (typeof encodingOrOffset === 'string') { 1155 | throw new TypeError( 1156 | 'The "string" argument must be of type string. Received type number' 1157 | ) 1158 | } 1159 | return allocUnsafe(arg) 1160 | } 1161 | return from(arg, encodingOrOffset, length) 1162 | } 1163 | 1164 | Buffer.poolSize = 8192; // not used by this implementation 1165 | 1166 | function from (value, encodingOrOffset, length) { 1167 | if (typeof value === 'string') { 1168 | return fromString(value, encodingOrOffset) 1169 | } 1170 | 1171 | if (ArrayBuffer.isView(value)) { 1172 | return fromArrayView(value) 1173 | } 1174 | 1175 | if (value == null) { 1176 | throw new TypeError( 1177 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 1178 | 'or Array-like Object. Received type ' + (typeof value) 1179 | ) 1180 | } 1181 | 1182 | if (isInstance(value, ArrayBuffer) || 1183 | (value && isInstance(value.buffer, ArrayBuffer))) { 1184 | return fromArrayBuffer(value, encodingOrOffset, length) 1185 | } 1186 | 1187 | if (typeof SharedArrayBuffer !== 'undefined' && 1188 | (isInstance(value, SharedArrayBuffer) || 1189 | (value && isInstance(value.buffer, SharedArrayBuffer)))) { 1190 | return fromArrayBuffer(value, encodingOrOffset, length) 1191 | } 1192 | 1193 | if (typeof value === 'number') { 1194 | throw new TypeError( 1195 | 'The "value" argument must not be of type number. Received type number' 1196 | ) 1197 | } 1198 | 1199 | const valueOf = value.valueOf && value.valueOf(); 1200 | if (valueOf != null && valueOf !== value) { 1201 | return Buffer.from(valueOf, encodingOrOffset, length) 1202 | } 1203 | 1204 | const b = fromObject(value); 1205 | if (b) return b 1206 | 1207 | if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && 1208 | typeof value[Symbol.toPrimitive] === 'function') { 1209 | return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) 1210 | } 1211 | 1212 | throw new TypeError( 1213 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 1214 | 'or Array-like Object. Received type ' + (typeof value) 1215 | ) 1216 | } 1217 | 1218 | /** 1219 | * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError 1220 | * if value is a number. 1221 | * Buffer.from(str[, encoding]) 1222 | * Buffer.from(array) 1223 | * Buffer.from(buffer) 1224 | * Buffer.from(arrayBuffer[, byteOffset[, length]]) 1225 | **/ 1226 | Buffer.from = function (value, encodingOrOffset, length) { 1227 | return from(value, encodingOrOffset, length) 1228 | }; 1229 | 1230 | // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: 1231 | // https://github.com/feross/buffer/pull/148 1232 | Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); 1233 | Object.setPrototypeOf(Buffer, Uint8Array); 1234 | 1235 | function assertSize (size) { 1236 | if (typeof size !== 'number') { 1237 | throw new TypeError('"size" argument must be of type number') 1238 | } else if (size < 0) { 1239 | throw new RangeError('The value "' + size + '" is invalid for option "size"') 1240 | } 1241 | } 1242 | 1243 | function alloc (size, fill, encoding) { 1244 | assertSize(size); 1245 | if (size <= 0) { 1246 | return createBuffer(size) 1247 | } 1248 | if (fill !== undefined) { 1249 | // Only pay attention to encoding if it's a string. This 1250 | // prevents accidentally sending in a number that would 1251 | // be interpreted as a start offset. 1252 | return typeof encoding === 'string' 1253 | ? createBuffer(size).fill(fill, encoding) 1254 | : createBuffer(size).fill(fill) 1255 | } 1256 | return createBuffer(size) 1257 | } 1258 | 1259 | /** 1260 | * Creates a new filled Buffer instance. 1261 | * alloc(size[, fill[, encoding]]) 1262 | **/ 1263 | Buffer.alloc = function (size, fill, encoding) { 1264 | return alloc(size, fill, encoding) 1265 | }; 1266 | 1267 | function allocUnsafe (size) { 1268 | assertSize(size); 1269 | return createBuffer(size < 0 ? 0 : checked(size) | 0) 1270 | } 1271 | 1272 | /** 1273 | * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. 1274 | * */ 1275 | Buffer.allocUnsafe = function (size) { 1276 | return allocUnsafe(size) 1277 | }; 1278 | /** 1279 | * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. 1280 | */ 1281 | Buffer.allocUnsafeSlow = function (size) { 1282 | return allocUnsafe(size) 1283 | }; 1284 | 1285 | function fromString (string, encoding) { 1286 | if (typeof encoding !== 'string' || encoding === '') { 1287 | encoding = 'utf8'; 1288 | } 1289 | 1290 | if (!Buffer.isEncoding(encoding)) { 1291 | throw new TypeError('Unknown encoding: ' + encoding) 1292 | } 1293 | 1294 | const length = byteLength(string, encoding) | 0; 1295 | let buf = createBuffer(length); 1296 | 1297 | const actual = buf.write(string, encoding); 1298 | 1299 | if (actual !== length) { 1300 | // Writing a hex string, for example, that contains invalid characters will 1301 | // cause everything after the first invalid character to be ignored. (e.g. 1302 | // 'abxxcd' will be treated as 'ab') 1303 | buf = buf.slice(0, actual); 1304 | } 1305 | 1306 | return buf 1307 | } 1308 | 1309 | function fromArrayLike (array) { 1310 | const length = array.length < 0 ? 0 : checked(array.length) | 0; 1311 | const buf = createBuffer(length); 1312 | for (let i = 0; i < length; i += 1) { 1313 | buf[i] = array[i] & 255; 1314 | } 1315 | return buf 1316 | } 1317 | 1318 | function fromArrayView (arrayView) { 1319 | if (isInstance(arrayView, Uint8Array)) { 1320 | const copy = new Uint8Array(arrayView); 1321 | return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) 1322 | } 1323 | return fromArrayLike(arrayView) 1324 | } 1325 | 1326 | function fromArrayBuffer (array, byteOffset, length) { 1327 | if (byteOffset < 0 || array.byteLength < byteOffset) { 1328 | throw new RangeError('"offset" is outside of buffer bounds') 1329 | } 1330 | 1331 | if (array.byteLength < byteOffset + (length || 0)) { 1332 | throw new RangeError('"length" is outside of buffer bounds') 1333 | } 1334 | 1335 | let buf; 1336 | if (byteOffset === undefined && length === undefined) { 1337 | buf = new Uint8Array(array); 1338 | } else if (length === undefined) { 1339 | buf = new Uint8Array(array, byteOffset); 1340 | } else { 1341 | buf = new Uint8Array(array, byteOffset, length); 1342 | } 1343 | 1344 | // Return an augmented `Uint8Array` instance 1345 | Object.setPrototypeOf(buf, Buffer.prototype); 1346 | 1347 | return buf 1348 | } 1349 | 1350 | function fromObject (obj) { 1351 | if (Buffer.isBuffer(obj)) { 1352 | const len = checked(obj.length) | 0; 1353 | const buf = createBuffer(len); 1354 | 1355 | if (buf.length === 0) { 1356 | return buf 1357 | } 1358 | 1359 | obj.copy(buf, 0, 0, len); 1360 | return buf 1361 | } 1362 | 1363 | if (obj.length !== undefined) { 1364 | if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { 1365 | return createBuffer(0) 1366 | } 1367 | return fromArrayLike(obj) 1368 | } 1369 | 1370 | if (obj.type === 'Buffer' && Array.isArray(obj.data)) { 1371 | return fromArrayLike(obj.data) 1372 | } 1373 | } 1374 | 1375 | function checked (length) { 1376 | // Note: cannot use `length < K_MAX_LENGTH` here because that fails when 1377 | // length is NaN (which is otherwise coerced to zero.) 1378 | if (length >= K_MAX_LENGTH) { 1379 | throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 1380 | 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') 1381 | } 1382 | return length | 0 1383 | } 1384 | 1385 | function SlowBuffer (length) { 1386 | if (+length != length) { // eslint-disable-line eqeqeq 1387 | length = 0; 1388 | } 1389 | return Buffer.alloc(+length) 1390 | } 1391 | 1392 | Buffer.isBuffer = function isBuffer (b) { 1393 | return b != null && b._isBuffer === true && 1394 | b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false 1395 | }; 1396 | 1397 | Buffer.compare = function compare (a, b) { 1398 | if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength); 1399 | if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength); 1400 | if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { 1401 | throw new TypeError( 1402 | 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' 1403 | ) 1404 | } 1405 | 1406 | if (a === b) return 0 1407 | 1408 | let x = a.length; 1409 | let y = b.length; 1410 | 1411 | for (let i = 0, len = Math.min(x, y); i < len; ++i) { 1412 | if (a[i] !== b[i]) { 1413 | x = a[i]; 1414 | y = b[i]; 1415 | break 1416 | } 1417 | } 1418 | 1419 | if (x < y) return -1 1420 | if (y < x) return 1 1421 | return 0 1422 | }; 1423 | 1424 | Buffer.isEncoding = function isEncoding (encoding) { 1425 | switch (String(encoding).toLowerCase()) { 1426 | case 'hex': 1427 | case 'utf8': 1428 | case 'utf-8': 1429 | case 'ascii': 1430 | case 'latin1': 1431 | case 'binary': 1432 | case 'base64': 1433 | case 'ucs2': 1434 | case 'ucs-2': 1435 | case 'utf16le': 1436 | case 'utf-16le': 1437 | return true 1438 | default: 1439 | return false 1440 | } 1441 | }; 1442 | 1443 | Buffer.concat = function concat (list, length) { 1444 | if (!Array.isArray(list)) { 1445 | throw new TypeError('"list" argument must be an Array of Buffers') 1446 | } 1447 | 1448 | if (list.length === 0) { 1449 | return Buffer.alloc(0) 1450 | } 1451 | 1452 | let i; 1453 | if (length === undefined) { 1454 | length = 0; 1455 | for (i = 0; i < list.length; ++i) { 1456 | length += list[i].length; 1457 | } 1458 | } 1459 | 1460 | const buffer = Buffer.allocUnsafe(length); 1461 | let pos = 0; 1462 | for (i = 0; i < list.length; ++i) { 1463 | let buf = list[i]; 1464 | if (isInstance(buf, Uint8Array)) { 1465 | if (pos + buf.length > buffer.length) { 1466 | if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf); 1467 | buf.copy(buffer, pos); 1468 | } else { 1469 | Uint8Array.prototype.set.call( 1470 | buffer, 1471 | buf, 1472 | pos 1473 | ); 1474 | } 1475 | } else if (!Buffer.isBuffer(buf)) { 1476 | throw new TypeError('"list" argument must be an Array of Buffers') 1477 | } else { 1478 | buf.copy(buffer, pos); 1479 | } 1480 | pos += buf.length; 1481 | } 1482 | return buffer 1483 | }; 1484 | 1485 | function byteLength (string, encoding) { 1486 | if (Buffer.isBuffer(string)) { 1487 | return string.length 1488 | } 1489 | if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { 1490 | return string.byteLength 1491 | } 1492 | if (typeof string !== 'string') { 1493 | throw new TypeError( 1494 | 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 1495 | 'Received type ' + typeof string 1496 | ) 1497 | } 1498 | 1499 | const len = string.length; 1500 | const mustMatch = (arguments.length > 2 && arguments[2] === true); 1501 | if (!mustMatch && len === 0) return 0 1502 | 1503 | // Use a for loop to avoid recursion 1504 | let loweredCase = false; 1505 | for (;;) { 1506 | switch (encoding) { 1507 | case 'ascii': 1508 | case 'latin1': 1509 | case 'binary': 1510 | return len 1511 | case 'utf8': 1512 | case 'utf-8': 1513 | return utf8ToBytes(string).length 1514 | case 'ucs2': 1515 | case 'ucs-2': 1516 | case 'utf16le': 1517 | case 'utf-16le': 1518 | return len * 2 1519 | case 'hex': 1520 | return len >>> 1 1521 | case 'base64': 1522 | return base64ToBytes(string).length 1523 | default: 1524 | if (loweredCase) { 1525 | return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 1526 | } 1527 | encoding = ('' + encoding).toLowerCase(); 1528 | loweredCase = true; 1529 | } 1530 | } 1531 | } 1532 | Buffer.byteLength = byteLength; 1533 | 1534 | function slowToString (encoding, start, end) { 1535 | let loweredCase = false; 1536 | 1537 | // No need to verify that "this.length <= MAX_UINT32" since it's a read-only 1538 | // property of a typed array. 1539 | 1540 | // This behaves neither like String nor Uint8Array in that we set start/end 1541 | // to their upper/lower bounds if the value passed is out of range. 1542 | // undefined is handled specially as per ECMA-262 6th Edition, 1543 | // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. 1544 | if (start === undefined || start < 0) { 1545 | start = 0; 1546 | } 1547 | // Return early if start > this.length. Done here to prevent potential uint32 1548 | // coercion fail below. 1549 | if (start > this.length) { 1550 | return '' 1551 | } 1552 | 1553 | if (end === undefined || end > this.length) { 1554 | end = this.length; 1555 | } 1556 | 1557 | if (end <= 0) { 1558 | return '' 1559 | } 1560 | 1561 | // Force coercion to uint32. This will also coerce falsey/NaN values to 0. 1562 | end >>>= 0; 1563 | start >>>= 0; 1564 | 1565 | if (end <= start) { 1566 | return '' 1567 | } 1568 | 1569 | if (!encoding) encoding = 'utf8'; 1570 | 1571 | while (true) { 1572 | switch (encoding) { 1573 | case 'hex': 1574 | return hexSlice(this, start, end) 1575 | 1576 | case 'utf8': 1577 | case 'utf-8': 1578 | return utf8Slice(this, start, end) 1579 | 1580 | case 'ascii': 1581 | return asciiSlice(this, start, end) 1582 | 1583 | case 'latin1': 1584 | case 'binary': 1585 | return latin1Slice(this, start, end) 1586 | 1587 | case 'base64': 1588 | return base64Slice(this, start, end) 1589 | 1590 | case 'ucs2': 1591 | case 'ucs-2': 1592 | case 'utf16le': 1593 | case 'utf-16le': 1594 | return utf16leSlice(this, start, end) 1595 | 1596 | default: 1597 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) 1598 | encoding = (encoding + '').toLowerCase(); 1599 | loweredCase = true; 1600 | } 1601 | } 1602 | } 1603 | 1604 | // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) 1605 | // to detect a Buffer instance. It's not possible to use `instanceof Buffer` 1606 | // reliably in a browserify context because there could be multiple different 1607 | // copies of the 'buffer' package in use. This method works even for Buffer 1608 | // instances that were created from another copy of the `buffer` package. 1609 | // See: https://github.com/feross/buffer/issues/154 1610 | Buffer.prototype._isBuffer = true; 1611 | 1612 | function swap (b, n, m) { 1613 | const i = b[n]; 1614 | b[n] = b[m]; 1615 | b[m] = i; 1616 | } 1617 | 1618 | Buffer.prototype.swap16 = function swap16 () { 1619 | const len = this.length; 1620 | if (len % 2 !== 0) { 1621 | throw new RangeError('Buffer size must be a multiple of 16-bits') 1622 | } 1623 | for (let i = 0; i < len; i += 2) { 1624 | swap(this, i, i + 1); 1625 | } 1626 | return this 1627 | }; 1628 | 1629 | Buffer.prototype.swap32 = function swap32 () { 1630 | const len = this.length; 1631 | if (len % 4 !== 0) { 1632 | throw new RangeError('Buffer size must be a multiple of 32-bits') 1633 | } 1634 | for (let i = 0; i < len; i += 4) { 1635 | swap(this, i, i + 3); 1636 | swap(this, i + 1, i + 2); 1637 | } 1638 | return this 1639 | }; 1640 | 1641 | Buffer.prototype.swap64 = function swap64 () { 1642 | const len = this.length; 1643 | if (len % 8 !== 0) { 1644 | throw new RangeError('Buffer size must be a multiple of 64-bits') 1645 | } 1646 | for (let i = 0; i < len; i += 8) { 1647 | swap(this, i, i + 7); 1648 | swap(this, i + 1, i + 6); 1649 | swap(this, i + 2, i + 5); 1650 | swap(this, i + 3, i + 4); 1651 | } 1652 | return this 1653 | }; 1654 | 1655 | Buffer.prototype.toString = function toString () { 1656 | const length = this.length; 1657 | if (length === 0) return '' 1658 | if (arguments.length === 0) return utf8Slice(this, 0, length) 1659 | return slowToString.apply(this, arguments) 1660 | }; 1661 | 1662 | Buffer.prototype.toLocaleString = Buffer.prototype.toString; 1663 | 1664 | Buffer.prototype.equals = function equals (b) { 1665 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') 1666 | if (this === b) return true 1667 | return Buffer.compare(this, b) === 0 1668 | }; 1669 | 1670 | Buffer.prototype.inspect = function inspect () { 1671 | let str = ''; 1672 | const max = exports.INSPECT_MAX_BYTES; 1673 | str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); 1674 | if (this.length > max) str += ' ... '; 1675 | return '' 1676 | }; 1677 | if (customInspectSymbol) { 1678 | Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect; 1679 | } 1680 | 1681 | Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { 1682 | if (isInstance(target, Uint8Array)) { 1683 | target = Buffer.from(target, target.offset, target.byteLength); 1684 | } 1685 | if (!Buffer.isBuffer(target)) { 1686 | throw new TypeError( 1687 | 'The "target" argument must be one of type Buffer or Uint8Array. ' + 1688 | 'Received type ' + (typeof target) 1689 | ) 1690 | } 1691 | 1692 | if (start === undefined) { 1693 | start = 0; 1694 | } 1695 | if (end === undefined) { 1696 | end = target ? target.length : 0; 1697 | } 1698 | if (thisStart === undefined) { 1699 | thisStart = 0; 1700 | } 1701 | if (thisEnd === undefined) { 1702 | thisEnd = this.length; 1703 | } 1704 | 1705 | if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { 1706 | throw new RangeError('out of range index') 1707 | } 1708 | 1709 | if (thisStart >= thisEnd && start >= end) { 1710 | return 0 1711 | } 1712 | if (thisStart >= thisEnd) { 1713 | return -1 1714 | } 1715 | if (start >= end) { 1716 | return 1 1717 | } 1718 | 1719 | start >>>= 0; 1720 | end >>>= 0; 1721 | thisStart >>>= 0; 1722 | thisEnd >>>= 0; 1723 | 1724 | if (this === target) return 0 1725 | 1726 | let x = thisEnd - thisStart; 1727 | let y = end - start; 1728 | const len = Math.min(x, y); 1729 | 1730 | const thisCopy = this.slice(thisStart, thisEnd); 1731 | const targetCopy = target.slice(start, end); 1732 | 1733 | for (let i = 0; i < len; ++i) { 1734 | if (thisCopy[i] !== targetCopy[i]) { 1735 | x = thisCopy[i]; 1736 | y = targetCopy[i]; 1737 | break 1738 | } 1739 | } 1740 | 1741 | if (x < y) return -1 1742 | if (y < x) return 1 1743 | return 0 1744 | }; 1745 | 1746 | // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, 1747 | // OR the last index of `val` in `buffer` at offset <= `byteOffset`. 1748 | // 1749 | // Arguments: 1750 | // - buffer - a Buffer to search 1751 | // - val - a string, Buffer, or number 1752 | // - byteOffset - an index into `buffer`; will be clamped to an int32 1753 | // - encoding - an optional encoding, relevant is val is a string 1754 | // - dir - true for indexOf, false for lastIndexOf 1755 | function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { 1756 | // Empty buffer means no match 1757 | if (buffer.length === 0) return -1 1758 | 1759 | // Normalize byteOffset 1760 | if (typeof byteOffset === 'string') { 1761 | encoding = byteOffset; 1762 | byteOffset = 0; 1763 | } else if (byteOffset > 0x7fffffff) { 1764 | byteOffset = 0x7fffffff; 1765 | } else if (byteOffset < -0x80000000) { 1766 | byteOffset = -0x80000000; 1767 | } 1768 | byteOffset = +byteOffset; // Coerce to Number. 1769 | if (numberIsNaN(byteOffset)) { 1770 | // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer 1771 | byteOffset = dir ? 0 : (buffer.length - 1); 1772 | } 1773 | 1774 | // Normalize byteOffset: negative offsets start from the end of the buffer 1775 | if (byteOffset < 0) byteOffset = buffer.length + byteOffset; 1776 | if (byteOffset >= buffer.length) { 1777 | if (dir) return -1 1778 | else byteOffset = buffer.length - 1; 1779 | } else if (byteOffset < 0) { 1780 | if (dir) byteOffset = 0; 1781 | else return -1 1782 | } 1783 | 1784 | // Normalize val 1785 | if (typeof val === 'string') { 1786 | val = Buffer.from(val, encoding); 1787 | } 1788 | 1789 | // Finally, search either indexOf (if dir is true) or lastIndexOf 1790 | if (Buffer.isBuffer(val)) { 1791 | // Special case: looking for empty string/buffer always fails 1792 | if (val.length === 0) { 1793 | return -1 1794 | } 1795 | return arrayIndexOf(buffer, val, byteOffset, encoding, dir) 1796 | } else if (typeof val === 'number') { 1797 | val = val & 0xFF; // Search for a byte value [0-255] 1798 | if (typeof Uint8Array.prototype.indexOf === 'function') { 1799 | if (dir) { 1800 | return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) 1801 | } else { 1802 | return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) 1803 | } 1804 | } 1805 | return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) 1806 | } 1807 | 1808 | throw new TypeError('val must be string, number or Buffer') 1809 | } 1810 | 1811 | function arrayIndexOf (arr, val, byteOffset, encoding, dir) { 1812 | let indexSize = 1; 1813 | let arrLength = arr.length; 1814 | let valLength = val.length; 1815 | 1816 | if (encoding !== undefined) { 1817 | encoding = String(encoding).toLowerCase(); 1818 | if (encoding === 'ucs2' || encoding === 'ucs-2' || 1819 | encoding === 'utf16le' || encoding === 'utf-16le') { 1820 | if (arr.length < 2 || val.length < 2) { 1821 | return -1 1822 | } 1823 | indexSize = 2; 1824 | arrLength /= 2; 1825 | valLength /= 2; 1826 | byteOffset /= 2; 1827 | } 1828 | } 1829 | 1830 | function read (buf, i) { 1831 | if (indexSize === 1) { 1832 | return buf[i] 1833 | } else { 1834 | return buf.readUInt16BE(i * indexSize) 1835 | } 1836 | } 1837 | 1838 | let i; 1839 | if (dir) { 1840 | let foundIndex = -1; 1841 | for (i = byteOffset; i < arrLength; i++) { 1842 | if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { 1843 | if (foundIndex === -1) foundIndex = i; 1844 | if (i - foundIndex + 1 === valLength) return foundIndex * indexSize 1845 | } else { 1846 | if (foundIndex !== -1) i -= i - foundIndex; 1847 | foundIndex = -1; 1848 | } 1849 | } 1850 | } else { 1851 | if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; 1852 | for (i = byteOffset; i >= 0; i--) { 1853 | let found = true; 1854 | for (let j = 0; j < valLength; j++) { 1855 | if (read(arr, i + j) !== read(val, j)) { 1856 | found = false; 1857 | break 1858 | } 1859 | } 1860 | if (found) return i 1861 | } 1862 | } 1863 | 1864 | return -1 1865 | } 1866 | 1867 | Buffer.prototype.includes = function includes (val, byteOffset, encoding) { 1868 | return this.indexOf(val, byteOffset, encoding) !== -1 1869 | }; 1870 | 1871 | Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { 1872 | return bidirectionalIndexOf(this, val, byteOffset, encoding, true) 1873 | }; 1874 | 1875 | Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { 1876 | return bidirectionalIndexOf(this, val, byteOffset, encoding, false) 1877 | }; 1878 | 1879 | function hexWrite (buf, string, offset, length) { 1880 | offset = Number(offset) || 0; 1881 | const remaining = buf.length - offset; 1882 | if (!length) { 1883 | length = remaining; 1884 | } else { 1885 | length = Number(length); 1886 | if (length > remaining) { 1887 | length = remaining; 1888 | } 1889 | } 1890 | 1891 | const strLen = string.length; 1892 | 1893 | if (length > strLen / 2) { 1894 | length = strLen / 2; 1895 | } 1896 | let i; 1897 | for (i = 0; i < length; ++i) { 1898 | const parsed = parseInt(string.substr(i * 2, 2), 16); 1899 | if (numberIsNaN(parsed)) return i 1900 | buf[offset + i] = parsed; 1901 | } 1902 | return i 1903 | } 1904 | 1905 | function utf8Write (buf, string, offset, length) { 1906 | return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) 1907 | } 1908 | 1909 | function asciiWrite (buf, string, offset, length) { 1910 | return blitBuffer(asciiToBytes(string), buf, offset, length) 1911 | } 1912 | 1913 | function base64Write (buf, string, offset, length) { 1914 | return blitBuffer(base64ToBytes(string), buf, offset, length) 1915 | } 1916 | 1917 | function ucs2Write (buf, string, offset, length) { 1918 | return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) 1919 | } 1920 | 1921 | Buffer.prototype.write = function write (string, offset, length, encoding) { 1922 | // Buffer#write(string) 1923 | if (offset === undefined) { 1924 | encoding = 'utf8'; 1925 | length = this.length; 1926 | offset = 0; 1927 | // Buffer#write(string, encoding) 1928 | } else if (length === undefined && typeof offset === 'string') { 1929 | encoding = offset; 1930 | length = this.length; 1931 | offset = 0; 1932 | // Buffer#write(string, offset[, length][, encoding]) 1933 | } else if (isFinite(offset)) { 1934 | offset = offset >>> 0; 1935 | if (isFinite(length)) { 1936 | length = length >>> 0; 1937 | if (encoding === undefined) encoding = 'utf8'; 1938 | } else { 1939 | encoding = length; 1940 | length = undefined; 1941 | } 1942 | } else { 1943 | throw new Error( 1944 | 'Buffer.write(string, encoding, offset[, length]) is no longer supported' 1945 | ) 1946 | } 1947 | 1948 | const remaining = this.length - offset; 1949 | if (length === undefined || length > remaining) length = remaining; 1950 | 1951 | if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { 1952 | throw new RangeError('Attempt to write outside buffer bounds') 1953 | } 1954 | 1955 | if (!encoding) encoding = 'utf8'; 1956 | 1957 | let loweredCase = false; 1958 | for (;;) { 1959 | switch (encoding) { 1960 | case 'hex': 1961 | return hexWrite(this, string, offset, length) 1962 | 1963 | case 'utf8': 1964 | case 'utf-8': 1965 | return utf8Write(this, string, offset, length) 1966 | 1967 | case 'ascii': 1968 | case 'latin1': 1969 | case 'binary': 1970 | return asciiWrite(this, string, offset, length) 1971 | 1972 | case 'base64': 1973 | // Warning: maxLength not taken into account in base64Write 1974 | return base64Write(this, string, offset, length) 1975 | 1976 | case 'ucs2': 1977 | case 'ucs-2': 1978 | case 'utf16le': 1979 | case 'utf-16le': 1980 | return ucs2Write(this, string, offset, length) 1981 | 1982 | default: 1983 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) 1984 | encoding = ('' + encoding).toLowerCase(); 1985 | loweredCase = true; 1986 | } 1987 | } 1988 | }; 1989 | 1990 | Buffer.prototype.toJSON = function toJSON () { 1991 | return { 1992 | type: 'Buffer', 1993 | data: Array.prototype.slice.call(this._arr || this, 0) 1994 | } 1995 | }; 1996 | 1997 | function base64Slice (buf, start, end) { 1998 | if (start === 0 && end === buf.length) { 1999 | return base64Js.fromByteArray(buf) 2000 | } else { 2001 | return base64Js.fromByteArray(buf.slice(start, end)) 2002 | } 2003 | } 2004 | 2005 | function utf8Slice (buf, start, end) { 2006 | end = Math.min(buf.length, end); 2007 | const res = []; 2008 | 2009 | let i = start; 2010 | while (i < end) { 2011 | const firstByte = buf[i]; 2012 | let codePoint = null; 2013 | let bytesPerSequence = (firstByte > 0xEF) 2014 | ? 4 2015 | : (firstByte > 0xDF) 2016 | ? 3 2017 | : (firstByte > 0xBF) 2018 | ? 2 2019 | : 1; 2020 | 2021 | if (i + bytesPerSequence <= end) { 2022 | let secondByte, thirdByte, fourthByte, tempCodePoint; 2023 | 2024 | switch (bytesPerSequence) { 2025 | case 1: 2026 | if (firstByte < 0x80) { 2027 | codePoint = firstByte; 2028 | } 2029 | break 2030 | case 2: 2031 | secondByte = buf[i + 1]; 2032 | if ((secondByte & 0xC0) === 0x80) { 2033 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F); 2034 | if (tempCodePoint > 0x7F) { 2035 | codePoint = tempCodePoint; 2036 | } 2037 | } 2038 | break 2039 | case 3: 2040 | secondByte = buf[i + 1]; 2041 | thirdByte = buf[i + 2]; 2042 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { 2043 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F); 2044 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { 2045 | codePoint = tempCodePoint; 2046 | } 2047 | } 2048 | break 2049 | case 4: 2050 | secondByte = buf[i + 1]; 2051 | thirdByte = buf[i + 2]; 2052 | fourthByte = buf[i + 3]; 2053 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { 2054 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F); 2055 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { 2056 | codePoint = tempCodePoint; 2057 | } 2058 | } 2059 | } 2060 | } 2061 | 2062 | if (codePoint === null) { 2063 | // we did not generate a valid codePoint so insert a 2064 | // replacement char (U+FFFD) and advance only 1 byte 2065 | codePoint = 0xFFFD; 2066 | bytesPerSequence = 1; 2067 | } else if (codePoint > 0xFFFF) { 2068 | // encode to utf16 (surrogate pair dance) 2069 | codePoint -= 0x10000; 2070 | res.push(codePoint >>> 10 & 0x3FF | 0xD800); 2071 | codePoint = 0xDC00 | codePoint & 0x3FF; 2072 | } 2073 | 2074 | res.push(codePoint); 2075 | i += bytesPerSequence; 2076 | } 2077 | 2078 | return decodeCodePointsArray(res) 2079 | } 2080 | 2081 | // Based on http://stackoverflow.com/a/22747272/680742, the browser with 2082 | // the lowest limit is Chrome, with 0x10000 args. 2083 | // We go 1 magnitude less, for safety 2084 | const MAX_ARGUMENTS_LENGTH = 0x1000; 2085 | 2086 | function decodeCodePointsArray (codePoints) { 2087 | const len = codePoints.length; 2088 | if (len <= MAX_ARGUMENTS_LENGTH) { 2089 | return String.fromCharCode.apply(String, codePoints) // avoid extra slice() 2090 | } 2091 | 2092 | // Decode in chunks to avoid "call stack size exceeded". 2093 | let res = ''; 2094 | let i = 0; 2095 | while (i < len) { 2096 | res += String.fromCharCode.apply( 2097 | String, 2098 | codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) 2099 | ); 2100 | } 2101 | return res 2102 | } 2103 | 2104 | function asciiSlice (buf, start, end) { 2105 | let ret = ''; 2106 | end = Math.min(buf.length, end); 2107 | 2108 | for (let i = start; i < end; ++i) { 2109 | ret += String.fromCharCode(buf[i] & 0x7F); 2110 | } 2111 | return ret 2112 | } 2113 | 2114 | function latin1Slice (buf, start, end) { 2115 | let ret = ''; 2116 | end = Math.min(buf.length, end); 2117 | 2118 | for (let i = start; i < end; ++i) { 2119 | ret += String.fromCharCode(buf[i]); 2120 | } 2121 | return ret 2122 | } 2123 | 2124 | function hexSlice (buf, start, end) { 2125 | const len = buf.length; 2126 | 2127 | if (!start || start < 0) start = 0; 2128 | if (!end || end < 0 || end > len) end = len; 2129 | 2130 | let out = ''; 2131 | for (let i = start; i < end; ++i) { 2132 | out += hexSliceLookupTable[buf[i]]; 2133 | } 2134 | return out 2135 | } 2136 | 2137 | function utf16leSlice (buf, start, end) { 2138 | const bytes = buf.slice(start, end); 2139 | let res = ''; 2140 | // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) 2141 | for (let i = 0; i < bytes.length - 1; i += 2) { 2142 | res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)); 2143 | } 2144 | return res 2145 | } 2146 | 2147 | Buffer.prototype.slice = function slice (start, end) { 2148 | const len = this.length; 2149 | start = ~~start; 2150 | end = end === undefined ? len : ~~end; 2151 | 2152 | if (start < 0) { 2153 | start += len; 2154 | if (start < 0) start = 0; 2155 | } else if (start > len) { 2156 | start = len; 2157 | } 2158 | 2159 | if (end < 0) { 2160 | end += len; 2161 | if (end < 0) end = 0; 2162 | } else if (end > len) { 2163 | end = len; 2164 | } 2165 | 2166 | if (end < start) end = start; 2167 | 2168 | const newBuf = this.subarray(start, end); 2169 | // Return an augmented `Uint8Array` instance 2170 | Object.setPrototypeOf(newBuf, Buffer.prototype); 2171 | 2172 | return newBuf 2173 | }; 2174 | 2175 | /* 2176 | * Need to make sure that buffer isn't trying to write out of bounds. 2177 | */ 2178 | function checkOffset (offset, ext, length) { 2179 | if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') 2180 | if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') 2181 | } 2182 | 2183 | Buffer.prototype.readUintLE = 2184 | Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { 2185 | offset = offset >>> 0; 2186 | byteLength = byteLength >>> 0; 2187 | if (!noAssert) checkOffset(offset, byteLength, this.length); 2188 | 2189 | let val = this[offset]; 2190 | let mul = 1; 2191 | let i = 0; 2192 | while (++i < byteLength && (mul *= 0x100)) { 2193 | val += this[offset + i] * mul; 2194 | } 2195 | 2196 | return val 2197 | }; 2198 | 2199 | Buffer.prototype.readUintBE = 2200 | Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { 2201 | offset = offset >>> 0; 2202 | byteLength = byteLength >>> 0; 2203 | if (!noAssert) { 2204 | checkOffset(offset, byteLength, this.length); 2205 | } 2206 | 2207 | let val = this[offset + --byteLength]; 2208 | let mul = 1; 2209 | while (byteLength > 0 && (mul *= 0x100)) { 2210 | val += this[offset + --byteLength] * mul; 2211 | } 2212 | 2213 | return val 2214 | }; 2215 | 2216 | Buffer.prototype.readUint8 = 2217 | Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { 2218 | offset = offset >>> 0; 2219 | if (!noAssert) checkOffset(offset, 1, this.length); 2220 | return this[offset] 2221 | }; 2222 | 2223 | Buffer.prototype.readUint16LE = 2224 | Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { 2225 | offset = offset >>> 0; 2226 | if (!noAssert) checkOffset(offset, 2, this.length); 2227 | return this[offset] | (this[offset + 1] << 8) 2228 | }; 2229 | 2230 | Buffer.prototype.readUint16BE = 2231 | Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { 2232 | offset = offset >>> 0; 2233 | if (!noAssert) checkOffset(offset, 2, this.length); 2234 | return (this[offset] << 8) | this[offset + 1] 2235 | }; 2236 | 2237 | Buffer.prototype.readUint32LE = 2238 | Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { 2239 | offset = offset >>> 0; 2240 | if (!noAssert) checkOffset(offset, 4, this.length); 2241 | 2242 | return ((this[offset]) | 2243 | (this[offset + 1] << 8) | 2244 | (this[offset + 2] << 16)) + 2245 | (this[offset + 3] * 0x1000000) 2246 | }; 2247 | 2248 | Buffer.prototype.readUint32BE = 2249 | Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { 2250 | offset = offset >>> 0; 2251 | if (!noAssert) checkOffset(offset, 4, this.length); 2252 | 2253 | return (this[offset] * 0x1000000) + 2254 | ((this[offset + 1] << 16) | 2255 | (this[offset + 2] << 8) | 2256 | this[offset + 3]) 2257 | }; 2258 | 2259 | Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { 2260 | offset = offset >>> 0; 2261 | validateNumber(offset, 'offset'); 2262 | const first = this[offset]; 2263 | const last = this[offset + 7]; 2264 | if (first === undefined || last === undefined) { 2265 | boundsError(offset, this.length - 8); 2266 | } 2267 | 2268 | const lo = first + 2269 | this[++offset] * 2 ** 8 + 2270 | this[++offset] * 2 ** 16 + 2271 | this[++offset] * 2 ** 24; 2272 | 2273 | const hi = this[++offset] + 2274 | this[++offset] * 2 ** 8 + 2275 | this[++offset] * 2 ** 16 + 2276 | last * 2 ** 24; 2277 | 2278 | return BigInt(lo) + (BigInt(hi) << BigInt(32)) 2279 | }); 2280 | 2281 | Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { 2282 | offset = offset >>> 0; 2283 | validateNumber(offset, 'offset'); 2284 | const first = this[offset]; 2285 | const last = this[offset + 7]; 2286 | if (first === undefined || last === undefined) { 2287 | boundsError(offset, this.length - 8); 2288 | } 2289 | 2290 | const hi = first * 2 ** 24 + 2291 | this[++offset] * 2 ** 16 + 2292 | this[++offset] * 2 ** 8 + 2293 | this[++offset]; 2294 | 2295 | const lo = this[++offset] * 2 ** 24 + 2296 | this[++offset] * 2 ** 16 + 2297 | this[++offset] * 2 ** 8 + 2298 | last; 2299 | 2300 | return (BigInt(hi) << BigInt(32)) + BigInt(lo) 2301 | }); 2302 | 2303 | Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { 2304 | offset = offset >>> 0; 2305 | byteLength = byteLength >>> 0; 2306 | if (!noAssert) checkOffset(offset, byteLength, this.length); 2307 | 2308 | let val = this[offset]; 2309 | let mul = 1; 2310 | let i = 0; 2311 | while (++i < byteLength && (mul *= 0x100)) { 2312 | val += this[offset + i] * mul; 2313 | } 2314 | mul *= 0x80; 2315 | 2316 | if (val >= mul) val -= Math.pow(2, 8 * byteLength); 2317 | 2318 | return val 2319 | }; 2320 | 2321 | Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { 2322 | offset = offset >>> 0; 2323 | byteLength = byteLength >>> 0; 2324 | if (!noAssert) checkOffset(offset, byteLength, this.length); 2325 | 2326 | let i = byteLength; 2327 | let mul = 1; 2328 | let val = this[offset + --i]; 2329 | while (i > 0 && (mul *= 0x100)) { 2330 | val += this[offset + --i] * mul; 2331 | } 2332 | mul *= 0x80; 2333 | 2334 | if (val >= mul) val -= Math.pow(2, 8 * byteLength); 2335 | 2336 | return val 2337 | }; 2338 | 2339 | Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { 2340 | offset = offset >>> 0; 2341 | if (!noAssert) checkOffset(offset, 1, this.length); 2342 | if (!(this[offset] & 0x80)) return (this[offset]) 2343 | return ((0xff - this[offset] + 1) * -1) 2344 | }; 2345 | 2346 | Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { 2347 | offset = offset >>> 0; 2348 | if (!noAssert) checkOffset(offset, 2, this.length); 2349 | const val = this[offset] | (this[offset + 1] << 8); 2350 | return (val & 0x8000) ? val | 0xFFFF0000 : val 2351 | }; 2352 | 2353 | Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { 2354 | offset = offset >>> 0; 2355 | if (!noAssert) checkOffset(offset, 2, this.length); 2356 | const val = this[offset + 1] | (this[offset] << 8); 2357 | return (val & 0x8000) ? val | 0xFFFF0000 : val 2358 | }; 2359 | 2360 | Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { 2361 | offset = offset >>> 0; 2362 | if (!noAssert) checkOffset(offset, 4, this.length); 2363 | 2364 | return (this[offset]) | 2365 | (this[offset + 1] << 8) | 2366 | (this[offset + 2] << 16) | 2367 | (this[offset + 3] << 24) 2368 | }; 2369 | 2370 | Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { 2371 | offset = offset >>> 0; 2372 | if (!noAssert) checkOffset(offset, 4, this.length); 2373 | 2374 | return (this[offset] << 24) | 2375 | (this[offset + 1] << 16) | 2376 | (this[offset + 2] << 8) | 2377 | (this[offset + 3]) 2378 | }; 2379 | 2380 | Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { 2381 | offset = offset >>> 0; 2382 | validateNumber(offset, 'offset'); 2383 | const first = this[offset]; 2384 | const last = this[offset + 7]; 2385 | if (first === undefined || last === undefined) { 2386 | boundsError(offset, this.length - 8); 2387 | } 2388 | 2389 | const val = this[offset + 4] + 2390 | this[offset + 5] * 2 ** 8 + 2391 | this[offset + 6] * 2 ** 16 + 2392 | (last << 24); // Overflow 2393 | 2394 | return (BigInt(val) << BigInt(32)) + 2395 | BigInt(first + 2396 | this[++offset] * 2 ** 8 + 2397 | this[++offset] * 2 ** 16 + 2398 | this[++offset] * 2 ** 24) 2399 | }); 2400 | 2401 | Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { 2402 | offset = offset >>> 0; 2403 | validateNumber(offset, 'offset'); 2404 | const first = this[offset]; 2405 | const last = this[offset + 7]; 2406 | if (first === undefined || last === undefined) { 2407 | boundsError(offset, this.length - 8); 2408 | } 2409 | 2410 | const val = (first << 24) + // Overflow 2411 | this[++offset] * 2 ** 16 + 2412 | this[++offset] * 2 ** 8 + 2413 | this[++offset]; 2414 | 2415 | return (BigInt(val) << BigInt(32)) + 2416 | BigInt(this[++offset] * 2 ** 24 + 2417 | this[++offset] * 2 ** 16 + 2418 | this[++offset] * 2 ** 8 + 2419 | last) 2420 | }); 2421 | 2422 | Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { 2423 | offset = offset >>> 0; 2424 | if (!noAssert) checkOffset(offset, 4, this.length); 2425 | return ieee754.read(this, offset, true, 23, 4) 2426 | }; 2427 | 2428 | Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { 2429 | offset = offset >>> 0; 2430 | if (!noAssert) checkOffset(offset, 4, this.length); 2431 | return ieee754.read(this, offset, false, 23, 4) 2432 | }; 2433 | 2434 | Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { 2435 | offset = offset >>> 0; 2436 | if (!noAssert) checkOffset(offset, 8, this.length); 2437 | return ieee754.read(this, offset, true, 52, 8) 2438 | }; 2439 | 2440 | Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { 2441 | offset = offset >>> 0; 2442 | if (!noAssert) checkOffset(offset, 8, this.length); 2443 | return ieee754.read(this, offset, false, 52, 8) 2444 | }; 2445 | 2446 | function checkInt (buf, value, offset, ext, max, min) { 2447 | if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') 2448 | if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') 2449 | if (offset + ext > buf.length) throw new RangeError('Index out of range') 2450 | } 2451 | 2452 | Buffer.prototype.writeUintLE = 2453 | Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { 2454 | value = +value; 2455 | offset = offset >>> 0; 2456 | byteLength = byteLength >>> 0; 2457 | if (!noAssert) { 2458 | const maxBytes = Math.pow(2, 8 * byteLength) - 1; 2459 | checkInt(this, value, offset, byteLength, maxBytes, 0); 2460 | } 2461 | 2462 | let mul = 1; 2463 | let i = 0; 2464 | this[offset] = value & 0xFF; 2465 | while (++i < byteLength && (mul *= 0x100)) { 2466 | this[offset + i] = (value / mul) & 0xFF; 2467 | } 2468 | 2469 | return offset + byteLength 2470 | }; 2471 | 2472 | Buffer.prototype.writeUintBE = 2473 | Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { 2474 | value = +value; 2475 | offset = offset >>> 0; 2476 | byteLength = byteLength >>> 0; 2477 | if (!noAssert) { 2478 | const maxBytes = Math.pow(2, 8 * byteLength) - 1; 2479 | checkInt(this, value, offset, byteLength, maxBytes, 0); 2480 | } 2481 | 2482 | let i = byteLength - 1; 2483 | let mul = 1; 2484 | this[offset + i] = value & 0xFF; 2485 | while (--i >= 0 && (mul *= 0x100)) { 2486 | this[offset + i] = (value / mul) & 0xFF; 2487 | } 2488 | 2489 | return offset + byteLength 2490 | }; 2491 | 2492 | Buffer.prototype.writeUint8 = 2493 | Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { 2494 | value = +value; 2495 | offset = offset >>> 0; 2496 | if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); 2497 | this[offset] = (value & 0xff); 2498 | return offset + 1 2499 | }; 2500 | 2501 | Buffer.prototype.writeUint16LE = 2502 | Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { 2503 | value = +value; 2504 | offset = offset >>> 0; 2505 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); 2506 | this[offset] = (value & 0xff); 2507 | this[offset + 1] = (value >>> 8); 2508 | return offset + 2 2509 | }; 2510 | 2511 | Buffer.prototype.writeUint16BE = 2512 | Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { 2513 | value = +value; 2514 | offset = offset >>> 0; 2515 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); 2516 | this[offset] = (value >>> 8); 2517 | this[offset + 1] = (value & 0xff); 2518 | return offset + 2 2519 | }; 2520 | 2521 | Buffer.prototype.writeUint32LE = 2522 | Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { 2523 | value = +value; 2524 | offset = offset >>> 0; 2525 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); 2526 | this[offset + 3] = (value >>> 24); 2527 | this[offset + 2] = (value >>> 16); 2528 | this[offset + 1] = (value >>> 8); 2529 | this[offset] = (value & 0xff); 2530 | return offset + 4 2531 | }; 2532 | 2533 | Buffer.prototype.writeUint32BE = 2534 | Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { 2535 | value = +value; 2536 | offset = offset >>> 0; 2537 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); 2538 | this[offset] = (value >>> 24); 2539 | this[offset + 1] = (value >>> 16); 2540 | this[offset + 2] = (value >>> 8); 2541 | this[offset + 3] = (value & 0xff); 2542 | return offset + 4 2543 | }; 2544 | 2545 | function wrtBigUInt64LE (buf, value, offset, min, max) { 2546 | checkIntBI(value, min, max, buf, offset, 7); 2547 | 2548 | let lo = Number(value & BigInt(0xffffffff)); 2549 | buf[offset++] = lo; 2550 | lo = lo >> 8; 2551 | buf[offset++] = lo; 2552 | lo = lo >> 8; 2553 | buf[offset++] = lo; 2554 | lo = lo >> 8; 2555 | buf[offset++] = lo; 2556 | let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); 2557 | buf[offset++] = hi; 2558 | hi = hi >> 8; 2559 | buf[offset++] = hi; 2560 | hi = hi >> 8; 2561 | buf[offset++] = hi; 2562 | hi = hi >> 8; 2563 | buf[offset++] = hi; 2564 | return offset 2565 | } 2566 | 2567 | function wrtBigUInt64BE (buf, value, offset, min, max) { 2568 | checkIntBI(value, min, max, buf, offset, 7); 2569 | 2570 | let lo = Number(value & BigInt(0xffffffff)); 2571 | buf[offset + 7] = lo; 2572 | lo = lo >> 8; 2573 | buf[offset + 6] = lo; 2574 | lo = lo >> 8; 2575 | buf[offset + 5] = lo; 2576 | lo = lo >> 8; 2577 | buf[offset + 4] = lo; 2578 | let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); 2579 | buf[offset + 3] = hi; 2580 | hi = hi >> 8; 2581 | buf[offset + 2] = hi; 2582 | hi = hi >> 8; 2583 | buf[offset + 1] = hi; 2584 | hi = hi >> 8; 2585 | buf[offset] = hi; 2586 | return offset + 8 2587 | } 2588 | 2589 | Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { 2590 | return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) 2591 | }); 2592 | 2593 | Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { 2594 | return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) 2595 | }); 2596 | 2597 | Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { 2598 | value = +value; 2599 | offset = offset >>> 0; 2600 | if (!noAssert) { 2601 | const limit = Math.pow(2, (8 * byteLength) - 1); 2602 | 2603 | checkInt(this, value, offset, byteLength, limit - 1, -limit); 2604 | } 2605 | 2606 | let i = 0; 2607 | let mul = 1; 2608 | let sub = 0; 2609 | this[offset] = value & 0xFF; 2610 | while (++i < byteLength && (mul *= 0x100)) { 2611 | if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { 2612 | sub = 1; 2613 | } 2614 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF; 2615 | } 2616 | 2617 | return offset + byteLength 2618 | }; 2619 | 2620 | Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { 2621 | value = +value; 2622 | offset = offset >>> 0; 2623 | if (!noAssert) { 2624 | const limit = Math.pow(2, (8 * byteLength) - 1); 2625 | 2626 | checkInt(this, value, offset, byteLength, limit - 1, -limit); 2627 | } 2628 | 2629 | let i = byteLength - 1; 2630 | let mul = 1; 2631 | let sub = 0; 2632 | this[offset + i] = value & 0xFF; 2633 | while (--i >= 0 && (mul *= 0x100)) { 2634 | if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { 2635 | sub = 1; 2636 | } 2637 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF; 2638 | } 2639 | 2640 | return offset + byteLength 2641 | }; 2642 | 2643 | Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { 2644 | value = +value; 2645 | offset = offset >>> 0; 2646 | if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80); 2647 | if (value < 0) value = 0xff + value + 1; 2648 | this[offset] = (value & 0xff); 2649 | return offset + 1 2650 | }; 2651 | 2652 | Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { 2653 | value = +value; 2654 | offset = offset >>> 0; 2655 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); 2656 | this[offset] = (value & 0xff); 2657 | this[offset + 1] = (value >>> 8); 2658 | return offset + 2 2659 | }; 2660 | 2661 | Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { 2662 | value = +value; 2663 | offset = offset >>> 0; 2664 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); 2665 | this[offset] = (value >>> 8); 2666 | this[offset + 1] = (value & 0xff); 2667 | return offset + 2 2668 | }; 2669 | 2670 | Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { 2671 | value = +value; 2672 | offset = offset >>> 0; 2673 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); 2674 | this[offset] = (value & 0xff); 2675 | this[offset + 1] = (value >>> 8); 2676 | this[offset + 2] = (value >>> 16); 2677 | this[offset + 3] = (value >>> 24); 2678 | return offset + 4 2679 | }; 2680 | 2681 | Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { 2682 | value = +value; 2683 | offset = offset >>> 0; 2684 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); 2685 | if (value < 0) value = 0xffffffff + value + 1; 2686 | this[offset] = (value >>> 24); 2687 | this[offset + 1] = (value >>> 16); 2688 | this[offset + 2] = (value >>> 8); 2689 | this[offset + 3] = (value & 0xff); 2690 | return offset + 4 2691 | }; 2692 | 2693 | Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { 2694 | return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) 2695 | }); 2696 | 2697 | Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { 2698 | return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) 2699 | }); 2700 | 2701 | function checkIEEE754 (buf, value, offset, ext, max, min) { 2702 | if (offset + ext > buf.length) throw new RangeError('Index out of range') 2703 | if (offset < 0) throw new RangeError('Index out of range') 2704 | } 2705 | 2706 | function writeFloat (buf, value, offset, littleEndian, noAssert) { 2707 | value = +value; 2708 | offset = offset >>> 0; 2709 | if (!noAssert) { 2710 | checkIEEE754(buf, value, offset, 4); 2711 | } 2712 | ieee754.write(buf, value, offset, littleEndian, 23, 4); 2713 | return offset + 4 2714 | } 2715 | 2716 | Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { 2717 | return writeFloat(this, value, offset, true, noAssert) 2718 | }; 2719 | 2720 | Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { 2721 | return writeFloat(this, value, offset, false, noAssert) 2722 | }; 2723 | 2724 | function writeDouble (buf, value, offset, littleEndian, noAssert) { 2725 | value = +value; 2726 | offset = offset >>> 0; 2727 | if (!noAssert) { 2728 | checkIEEE754(buf, value, offset, 8); 2729 | } 2730 | ieee754.write(buf, value, offset, littleEndian, 52, 8); 2731 | return offset + 8 2732 | } 2733 | 2734 | Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { 2735 | return writeDouble(this, value, offset, true, noAssert) 2736 | }; 2737 | 2738 | Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { 2739 | return writeDouble(this, value, offset, false, noAssert) 2740 | }; 2741 | 2742 | // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) 2743 | Buffer.prototype.copy = function copy (target, targetStart, start, end) { 2744 | if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') 2745 | if (!start) start = 0; 2746 | if (!end && end !== 0) end = this.length; 2747 | if (targetStart >= target.length) targetStart = target.length; 2748 | if (!targetStart) targetStart = 0; 2749 | if (end > 0 && end < start) end = start; 2750 | 2751 | // Copy 0 bytes; we're done 2752 | if (end === start) return 0 2753 | if (target.length === 0 || this.length === 0) return 0 2754 | 2755 | // Fatal error conditions 2756 | if (targetStart < 0) { 2757 | throw new RangeError('targetStart out of bounds') 2758 | } 2759 | if (start < 0 || start >= this.length) throw new RangeError('Index out of range') 2760 | if (end < 0) throw new RangeError('sourceEnd out of bounds') 2761 | 2762 | // Are we oob? 2763 | if (end > this.length) end = this.length; 2764 | if (target.length - targetStart < end - start) { 2765 | end = target.length - targetStart + start; 2766 | } 2767 | 2768 | const len = end - start; 2769 | 2770 | if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { 2771 | // Use built-in when available, missing from IE11 2772 | this.copyWithin(targetStart, start, end); 2773 | } else { 2774 | Uint8Array.prototype.set.call( 2775 | target, 2776 | this.subarray(start, end), 2777 | targetStart 2778 | ); 2779 | } 2780 | 2781 | return len 2782 | }; 2783 | 2784 | // Usage: 2785 | // buffer.fill(number[, offset[, end]]) 2786 | // buffer.fill(buffer[, offset[, end]]) 2787 | // buffer.fill(string[, offset[, end]][, encoding]) 2788 | Buffer.prototype.fill = function fill (val, start, end, encoding) { 2789 | // Handle string cases: 2790 | if (typeof val === 'string') { 2791 | if (typeof start === 'string') { 2792 | encoding = start; 2793 | start = 0; 2794 | end = this.length; 2795 | } else if (typeof end === 'string') { 2796 | encoding = end; 2797 | end = this.length; 2798 | } 2799 | if (encoding !== undefined && typeof encoding !== 'string') { 2800 | throw new TypeError('encoding must be a string') 2801 | } 2802 | if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { 2803 | throw new TypeError('Unknown encoding: ' + encoding) 2804 | } 2805 | if (val.length === 1) { 2806 | const code = val.charCodeAt(0); 2807 | if ((encoding === 'utf8' && code < 128) || 2808 | encoding === 'latin1') { 2809 | // Fast path: If `val` fits into a single byte, use that numeric value. 2810 | val = code; 2811 | } 2812 | } 2813 | } else if (typeof val === 'number') { 2814 | val = val & 255; 2815 | } else if (typeof val === 'boolean') { 2816 | val = Number(val); 2817 | } 2818 | 2819 | // Invalid ranges are not set to a default, so can range check early. 2820 | if (start < 0 || this.length < start || this.length < end) { 2821 | throw new RangeError('Out of range index') 2822 | } 2823 | 2824 | if (end <= start) { 2825 | return this 2826 | } 2827 | 2828 | start = start >>> 0; 2829 | end = end === undefined ? this.length : end >>> 0; 2830 | 2831 | if (!val) val = 0; 2832 | 2833 | let i; 2834 | if (typeof val === 'number') { 2835 | for (i = start; i < end; ++i) { 2836 | this[i] = val; 2837 | } 2838 | } else { 2839 | const bytes = Buffer.isBuffer(val) 2840 | ? val 2841 | : Buffer.from(val, encoding); 2842 | const len = bytes.length; 2843 | if (len === 0) { 2844 | throw new TypeError('The value "' + val + 2845 | '" is invalid for argument "value"') 2846 | } 2847 | for (i = 0; i < end - start; ++i) { 2848 | this[i + start] = bytes[i % len]; 2849 | } 2850 | } 2851 | 2852 | return this 2853 | }; 2854 | 2855 | // CUSTOM ERRORS 2856 | // ============= 2857 | 2858 | // Simplified versions from Node, changed for Buffer-only usage 2859 | const errors = {}; 2860 | function E (sym, getMessage, Base) { 2861 | errors[sym] = class NodeError extends Base { 2862 | constructor () { 2863 | super(); 2864 | 2865 | Object.defineProperty(this, 'message', { 2866 | value: getMessage.apply(this, arguments), 2867 | writable: true, 2868 | configurable: true 2869 | }); 2870 | 2871 | // Add the error code to the name to include it in the stack trace. 2872 | this.name = `${this.name} [${sym}]`; 2873 | // Access the stack to generate the error message including the error code 2874 | // from the name. 2875 | this.stack; // eslint-disable-line no-unused-expressions 2876 | // Reset the name to the actual name. 2877 | delete this.name; 2878 | } 2879 | 2880 | get code () { 2881 | return sym 2882 | } 2883 | 2884 | set code (value) { 2885 | Object.defineProperty(this, 'code', { 2886 | configurable: true, 2887 | enumerable: true, 2888 | value, 2889 | writable: true 2890 | }); 2891 | } 2892 | 2893 | toString () { 2894 | return `${this.name} [${sym}]: ${this.message}` 2895 | } 2896 | }; 2897 | } 2898 | 2899 | E('ERR_BUFFER_OUT_OF_BOUNDS', 2900 | function (name) { 2901 | if (name) { 2902 | return `${name} is outside of buffer bounds` 2903 | } 2904 | 2905 | return 'Attempt to access memory outside buffer bounds' 2906 | }, RangeError); 2907 | E('ERR_INVALID_ARG_TYPE', 2908 | function (name, actual) { 2909 | return `The "${name}" argument must be of type number. Received type ${typeof actual}` 2910 | }, TypeError); 2911 | E('ERR_OUT_OF_RANGE', 2912 | function (str, range, input) { 2913 | let msg = `The value of "${str}" is out of range.`; 2914 | let received = input; 2915 | if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { 2916 | received = addNumericalSeparator(String(input)); 2917 | } else if (typeof input === 'bigint') { 2918 | received = String(input); 2919 | if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { 2920 | received = addNumericalSeparator(received); 2921 | } 2922 | received += 'n'; 2923 | } 2924 | msg += ` It must be ${range}. Received ${received}`; 2925 | return msg 2926 | }, RangeError); 2927 | 2928 | function addNumericalSeparator (val) { 2929 | let res = ''; 2930 | let i = val.length; 2931 | const start = val[0] === '-' ? 1 : 0; 2932 | for (; i >= start + 4; i -= 3) { 2933 | res = `_${val.slice(i - 3, i)}${res}`; 2934 | } 2935 | return `${val.slice(0, i)}${res}` 2936 | } 2937 | 2938 | // CHECK FUNCTIONS 2939 | // =============== 2940 | 2941 | function checkBounds (buf, offset, byteLength) { 2942 | validateNumber(offset, 'offset'); 2943 | if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { 2944 | boundsError(offset, buf.length - (byteLength + 1)); 2945 | } 2946 | } 2947 | 2948 | function checkIntBI (value, min, max, buf, offset, byteLength) { 2949 | if (value > max || value < min) { 2950 | const n = typeof min === 'bigint' ? 'n' : ''; 2951 | let range; 2952 | if (byteLength > 3) { 2953 | if (min === 0 || min === BigInt(0)) { 2954 | range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`; 2955 | } else { 2956 | range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + 2957 | `${(byteLength + 1) * 8 - 1}${n}`; 2958 | } 2959 | } else { 2960 | range = `>= ${min}${n} and <= ${max}${n}`; 2961 | } 2962 | throw new errors.ERR_OUT_OF_RANGE('value', range, value) 2963 | } 2964 | checkBounds(buf, offset, byteLength); 2965 | } 2966 | 2967 | function validateNumber (value, name) { 2968 | if (typeof value !== 'number') { 2969 | throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) 2970 | } 2971 | } 2972 | 2973 | function boundsError (value, length, type) { 2974 | if (Math.floor(value) !== value) { 2975 | validateNumber(value, type); 2976 | throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) 2977 | } 2978 | 2979 | if (length < 0) { 2980 | throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() 2981 | } 2982 | 2983 | throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 2984 | `>= ${type ? 1 : 0} and <= ${length}`, 2985 | value) 2986 | } 2987 | 2988 | // HELPER FUNCTIONS 2989 | // ================ 2990 | 2991 | const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; 2992 | 2993 | function base64clean (str) { 2994 | // Node takes equal signs as end of the Base64 encoding 2995 | str = str.split('=')[0]; 2996 | // Node strips out invalid characters like \n and \t from the string, base64-js does not 2997 | str = str.trim().replace(INVALID_BASE64_RE, ''); 2998 | // Node converts strings with length < 2 to '' 2999 | if (str.length < 2) return '' 3000 | // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not 3001 | while (str.length % 4 !== 0) { 3002 | str = str + '='; 3003 | } 3004 | return str 3005 | } 3006 | 3007 | function utf8ToBytes (string, units) { 3008 | units = units || Infinity; 3009 | let codePoint; 3010 | const length = string.length; 3011 | let leadSurrogate = null; 3012 | const bytes = []; 3013 | 3014 | for (let i = 0; i < length; ++i) { 3015 | codePoint = string.charCodeAt(i); 3016 | 3017 | // is surrogate component 3018 | if (codePoint > 0xD7FF && codePoint < 0xE000) { 3019 | // last char was a lead 3020 | if (!leadSurrogate) { 3021 | // no lead yet 3022 | if (codePoint > 0xDBFF) { 3023 | // unexpected trail 3024 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); 3025 | continue 3026 | } else if (i + 1 === length) { 3027 | // unpaired lead 3028 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); 3029 | continue 3030 | } 3031 | 3032 | // valid lead 3033 | leadSurrogate = codePoint; 3034 | 3035 | continue 3036 | } 3037 | 3038 | // 2 leads in a row 3039 | if (codePoint < 0xDC00) { 3040 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); 3041 | leadSurrogate = codePoint; 3042 | continue 3043 | } 3044 | 3045 | // valid surrogate pair 3046 | codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; 3047 | } else if (leadSurrogate) { 3048 | // valid bmp char, but last char was a lead 3049 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); 3050 | } 3051 | 3052 | leadSurrogate = null; 3053 | 3054 | // encode utf8 3055 | if (codePoint < 0x80) { 3056 | if ((units -= 1) < 0) break 3057 | bytes.push(codePoint); 3058 | } else if (codePoint < 0x800) { 3059 | if ((units -= 2) < 0) break 3060 | bytes.push( 3061 | codePoint >> 0x6 | 0xC0, 3062 | codePoint & 0x3F | 0x80 3063 | ); 3064 | } else if (codePoint < 0x10000) { 3065 | if ((units -= 3) < 0) break 3066 | bytes.push( 3067 | codePoint >> 0xC | 0xE0, 3068 | codePoint >> 0x6 & 0x3F | 0x80, 3069 | codePoint & 0x3F | 0x80 3070 | ); 3071 | } else if (codePoint < 0x110000) { 3072 | if ((units -= 4) < 0) break 3073 | bytes.push( 3074 | codePoint >> 0x12 | 0xF0, 3075 | codePoint >> 0xC & 0x3F | 0x80, 3076 | codePoint >> 0x6 & 0x3F | 0x80, 3077 | codePoint & 0x3F | 0x80 3078 | ); 3079 | } else { 3080 | throw new Error('Invalid code point') 3081 | } 3082 | } 3083 | 3084 | return bytes 3085 | } 3086 | 3087 | function asciiToBytes (str) { 3088 | const byteArray = []; 3089 | for (let i = 0; i < str.length; ++i) { 3090 | // Node's code seems to be doing this and not & 0x7F.. 3091 | byteArray.push(str.charCodeAt(i) & 0xFF); 3092 | } 3093 | return byteArray 3094 | } 3095 | 3096 | function utf16leToBytes (str, units) { 3097 | let c, hi, lo; 3098 | const byteArray = []; 3099 | for (let i = 0; i < str.length; ++i) { 3100 | if ((units -= 2) < 0) break 3101 | 3102 | c = str.charCodeAt(i); 3103 | hi = c >> 8; 3104 | lo = c % 256; 3105 | byteArray.push(lo); 3106 | byteArray.push(hi); 3107 | } 3108 | 3109 | return byteArray 3110 | } 3111 | 3112 | function base64ToBytes (str) { 3113 | return base64Js.toByteArray(base64clean(str)) 3114 | } 3115 | 3116 | function blitBuffer (src, dst, offset, length) { 3117 | let i; 3118 | for (i = 0; i < length; ++i) { 3119 | if ((i + offset >= dst.length) || (i >= src.length)) break 3120 | dst[i + offset] = src[i]; 3121 | } 3122 | return i 3123 | } 3124 | 3125 | // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass 3126 | // the `instanceof` check but they should be treated as of that type. 3127 | // See: https://github.com/feross/buffer/issues/166 3128 | function isInstance (obj, type) { 3129 | return obj instanceof type || 3130 | (obj != null && obj.constructor != null && obj.constructor.name != null && 3131 | obj.constructor.name === type.name) 3132 | } 3133 | function numberIsNaN (obj) { 3134 | // For IE11 support 3135 | return obj !== obj // eslint-disable-line no-self-compare 3136 | } 3137 | 3138 | // Create lookup table for `toString('hex')` 3139 | // See: https://github.com/feross/buffer/issues/219 3140 | const hexSliceLookupTable = (function () { 3141 | const alphabet = '0123456789abcdef'; 3142 | const table = new Array(256); 3143 | for (let i = 0; i < 16; ++i) { 3144 | const i16 = i * 16; 3145 | for (let j = 0; j < 16; ++j) { 3146 | table[i16 + j] = alphabet[i] + alphabet[j]; 3147 | } 3148 | } 3149 | return table 3150 | })(); 3151 | 3152 | // Return not function with Error if BigInt not supported 3153 | function defineBigIntMethod (fn) { 3154 | return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn 3155 | } 3156 | 3157 | function BufferBigIntNotDefined () { 3158 | throw new Error('BigInt not supported') 3159 | } 3160 | }); 3161 | 3162 | const version = "0.0.28"; 3163 | 3164 | exports.App = App; 3165 | exports.AppWidget = AppWidget; 3166 | exports.Buffer = buffer.Buffer; 3167 | exports.HmDomApi = HmDomApi; 3168 | exports.HmLogger = HmLogger; 3169 | exports.HmSensorApi = HmSensorApi; 3170 | exports.Page = Page; 3171 | exports.Router = Router; 3172 | exports.SensorWidgetFactory = SensorWidgetFactory; 3173 | exports.WatchFace = WatchFace; 3174 | exports.WatchWidget = WatchWidget; 3175 | exports.WidgetFactory = WidgetFactory; 3176 | exports.version = version; 3177 | 3178 | Object.defineProperty(exports, '__esModule', { value: true }); 3179 | 3180 | }))); 3181 | --------------------------------------------------------------------------------