├── docs ├── .nojekyll ├── _navbar.md ├── favicon.ico ├── assets │ └── device │ │ └── checkLayoutOrientation │ │ └── checkLayoutOrientation-2.jpeg ├── _coverpage.md ├── _sidebar.md ├── other │ ├── _about.md │ ├── _start.md │ └── _update.md ├── lib │ ├── _delete.md │ ├── _other.md │ ├── _update.md │ ├── _add.md │ └── _query.md ├── index.html ├── js │ └── d-js-utils.js └── docsify.js ├── src ├── uitils │ ├── config.js │ ├── type.js │ ├── log.js │ └── Dep.js ├── global.js ├── Idb.js └── DB.js ├── .gitignore ├── .babelrc ├── example ├── index.html ├── db_student_config.js └── index.js ├── package.json └── README.md /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/uitils/config.js: -------------------------------------------------------------------------------- 1 | export const NAME = 'idb-js'; -------------------------------------------------------------------------------- /docs/_navbar.md: -------------------------------------------------------------------------------- 1 | * [github](https://www.github.com/ifmiss/d-js-utils) -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/verybigorange/idb-js/HEAD/docs/favicon.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | npm-debug.log 4 | lerna-debug.log 5 | npm-debug.log.* 6 | lerna-debug.log.* 7 | .idea 8 | .vscode 9 | .npmrc 10 | dist/ 11 | .cache -------------------------------------------------------------------------------- /docs/assets/device/checkLayoutOrientation/checkLayoutOrientation-2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/verybigorange/idb-js/HEAD/docs/assets/device/checkLayoutOrientation/checkLayoutOrientation-2.jpeg -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "env", 5 | { 6 | "modules": false 7 | } 8 | ] 9 | ], 10 | "plugins": [ 11 | "external-helpers" 12 | ] 13 | } -------------------------------------------------------------------------------- /src/uitils/type.js: -------------------------------------------------------------------------------- 1 | export const isObject = data => Object.prototype.toString.call(data) === "[object Object]" 2 | export const isArray = data => Object.prototype.toString.call(data) === "[object Array]" -------------------------------------------------------------------------------- /docs/_coverpage.md: -------------------------------------------------------------------------------- 1 | # idb-js 2.0.0 2 | 3 | > 基于indedb的封装,简单易用。 4 | 5 | * 作者:verybigorange 6 | * QQ: 449732828 7 | 8 | [GitHub](https://github.com/verybigorange/idb-js) 9 | [Get Started](/other/_about.md) -------------------------------------------------------------------------------- /src/uitils/log.js: -------------------------------------------------------------------------------- 1 | import { NAME } from "./config"; 2 | 3 | export function log_error(msg = "") { 4 | throw new Error(`${NAME}:${msg}`); 5 | } 6 | 7 | export function log(msg = "") { 8 | console.log(`${NAME}:${msg}`); 9 | } 10 | -------------------------------------------------------------------------------- /docs/_sidebar.md: -------------------------------------------------------------------------------- 1 | * 开始 2 | * [简介](/other/_about.md) 3 | * [快速开始](/other/_start.md) 4 | * [更新内容](/other/_update.md) 5 | * 6 | * db方法 7 | * [增加](/lib/_add.md) 8 | * [删除](/lib/_delete.md) 9 | * [查询]( /lib/_query.md) 10 | * [修改]( /lib/_update.md) 11 | * [其他]( /lib/_other.md) 12 | -------------------------------------------------------------------------------- /src/uitils/Dep.js: -------------------------------------------------------------------------------- 1 | class Dep { 2 | constructor() { 3 | this.deps = []; 4 | } 5 | 6 | add(element) { 7 | this.deps.push(element); 8 | } 9 | 10 | notify() { 11 | for (let i = 0; i < this.deps.length; i++) { 12 | this.deps[i](); 13 | } 14 | this.deps.length = 0; 15 | } 16 | } 17 | 18 | export default Dep; -------------------------------------------------------------------------------- /src/global.js: -------------------------------------------------------------------------------- 1 | // 兼容 2 | export const indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; 3 | export const IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction; 4 | export const IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange; -------------------------------------------------------------------------------- /docs/other/_about.md: -------------------------------------------------------------------------------- 1 | # 简介 2 | #### 产生背景 3 | 随着前端业务的复杂以及浏览器的迭代,越来越多的网站考虑用indexdb做前端数据缓存,但是原始API使用起来相对比较麻烦,所以诞生了idb-js。 4 | 5 | #### 功能描述 6 | 主要包括建立数据库,建立表(store),以及一些增删查改的api。 7 | 8 | #### 2.0与1.0的区别 9 | 2.0较于1.0最大的改变就是更加简单、灵活。 10 | - 2.0版本支持Promise,而不再是callback 11 | - 基于奥卡姆剃刀,去掉部分不常用的API,只保留常用基本的API,化繁为简 12 | - 提供创建事务的API和获取DB的API,让用户使用更加灵活,不局限于当前库的方法 -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/lib/_delete.md: -------------------------------------------------------------------------------- 1 | # 删除 2 | 删除数据库中的一条或者多条数据 3 | 4 | ## delete 5 | `delete`游标的方式删除单条或者多条数据 6 | ##### 参数 7 | - `{Object}` 8 | 9 | ##### 属性 10 | - `tableName` { String } 表名 11 | - `condition` [非必传,不传则全部数据] { Function } 匹配条件 @return { Boolean } 12 | ##### 返回值 `Promise<[]>` 13 | 14 | ##### `Demo`: 15 | ```js 16 | // 将grade表中,将name是小红的数据删除 17 | const res = await IDB.delete({ 18 | tableName: "grade", 19 | condition: (item, index) => item.name === "小红", 20 | }); 21 | console.log("删除的数据:", res); 22 | ``` -------------------------------------------------------------------------------- /docs/other/_start.md: -------------------------------------------------------------------------------- 1 | # 快速使用 2 | #### 安装 3 | 使用npm安装 `idb-js` 依赖 4 | ```bash 5 | npm install idb-js 6 | ``` 7 | #### 使用 8 | * 第一步: 引入Idb 9 | ``` 10 | import Idb from 'idb-js' // 引入Idb 11 | ``` 12 | * 第二步: 引入数据库配置 13 | ``` 14 | import IDB_Config from './IDB_Config.js' 15 | ``` 16 | 17 | * 第三步: 载入配置,数据库开启成功拿到数据库实例进行操作 18 | ``` 19 | Idb(IDB_Config).then(IDB => {...}) 20 | ``` 21 | 22 | #### 数据库配置 23 | IDB_Config.js 24 | 25 | ``` 26 | export default { 27 | dbName: "myDB", 28 | version: 1, 29 | tables: [ 30 | { 31 | tableName: "表名1", 32 | option: { keyPath: "id" }, 33 | }, 34 | ], 35 | }; 36 | ``` -------------------------------------------------------------------------------- /src/Idb.js: -------------------------------------------------------------------------------- 1 | import DB from "./DB"; 2 | import { log } from "./uitils/log"; 3 | 4 | function Idb({ dbName, version = new Date().getTime(), tables = [] }) { 5 | const db = new DB({ 6 | dbName, 7 | version 8 | }); 9 | 10 | for (let tableItem of tables) { 11 | // tableItem @tableName,@option,@indexs 12 | db.add_table(tableItem); 13 | } 14 | 15 | return new Promise((resolve, reject) => { 16 | db.open({ 17 | success: () => { 18 | log(`数据库 ${dbName} 已经打开`); 19 | resolve(db); 20 | }, 21 | error: err => { 22 | reject(err); 23 | } 24 | }); 25 | }); 26 | } 27 | 28 | export default Idb; -------------------------------------------------------------------------------- /docs/lib/_other.md: -------------------------------------------------------------------------------- 1 | # 其他API 2 | 3 | 4 | ## transaction 5 | `transaction`创建一个事务 6 | ##### 参数 7 | - `string` 表名 8 | 9 | ##### 返回值 `Promise<事务对象store>` 10 | 11 | 12 | ##### `Demo`: 13 | ```js 14 | // 开启一个事务查询所有数据 15 | const store = await IDB.transaction("grade"); 16 | store.getAll().onsuccess = function (event) { 17 | console.log("开启一个事务,查询所有数据:", event.target.result); 18 | }; 19 | ``` 20 | 关于事务操作的更多方法,请查看 https://developer.mozilla.org/zh-CN/docs/Web/API/IDBObjectStore 21 | 22 | ## getDB 23 | `getDB`获取IDBDatabase对象 24 | ##### 参数 25 | 无 26 | 27 | ##### 返回值 `Promise<事务对象store>` 28 | 29 | 30 | ##### `Demo`: 31 | ```js 32 | // 关闭数据库 33 | const db = await IDB.getDB(); 34 | db.close(); 35 | ``` 36 | 37 | 关于IDBDatabase对象更多信息,请查看 https://developer.mozilla.org/zh-CN/docs/Web/API/IDBDatabase -------------------------------------------------------------------------------- /docs/other/_update.md: -------------------------------------------------------------------------------- 1 | # 更新内容 2 | 3 | ### 2.0.0 4 | - `2023-08-08` 5 | - 增删查改全面升级 6 | - 支持 `promise` 7 | - `condition` 中注入 `index` 8 | - 废弃部分API 9 | - `close_db` 10 | - `delete_db` 11 | - `clear_table` 12 | - `delete_by_primaryKey` 13 | - `query_by_primaryKey` 14 | - `query_by_index` 15 | - `insert` 更改为 `add` 16 | 17 | ### 1.3.1 18 | - `2019-2-15` 19 | - `insert`方法中,底层将`add` 替换成 `put`的方式 20 | 21 | ### 1.3.0 22 | - `2018-12-14` 增加文档 23 | 24 | ### 1.2.1 25 | - `2018-12-07` 完成了基础方法 26 | - `close_db` 27 | - `delete_db` 28 | - `clear_table` 29 | - `insert` 30 | - `query` 31 | - `query_by_primaryKey` 32 | - `query_by_index` 33 | - ,`queryAll` 34 | - `delete` 35 | - `delete_by_primaryKey` 36 | - `update` 37 | - `update_by_primaryKey` 38 | -------------------------------------------------------------------------------- /docs/lib/_update.md: -------------------------------------------------------------------------------- 1 | # 修改 2 | 修改数据库中的一条或者多条数据 3 | 4 | ## update 5 | `update`游标的方式修改单条或者多条数据 6 | ##### 参数 7 | - `{Object}` 8 | 9 | ##### 属性 10 | - `tableName` { String } 表名 11 | - `condition` [非必传,不传则全部数据] { Function } 匹配条件 @return { Boolean } 12 | - `handler` { Function } 修改方式 13 | 14 | ##### 返回值 `Promise<[]>` 15 | ##### `Demo`: 16 | ```js 17 | // 根据条件修改 18 | // 将grade表中,将name是小明的全部数据的score修改为100 19 | const res = await IDB.update({ 20 | tableName: "grade", 21 | condition: (item, index) => item.name === '小明', 22 | handler: (row) => { 23 | row.score = 100; 24 | }, 25 | }); 26 | console.log("根据条件修改的数据:", res); 27 | ``` 28 | 29 | ```js 30 | // 全部数据修改-全部数据增加新字段newField 31 | const res = await IDB.update({ 32 | tableName: "grade", 33 | handler: (row, index) => { 34 | row.newField = "这是新字段"; 35 | }, 36 | }); 37 | console.log("全部数据修改-增加新字段:", res); 38 | ``` -------------------------------------------------------------------------------- /docs/lib/_add.md: -------------------------------------------------------------------------------- 1 | # 增加 2 | 向数据库中插入数据 3 | 4 | ## add 5 | `add`添加单条或者多条数据 6 | ##### 参数 7 | - `{Object}` 8 | 9 | ##### 属性 10 | - `tableName` { String } 表名 11 | - `data` { Object \| Array } 数据,单个对象或者一个数组对象 12 | 13 | ##### 返回值 `Promise` 14 | ##### `Demo`: 15 | ```js 16 | // 插入单条数据 17 | try { 18 | await IDB.add({ 19 | tableName: "grade", 20 | data: { 21 | id: 1, 22 | score: 98, 23 | name: "小明", 24 | }, 25 | }); 26 | console.log("数据添加成功"); 27 | } catch (error) { 28 | console.log("数据添加失败", error); 29 | } 30 | 31 | // 插入多条数据 32 | await IDB.add({ 33 | tableName: "grade", 34 | data: [ 35 | { 36 | id: 2, 37 | score: 99, 38 | name: "小红", 39 | }, 40 | { 41 | id: 3, 42 | score: 100, 43 | name: "小刚", 44 | }, 45 | ], 46 | }); 47 | ``` -------------------------------------------------------------------------------- /example/db_student_config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | dbName: "student", 3 | version: 1, 4 | tables: [ 5 | { 6 | tableName: "grade", 7 | option: { keyPath: "id" }, 8 | }, 9 | // { 10 | // tableName: "info", 11 | // option: { keyPath: "id" }, 12 | // indexs: [ // 创建索引 https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/createIndex 13 | // { 14 | // key: "id", 15 | // option: { 16 | // unique: true, 17 | // }, 18 | // }, 19 | // { 20 | // key: "name", 21 | // option: { 22 | // unique: false, 23 | // }, 24 | // }, 25 | // { 26 | // key: "age", 27 | // option: { 28 | // unique: false, 29 | // }, 30 | // }, 31 | // { 32 | // key: "sex", 33 | // option: { 34 | // unique: false, 35 | // }, 36 | // }, 37 | // ], 38 | // }, 39 | ], 40 | }; 41 | -------------------------------------------------------------------------------- /docs/lib/_query.md: -------------------------------------------------------------------------------- 1 | # 查询 2 | 查询数据库中的一条或者多条数据 3 | 4 | ## query 5 | `query`游标的方式查询单条或者多条数据 6 | ##### 参数 7 | - `{Object}` 8 | 9 | ##### 属性 10 | - `tableName` { String } 表名 11 | - `condition` [非必传,不传则全部数据] { Function } 匹配条件 @return { Boolean } 12 | 13 | ##### 返回值 `Promise<[]>` 14 | 15 | 16 | ##### `Demo`: 17 | ```js 18 | // 按条件查询 19 | // 将grade表中,将score是100的数据查询出来 20 | const res = await IDB.query({ 21 | tableName: "grade", 22 | condition: (item, index) => item.score == 100, 23 | }); 24 | console.log(`按条件查询:`, res); 25 | ``` 26 | 27 | ```js 28 | // 查询全部数据 29 | const res = await IDB.query({ 30 | tableName: "grade", 31 | }); 32 | console.log(`查询全部数据:`, res); 33 | ``` 34 | 35 | ```js 36 | // 按分页查询 37 | const res = await IDB.query({ 38 | tableName: "grade", 39 | condition: (item, index) => { 40 | const page = 2; 41 | const pageSize = 2; 42 | const min = (page - 1) * pageSize; 43 | const max = page * pageSize; 44 | return index >= min && index < max; 45 | }, 46 | }); 47 | console.log(`按分页查询`, res); 48 | ``` -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "idb-js", 3 | "version": "2.0.0", 4 | "description": "Simple to use indexdb", 5 | "main": "dist/Idb.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "parcel --port 3001 example/index.html", 9 | "build": "node build.js", 10 | "publish": "npm publish --access public", 11 | "doc": "docsify serve docs" 12 | }, 13 | "files": [ 14 | "src", 15 | "dist/*.js", 16 | "example/**" 17 | ], 18 | "author": "zhoucheng", 19 | "license": "ISC", 20 | "bugs": { 21 | "url": "https://github.com/verybigorange/indexDB_easy/issues" 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "https://github.com/verybigorange/indexDB_easy.git" 26 | }, 27 | "keywords": [ 28 | "indexdb", 29 | "database", 30 | "indexDB" 31 | ], 32 | "devDependencies": { 33 | "ansi-styles": "^3.2.1", 34 | "babel-core": "^6.26.3", 35 | "babel-plugin-external-helpers": "^6.22.0", 36 | "babel-preset-env": "^1.7.0", 37 | "chalk": "^2.4.1", 38 | "parcel-bundler": "^1.12.5", 39 | "rmrf": "^2.0.0", 40 | "rollup": "^0.67.3", 41 | "rollup-plugin-babel": "^3.0.7", 42 | "rollup-plugin-node-resolve": "^3.4.0", 43 | "rollup-plugin-uglify": "^6.0.0" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | idb-js 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 加载中 21 |
22 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import Idb from "../src/Idb"; 2 | import db_student_config from "./db_student_config"; 3 | 4 | (async function () { 5 | const IDB = await Idb(db_student_config); 6 | console.log(IDB); 7 | 8 | try { 9 | // 添加一条数据 10 | await IDB.add({ 11 | tableName: "grade", 12 | data: { 13 | id: 1, 14 | score: 98, 15 | name: "小明", 16 | }, 17 | }); 18 | console.log("数据添加成功"); 19 | } catch (error) { 20 | console.log("数据添加失败", error); 21 | } 22 | 23 | // 添加多条数据 24 | try { 25 | await IDB.add({ 26 | tableName: "grade", 27 | data: [ 28 | { 29 | id: 2, 30 | score: 99, 31 | name: "小红", 32 | }, 33 | { 34 | id: 3, 35 | score: 100, 36 | name: "小刚", 37 | }, 38 | { 39 | id: 4, 40 | score: 67, 41 | name: "小刚刚", 42 | }, 43 | { 44 | id: 5, 45 | score: 100, 46 | name: "小李", 47 | }, 48 | { 49 | id: 6, 50 | score: 100, 51 | name: "小高", 52 | }, 53 | ], 54 | }); 55 | } catch (error) {} 56 | 57 | // 按分页查询 58 | const res = await IDB.query({ 59 | tableName: "grade", 60 | condition: (item, index) => { 61 | const page = 2; 62 | const pageSize = 2; 63 | const min = (page - 1) * pageSize; 64 | const max = page * pageSize; 65 | return index >= min && index < max; 66 | }, 67 | }); 68 | console.log(`按分页查询`, res); 69 | 70 | // 按条件查询 71 | const res1 = await IDB.query({ 72 | tableName: "grade", 73 | condition: (item, index) => item.score == 100, 74 | }); 75 | console.log(`按条件查询:`, res1); 76 | 77 | // 查询全部 78 | const res2 = await IDB.query({ 79 | tableName: "grade", 80 | }); 81 | console.log(`查询全部:`, res2); 82 | 83 | // 根据条件修改 84 | const res3 = await IDB.update({ 85 | tableName: "grade", 86 | condition: (item, index) => item.score == 100, 87 | handler: (row) => { 88 | row.name = "新名字"; 89 | }, 90 | }); 91 | console.log("根据条件修改的数据:", res3); 92 | 93 | // 全部数据修改-增加新字段 94 | const res4 = await IDB.update({ 95 | tableName: "grade", 96 | handler: (row, index) => { 97 | row.newField = "这是新字段"; 98 | }, 99 | }); 100 | console.log("全部数据修改-增加新字段:", res4); 101 | 102 | // 删除数据 103 | const res5 = await IDB.delete({ 104 | tableName: "grade", 105 | condition: (item, index) => item.name === "小红", 106 | }); 107 | console.log("删除的数据:", res5); 108 | 109 | // 开启一个事务 110 | const store = await IDB.transaction("grade"); 111 | store.getAll().onsuccess = function (event) { 112 | console.log("开启一个事务,查询所有数据:", event.target.result); 113 | }; 114 | 115 | // 获取IDBDatabase对象 116 | const db = await IDB.getDB(); 117 | console.log("getDB", db); 118 | })(); 119 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # idb-js 2 | 基于indexdb本地数据库的封装, 简单易用. 3 | 4 | [文档地址](https://verybigorange.github.io/idb-js/) 5 | 6 | #### 安装 7 | 使用npm安装 `idb-js` 依赖 8 | ```bash 9 | npm install idb-js 10 | ``` 11 | #### 使用 12 | * 第一步: 引入Idb 13 | ``` 14 | import Idb from 'idb-js' // 引入Idb 15 | ``` 16 | * 第二步: 引入数据库配置 17 | ``` 18 | import IDB_Config from './IDB_Config.js' 19 | ``` 20 | 21 | * 第三步: 载入配置,数据库开启成功拿到数据库实例进行操作 22 | ``` 23 | Idb(IDB_Config).then(IDB => {...}) 24 | ``` 25 | 26 | #### 数据库配置 27 | IDB_Config.js 28 | 29 | ``` 30 | export default { 31 | dbName: "myDB", 32 | version: 1, 33 | tables: [ 34 | { 35 | tableName: "表名1", 36 | option: { keyPath: "id" }, 37 | }, 38 | ], 39 | }; 40 | ``` 41 | 42 | 43 | ### add 44 | 添加单条或者多条数据 45 | 46 | ##### `Demo`: 47 | ```js 48 | // 插入单条数据 49 | try { 50 | await IDB.add({ 51 | tableName: "grade", 52 | data: { 53 | id: 1, 54 | score: 98, 55 | name: "小明", 56 | }, 57 | }); 58 | console.log("数据添加成功"); 59 | } catch (error) { 60 | console.log("数据添加失败", error); 61 | } 62 | 63 | // 插入多条数据 64 | await IDB.add({ 65 | tableName: "grade", 66 | data: [ 67 | { 68 | id: 2, 69 | score: 99, 70 | name: "小红", 71 | }, 72 | { 73 | id: 3, 74 | score: 100, 75 | name: "小刚", 76 | }, 77 | ], 78 | }); 79 | ``` 80 | 81 | ### delete 82 | 删除数据库中的一条或者多条数据 83 | 84 | ##### `Demo`: 85 | ```js 86 | // 将grade表中,将name是小红的数据删除 87 | const res = await IDB.delete({ 88 | tableName: "grade", 89 | condition: (item, index) => item.name === "小红", 90 | }); 91 | console.log("删除的数据:", res); 92 | ``` 93 | 94 | ### qeury 95 | 查询数据库中的一条或者多条数据 96 | 97 | ##### `Demo`: 98 | ```js 99 | // 按条件查询 100 | // 将grade表中,将score是100的数据查询出来 101 | const res = await IDB.query({ 102 | tableName: "grade", 103 | condition: (item, index) => item.score == 100, 104 | }); 105 | console.log(`按条件查询:`, res); 106 | ``` 107 | ```js 108 | // 查询全部数据 109 | const res = await IDB.query({ 110 | tableName: "grade", 111 | }); 112 | console.log(`查询全部数据:`, res); 113 | ``` 114 | 115 | ```js 116 | // 按分页查询 117 | const res = await IDB.query({ 118 | tableName: "grade", 119 | condition: (item, index) => { 120 | const page = 2; 121 | const pageSize = 2; 122 | const min = (page - 1) * pageSize; 123 | const max = page * pageSize; 124 | return index >= min && index < max; 125 | }, 126 | }); 127 | console.log(`按分页查询`, res); 128 | ``` 129 | 130 | ### update 131 | 修改数据库中的一条或者多条数据 132 | 133 | ##### `Demo`: 134 | ```js 135 | // 根据条件修改 136 | // 将grade表中,将name是小明的全部数据的score修改为100 137 | const res = await IDB.update({ 138 | tableName: "grade", 139 | condition: (item, index) => item.name === '小明', 140 | handler: (row) => { 141 | row.score = 100; 142 | }, 143 | }); 144 | console.log("根据条件修改的数据:", res); 145 | ``` 146 | 147 | ```js 148 | // 全部数据修改-全部数据增加新字段newField 149 | const res = await IDB.update({ 150 | tableName: "grade", 151 | handler: (row, index) => { 152 | row.newField = "这是新字段"; 153 | }, 154 | }); 155 | console.log("全部数据修改-增加新字段:", res); 156 | ``` 157 | 158 | ### transaction 159 | 创建一个事务 160 | 161 | ##### `Demo`: 162 | ```js 163 | // 开启一个事务查询所有数据 164 | const store = await IDB.transaction("grade"); 165 | store.getAll().onsuccess = function (event) { 166 | console.log("开启一个事务,查询所有数据:", event.target.result); 167 | }; 168 | ``` 169 | 关于事务操作的更多方法,请查看 https://developer.mozilla.org/zh-CN/docs/Web/API/IDBObjectStore 170 | 171 | ### getDB 172 | 获取IDBDatabase对象 173 | 174 | ##### `Demo`: 175 | ```js 176 | // 关闭数据库 177 | const db = await IDB.getDB(); 178 | db.close(); 179 | ``` 180 | 181 | 关于IDBDatabase对象更多信息,请查看 https://developer.mozilla.org/zh-CN/docs/Web/API/IDBDatabase 182 | 183 | 184 | ### TODO 185 | - 增加单元测试 186 | - 支持Typescript 187 | -------------------------------------------------------------------------------- /src/DB.js: -------------------------------------------------------------------------------- 1 | import Dep from "./uitils/Dep.js"; 2 | import { log_error } from "./uitils/log"; 3 | import { indexedDB, IDBTransaction, IDBKeyRange } from "./global"; 4 | import { isArray, isObject } from "./uitils/type.js"; 5 | import { NAME } from "./uitils/config.js"; 6 | 7 | class DB { 8 | constructor({ dbName, version }) { 9 | this.dbName = dbName; 10 | this.version = version; 11 | this.db = null; 12 | this.idb = null; 13 | this.tables = []; 14 | this._status = false; // 是否先添加了表 15 | this._dep_ = new Dep(); 16 | } 17 | 18 | /** 19 | * 打开数据库 20 | * @success 成功的回调,返回db,非必传 21 | * @error 失败的回调,返回错误信息,非必传 22 | * */ 23 | open(ops) { 24 | let success = () => {}, 25 | error = () => {}; 26 | 27 | if (ops) { 28 | success = ops.success ? ops.success : success; 29 | error = ops.error ? ops.error : error; 30 | } 31 | 32 | // 打开前要先添加表 33 | if (this.tables.length == 0 && !this._status) { 34 | log_error("打开前要先用add_table添加表"); 35 | return; 36 | } 37 | 38 | if (typeof success !== "function") { 39 | log_error("open中success必须是一个function类型"); 40 | return; 41 | } 42 | 43 | const request = indexedDB.open(this.dbName, this.version); 44 | 45 | request.onerror = (e) => { 46 | error(e.currentTarget.error.message); 47 | }; 48 | 49 | request.onsuccess = (e) => { 50 | this.db = e.target.result; 51 | success(this.db); 52 | this._dep_.notify(); 53 | }; 54 | 55 | request.onupgradeneeded = (e) => { 56 | this.idb = e.target.result; 57 | 58 | for (let i = 0; i < this.tables.length; i++) { 59 | this.__create_table(this.idb, this.tables[i]); 60 | } 61 | }; 62 | } 63 | 64 | /** 65 | * 添加一张表 66 | * @param tableOption 67 | * @tableName 表名 68 | * @option 表配置 69 | * @index 索引配置 70 | * */ 71 | add_table(tableOption = {}) { 72 | this._status = false; 73 | this.tables.push(tableOption); 74 | } 75 | 76 | /** 77 | * 开启一个事务 78 | * @param tableName 表名 79 | * @param mode 模式 readonly | readwrite 80 | * @return promise 81 | * */ 82 | transaction(tableName, mode = "readwrite") { 83 | return this.__action(() => 84 | this.db.transaction(tableName, mode).objectStore(tableName) 85 | ); 86 | } 87 | 88 | /** 89 | * 返回IDBDatabase对象 90 | * @return promise 91 | * */ 92 | getDB() { 93 | return this.__action(() => this.db); 94 | } 95 | 96 | /** 97 | * @method 查询 98 | * @param {Object} 99 | * @property {String} tableName 表名 100 | * @property {Function} condition 查询的条件,如果不传,默认查询全部数据 101 | * @arg {Object} 遍历每条数据,和filter类似 102 | * @arg {number} 索引index,从0开始 103 | * @return 条件 104 | * @return Promise<[]> 105 | * */ 106 | query({ tableName, condition = () => true }) { 107 | return this.__action(() => 108 | this.__create_transaction( 109 | tableName, 110 | (store) => { 111 | return new Promise(async (resolve, reject) => { 112 | try { 113 | const res = []; 114 | let index = 0; 115 | this.__openCursor(store, async (cursor) => { 116 | if (cursor) { 117 | if (await condition(cursor.value, index)) { 118 | res.push(cursor.value); 119 | } 120 | cursor.continue(); 121 | index++; 122 | } else { 123 | resolve(res); 124 | } 125 | }); 126 | } catch (error) { 127 | reject(error); 128 | } 129 | }); 130 | }, 131 | "readonly" 132 | ) 133 | ); 134 | } 135 | 136 | /** 137 | * @method 增加数据 138 | * @param {Object} 139 | * @property {String} tableName 表名 140 | * @property {Object} data 插入的数据 141 | * @property {Function} [success] 插入成功的回调 142 | * @return {Promise} 143 | * */ 144 | add({ tableName, data }) { 145 | if (!(isArray(data) || isObject(data))) { 146 | log_error("in insert,data type is Object or Array"); 147 | return; 148 | } 149 | 150 | return this.__action(() => 151 | this.__create_transaction( 152 | tableName, 153 | (store) => { 154 | isArray(data) ? data.forEach((v) => store.add(v)) : store.add(data); 155 | }, 156 | "readwrite" 157 | ) 158 | ); 159 | } 160 | 161 | /** 162 | * @method 删除数据 163 | * @param {Object} 164 | * @property {String} tableName 表名 165 | * @property {Function} condition 查询的条件,遍历,与filter类似,默认全部数据 166 | * @arg {Object} 每个元素 167 | * @arg {Number} 索引index,从0开始 168 | * */ 169 | delete({ tableName, condition = () => true }) { 170 | return this.__action(() => 171 | this.__create_transaction( 172 | tableName, 173 | (store) => { 174 | return new Promise(async (resolve, reject) => { 175 | try { 176 | const res = []; 177 | let index = 0; 178 | this.__openCursor(store, async (cursor) => { 179 | if (cursor) { 180 | let curValue = cursor.value; 181 | if (await condition(curValue, index)) { 182 | cursor.delete(curValue); 183 | res.push(curValue); 184 | } 185 | cursor.continue(); 186 | index++; 187 | } else { 188 | resolve(res); 189 | } 190 | }); 191 | } catch (error) { 192 | reject(error); 193 | } 194 | }); 195 | }, 196 | "readwrite" 197 | ) 198 | ); 199 | } 200 | 201 | /** 202 | * @method 修改数据 203 | * @param {Object} 204 | * @property {String} tableName 表名 205 | * @property {Function} condition 查询的条件,遍历,与filter类似,默认全部数据 206 | * @arg {Object} 每个元素 207 | * @arg {Number} 索引index,从0开始 208 | * @property {Function} handler 处理函数,接收本条数据的引用,对其修改 209 | * */ 210 | update({ tableName, handler, condition = () => true }) { 211 | return this.__action(() => 212 | this.__create_transaction( 213 | tableName, 214 | (store) => { 215 | return new Promise(async (resolve, reject) => { 216 | try { 217 | const res = []; 218 | let index = 0; 219 | this.__openCursor(store, async (cursor) => { 220 | if (cursor) { 221 | let curValue = cursor.value; 222 | if (await condition(curValue, index)) { 223 | await handler(curValue); 224 | cursor.update(curValue); 225 | res.push(curValue); 226 | } 227 | cursor.continue(); 228 | index++; 229 | } else { 230 | resolve(res); 231 | } 232 | }); 233 | } catch (error) { 234 | reject(error); 235 | } 236 | }); 237 | }, 238 | "readwrite" 239 | ) 240 | ); 241 | } 242 | 243 | /** 244 | * @method 开启游标 245 | * @param Store 246 | * @param callback {游标} 247 | * */ 248 | __openCursor(store, callback) { 249 | const request = store.openCursor(); 250 | 251 | request.onsuccess = (e) => { 252 | const cursor = e.target.result; 253 | callback(cursor); 254 | }; 255 | } 256 | 257 | /** 258 | * @method 开启事务 259 | * @param {String} 表名 260 | * @param {String} 事务权限 261 | * @return {Promise} 262 | * */ 263 | __create_transaction(tableName, handler, mode = "readwrite") { 264 | return new Promise(async (resolve, reject) => { 265 | if (!tableName || !mode) { 266 | reject(); 267 | throw new Error( 268 | "in __create_transaction,tableName and mode is required" 269 | ); 270 | } 271 | const transaction = this.db.transaction(tableName, mode); 272 | 273 | const store = transaction.objectStore(tableName); 274 | 275 | let data = null; 276 | try { 277 | data = await handler(store); 278 | } catch (error) { 279 | reject(error); 280 | } 281 | 282 | transaction.oncomplete = (event) => { 283 | resolve({ data, event }); 284 | }; 285 | transaction.onerror = (event) => { 286 | reject({ 287 | name: NAME, 288 | msg: event.target.error, 289 | event, 290 | }); 291 | }; 292 | }); 293 | } 294 | 295 | // db是异步的,保证fn执行的时候db存在 296 | __action(handler) { 297 | return new Promise((resolve, reject) => { 298 | const action = async () => { 299 | try { 300 | const result = await handler(); 301 | resolve(result); 302 | } catch (error) { 303 | reject(error); 304 | } 305 | }; 306 | // 如果db不存在,加入依赖 307 | if (!this.db) { 308 | this._dep_.add(action); 309 | } else { 310 | action(); 311 | } 312 | }); 313 | } 314 | 315 | /** 316 | * 创建table 317 | * @option keyPath指定主键 autoIncrement是否自增 318 | * @index 索引配置 319 | * */ 320 | __create_table(idb, { tableName, option, indexs = [] }) { 321 | if (!idb.objectStoreNames.contains(tableName)) { 322 | let store = idb.createObjectStore(tableName, option); 323 | for (let indexItem of indexs) { 324 | this.__create_index(store, indexItem); 325 | } 326 | } 327 | } 328 | 329 | /** 330 | * 创建索引 331 | * @option unique是否是唯一值 332 | * */ 333 | __create_index(store, { key, option }) { 334 | store.createIndex(key, key, option); 335 | } 336 | } 337 | 338 | export default DB; 339 | -------------------------------------------------------------------------------- /docs/js/d-js-utils.js: -------------------------------------------------------------------------------- 1 | var Dutils=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=window.navigator.userAgent,r={isMobile:function(){return/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(o)},isIOS:function(){return/(iPhone|iPad|iPod|iOS)/i.test(o)},isAndroid:function(){return o.indexOf("Android")>-1||o.indexOf("Adr")>-1},checkLayoutOrientation:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"请旋转屏幕,以达到更好的浏览效果";if(window.hasOwnProperty("orientation")){var t=null;n(),window.addEventListener("orientationchange",function(){n()})}function n(){var n=window.orientation;0===n||360===n?t&&(document.body.removeChild(t),t=null):((t=document.createElement("div")).style.cssText="position: fixed;\n top: 0;\n left: 0;\n right:0;\n bottom:0;\n display:flex;\n align-items:center;\n justify-content:center;\n font-size: 20px;\n background:#fff;\n z-index: 19940320;\n padding: 40px;",t.innerText=e,document.body.appendChild(t))}}};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o={isPhoneNum:function(e){var t=String(e);return/^1[3-9]\d{9}$/.test(t)},isEmail:function(e){var t=String(e);return/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(t)},isWeiXin:function(){return"micromessenger"===window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)},isChinese:function(e){return/^[\u3220-\uFA29]+$/.test(String(e))},initEsDataType:function(){this.dataType={};["Null","Undefined","Object","Array","String","Number","Boolean","Function","RegExp"].forEach(function(e){o["is"+e]=function(t){return function(e){return Object.prototype.toString.call(e).match(/\[object (.*?)\]/)[1].toLowerCase()}(t)===e.toLowerCase()}})},isEmptyObject:function(e){if(!o.isObject(e))throw TypeError("参数不是真正的object对象");return"{}"===JSON.stringify(e)}};o.initEsDataType(),t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r={setCookie:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:72e5,o=new Date;o.setTime(o.getTime()+n),document.cookie=e+"="+escape(t)+";expires="+o.toGMTString()},getCookie:function(e){if(e){var t=new RegExp("(^| )"+e+"=([^;]*)(;|$)"),n=document.cookie.match(t);return n&&n[2]?n[2]:null}var o=[];if(""!==document.cookie){var r=document.cookie.split("; ");for(var i in r)o.push({name:""+unescape(r[i].split("=")[0]),value:""+unescape(r[i].split("=")[1])});return o}return null},rmCookie:function(e){var t=new Date;if(t.setTime(t.getTime()-1),e){var n=r.getCookie(e);null!==n&&(document.cookie=e+"="+n+";expires="+t.toGMTString())}else{var o=r.getCookie();for(var i in o)document.cookie=o[i].name+"="+o[i].value+";expires="+t.toGMTString()}},saveDataAsFile:function(e,t){var n,o,r=window.URL||window.webkitURL||window,i=new Blob([t]),u=document.createElementNS("http://www.w3.org/1999/xhtml","a");u.href=r.createObjectURL(i),u.download=e,n=u,(o=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),n.dispatchEvent(o)},fileToFormData:function(e){if("object"!==(void 0===e?"undefined":o(e)))throw new TypeError("参数必须为对象格式且包含file文件");var t=new FormData;for(var n in e)e.hasOwnProperty(n)&&t.append(n,e[n])},getRandomDataFromArr:function(e,t){var n=Number(t),o=Array.from(new Set(e)),r=new Array;if(!(n>0))throw new Error("数量必须大于0");if(o&&o.length>n){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:"未曾遗忘的青春",t=arguments[1];if(t&&"object"!==(void 0===t?"undefined":o(t)))throw new TypeError("options is an object, but found "+(void 0===t?"undefined":o(t)));var n=Object.assign({},{isMax:!0,colors:["#a18cd1","#fbc2eb","#8ec5fc"]},t);n.isMax?console.log("%c"+e,"background-size: 100%;background-image: -moz-linear-gradient(left, "+n.colors.toString()+");background-image: -webkit-linear-gradient(left, "+n.colors.toString()+");background-image: linear-gradient(to right, "+n.colors.toString()+");padding:20px 40px;color:#fff;font-size:18px;"):console.log("%c"+e,"background-size: 100%;background-image: -moz-linear-gradient(left, "+n.colors.toString()+");background-image: -webkit-linear-gradient(left, "+n.colors.toString()+");background-image: linear-gradient(to right, "+n.colors.toString()+");padding:2px 5px;color:#fff;font-size:12px;")}),notification:function(e){var t=Object.assign({},{title:"未曾遗忘的青春",body:"Hello World !!!",icon:"http://www.daiwei.org/index/images/logo/dw1.png",show:function(){},click:function(){}},e);return new Promise(function(e,n){window.Notification&&"denied"!==Notification.permission?(Notification.requestPermission(function(){var e=new Notification(t.title,{body:t.body,icon:t.icon});e.onshow=function(){t.show()},e.onclick=function(){t.click()}}),e(t)):n(t)})},randomColor:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return"rgba("+Math.floor(256*Math.random())+","+Math.floor(256*Math.random())+","+Math.floor(256*Math.random())+","+e+")"},showLayoutFramework:function(){[].forEach.call(document.querySelectorAll("*"),function(e){e.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)})},parseUrl:function(e){if(e){for(var t=e.slice(e.indexOf("?")).slice(1).split("&"),n={},o=0;o255?2:1}return n},strTrim:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("string"!=typeof e)throw new TypeError("str must be string but found "+(void 0===e?"undefined":o(e)));switch(t){case 0:return e.replace(/(^\s*)|(\s*$)/g,"");case 1:return e.replace(/\s/g,"");case 2:return e.replace(/(^\s*)/g,"");case 3:return e.replace(/(\s*$)/g,"");default:return e.replace(/(^\s*)|(\s*$)/g,"")}},throttle:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("function"!=typeof e)throw new Error("第一个参数必须是方法");var n=e,o=null,r=!0;return function(){var e=arguments,i=this;if(r)return n.apply(i,e),void(r=!1);o||(o=setTimeout(function(){setTimeout(o),o=null,n.apply(i,e)},t))}},debounce:function(e,t){if("function"!=typeof e)throw new Error("第一个参数必须是方法");var n=void 0;return function(){clearTimeout(n),n||e.apply(this,arguments),n=setTimeout(function(){setTimeout(n),n=null},t)}},formatDate:function(e,t){var n=new Date(t),o={"M+":n.getMonth()+1,"d+":n.getDate(),"h+":n.getHours(),"m+":n.getMinutes(),"s+":n.getSeconds(),"q+":Math.floor((n.getMonth()+3)/3),S:n.getMilliseconds()};for(var r in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(n.getFullYear()+"").substr(4-RegExp.$1.length))),o)new RegExp("("+r+")").test(e)&&(e=e.replace(RegExp.$1,1===RegExp.$1.length?o[r]:("00"+o[r]).substr((""+o[r]).length)));return e},copyCode:function(e){var t=document.createElement("textarea");t.style.cssText="position: absolute; top: -1000px; right: -1000px; z-index: -1000;",document.body.appendChild(t),t.value=e,t.select(),document.execCommand("copy"),document.body.removeChild(t)},openFullScreen:function(e){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullScreen()},exitFullScreen:function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExiFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r={hasClass:function(e,t){return e.classList.contains(t)},addClass:function(e,t){Array.isArray(t)?t.forEach(function(t){r.hasClass(e,t)||e.classList.add(t)}):r.hasClass(e,t)||e.classList.add(t)},rmClass:function(e,t){Array.isArray(t)?t.forEach(function(t){r.hasClass(e,t)&&e.classList.remove(t)}):r.hasClass(e,t)&&e.classList.remove(t)},getComputedStyle:function(e,t){if(!e)throw new Error("dom元素不存在");if(!t)throw new Error("请输入需要查询的css属性名称");return document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(e,!1)[t]:e.currentStyle[t]},cssFilter:function(e,t,n){if("object"===(void 0===t?"undefined":o(t))&&!n){var r="";for(var i in t)t.hasOwnProperty(i)&&(r+=i+"("+t[i]+")");return e.style.filter=r,void(e.style.webkitFilter=r)}e.style.filter=t+"("+n+")",e.style.webkitFilter=t+"("+n+")"}};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=l(n(4)),r=l(n(3)),i=l(n(2)),u=l(n(1)),c=l(n(0));function l(e){return e&&e.__esModule?e:{default:e}}var a={store:i.default,dom:o.default,utils:r.default,exp:u.default,device:c.default};t.default=a}]).default; -------------------------------------------------------------------------------- /docs/docsify.js: -------------------------------------------------------------------------------- 1 | !function(){function e(e){var t=Object.create(null);return function(n){var r=i(n)?n:JSON.stringify(n);return t[r]||(t[r]=e(n))}}var t=e(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),n=Object.prototype.hasOwnProperty,r=Object.assign||function(e){for(var t=arguments,r=1;r=i.length)r(n);else if("function"==typeof t)if(2===t.length)t(n,function(t){n=t,o(e+1)});else{var a=t(n);n=void 0===a?n:a,o(e+1)}else o(e+1)};o(0)}var l=!0,c=l&&document.body.clientWidth<=600,u=l&&window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/),h={};function p(e,t){if(void 0===t&&(t=!1),"string"==typeof e){if(void 0!==window.Vue)return m(e);e=t?m(e):h[e]||(h[e]=m(e))}return e}var d=l&&document,g=l&&d.body,f=l&&d.head;function m(e,t){return t?e.querySelector(t):d.querySelector(e)}function v(e,t){return[].slice.call(t?e.querySelectorAll(t):d.querySelectorAll(e))}function b(e,t){return e=d.createElement(e),t&&(e.innerHTML=t),e}function y(e,t){return e.appendChild(t)}function k(e,t){return e.insertBefore(t,e.children[0])}function w(e,t,n){o(t)?window.addEventListener(e,t):e.addEventListener(t,n)}function x(e,t,n){o(t)?window.removeEventListener(e,t):e.removeEventListener(t,n)}function _(e,t,n){e&&e.classList[n?t:"toggle"](n||t)}var S=Object.freeze({getNode:p,$:d,body:g,head:f,find:m,findAll:v,create:b,appendTo:y,before:k,on:w,off:x,toggleClass:_,style:function(e){y(f,b("style",e))}});function C(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+='
  • '+e.title+"
  • ",e.children&&(t+='
    • '+C(e.children)+"
    ")}),t):""}function L(e,t){return'

    '+t.slice(5).trim()+"

    "}var E,A;function $(e){var t,n=e.loaded,r=e.total,i=e.step;!E&&function(){var e=b("div");e.classList.add("progress"),y(g,e),E=e}(),t=i?(t=parseInt(E.style.width||0,10)+i)>80?80:t:Math.floor(n/r*100),E.style.opacity=1,E.style.width=t>=95?"100%":t+"%",t>=95&&(clearTimeout(A),A=setTimeout(function(e){E.style.opacity=0,E.style.width="0%"},200))}var T={};function P(e,t,r){void 0===t&&(t=!1),void 0===r&&(r={});var i=new XMLHttpRequest,o=function(){i.addEventListener.apply(i,arguments)},s=T[e];if(s)return{then:function(e){return e(s.content,s.opt)},abort:a};i.open("GET",e);for(var l in r)n.call(r,l)&&i.setRequestHeader(l,r[l]);return i.send(),{then:function(n,r){if(void 0===r&&(r=a),t){var s=setInterval(function(e){return $({step:Math.floor(5*Math.random()+1)})},500);o("progress",$),o("loadend",function(e){$(e),clearInterval(s)})}o("error",r),o("load",function(t){var a=t.target;if(a.status>=400)r(a);else{var o=T[e]={content:a.response,opt:{updatedAt:i.getResponseHeader("last-modified")}};n(o.content,o.opt)}})},abort:function(e){return 4!==i.readyState&&i.abort()}}}function F(e,t){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,t)}var O=/([^{]*?)\w(?=\})/g,M={YYYY:"getFullYear",YY:"getYear",MM:function(e){return e.getMonth()+1},DD:"getDate",HH:"getHours",mm:"getMinutes",ss:"getSeconds"};var N="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function j(e,t){return e(t={exports:{}},t.exports),t.exports}var R=j(function(e,t){(function(){var t={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:p,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:p,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:p,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};t.bullet=/(?:[*+-]|\d+\.)/,t.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,t.item=l(t.item,"gm")(/bull/g,t.bullet)(),t.list=l(t.list)(/bull/g,t.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+t.def.source+")")(),t.blockquote=l(t.blockquote)("def",t.def)(),t._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",t.html=l(t.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,t._tag)(),t.paragraph=l(t.paragraph)("hr",t.hr)("heading",t.heading)("lheading",t.lheading)("blockquote",t.blockquote)("tag","<"+t._tag)("def",t.def)(),t.normal=d({},t),t.gfm=d({},t.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),t.gfm.paragraph=l(t.paragraph)("(?!","(?!"+t.gfm.fences.source.replace("\\1","\\2")+"|"+t.list.source.replace("\\1","\\3")+"|")(),t.tables=d({},t.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function n(e){this.tokens=[],this.tokens.links={},this.options=e||g.defaults,this.rules=t.normal,this.options.gfm&&(this.options.tables?this.rules=t.tables:this.rules=t.gfm)}n.rules=t,n.lex=function(e,t){return new n(t).lex(e)},n.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},n.prototype.token=function(e,n,r){var i,a,o,s,l,c,u,h,p;for(e=e.replace(/^ +$/gm,"");e;)if((o=this.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(n&&(o=this.rules.nptable.exec(e))){for(e=e.substring(o[0].length),c={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},h=0;h ?/gm,""),this.token(o,n,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(e)){for(e=e.substring(o[0].length),s=o[2],this.tokens.push({type:"list_start",ordered:s.length>1}),i=!1,p=(o=o[0].match(this.rules.item)).length,h=0;h1&&l.length>1||(e=o.slice(h+1).join("\n")+e,h=p-1)),a=i||/\n\n(?!\s*$)/.test(c),h!==p-1&&(i="\n"===c.charAt(c.length-1),a||(a=i)),this.tokens.push({type:a?"loose_item_start":"list_item_start"}),this.token(c,!1,r),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!r&&n&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(n&&(o=this.rules.table.exec(e))){for(e=e.substring(o[0].length),c={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},h=0;h])/,autolink:/^<([^ <>]+(@|:\/)[^ <>]+)>/,url:p,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^<'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)([\s\S]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:p,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,r.link=l(r.link)("inside",r._inside)("href",r._href)(),r.reflink=l(r.reflink)("inside",r._inside)(),r.normal=d({},r),r.pedantic=d({},r.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),r.gfm=d({},r.normal,{escape:l(r.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:l(r.text)("]|","~]|")("|","|https?://|")()}),r.breaks=d({},r.gfm,{br:l(r.br)("{2,}","*")(),text:l(r.gfm.text)("{2,}","*")()});function i(e,t){if(this.options=t||g.defaults,this.links=e,this.rules=r.normal,this.renderer=this.options.renderer||new a,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=r.breaks:this.rules=r.gfm:this.options.pedantic&&(this.rules=r.pedantic)}i.rules=r,i.output=function(e,t,n){return new i(t,n).output(e)},i.prototype.output=function(e){for(var t,n,r,i,a="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),a+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=s(":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1])),r=this.mangle("mailto:")+n):r=n=s(i[1]),a+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):s(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,a+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){a+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,a+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),a+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),a+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),a+=this.renderer.codespan(s(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),a+=this.renderer.text(s(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),r=n=s(i[1]),a+=this.renderer.link(r,null,n);return a},i.prototype.outputLink=function(e,t){var n=s(t.href),r=t.title?s(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,s(e[1]))},i.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},i.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n};function a(e){this.options=e||{}}a.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
    '+(n?e:s(e,!0))+"\n
    \n":"
    "+(n?e:s(e,!0))+"\n
    "},a.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},a.prototype.html=function(e){return e},a.prototype.heading=function(e,t,n){return"'+e+"\n"},a.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},a.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"\n"},a.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},a.prototype.paragraph=function(e){return"

    "+e+"

    \n"},a.prototype.table=function(e,t){return"\n\n"+e+"\n\n"+t+"\n
    \n"},a.prototype.tablerow=function(e){return"\n"+e+"\n"},a.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+"\n"},a.prototype.strong=function(e){return""+e+""},a.prototype.em=function(e){return""+e+""},a.prototype.codespan=function(e){return""+e+""},a.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},a.prototype.del=function(e){return""+e+""},a.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent((i=e,i.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}var i;this.options.baseUrl&&!h.test(e)&&(e=c(this.options.baseUrl,e));var a='
    "},a.prototype.image=function(e,t,n){this.options.baseUrl&&!h.test(e)&&(e=c(this.options.baseUrl,e));var r=''+n+'":">"},a.prototype.text=function(e){return e};function o(e){this.tokens=[],this.token=null,this.options=e||g.defaults,this.options.renderer=this.options.renderer||new a,this.renderer=this.options.renderer,this.renderer.options=this.options}o.parse=function(e,t,n){return new o(t,n).parse(e)},o.prototype.parse=function(e){this.inline=new i(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i="",a="";for(n="",e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'")}function l(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=(i=i.source||i).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function c(e,t){return u[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?u[" "+e]=e+"/":u[" "+e]=e.replace(/[^/]*$/,"")),e=u[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}var u={},h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(){}p.exec=p;function d(e){for(var t,n,r=arguments,i=1;iAn error occurred:

    "+s(e.message+"",!0)+"
    ";throw e}}g.options=g.setOptions=function(e){return d(g.defaults,e),g},g.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new a,xhtml:!1,baseUrl:null},g.Parser=o,g.parser=o.parse,g.Renderer=a,g.Lexer=n,g.lexer=n.lex,g.InlineLexer=i,g.inlineLexer=i.output,g.parse=g,e.exports=g}).call(function(){return this||("undefined"!=typeof window?window:N)}())}),q=j(function(e){var t="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},n=function(){var e=/\blang(?:uage)?-(\w+)\b/i,n=0,r=t.Prism={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof i?new i(e.type,r.util.encode(e.content),e.alias):"Array"===r.util.type(e)?e.map(r.util.encode):e.replace(/&/g,"&").replace(/e.length)return;if(!(w instanceof l)){p.lastIndex=0;var x=1;if(!(A=p.exec(w))&&f&&y!=t.length-1){if(p.lastIndex=k,!(A=p.exec(e)))break;for(var _=A.index+(g?A[1].length:0),S=A.index+A[0].length,C=y,L=k,E=t.length;C=(L+=t[C].length)&&(++y,k=L);if(t[y]instanceof l||t[C-1].greedy)continue;x=C-y,w=e.slice(k,L),A.index-=k}if(A){g&&(m=A[1].length);S=(_=A.index+m)+(A=A[0].slice(m)).length;var A,$=w.slice(0,_),T=w.slice(S),P=[y,x];$&&(++y,k+=$.length,P.push($));var F=new l(c,d?r.tokenize(A,d):A,v,A,f);if(P.push(F),T&&P.push(T),Array.prototype.splice.apply(t,P),1!=x&&r.matchGrammar(e,t,n,y,k,!0,c),o)break}else if(o)break}}}}},tokenize:function(e,t,n){var i=[e],a=t.rest;if(a){for(var o in a)t[o]=a[o];delete t.rest}return r.matchGrammar(e,i,t,0,0,!1),i},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,a=0;i=n[a++];)i(t)}}},i=r.Token=function(e,t,n,r,i){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!i};if(i.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return i.stringify(n,t,e)}).join("");var a={type:e.type,content:i.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if(e.alias){var o="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(a.classes,o)}r.hooks.run("wrap",a);var s=Object.keys(a.attributes).map(function(e){return e+'="'+(a.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+(s?" "+s:"")+">"+a.content+""},!t.document)return t.addEventListener?(r.disableWorkerMessageHandler||t.addEventListener("message",function(e){var n=JSON.parse(e.data),i=n.language,a=n.code,o=n.immediateClose;t.postMessage(r.highlight(a,r.languages[i],i)),o&&t.close()},!1),t.Prism):t.Prism;var a=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return a&&(r.filename=a.src,r.manual||a.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(r.highlightAll):window.setTimeout(r.highlightAll,16):document.addEventListener("DOMContentLoaded",r.highlightAll))),t.Prism}();e.exports&&(e.exports=n),void 0!==N&&(N.Prism=n),n.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),n.languages.xml=n.languages.markup,n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},n.languages.css.atrule.inside.rest=n.util.clone(n.languages.css),n.languages.markup&&(n.languages.insertBefore("markup","tag",{style:{pattern:/()[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:n.languages.css,alias:"language-css",greedy:!0}}),n.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:n.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:n.languages.css}},alias:"language-css"}},n.languages.markup.tag)),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+(?:[Ee][+-]?\d+)?|NaN|Infinity)\b/,function:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),n.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"}}),n.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}}}),n.languages.markup&&n.languages.insertBefore("markup","tag",{script:{pattern:/()[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:n.languages.javascript,alias:"language-javascript",greedy:!0}}),n.languages.js=n.languages.javascript,"undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector&&(self.Prism.fileHighlight=function(){var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(t){for(var r,i=t.getAttribute("data-src"),a=t,o=/\blang(?:uage)?-(?!\*)(\w+)\b/i;a&&!o.test(a.className);)a=a.parentNode;if(a&&(r=(t.className.match(o)||[,""])[1]),!r){var s=(i.match(/\.(\w+)$/)||[,""])[1];r=e[s]||s}var l=document.createElement("code");l.className="language-"+r,t.textContent="",l.textContent="Loading…",t.appendChild(l);var c=new XMLHttpRequest;c.open("GET",i,!0),c.onreadystatechange=function(){4==c.readyState&&(c.status<400&&c.responseText?(l.textContent=c.responseText,n.highlightElement(l)):c.status>=400?l.textContent="✖ Error "+c.status+" while fetching file: "+c.statusText:l.textContent="✖ Error: File does not exist or is empty")},c.send(null)})},document.addEventListener("DOMContentLoaded",self.Prism.fileHighlight))});function H(e,t){var n=[],r={};return e.forEach(function(e){var i=e.level||1,a=i-1;i>t||(r[a]?r[a].children=(r[a].children||[]).concat(e):n.push(e),r[i]=e)}),n}var z={},I=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g;function B(e){return e.toLowerCase()}function U(e){if("string"!=typeof e)return"";var t=e.trim().replace(/[A-Z]+/g,B).replace(/<[^>\d]+>/g,"").replace(I,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),r=z[t];return r=n.call(z,t)?r+1:0,z[t]=r,r&&(t=t+"-"+r),t}U.clear=function(){z={}};function D(e,t){return''+t+''}var Y=decodeURIComponent,W=encodeURIComponent;function G(e){var t={};return(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var n=e.replace(/\+/g," ").split("=");t[n[0]]=n[1]&&Y(n[1])}),t):t}function X(e,t){void 0===t&&(t=[]);var n=[];for(var r in e)t.indexOf(r)>-1||n.push(e[r]?(W(r)+"="+W(e[r])).toLowerCase():W(r));return n.length?"?"+n.join("&"):""}var Q=e(function(e){return/(:|(\/{2}))/g.test(e)}),V=e(function(e){return/\/$/g.test(e)?e:(e=e.match(/(\S*\/)[^/]+$/))?e[1]:""}),Z=e(function(e){return e.replace(/^\/+/,"/").replace(/([^:])\/{2,}/g,"$1/")});function J(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Z(e.join("/"))}var K=e(function(e){return e.replace("#","?id=")}),ee={};function te(e){void 0===e&&(e="");var t={};return e&&(e=e.replace(/:([\w-]+)=?([\w-]+)?/g,function(e,n,r){return t[n]=r&&r.replace(/"/g,"")||!0,""}).trim()),{str:e,config:t}}var ne={markdown:function(e){return{url:e}},iframe:function(e,t){return{code:'"}},video:function(e,t){return{code:'"}},audio:function(e,t){return{code:'"}},code:function(e,t){var n=e.match(/\.(\w+)$/);return"md"===(n=t||n&&n[1])&&(n="markdown"),{url:e,lang:n}}},re=function(t,n){this.config=t,this.router=n,this.cacheTree={},this.toc=[],this.linkTarget=t.externalLinkTarget||"_blank",this.contentBase=n.getBasePath();var a,s=this._initRenderer(),c=t.markdown||{};o(c)?a=c(R,s):(R.setOptions(r(c,{renderer:r(s,c.renderer)})),a=R),this._marked=a,this.compile=e(function(e){var n="";if(!e)return e;n=i(e)?a(e):a.parser(e),n=t.noEmoji?n:(r=n,r.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g,function(e){return e.replace(/:/g,"__colon__")}).replace(/:(\w+?):/gi,l&&window.emojify||D).replace(/__colon__/g,":"));var r;return U.clear(),n})};re.prototype.compileEmbed=function(e,t){var n,r=te(t),i=r.str,a=r.config;if(t=i,a.include){Q(e)||(e=J(this.contentBase,V(this.router.getCurrentPath()),e));var o;if(a.type&&(o=ne[a.type]))(n=o.call(this,e,t)).type=a.type;else{var s="code";/\.(md|markdown)/.test(e)?s="markdown":/\.html?/.test(e)?s="iframe":/\.(mp4|ogg)/.test(e)?s="video":/\.mp3/.test(e)&&(s="audio"),(n=ne[s].call(this,e,t)).type=s}return n}},re.prototype._matchNotCompileLink=function(e){for(var t=this.config.noCompileLinks||[],n=0;n
    '+e+""},a.code=e.code=function(e,t){void 0===t&&(t=""),e=e.replace(/@DOCSIFY_QM@/g,"`");return'
    '+q.highlight(e,q.languages[t]||q.languages.markup)+"
    "},a.link=e.link=function(e,r,a){void 0===r&&(r="");var o="",s=te(r),l=s.str,c=s.config;return r=l,Q(e)||i._matchNotCompileLink(e)||c.ignore?o+=' target="'+t+'"':(e===i.config.homepage&&(e="README"),e=n.toURL(e,null,n.getCurrentPath())),c.target&&(o+=" target="+c.target),c.disabled&&(o+=" disabled",e="javascript:void(0)"),r&&(o+=' title="'+r+'"'),'"+a+""},a.paragraph=e.paragraph=function(e){return/^!>/.test(e)?L("tip",e):/^\?>/.test(e)?L("warn",e):"

    "+e+"

    "},a.image=e.image=function(e,t,i){var a=e,o="",s=te(t),l=s.str,c=s.config;t=l,c["no-zoom"]&&(o+=" data-no-zoom"),t&&(o+=' title="'+t+'"');var u=c.size;if(u){var h=u.split("x");h[1]?o+="width="+h[0]+" height="+h[1]:o+="width="+h[0]}return Q(e)||(a=J(r,V(n.getCurrentPath()),e)),''+i+'"};var o=/^\[([ x])\] +/;return a.listitem=e.listitem=function(e){var t=o.exec(e);return t&&(e=e.replace(o,'")),""+e+"\n"},e.origin=a,e},re.prototype.sidebar=function(e,t){var n=this.router.getCurrentPath(),r="";if(e)r=this.compile(e);else{var i=this.cacheTree[n]||H(this.toc,t);r=C(i,"
      "),this.cacheTree[n]=i}return r},re.prototype.subSidebar=function(e){if(e){var t=this.router.getCurrentPath(),n=this.cacheTree,r=this.toc;r[0]&&r[0].ignoreAllSubs&&r.splice(0),r[0]&&1===r[0].level&&r.shift();for(var i=0;i')}this.toc=[]},re.prototype.article=function(e){return this.compile(e)},re.prototype.cover=function(e){var t=this.toc.slice(),n=this.compile(e);return this.toc=t.slice(),n};var ie=d.title;function ae(){var e=p("section.cover");if(e){var t=e.getBoundingClientRect().height;window.pageYOffset>=t||e.classList.contains("hidden")?_(g,"add","sticky"):_(g,"remove","sticky")}}function oe(e,t,n,r){var i,a=v(t=p(t),"a"),o=decodeURI(e.toURL(e.getCurrentPath()));return a.sort(function(e,t){return t.href.length-e.href.length}).forEach(function(e){var t=e.getAttribute("href"),r=n?e.parentNode:e;0!==o.indexOf(t)||i?_(r,"remove","active"):(i=e,_(r,"add","active"))}),r&&(d.title=i?i.innerText+" - "+ie:ie),i}var se=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.duration=t.duration||1e3,this.ease=t.easing||this._defaultEase,this.start=t.start,this.end=t.end,this.frame=null,this.next=null,this.isRunning=!1,this.events={},this.direction=this.startthis.end&&e>=this.next}[this.direction]}},{key:"_defaultEase",value:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}}]),e}(),ce={},ue=!1,he=null,pe=!0,de=0;function ge(e){if(pe){for(var t,n=p(".sidebar"),r=v(".anchor"),i=m(n,".sidebar-nav"),a=m(n,"li.active"),o=document.documentElement,s=(o&&o.scrollTop||document.body.scrollTop)-de,l=0,c=r.length;ls){t||(t=u);break}t=u}if(t){var h=ce[fe(decodeURIComponent(e),t.getAttribute("data-id"))];if(h&&h!==a&&(a&&a.classList.remove("active"),h.classList.add("active"),a=h,!ue&&g.classList.contains("sticky"))){var d=n.clientHeight,f=a.offsetTop+a.clientHeight+40,b=f-0=i.scrollTop&&f<=i.scrollTop+d?i.scrollTop:b?0:f-d;n.scrollTop=y}}}}function fe(e,t){return e+"?id="+t}function me(e,t){if(t){var n=m("#"+t);n&&(r=n,he&&he.stop(),pe=!1,he=new le({start:window.pageYOffset,end:r.getBoundingClientRect().top+window.pageYOffset,duration:500}).on("tick",function(e){return window.scrollTo(0,e)}).on("done",function(){pe=!0,he=null}).begin());var r,i=ce[fe(e,t)],a=m(p(".sidebar"),"li.active");a&&a.classList.remove("active"),i&&i.classList.add("active")}}var ve=d.scrollingElement||d.documentElement;var be={};function ye(e,t){var n=e.compiler,i=e.raw;void 0===i&&(i="");var a,o=e.fetch;if(a=be[i])return t(a);var s=n._marked,l=s.lexer(i),c=[],u=s.InlineLexer.rules.link,h=l.links;l.forEach(function(e,t){"paragraph"===e.type&&(e.text=e.text.replace(new RegExp(u.source,"g"),function(e,r,i,a){var o=n.compileEmbed(i,a);return o?("markdown"!==o.type&&"code"!==o.type||c.push({index:t,embed:o}),o.code):e}))});var p=0;!function(e,t){var n,r=e.embedTokens,i=e.compile,a=(e.fetch,0),o=1;if(!r.length)return t({});for(;n=r[a++];){var s=function(e){return function(n){var r;n&&("markdown"===e.embed.type?r=i.lexer(n):"code"===e.embed.type&&(r=i.lexer("```"+e.embed.lang+"\n"+n.replace(/`/g,"@DOCSIFY_QM@")+"\n```\n"))),t({token:e,embedToken:r}),++o>=a&&t({})}}(n);P(n.embed.url).then(s)}}({compile:s,embedTokens:c,fetch:o},function(e){var n=e.embedToken,a=e.token;if(a){var o=a.index+p;r(h,n.links),l=l.slice(0,o).concat(n,l.slice(o+1)),p+=n.length-1}else be[i]=l.concat(),l.links=be[i].links=h,t(l)})}function ke(){var e=v(".markdown-section>script").filter(function(e){return!/template/.test(e.type)})[0];if(!e)return!1;var t=e.innerText.trim();if(!t)return!1;setTimeout(function(e){window.__EXECUTE_RESULT__=new Function(t)()},0)}function we(e,t,n){return t="function"==typeof n?n(t):"string"==typeof n?function(e){var t=[],n=0;return e.replace(O,function(r,i,a){t.push(e.substring(n,a-1)),n=a+=r.length+1,t.push(function(e){return("00"+("string"==typeof M[r]?e[M[r]]():M[r](e))).slice(-r.length)})}),n!==e.length&&t.push(e.substring(n)),function(e){for(var n="",r=0,i=e||new Date;r'):"")),t.coverpage&&(a+='
      \x3c!--cover--\x3e
      '),t.logo&&(t.logo=J(e.router.getBasePath(),t.logo)),a+=function(e){var t='';return(c?t+"
      ":"
      "+t)+'
      \x3c!--main--\x3e
      '}(t),e._renderTo(i,a,!0)):e.rendered=!0;var s;t.mergeNavbar&&c?o=m(".sidebar"):(r.classList.add("app-nav"),t.repo||r.classList.add("no-badge")),t.loadNavbar&&k(o,r),t.themeColor&&(d.head.appendChild(b("div",(u=t.themeColor,"")).firstElementChild),function(e){if(!(window.CSS&&window.CSS.supports&&window.CSS.supports("(--v:red)"))){var t=v("style:not(.inserted),link");[].forEach.call(t,function(t){if("STYLE"===t.nodeName)F(t,e);else if("LINK"===t.nodeName){var n=t.getAttribute("href");if(!/\.css$/.test(n))return;P(n).then(function(t){var n=b("style",t);f.appendChild(n),F(n,e)})}})}}(t.themeColor));var u;e._updateRender(),_(g,"ready")}var Se={};var Ce=function(e){this.config=e};Ce.prototype.getBasePath=function(){return this.config.basePath},Ce.prototype.getFile=function(e,t){void 0===e&&(e=this.getCurrentPath());var n=this.config,r=this.getBasePath(),i="string"==typeof n.ext?n.ext:".md";e=n.alias?function e(t,n,r){var i=Object.keys(n).filter(function(e){return(Se[e]||(Se[e]=new RegExp("^"+e+"$"))).test(t)&&t!==r})[0];return i?e(t.replace(Se[i],n[i]),n,t):t}(e,n.alias):e,a=e,o=i;var a,o;return e=(e=new RegExp("\\.("+o.replace(/^\./,"")+"|html)$","g").test(a)?a:/\/$/g.test(a)?a+"README"+o:""+a+o)==="/README"+i?n.homepage||e:e,e=Q(e)?e:J(r,e),t&&(e=e.replace(new RegExp("^"+r),"")),e},Ce.prototype.onchange=function(e){void 0===e&&(e=a),e()},Ce.prototype.getCurrentPath=function(){},Ce.prototype.normalize=function(){},Ce.prototype.parse=function(){},Ce.prototype.toURL=function(e,t,n){var i=n&&"#"===e[0],a=this.parse(K(e));if(a.query=r({},a.query,t),e=(e=a.path+X(a.query)).replace(/\.md(\?)|\.md$/,"$1"),i){var o=n.indexOf("?");e=(o>0?n.substr(0,o):n)+e}return Z("/"+e)};function Le(e){var t=location.href.indexOf("#");location.replace(location.href.slice(0,t>=0?t:0)+"#"+e)}var Ee=function(e){function t(t){e.call(this,t),this.mode="hash"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getBasePath=function(){var e=window.location.pathname||"",t=this.config.basePath;return/^(\/|https?:)/g.test(t)?t:Z(e+"/"+t)},t.prototype.getCurrentPath=function(){var e=location.href,t=e.indexOf("#");return-1===t?"":e.slice(t+1)},t.prototype.onchange=function(e){void 0===e&&(e=a),w("hashchange",e)},t.prototype.normalize=function(){var e=this.getCurrentPath();if("/"===(e=K(e)).charAt(0))return Le(e);Le("/"+e)},t.prototype.parse=function(e){void 0===e&&(e=location.href);var t="",n=e.indexOf("#");n>=0&&(e=e.slice(n+1));var r=e.indexOf("?");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{path:e,file:this.getFile(e,!0),query:G(t)}},t.prototype.toURL=function(t,n,r){return"#"+e.prototype.toURL.call(this,t,n,r)},t}(Ce),Ae=function(e){function t(t){e.call(this,t),this.mode="history"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCurrentPath=function(){var e=this.getBasePath(),t=window.location.pathname;return e&&0===t.indexOf(e)&&(t=t.slice(e.length)),(t||"/")+window.location.search+window.location.hash},t.prototype.onchange=function(e){void 0===e&&(e=a),w("click",function(t){var n="A"===t.target.tagName?t.target:t.target.parentNode;if("A"===n.tagName&&!/_blank/.test(n.target)){t.preventDefault();var r=n.href;window.history.pushState({key:r},"",r),e()}}),w("popstate",e)},t.prototype.parse=function(e){void 0===e&&(e=location.href);var t="",n=e.indexOf("?");n>=0&&(t=e.slice(n+1),e=e.slice(0,n));var r=J(location.origin),i=e.indexOf(r);return i>-1&&(e=e.slice(i+r.length)),{path:e,file:this.getFile(e),query:G(t)}},t}(Ce);var $e={};function Te(e){e.router.normalize(),e.route=e.router.parse(),g.setAttribute("data-page",e.route.file)}function Pe(e){!function(e){var t=function(e){return g.classList.toggle("close")};w(e=p(e),"click",function(e){e.stopPropagation(),t()}),c&&w(g,"click",function(e){return g.classList.contains("close")&&t()})}("button.sidebar-toggle",e.router),t=".sidebar",e.router,w(t=p(t),"click",function(e){var t=e.target;"A"===t.nodeName&&t.nextSibling&&t.nextSibling.classList.contains("app-sub-sidebar")&&_(t.parentNode,"collapse")});var t;e.config.coverpage?!c&&w("scroll",ae):g.classList.add("sticky")}function Fe(e,t,n,r,i,a){e=a?e:e.replace(/\/$/,""),(e=V(e))&&P(i.router.getFile(e+n)+t,!1,i.config.requestHeaders).then(r,function(a){return Fe(e,t,n,r,i)})}var Oe=Object.freeze({cached:e,hyphenate:t,hasOwn:n,merge:r,isPrimitive:i,noop:a,isFn:o,inBrowser:l,isMobile:c,supportsPushState:u,parseQuery:G,stringifyQuery:X,isAbsolutePath:Q,getParentPath:V,cleanPath:Z,getPath:J,replaceSlug:K});function Me(){this._init()}var Ne=Me.prototype;Ne._init=function(){this.config=function(){var e=r({el:"#app",repo:"",maxLevel:6,subMaxLevel:0,loadSidebar:null,loadNavbar:null,homepage:"README.md",coverpage:"",basePath:"",auto2top:!1,name:"",themeColor:"",nameLink:window.location.pathname,autoHeader:!1,executeScript:null,noEmoji:!1,ga:"",ext:".md",mergeNavbar:!1,formatUpdated:"",externalLinkTarget:"_blank",routerMode:"hash",noCompileLinks:[]},window.$docsify),a=document.currentScript||[].slice.call(document.getElementsByTagName("script")).filter(function(e){return/docsify\./.test(e.src)})[0];if(a){for(var o in e)if(n.call(e,o)){var s=a.getAttribute("data-"+t(o));i(s)&&(e[o]=""===s||s)}!0===e.loadSidebar&&(e.loadSidebar="_sidebar"+e.ext),!0===e.loadNavbar&&(e.loadNavbar="_navbar"+e.ext),!0===e.coverpage&&(e.coverpage="_coverpage"+e.ext),!0===e.repo&&(e.repo=""),!0===e.name&&(e.name="")}return window.$docsify=e,e}(),(e=this)._hooks={},e._lifecycle={},["init","mounted","beforeEach","afterEach","doneEach","ready"].forEach(function(t){var n=e._hooks[t]=[];e._lifecycle[t]=function(e){return n.push(e)}});var e;[].concat((a=this).config.plugins).forEach(function(e){return o(e)&&e(a._lifecycle,a)});var a;s(this,"init"),function(e){var t,n=e.config;t="history"===(n.routerMode||"hash")&&u?new Ae(n):new Ee(n),e.router=t,Te(e),$e=e.route,t.onchange(function(t){Te(e),e._updateRender(),$e.path!==e.route.path?(e.$fetch(),$e=e.route):e.$resetEvents()})}(this),_e(this),Pe(this),function(e){var t=e.config.loadSidebar;if(e.rendered){var n=oe(e.router,".sidebar-nav",!0,!0);t&&n&&(n.parentNode.innerHTML+=window.__SUB_SIDEBAR__),e._bindEventOnRendered(n),e.$resetEvents(),s(e,"doneEach"),s(e,"ready")}else e.$fetch(function(t){return s(e,"ready")})}(this),s(this,"mounted")};Ne.route={};(je=Ne)._renderTo=function(e,t,n){var r=p(e);r&&(r[n?"outerHTML":"innerHTML"]=t)},je._renderSidebar=function(e){var t=this.config,n=t.maxLevel,r=t.subMaxLevel,i=t.loadSidebar;this._renderTo(".sidebar-nav",this.compiler.sidebar(e,n));var a=oe(this.router,".sidebar-nav",!0,!0);i&&a?a.parentNode.innerHTML+=this.compiler.subSidebar(r)||"":this.compiler.subSidebar(),this._bindEventOnRendered(a)},je._bindEventOnRendered=function(e){var t=this.config,n=t.autoHeader,r=t.auto2top;if(function(e){var t=m(".cover.show");de=t?t.offsetHeight:0;for(var n=p(".sidebar"),r=v(n,"li"),i=0,a=r.length;i([^<]*?)

      $');if(i){if("color"===i[2])n.style.background=i[1]+(i[3]||"");else{var a=i[1];_(n,"add","has-mask"),Q(i[1])||(a=J(this.router.getBasePath(),i[1])),n.style.backgroundImage="url("+a+")",n.style.backgroundSize="cover",n.style.backgroundPosition="center center"}r=r.replace(i[0],"")}this._renderTo(".cover-main",r),ae()}else _(n,"remove","show")},je._updateRender=function(){!function(e){var t=p(".app-name-link"),n=e.config.nameLink,r=e.route.path;if(t)if(i(e.config.nameLink))t.setAttribute("href",n);else if("object"==typeof n){var a=Object.keys(n).filter(function(e){return r.indexOf(e)>-1})[0];t.setAttribute("href",n[a])}}(this)};var je;!function(e){var t,n=function(e,n,r){return t&&t.abort&&t.abort(),t=P(e,!0,r)};e._loadSideAndNav=function(e,t,n,r){var i=this;return function(){if(!n)return r();Fe(e,t,n,function(e){i._renderSidebar(e),r()},i,!0)}},e._fetch=function(e){var t=this;void 0===e&&(e=a);var r=this.route,i=r.path,o=X(r.query,["id"]),s=this.config,l=s.loadNavbar,c=s.requestHeaders,u=s.loadSidebar,h=this.router.getFile(i),p=n(h+o,0,c);this.isHTML=/\.html$/g.test(h),p.then(function(n,r){return t._renderMain(n,r,t._loadSideAndNav(i,o,u,e))},function(n){t._fetchFallbackPage(h,o,e)||t._fetch404(h,o,e)}),l&&Fe(i,o,l,function(e){return t._renderNav(e)},this,!0)},e._fetchCover=function(){var e=this,t=this.config,n=t.coverpage,r=t.requestHeaders,i=this.route.query,a=V(this.route.path);if(n){var o=null,s=this.route.path;if("string"==typeof n)"/"===s&&(o=n);else if(Array.isArray(n))o=n.indexOf(s)>-1&&"_coverpage";else{var l=n[s];o=!0===l?"_coverpage":l}var c=Boolean(o)&&this.config.onlyCover;return o?(o=this.router.getFile(a+o),this.coverIsHTML=/\.html$/g.test(o),P(o+X(i,["id"]),!1,r).then(function(t){return e._renderCover(t,c)})):this._renderCover(null,c),c}},e.$fetch=function(e){var t=this;void 0===e&&(e=a);var n=function(){s(t,"doneEach"),e()};this._fetchCover()?n():this._fetch(function(){t.$resetEvents(),n()})},e._fetchFallbackPage=function(e,t,r){var i=this;void 0===r&&(r=a);var o=this.config,s=o.requestHeaders,l=o.fallbackLanguages,c=o.loadSidebar;if(!l)return!1;var u=e.split("/")[1];if(-1===l.indexOf(u))return!1;var h=e.replace(new RegExp("^/"+u),"");return n(h+t,0,s).then(function(n,a){return i._renderMain(n,a,i._loadSideAndNav(e,t,c,r))},function(){return i._fetch404(e,t,r)}),!0},e._fetch404=function(e,t,r){var i=this;void 0===r&&(r=a);var o=this.config,s=o.loadSidebar,l=o.requestHeaders,c=o.notFoundPage,u=this._loadSideAndNav(e,t,s,r);if(c){var h=function(e,t){var n,r,i=t.notFoundPage,a="_404"+(t.ext||".md");switch(typeof i){case"boolean":r=a;break;case"string":r=i;break;case"object":r=(n=Object.keys(i).sort(function(e,t){return t.length-e.length}).find(function(t){return e.match(new RegExp("^"+t))}))&&i[n]||a}return r}(e,this.config);return n(this.router.getFile(h),0,l).then(function(e,t){return i._renderMain(e,t,u)},function(){return i._renderMain(null,{},u)}),!0}return this._renderMain(null,{},u),!1}}(Ne),Ne.$resetEvents=function(){me(this.route.path,this.route.query.id),this.config.loadNavbar&&oe(this.router,"nav")};window.Docsify={util:Oe,dom:S,get:P,slugify:U},window.DocsifyCompiler=re,window.marked=R,window.Prism=q,Me.version="4.7.0",function(e){var t=document.readyState;if("complete"===t||"interactive"===t)return setTimeout(e,0);document.addEventListener("DOMContentLoaded",e)}(function(e){return new Me})}(); --------------------------------------------------------------------------------