diff --git a/brain/api/content/posts.js b/brain/api/content/posts.js index 77271f2..98de1f1 100644 --- a/brain/api/content/posts.js +++ b/brain/api/content/posts.js @@ -1,4 +1,3 @@ -var express = require('express'); import DateUtils from '../../tools/utilities/DateUtils'; import StringUtils from '../../tools/utilities/StringUtils'; import * as DataEvent from '../../tools/events/DataEvent'; @@ -17,6 +16,7 @@ import RightsManager, OBJECT_POST } from '../../tools/utilities/RightsManager'; +const express = require('express'); const router = express.Router(); const multer = require('multer'); const md = require('markdown-it')('commonmark'); diff --git a/brain/app.js b/brain/app.js index 5f70e65..18a76a4 100644 --- a/brain/app.js +++ b/brain/app.js @@ -44,6 +44,7 @@ app.use(flash()); var front = require('./routes/front/index')(session); var back = require('./routes/back/index'); var postDashboard = require('./routes/back/dash_posts'); +var settingsDashboard = require('./routes/back/dash_settings'); //api var postLibrary = require('./api/content/posts'); var mailer = require('./api/content/mailer'); @@ -54,6 +55,7 @@ app.use('/api/post', postLibrary); app.use('/', front); app.use('/@/dashboard', back); app.use('/@/dashboard/posts', postDashboard); +app.use('/@/dashboard/settings', settingsDashboard); //app.use('/mailer', mailer); // catch 404 and forward to error handler app.use(function(req, res, next) diff --git a/brain/routes/back/dash_settings.js b/brain/routes/back/dash_settings.js new file mode 100644 index 0000000..a730058 --- /dev/null +++ b/brain/routes/back/dash_settings.js @@ -0,0 +1,50 @@ +const express = require('express'); +const router = express.Router(); +const FileHound = require('filehound'); +const Models = require('../../models'); +const fs = require("fs-extra"); +var themes = []; +var settings = []; +//-------------------------- +// SETTINGS +//-------------------------- +router.get('/', function(req, res) +{ + fs.readJson('site-settings.json').then(obj => + { + settings = obj; + }).catch(err => + { + //console.error(err) + }) + FileHound.create().paths('themes').ext('json').find().then(files => + { + for (let index = 0; index < files.length; index++) + { + fs.readJson(files[index]).then(theme => + { + (theme.name == settings.theme) ? themes.push({theme: theme, current:true}) : themes.push({theme: theme, current:false}) + }).catch(err => + { + //console.error(err) + }) + } + }); + if (req.session.user) + { + let memberInfo = []; + memberInfo.push({handle:req.session.user.handle, email:req.session.user.email, avi:req.session.user.avatar}); + res.render('dash/settings', + { + title: 'Dashboard | Settings', + themes: themes, + settings: settings, + member: memberInfo[0] + }); + } + else + { + res.redirect('/@/dashboard'); + } +}); +module.exports = router; \ No newline at end of file diff --git a/brain/routes/back/index.js b/brain/routes/back/index.js index 45727c4..0c2ca75 100644 --- a/brain/routes/back/index.js +++ b/brain/routes/back/index.js @@ -9,64 +9,40 @@ router.get('/', function(req, res) { var loggedIn = false if (req.session.user) loggedIn = true; - Models.FreshPost.sync().then(f => + Models.FreshPost.findAll( { - Models.FreshPost.findAll( - { - order: [ - ['id', 'DESC'] - ], - limit: 5 - }).then(function(posts) + order: [ + ['id', 'DESC'] + ], + limit: 5 + }).then(function(posts) + { + let filtered = []; + for (let index = 0; index < posts.length; index++) { - let filtered = []; - for (let index = 0; index < posts.length; index++) + let item = posts[index].post; + if (typeof item.deleted == 'undefined' || item.deleted == false) { - let item = posts[index].post; - if (typeof item.deleted == 'undefined' || item.deleted == false) - { - filtered.push(posts[index]) - } - else - { - continue - } + filtered.push(posts[index]) } - res.render('dash/index', + else { - title: 'Dashboard', - user_status: loggedIn, - items: filtered - }); - }).then(function(value) - { - //console.log(value); - }).catch(function(err) - { - //next(err); - }) - }).catch(err => - { - console.log("ERR: " + err); - }) -}); -//-------------------------- -// SETTINGS -//-------------------------- -router.get('/settings/', function(req, res) -{ - if (req.session.user) - { - res.render('dash/settings', + continue + } + } + res.render('dash/index', { - title: 'Dashboard | Settings', - mode: 'admin' + title: 'Dashboard', + user_status: loggedIn, + items: filtered }); - } - else + }).then(function(value) { - res.redirect('/@/dashboard'); - } + //console.log(value); + }).catch(function(err) + { + //next(err); + }) }); //-------------------------- // Login diff --git a/brain/routes/front/index.js b/brain/routes/front/index.js index 2f09f7d..70b948f 100644 --- a/brain/routes/front/index.js +++ b/brain/routes/front/index.js @@ -1,7 +1,7 @@ var express = require('express'); var router = express.Router(); var Models = require('../../models'); -var config = require('../../../config.json'); +var config = require('../../../site-settings.json'); module.exports = function (session) { //-------------------------- // Index diff --git a/brain/tools/ui/Slideshow.js b/brain/tools/ui/Slideshow.js deleted file mode 100644 index 49fdd67..0000000 --- a/brain/tools/ui/Slideshow.js +++ /dev/null @@ -1,59 +0,0 @@ -import TransformEffects from './TransformEffects.jsx'; - -class Slideshow{ - - //-------------------------- - // constructor - //-------------------------- - constructor(slides) - { - this.slides = slides; - var timer = null; - this.slideIndex = 0; - for(let i of slides) - { - new TransformEffects().rotateY(i, 0, 90, "top right"); - i.style.opacity = 1; - } - - this.start(); - } - - //-------------------------- - // methods - //-------------------------- - start() - { - new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 0, "top right"); - this.startTimer() - } - - startTimer() - { - var self = this; - this.timer = setTimeout(f=> - { - self.slideTranstion(); - }, 4000); - } - - slideTranstion() - { - new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 90, "top right"); - ++this.slideIndex; - if(this.slideIndex > this.slides.length-1) - this.slideIndex = 0; - new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 0, "top right"); - this.startTimer(); - } - - setDisplayType() - { - - } - - //-------------------------- - // eventhandlers - //-------------------------- -} -export {Slideshow as default} diff --git a/package-lock.json b/package-lock.json index 31cf9c8..f2149cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1771,8 +1771,7 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", @@ -1895,19 +1894,10 @@ } } }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "requires": { - "hoek": "2.x.x" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2239,8 +2229,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concat-stream": { "version": "1.6.2", @@ -2364,14 +2353,6 @@ } } }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "requires": { - "boom": "2.x.x" - } - }, "css-parse": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.7.0.tgz", @@ -2699,6 +2680,11 @@ "brfs": "^1.4.3" } }, + "err-code": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", + "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=" + }, "es5-ext": { "version": "0.10.46", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz", @@ -3089,11 +3075,34 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, + "file-js": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/file-js/-/file-js-0.3.0.tgz", + "integrity": "sha1-+rRr94I0bJKUSZ8fDSrQfYOPJdE=", + "requires": { + "bluebird": "^3.4.7", + "minimatch": "^3.0.3", + "proper-lockfile": "^1.2.0" + } + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" }, + "filehound": { + "version": "1.16.5", + "resolved": "https://registry.npmjs.org/filehound/-/filehound-1.16.5.tgz", + "integrity": "sha512-pMGt+Fl/msSDMBU/3/jUtNkBvDKAeRb0eIrhyz3qB/gqFSGqWMrExCGfgTJjtch9YEKYTi1Z/N5Tpuzfj/pkBg==", + "requires": { + "bluebird": "^3.5.1", + "file-js": "0.3.0", + "lodash": "^4.17.10", + "minimatch": "^3.0.4", + "moment": "^2.22.1", + "unit-compare": "^1.0.1" + } + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -3961,17 +3970,6 @@ "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", "dev": true }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" - } - }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -3983,11 +3981,6 @@ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.13.1.tgz", "integrity": "sha512-Sc28JNQNDzaH6PORtRLMvif9RSn1mYuOoX3omVjnb0+HbpPygU2ALBI0R/wsiqCb4/fcp07Gdo8g+fhtFrQl6A==" }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" - }, "html-encoding-sniffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", @@ -4428,14 +4421,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "requires": { - "jsonify": "~0.0.0" - } - }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -4455,11 +4440,6 @@ "graceful-fs": "^4.1.6" } }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -4804,7 +4784,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -5448,6 +5427,17 @@ "with-callback": "^1.0.2" } }, + "proper-lockfile": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/proper-lockfile/-/proper-lockfile-1.2.0.tgz", + "integrity": "sha1-zv9d2J0+XxD7deHo52vHWAGlnDQ=", + "requires": { + "err-code": "^1.0.0", + "extend": "^3.0.0", + "graceful-fs": "^4.1.2", + "retry": "^0.10.0" + } + }, "proto-list": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", @@ -5861,6 +5851,11 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "retry": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", + "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=" + }, "retry-as-promised": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-2.3.2.tgz", @@ -5944,140 +5939,6 @@ "integrity": "sha1-io6pbtN0G4WpKgSCQuniBxyePLE=", "dev": true }, - "scrape-metadata": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/scrape-metadata/-/scrape-metadata-2.0.0.tgz", - "integrity": "sha1-fr9sO14F211ZzX6I/G8auTuIL/4=", - "requires": { - "htmlparser2": "3.9.2", - "request": "2.81.0" - }, - "dependencies": { - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" - }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" - }, - "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" - } - }, - "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=" - }, - "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - } - }, - "htmlparser2": { - "version": "3.9.2", - "resolved": "http://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", - "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", - "requires": { - "domelementtype": "^1.3.0", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" - } - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=" - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" - }, - "request": { - "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "performance-now": "^0.2.0", - "qs": "~6.4.0", - "safe-buffer": "^5.0.1", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.0.0" - } - }, - "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "requires": { - "punycode": "^1.4.1" - } - } - } - }, "semver": { "version": "4.3.2", "resolved": "http://registry.npmjs.org/semver/-/semver-4.3.2.tgz", @@ -6463,14 +6324,6 @@ "kind-of": "^3.2.0" } }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "requires": { - "hoek": "2.x.x" - } - }, "socks": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/socks/-/socks-2.2.1.tgz", @@ -6657,11 +6510,6 @@ "safe-buffer": "~5.1.0" } }, - "stringstream": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", - "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==" - }, "strip-ansi": { "version": "3.0.1", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -7014,6 +6862,14 @@ "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", "dev": true }, + "unit-compare": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unit-compare/-/unit-compare-1.0.1.tgz", + "integrity": "sha1-DHRZ8OW/U2N+qHPKPO4Y3i7so4Y=", + "requires": { + "moment": "^2.14.1" + } + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", diff --git a/package.json b/package.json index 6e43be0..78badcc 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "esm": "^3.0.84", "express": "^4.16.4", "express-session": "^1.15.6", + "filehound": "^1.16.5", "fs-extra": "latest", "highlight.js": "^9.13.1", "jsdom": "^12.2.0", @@ -48,7 +49,6 @@ "reframe.js": "^2.2.1", "request": "^2.88.0", "sanitize-html": "^1.19.1", - "scrape-metadata": "^2.0.0", "sequelize": "^4.37.6", "sequelize-cli": "^5.3.0", "serve-favicon": "latest", diff --git a/site-settings.json b/site-settings.json new file mode 100644 index 0000000..7750f31 --- /dev/null +++ b/site-settings.json @@ -0,0 +1,17 @@ +{ + "url": "http://fipamo.local/", + "description":"The most chill blog framework ever.", + "theme": "default", + "private": false, + "email": { + "smtp": { + "domain":"", + "email": "", + "password": "" + }, + "mailgun": { + "domain": "", + "api-key": "" + } + } + } \ No newline at end of file diff --git a/themes/dash/assets/css/dash.css b/themes/dash/assets/css/dash.css index 2e5c3ba..1dd1f7c 100644 --- a/themes/dash/assets/css/dash.css +++ b/themes/dash/assets/css/dash.css @@ -1907,175 +1907,6 @@ svg.icons { } /** ------------------------------- --- Fipamo -------------------------------- -**/ -#bm-content { - width: 100%; - max-width: 1024px; - margin: 0 auto; -} -#bm-content #header-two { - font: 400 1.5em $bodyType; -} -#bm-content #bookmark-display { - padding: 0; -} -#bm-content #bookmark-display .bookmark-list .bookmark-entry { - background: #1e272f; - width: 50%; - height: 500px; - background-size: cover; - overflow: hidden; - display: inline-block; - vertical-align: top; - padding: 10px; -} -#bm-content #bookmark-display .bookmark-list .bookmark-entry .bookmark-info { - display: flex; - align-items: center; - justify-content: center; - width: 100%; - height: 100%; -} -#bm-content #bookmark-display .bookmark-list .bookmark-entry .bookmark-info label { - display: block; - font-size: 0.5em; - padding: 10px; - background: #374857; - border-radius: 5px; -} -#bm-content #bookmark-display .bookmark-list #paginate-control { - width: 100%; - height: 300px; - background: #3b4e5e; - display: flex; - align-items: center; - justify-content: center; -} -#bm-content #bookmark-display .bookmark-list #paginate-control #paginate { - margin: 0 auto; -} -#bm-content #bookmark-display .bookmark-list #paginate-control #paginate a, -#bm-content #bookmark-display .bookmark-list #paginate-control #paginate label { - display: inline-block; - vertical-align: top; -} -#bm-content #bookmark-display .bookmark-list #paginate-control #paginate label { - padding: 5px; - color: #f5ab35; - font-size: 2.2em; -} -#bm-content #bookmark-display .bookmark-list #paginate-control #paginate a { - padding: 20px; - margin-top: 4px; -} -@media only screen and (max-width: 768px) { - #bm-content #bookmark-display .bookmark-list .bookmark-entry { - width: 100%; - } -} -/** -------------------------------- --- Folio -------------------------------- -**/ -#work-content { - width: 100%; - max-width: 1024px; - margin: 0 auto; -} -#work-content #header #header-two p { - font: 400 1.5em $bodyType; -} -#work-content #header #header-two p span { - color: #b2cce5; -} -#work-content #work-display { - padding: 0; - margin: 0 0 40px 0; - opacity: 0; -} -#work-content #work-list .work-item { - width: 50%; - height: 300px; - display: inline-block; - vertical-align: top; - background-size: cover; - background-color: #f5ab35; - color: #f5ab35; -} -#work-content #work-list .work-item span { - font: 600 0.7em $titleType; -} -#work-content #work-contact #contact-form { - opacity: 1; -} -#work-content #work-contact #contact-form label { - font: 600 0.8em $titleType; - color: #fc6399; - margin: 0 0 15px 0; - display: block; -} -#work-content #work-contact #contact-form #request-form input[type=email], -#work-content #work-contact #contact-form #request-form input[type=password], -#work-content #work-contact #contact-form #request-form input[type=text] { - width: 100%; - margin: 0 10px 10px 0; -} -#work-content #work-contact #contact-form #request-form select { - width: 100%; - margin-bottom: 10px; -} -#work-content #work-contact #contact-form #request-form textarea { - width: 100%; -} -#work-content #work-contact #contact-info label#request-status { - font: 600 0.8em $titleType; - color: #fc6399; - margin: 0 0 15px 0; - display: block; - text-transform: uppercase; -} -#work-content #work-contact #contact-info p { - font: 400 1em $bodyType; - color: #f5ab35; -} -#work-content #work-contact #contact-info p i { - color: #fc6399; -} -#project-content { - width: 100%; - max-width: 1024px; - margin: 0 auto; -} -#project-content #project-display { - padding: 0 20px 20px 20px; -} -#project-content #project-display #project-info span { - font: 400 2em $titleType; - color: #f2f1ef; -} -#project-content #project-display #project-desc { - font: 300 1.2em $bodyType; - color: #f5ab35; -} -#project-content #project-images { - margin: 10px 0 0 0; - opacity: 1; -} -#project-content #project-images .folio-image { - width: 100%; - margin: 0 0 50px 0; - opacity: 0; -} -@media screen and (max-width: 768px) { - #work-content #work-list .work-item { - width: 100%; - } -} -/** -------------------------------- -- Forms ------------------------------- **/ diff --git a/themes/dash/assets/css/dash.css.map b/themes/dash/assets/css/dash.css.map index b9b0aea..79e55a4 100644 --- a/themes/dash/assets/css/dash.css.map +++ b/themes/dash/assets/css/dash.css.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/styles/dash.styl","../../../../node_modules/bulma.styl/stylus/utilities/animations.styl","../../../../node_modules/bulma.styl/stylus/grid/columns.styl","../../../../node_modules/bulma.styl/stylus/utilities/mixins.styl","../../src/styles/main/_normalize.styl","../../src/styles/main/_typography.styl","../../src/styles/main/_structure.styl","../../src/styles/main/_mixins.styl","../../src/styles/main/_index.styl","../../src/styles/main/_settings.styl","../../src/styles/main/_fipamo.styl","../../src/styles/main/_folio.styl","../../src/styles/main/_forms.styl","../../src/styles/main/_posts.styl","../../src/styles/main/_editor.styl","../../src/styles/main/_editor-highlight.styl"],"names":[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AER;EACI,SAAQ,IAAR;EAEA,OAAM,QAAN;;AAEJ;EACI,aAAY,KAAZ;EACA,iBAAgB,KAAhB;;AAEJ;EACI,aAAY,KAAZ;EACA,iBAAgB,KAAhB;EACA,YAAW,OAAX;;AAEJ;EACI,aAAY,KAAZ;EACA,iBAAgB,aAAhB;EACA,YAAW,OAAX;;AC3FR;EACI,SAAQ,MAAR;EACA,YAAW,KAAX;EACA,SAAQ,MAAR;EACA,YAAsB,QAAtB;;AAEJ;AAAO;EACH,OAAM,QAAN;;AAEJ;AAAgB;AAAe;EAC3B,OAAM,QAAN;EACA,YAAW,OAAX;;AAEJ;EACI,OAAM,QAAN;;AAEJ;AAAgB;AAAgB;AAAY;AAAa;AAAc;AAAa;EAChF,OAAM,QAAN;;AAEJ;AAAY;AAAc;AAAoB;EAC1C,OAAM,QAAN;;AAEJ;AAAoB;AAAc;AAAe;EAC7C,OAAM,QAAN;;AAEJ;AAAY;AAAY;AAAc;AAAmB;EACrD,OAAM,QAAN;;AAEJ;AAAgB;AAAmB;AAAe;AAAqB;AAAsB;AAAc;EACvG,OAAM,QAAN;;AAEJ;AAAiB;AAAc;AAAa;AAAgB;AAA8B;AAAoB;AAAuB;EACjI,OAAiB,QAAjB;;AAEJ;EACI,OAAM,QAAN;;AAEJ;AAAkB;AAAe;EAC7B,OAAM,QAAN;;AAEJ;AAAe;EACX,YAAW,OAAX;;AAEJ;AAAe;AAAc;EACzB,aAAY,OAAZ","file":"dash.css"} \ No newline at end of file +{"version":3,"sources":["../../src/styles/dash.styl","../../../../node_modules/bulma.styl/stylus/utilities/animations.styl","../../../../node_modules/bulma.styl/stylus/grid/columns.styl","../../../../node_modules/bulma.styl/stylus/utilities/mixins.styl","../../src/styles/main/_normalize.styl","../../src/styles/main/_typography.styl","../../src/styles/main/_structure.styl","../../src/styles/main/_mixins.styl","../../src/styles/main/_index.styl","../../src/styles/main/_settings.styl","../../src/styles/main/_forms.styl","../../src/styles/main/_posts.styl","../../src/styles/main/_editor.styl","../../src/styles/main/_editor-highlight.styl"],"names":[],"mappings":"AAAA;;;;;ACAW;AACT;IACE,WAAqB,aAArB;;AACF;IACE,WAAuB,eAAvB;;;AAJO;AACT;IACE,WAAqB,aAArB;;AACF;IACE,WAAuB,eAAvB;;;AAJO;AACT;IACE,WAAqB,aAArB;;AACF;IACE,WAAuB,eAAvB;;;AAJO;AACT;IACE,WAAqB,aAArB;;AACF;IACE,WAAuB,eAAvB;;;ACFJ;EACE,SAAQ,MAAR;EACA,YAAW,EAAX;EACA,WAAU,EAAV;EACA,aAAY,EAAZ;EACA,SAAQ,QAAR;;AACA;EACE,MAAK,KAAL;;AACF;EACE,MAAK,KAAL;EACA,OAAM,KAAN;;AACF;EACE,MAAK,KAAL;EACA,OAAM,IAAN;;AACF;EACE,MAAK,KAAL;EACA,OAAM,SAAN;;AACF;EACE,MAAK,KAAL;EACA,OAAM,IAAN;;AACF;EACE,MAAK,KAAL;EACA,OAAM,SAAN;;AACF;EACE,MAAK,KAAL;EACA,OAAM,IAAN;;AACF;EACE,MAAK,KAAL;EACA,OAAM,IAAN;;AACF;EACE,MAAK,KAAL;EACA,OAAM,IAAN;;AACF;EACE,MAAK,KAAL;EACA,OAAM,IAAN;;AACF;EACE,MAAK,KAAL;;AACF;EACE,aAAY,IAAZ;;AACF;EACE,aAAY,SAAZ;;AACF;EACE,aAAY,IAAZ;;AACF;EACE,aAAY,SAAZ;;AACF;EACE,aAAY,IAAZ;;AACF;EACE,aAAY,IAAZ;;AACF;EACE,aAAY,IAAZ;;AACF;EACE,aAAY,IAAZ;;AACF;EACE,aAAY,IAAZ;;AAEA;EACE,MAAK,KAAL;EACA,OAAiB,mBAAjB;;AACF;EACE,aAAuB,mBAAvB;;AAJF;EACE,MAAK,KAAL;EACA,OAAiB,oBAAjB;;AACF;EACE,aAAuB,oBAAvB;;AAJF;EACE,MAAK,KAAL;EACA,OAAiB,IAAjB;;AACF;EACE,aAAuB,IAAvB;;AAJF;EACE,MAAK,KAAL;EACA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c;AAAe;EAC7C,OAAM,QAAN;;AAEJ;AAAY;AAAY;AAAc;AAAmB;EACrD,OAAM,QAAN;;AAEJ;AAAgB;AAAmB;AAAe;AAAqB;AAAsB;AAAc;EACvG,OAAM,QAAN;;AAEJ;AAAiB;AAAc;AAAa;AAAgB;AAA8B;AAAoB;AAAuB;EACjI,OAAiB,QAAjB;;AAEJ;EACI,OAAM,QAAN;;AAEJ;AAAkB;AAAe;EAC7B,OAAM,QAAN;;AAEJ;AAAe;EACX,YAAW,OAAX;;AAEJ;AAAe;AAAc;EACzB,aAAY,OAAZ","file":"dash.css"} \ No newline at end of file diff --git a/themes/dash/assets/js/dash.min.js b/themes/dash/assets/js/dash.min.js index b7ce421..b1c710a 100644 --- a/themes/dash/assets/js/dash.min.js +++ b/themes/dash/assets/js/dash.min.js @@ -8225,7 +8225,7 @@ function () { exports.default = PostEditor; PostEditor.uploadFiles = []; -},{"../../../../../brain/tools/utilities/DataUtils":"../../../../brain/tools/utilities/DataUtils.js","../../../../../brain/tools/events/DataEvent":"../../../../brain/tools/events/DataEvent.js","../actions/PostActions":"actions/PostActions.js","../../../../../brain/tools/events/EditorEvent":"../../../../brain/tools/events/EditorEvent.js","tiny-date-picker":"../../../../node_modules/tiny-date-picker/dist/tiny-date-picker.js","../../../../../brain/tools/utilities/DateUtils":"../../../../brain/tools/utilities/DateUtils.js","../../../../../brain/tools/ui/TextEditor":"../../../../brain/tools/ui/TextEditor.js","../../../../../brain/tools/utilities/DBUtils":"../../../../brain/tools/utilities/DBUtils.js"}],"../../../../brain/tools/effects/Animate.js":[function(require,module,exports) { +},{"../../../../../brain/tools/utilities/DataUtils":"../../../../brain/tools/utilities/DataUtils.js","../../../../../brain/tools/events/DataEvent":"../../../../brain/tools/events/DataEvent.js","../actions/PostActions":"actions/PostActions.js","../../../../../brain/tools/events/EditorEvent":"../../../../brain/tools/events/EditorEvent.js","tiny-date-picker":"../../../../node_modules/tiny-date-picker/dist/tiny-date-picker.js","../../../../../brain/tools/utilities/DateUtils":"../../../../brain/tools/utilities/DateUtils.js","../../../../../brain/tools/ui/TextEditor":"../../../../brain/tools/ui/TextEditor.js","../../../../../brain/tools/utilities/DBUtils":"../../../../brain/tools/utilities/DBUtils.js"}],"controllers/PostIndex.js":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -8233,70 +8233,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _EventEmitter2 = _interopRequireDefault(require("../events/EventEmitter")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -var Animate = -/*#__PURE__*/ -function (_EventEmitter) { - _inherits(Animate, _EventEmitter); - - //-------------------------- - // constructor - //-------------------------- - function Animate() { - _classCallCheck(this, Animate); - - return _possibleConstructorReturn(this, _getPrototypeOf(Animate).call(this)); - } //-------------------------- - // methods - //-------------------------- - - - _createClass(Animate, [{ - key: "object", - value: function object(properties) { - var animation = anime(properties); //animation.start(properties); - } //-------------------------- - // event handlers - //-------------------------- - - }]); - - return Animate; -}(_EventEmitter2.default); - -var _default = Animate; -exports.default = _default; -},{"../events/EventEmitter":"../../../../brain/tools/events/EventEmitter.js"}],"controllers/PostIndex.js":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _Animate = _interopRequireDefault(require("../../../../../brain/tools/effects/Animate")); - var _PostEditor = _interopRequireDefault(require("./PostEditor")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -8354,7 +8290,7 @@ function () { }(); exports.default = PostIndex; -},{"../../../../../brain/tools/effects/Animate":"../../../../brain/tools/effects/Animate.js","./PostEditor":"controllers/PostEditor.js"}],"controllers/DashManager.js":[function(require,module,exports) { +},{"./PostEditor":"controllers/PostEditor.js"}],"controllers/DashManager.js":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -8362,10 +8298,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _PostEditor = _interopRequireDefault(require("./PostEditor")); - -var _Animate = _interopRequireDefault(require("../../../../../brain/tools/effects/Animate")); - var _PostIndex = _interopRequireDefault(require("./PostIndex")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -8424,7 +8356,7 @@ function () { }(); exports.default = DashManager; -},{"./PostEditor":"controllers/PostEditor.js","../../../../../brain/tools/effects/Animate":"../../../../brain/tools/effects/Animate.js","./PostIndex":"controllers/PostIndex.js"}],"Base.js":[function(require,module,exports) { +},{"./PostIndex":"controllers/PostIndex.js"}],"Base.js":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -8463,8 +8395,7 @@ function () { this.dashManager = []; this.dataUtils = new _DataUtils.default(); this.dbUtils = new _DBUtils.default(); - this.settings = []; //this.cacheAssets(); - + this.settings = []; this.storeLocalData(); } @@ -8499,18 +8430,6 @@ function () { }).catch(function (err) { console.log(err); }); - } - }, { - key: "cacheAssets", - value: function cacheAssets() { - if ('serviceWorker' in navigator) { - window.addEventListener('load', function () { - navigator.serviceWorker.register('https://fipamo.local/tim-duncan.js?' + Math.round(new Date().getTime() / 1000)).then(function (registration) {//console.log('Service worker successfully registered on scope', registration.scope); - }).catch(function (error) {//console.log('Service worker failed to register'); - }); - }); - } else {//console.log("NOPE") - } } //-------------------------- // event handlers //-------------------------- @@ -8558,7 +8477,7 @@ var parent = module.bundle.parent; if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { var hostname = "" || location.hostname; var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; - var ws = new WebSocket(protocol + '://' + hostname + ':' + "60349" + '/'); + var ws = new WebSocket(protocol + '://' + hostname + ':' + "51778" + '/'); ws.onmessage = function (event) { var data = JSON.parse(event.data); diff --git a/themes/dash/assets/js/dash.min.map b/themes/dash/assets/js/dash.min.map index 2e21d43..4c0d09e 100644 --- a/themes/dash/assets/js/dash.min.map +++ b/themes/dash/assets/js/dash.min.map @@ -1 +1 @@ -{"version":3,"sources":["../../../../brain/tools/events/EventEmitter.js","../../../../brain/tools/events/DataEvent.js","../../../../brain/tools/utilities/DataUtils.js","../../../../brain/tools/utilities/StringUtils.js","../../../../brain/tools/utilities/DateUtils.js","../src/utils.js","../src/debug.js","../src/errors.js","../src/chaining-functions.js","../src/Promise.js","../src/Events.js","../src/Dexie.js","../../../../brain/tools/utilities/DBUtils.js","../../../../node_modules/uuid/lib/rng-browser.js","../../../../node_modules/uuid/lib/bytesToUuid.js","../../../../node_modules/uuid/v4.js","actions/PostActions.js","../../../../brain/tools/events/EditorEvent.js","../../../../node_modules/tiny-date-picker/dist/tiny-date-picker.js","../../src/mirror.js","../../src/utils.js","../../src/input.js","../../src/editable.js","../../src/main.js","../../../../brain/tools/ui/TextEditor.js","controllers/PostEditor.js","../../../../brain/tools/effects/Animate.js","controllers/PostIndex.js","controllers/DashManager.js","Base.js","Start.js"],"names":["EventEmitter","listeners","Map","label","callback","has","set","get","push","isFunction","obj","index","length","reduce","i","listener","splice","args","forEach","REQUEST_GOOD","REQUEST_LAME","IMG_REQUEST_GOOD","IMG_REQUEST_LAME","SETTINGS_LOADED","HTML_LOADED","ARCHIVES_JSON_LOADED","ARCHIVES_PAGE_LOADED","ARCHIVES_ENTRY_LOADED","PROJECT_UPDATED","PROJECT_ADDED","PROJECTS_SORTED","POST_IMAGE_ADDED","FEATURE_IMAGE_ADDED","POST_ERROR","POST_ADDED","POST_UPDATED","POST_DELETED","POSTS_SYNCED","LOCAL_DB_READY","DataEvent","REQUEST_TYPE_POST","REQUEST_TYPE_GET","REQUEST_TYPE_PUT","REQUEST_TYPE_DELETE","CONTENT_TYPE_JSON","CONTENT_TYPE_FORM","DataUtils","self","requestURL","eventType","requestType","contentType","requestData","Promise","resolve","reject","request","XMLHttpRequest","upload","onprogress","handleLoadProgress","open","onload","e","status","setRequestHeader","send","JSON","stringify","url","responseType","response","Error","statusText","onerror","src","body","document","querySelector","myImage","Image","crossOrigin","imgLoad","then","imageURL","window","URL","createObjectURL","percentComplete","Math","ceil","loaded","total","StringUtils","string","clean","replace","toLowerCase","quote_style","optTemp","noquotes","toString","OPTS","concat","ENT_HTML_QUOTE_SINGLE","DateUtils","time","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getTime","seconds","date","type","rawdate","day","String","getUTCDate","month","getUTCMonth","year","getUTCFullYear","hour","getUTCHours","minute","getUTCMinutes","getUTCSeconds","millisecond","getUTCMilliseconds","offset","getTimezoneOffset","asap","props","Debug.setDebug","Debug.debug","Debug.getErrorWithStack","keys","Debug.deprecated","COUNT","FINAL_KEY","DBUtils","dataUtils","db","Dexie","version","stores","postList","toArray","array","id","postData","freshID","put","fresh","catch","err","message","error","update","Number","post","updated","syncRemote","clear","result","bulkAdd","key","event","BulkError","newPostId","bounce","newPost","archive","deleted","console","log","uuidv4","require","PostActions","dateUtils","dbUtils","data","files","lastKey","freshData","txt","createElement","innerHTML","getElementById","html","value","title","slug","cleanString","plaintext","created","tags","page","getAttribute","featured","published","file","match","feature","name","uuid","author","modify","archivePost","EDITOR_DELETE","EDITOR_UPLOAD_POST_IMAGE","EDITOR_SAVE","EDITOR_UPDATE","EditorEvent","attributes","createMirror","element","mirror","mirrorCss","css","tagName","attr","getComputedStyle","initialize","styles","style","parentNode","insertBefore","nextSibling","rect","marker","ownerDocument","boundingRect","offsetLeft","offsetTop","offsetHeight","removeChild","isContentEditable","contentEditable","getContext","settings","customPos","iframe","noShadowCaret","contentWindow","contentDocument","getOffset","ctx","win","doc","getBoundingClientRect","docEl","documentElement","scrollLeft","pageXOffset","scrollTop","pageYOffset","top","left","isObject","createInputCaret","getPos","selectionStart","setPos","pos","setSelectionRange","elementOffset","position","getPosition","height","format","val","undefined","startRange","slice","endRange","createEditableCaret","sel","getSelection","found","find","parent","childNodes","node","nodeType","range","createRange","setStart","removeAllRanges","addRange","getRange","hasCustomPos","endOffset","endContainer","clonedRange","cloneRange","fixedPosition","setEnd","width","detach","shadowCaret","createTextNode","insertNode","selectNode","clientTop","clientLeft","inputOffset","rangeCount","getRangeAt","selectNodeContents","createCaret","options","caret","TextEditor","textEditor","scrollLimit","hljs","initHighlightingOnLoad","fixLimit","caretPos","setInputs","addEventListener","f","refresh","editorButtons","querySelectorAll","handleEditorOption","inputType","spiffed","highlight","innerText","temp","RegExp","maxWidth","classList","add","remove","setTimeout","pulled","deleteContents","preventDefault","target","emitEvent","PostEditor","urlPieces","split","postID","getPost","start","editor","addListener","handleEditorOptions","handleImageUpload","mode","handleImageActions","click","optionButtons","handlePostOptions","currentOption","active","setAttribute","uploadFiles","r","location","notify","confirm","deletePost","stopPropagation","dataTransfer","dropEffect","reader","FileReader","theFile","image","escape","span","join","appendChild","readAsDataURL","imageData","FormData","append","parse","Animate","properties","animation","anime","PostIndex","currentPage","choosePage","DashManager","currentDisplay","chooseDisplay","section","Base","dashManager","storeLocalData","posts","list","syncLocal","navigator","serviceWorker","register","round","registration","base"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAMA;;;AAGF;AACA;AACA;AACA,0BACA;AAAA;;AACI,SAAKC,SAAL,GAAiB,IAAIC,GAAJ,EAAjB;AACH,IACD;AACA;AACA;;;;;gCACYC,OAAOC,UAAU;AACzB,WAAKH,SAAL,CAAeI,GAAf,CAAmBF,KAAnB,KAA6B,KAAKF,SAAL,CAAeK,GAAf,CAAmBH,KAAnB,EAA0B,EAA1B,CAA7B;AACA,WAAKF,SAAL,CAAeM,GAAf,CAAmBJ,KAAnB,EAA0BK,IAA1B,CAA+BJ,QAA/B;AACH;;;mCAEcD,OAAOC,UAAU;AAC5B,UAAIK,UAAU,GAAG,SAAbA,UAAa,CAASC,GAAT,EAAc;AAC3B,eAAO,OAAOA,GAAP,IAAc,UAAd,IAA4B,KAAnC;AACH,OAFD;;AAIA,UAAIT,SAAS,GAAG,KAAKA,SAAL,CAAeM,GAAf,CAAmBJ,KAAnB,CAAhB;AAAA,UACIQ,KADJ;;AAGA,UAAIV,SAAS,IAAIA,SAAS,CAACW,MAA3B,EAAmC;AAC/BD,QAAAA,KAAK,GAAGV,SAAS,CAACY,MAAV,CAAiB,UAACC,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W,UAAAA,IAAI,EAAEY;AADV,SADA,EAGG7F,IAHH,CAGQ,UAAA8F,OAAO,EACf;AACIlI,UAAAA,IAAI,CAACmG,EAAL,CAAQI,QAAR,CAAiBC,OAAjB,CAAyB,UAAAC,KAAK,EAC9B;AACIzG,YAAAA,IAAI,CAACuH,UAAL,CAAgBd,KAAhB,EAAuB,IAAvB,EAA6BrE,IAA7B,CAAkC,UAAAZ,QAAQ,EAC1C;AACIjB,cAAAA,OAAO,CACP;AACIiB,gBAAAA,QAAQ,EAARA;AADJ,eADO,CAAP;AAIH,aAND,EAMGuF,KANH,CAMS,UAAAC,GAAG,EACZ;AACIxG,cAAAA,MAAM,CACN;AACIwG,gBAAAA,GAAG,EAAHA;AADJ,eADM,CAAN;AAIH,aAZD;AAaH,WAfD;AAgBH,SArBD,EAqBGD,KArBH,CAqBS,UAAA/F,CAAC,EACV;AACImH,UAAAA,OAAO,CAACC,GAAR,CAAY,OAAZ,EAAqBpH,CAArB;AACH,SAxBD;AAyBH,OA3BM,CAAP;AA4BH,MACD;AACA;AACA;;;;;;;;;ACrMJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC7BA;;AAUA;;AACA;;AACA;;;;;;;;;;;;AACA,IAAIqH,MAAM,GAAGC,OAAO,CAAC,SAAD,CAApB;;IACqBC;;;AAEjB;AACA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UAAAZ,QAAQ,EAChD;AACI2G,UAAAA,OAAO,CAACC,GAAR,CAAY5G,QAAZ;AACAjB,UAAAA,OAAO,CAACiB,QAAD,CAAP;AACH,SAJD,EAIGuF,KAJH,CAIS,UAAAC,GAAG,EACZ;AACImB,UAAAA,OAAO,CAACC,GAAR,CAAYpB,GAAZ;AACAxG,UAAAA,MAAM,CAAC0G,KAAD,CAAN;AACH,SARD;AASH,OAXM,CAAP;AAYH,MACD;AACA;AACA;;;;;;;;;;;;;;;;;;ACvHG,IAAMoD,aAAa,GAAG,cAAtB;;AACA,IAAMC,wBAAwB,GAAG,mBAAjC;;AACA,IAAMC,WAAW,GAAG,YAApB;;AACA,IAAMC,aAAa,GAAG,cAAtB;;;IAEDC;;;;eAaS,IAAIA,WAAJ;;;;;;AClBf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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IAAI,CAAC1Y,IAAL,CAAU;AAACiJ,YAAAA,EAAE,EAACwP,KAAK,CAACtY,KAAD,CAAL,CAAa8I,EAAjB;AAAqBW,YAAAA,IAAI,EAAC6O,KAAK,CAACtY,KAAD,CAAL,CAAayJ;AAAvC,WAAV;AACH;;AACDrH,QAAAA,IAAI,CAACyI,OAAL,CAAa2N,SAAb,CAAuBD,IAAvB,EAA6B/T,IAA7B,CAAkC,UAAA2R,CAAC,EAAE;AACjC/T,UAAAA,IAAI,CAACiT,KAAL;AACH,SAFD,EAEGlM,KAFH,CAES,UAAAC,GAAG,EAAE;AACVmB,UAAAA,OAAO,CAACC,GAAR,CAAYpB,GAAZ;AACH,SAJD;AAKH,OAbD,EAaGD,KAbH,CAaS,UAACC,GAAD,EACT;AACImB,QAAAA,OAAO,CAACC,GAAR,CAAYpB,GAAZ;AACH,OAhBD;AAiBH;;;kCAGD;AACI,UAAI,mBAAmBqP,SAAvB,EACA;AACI/T,QAAAA,MAAM,CAACgP,gBAAP,CAAwB,MAAxB,EAAgC,YAChC;AACI+E,UAAAA,SAAS,CAACC,aAAV,CAAwBC,QAAxB,CAAiC,wCAAsC7T,IAAI,CAAC8T,KAAL,CAAW,IAAI5S,IAAJ,GAAWO,OAAX,KAAqB,IAAhC,CAAvE,EAA8G/B,IAA9G,CAAmH,UAASqU,YAAT,EACnH,CACI;AACH,WAHD,EAGG1P,KAHH,CAGS,UAASG,KAAT,EACT,CACI;AACH,WAND;AAOH,SATD;AAUH,OAZD,MAcA,CACI;AACH;AACJ,MACD;AACA;AACA;;;;;;;;;;;AC/EJ;;;;AAEApF,QAAQ,CAACwP,gBAAT,CAA0B,kBAA1B,EAA8C,YAAW;AAErD,MAAIoF,IAAI,GAAG,IAAIX,aAAJ,EAAX;AACH,CAHD,EAGG,KAHH","file":"dash.min.map","sourceRoot":"../../src/com","sourcesContent":["class EventEmitter\n{\n\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n this.listeners = new Map();\n }\n //--------------------------\n // methods\n //--------------------------\n addListener(label, callback) {\n this.listeners.has(label) || this.listeners.set(label, []);\n this.listeners.get(label).push(callback);\n }\n\n removeListener(label, callback) {\n var isFunction = function(obj) {\n return typeof obj == 'function' || false;\n };\n\n var listeners = this.listeners.get(label),\n index;\n\n if (listeners && listeners.length) {\n index = listeners.reduce((i, listener, index) => {\n return (isFunction(listener) && listener === callback)\n ? i = index\n : i;\n }, -1);\n\n if (index > -1) {\n listeners.splice(index, 1);\n this.listeners.set(label, listeners);\n return true;\n }\n }\n return false;\n }\n\n emitEvent(label, ...args) {\n var listeners = this.listeners.get(label);\n if (listeners && listeners.length) {\n listeners.forEach((listener) => {\n listener(...args);\n });\n return true;\n }\n return false;\n }\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default EventEmitter\n","export const REQUEST_GOOD = 'requestGood';\nexport const REQUEST_LAME = 'requestLame';\nexport const IMG_REQUEST_GOOD = 'imgRequestGood';\nexport const IMG_REQUEST_LAME = 'imgRequestLame';\nexport const SETTINGS_LOADED = 'dataLoaded';\nexport const HTML_LOADED = 'htmlLoaded';\nexport const ARCHIVES_JSON_LOADED = 'archivesJSONLoaded';\nexport const ARCHIVES_PAGE_LOADED = 'archivesPAGELoaded';\nexport const ARCHIVES_ENTRY_LOADED = 'archivesEntryLoaded';\nexport const PROJECT_UPDATED = 'projectUpdated';\nexport const PROJECT_ADDED = 'projectAdded';\nexport const PROJECTS_SORTED = 'projectsSorted';\nexport const POST_IMAGE_ADDED = 'postImageAdded';\nexport const FEATURE_IMAGE_ADDED = 'featureImageAdded';\nexport const POST_ERROR = 'postError';\nexport const POST_ADDED = 'postAdded';\nexport const POST_UPDATED = 'postUpdated';\nexport const POST_DELETED = 'postImageAdded';\nexport const POSTS_SYNCED = 'postsSynced';\nexport const LOCAL_DB_READY = 'localDBReady';\n\nclass DataEvent\n{\n\n //--------------------------\n // methods\n //--------------------------\n\n\n\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default new DataEvent\n","export const REQUEST_TYPE_POST = \"POST\";\nexport const REQUEST_TYPE_GET = \"GET\";\nexport const REQUEST_TYPE_PUT = \"PUT\";\nexport const REQUEST_TYPE_DELETE = \"DELETE\";\nexport const CONTENT_TYPE_JSON = 'json';\nexport const CONTENT_TYPE_FORM = 'x-www-form-urlencoded';\nimport EventEmitter from '../events/EventEmitter';\nimport * as DataEvent from '../events/DataEvent';\nclass DataUtils extends EventEmitter\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n super();\n var self = this;\n }\n //--------------------------\n // methods\n //--------------------------\n request(requestURL, eventType, requestType = REQUEST_TYPE_GET, contentType = CONTENT_TYPE_JSON, requestData = null)\n {\n var self = this;\n return new Promise(function(resolve, reject)\n {\n var request = new XMLHttpRequest();\n request.upload.onprogress = self.handleLoadProgress;\n request.open(requestType, requestURL, true);\n request.onload = function(e)\n {\n if (request.status == 200)\n {\n resolve(\n {\n request,\n eventType\n });\n }\n else\n {\n reject(\n {\n request,\n eventType\n });\n };\n };\n if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST)\n {\n switch (contentType)\n {\n case CONTENT_TYPE_JSON:\n request.setRequestHeader(\"Content-type\", \"application/\" + contentType);\n request.send(JSON.stringify(requestData));\n break;\n case CONTENT_TYPE_FORM:\n request.send(requestData);\n break;\n }\n }\n else\n {\n request.send();\n }\n })\n }\n imgLoad(url)\n {\n 'use strict';\n // Create new promise with the Promise() constructor;\n // This has as its argument a function with two parameters, resolve and reject\n return new Promise(function(resolve, reject)\n {\n // Standard XHR to load an image\n var request = new XMLHttpRequest();\n request.open('GET', url);\n request.responseType = 'blob';\n // When the request loads, check whether it was successful\n request.onload = function()\n {\n if (request.status === 200)\n {\n // If successful, resolve the promise by passing back the request response\n resolve(request.response);\n }\n else\n {\n // If it fails, reject the promise with a error message\n reject(new Error('Image didn\\'t load successfully; error code:' + request.statusText));\n }\n };\n request.onerror = function()\n {\n // Also deal with the case when the entire request fails to begin with\n // This is probably a network error, so reject the promise with an appropriate message\n reject(new Error('There was a network error.'));\n };\n // Send the request\n request.send();\n });\n }\n loadImage(src)\n {\n 'use strict';\n let self = this;\n return new Promise(function(resolve, reject)\n {\n // Get a reference to the body element, and create a new image object\n var body = document.querySelector('body'),\n myImage = new Image();\n myImage.crossOrigin = \"\"; // or \"anonymous\"\n // Call the function with the URL we want to load, but then chain the\n // promise then() method on to the end of it. This contains two callbacks\n self.imgLoad(src).then(function(response)\n {\n // The first runs when the promise resolves, with the request.reponse specified within the resolve() method.\n var imageURL = window.URL.createObjectURL(response);\n resolve(imageURL);\n //$('background-content').setStyle('background-image', 'url('+imageURL+')') //myImage.src = imageURL;\n //console.log(imageURL);\n //body.appendChild(myImage);\n // The second runs when the promise is rejected, and logs the Error specified with the reject() method.\n }, function(Error)\n {\n reject(Error)\n });\n });\n }\n //--------------------------\n // event handlers\n //--------------------------\n handleLoadProgress(e)\n {\n var percentComplete = Math.ceil((e.loaded / e.total) * 100);\n //console.log(percentComplete);\n }\n}\nexport default DataUtils;","class StringUtils\n{\n\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {}\n //--------------------------\n // methods\n //--------------------------\n cleanString(string)\n {\n var clean = string.replace(/(^\\-+|[^a-zA-Z0-9\\/_| -]+|\\-+$)/g, '').toLowerCase().replace(/[\\/_| -]+/g, '-');\n return clean;\n }\n\n decodeHTML(string, quote_style) {\n var optTemp = 0,\n i = 0,\n noquotes = false;\n if (typeof quote_style === 'undefined') {\n quote_style = 2;\n }\n string = string.toString().replace(/</g, '<').replace(/>/g, '>');\n var OPTS = {\n 'ENT_NOQUOTES': 0,\n 'ENT_HTML_QUOTE_SINGLE': 1,\n 'ENT_HTML_QUOTE_DOUBLE': 2,\n 'ENT_COMPAT': 2,\n 'ENT_QUOTES': 3,\n 'ENT_IGNORE': 4\n };\n if (quote_style === 0) {\n noquotes = true;\n }\n if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags\n quote_style = [].concat(quote_style);\n for (i = 0; i < quote_style.length; i++) {\n // Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4\n if (OPTS[quote_style[i]] === 0) {\n noquotes = true;\n } else if (OPTS[quote_style[i]]) {\n optTemp = optTemp | OPTS[quote_style[i]];\n }\n }\n quote_style = optTemp;\n }\n if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {\n string = string.replace(/�*39;/g, \"'\"); // PHP doesn't currently escape if more than one 0, but it should\n // string = string.replace(/'|�*27;/g, \"'\"); // This would also be useful here, but not a part of PHP\n }\n if (!noquotes) {\n string = string.replace(/"/g, '\"');\n }\n // Put this in last place to avoid escape being double-decoded\n string = string.replace(/&/g, '&');\n return string;\n }\n\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default StringUtils\n","class DateUtils {\n\n //--------------------------\n // constructor\n //--------------------------\n constructor() {}\n\n //--------------------------\n // methods\n //--------------------------\n getMKtime() {\n var time = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), new Date().getHours(), new Date().getMinutes(), new Date().getSeconds(), 0).getTime() / 1000;\n return time;\n }\n\n convertMKtime(seconds) {\n var date = new Date(seconds * 1000);\n return date;\n }\n\n getDate(type, rawdate) {\n var day = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCDate()) : String(new Date().getUTCDate()));\n var month = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCMonth() + 1) : String(new Date().getUTCMonth() + 1));\n var year = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCFullYear()) : String(new Date().getUTCFullYear()));\n var hour = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCHours()) : String(new Date().getUTCHours()));\n var minute = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCMinutes()) : String(new Date().getUTCMinutes()));\n var seconds = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCSeconds()) : String(new Date().getUTCSeconds()));\n var millisecond = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCMilliseconds()) : String(new Date().getUTCMilliseconds()));\n var offset = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getTimezoneOffset()) : String(new Date().getTimezoneOffset()));\n if (day.length == 1)\n day = String(\"0\" + day);\n if (month.length == 1)\n month = String(\"0\" + month);\n offset = String(offset / 60);\n if (offset.length == 1)\n offset = String(\"0\" + offset);\n switch (type) {\n case \"day\":\n return day;\n break;\n case \"month\":\n return month;\n break;\n case \"year\":\n return year;\n break;\n case \"stamp\":\n return String(year + \"-\" + month + \"-\" + day + \" \" + hour + \":\" + minute + \":\" + seconds + \".\" + millisecond + \"-\" + (offset));\n break\n default:\n return String(year + \"-\" + month + \"-\" + day);\n break;\n }\n }\n\n //--------------------------\n // event handlers\n //--------------------------\n}\n\nexport default DateUtils","export var keys = Object.keys;\nexport var isArray = Array.isArray;\nexport var _global =\n typeof self !== 'undefined' ? self :\n typeof window !== 'undefined' ? window :\n global;\n\nexport function extend(obj, extension) {\n if (typeof extension !== 'object') return obj;\n keys(extension).forEach(function (key) {\n obj[key] = extension[key];\n });\n return obj;\n}\n\nexport const getProto = Object.getPrototypeOf;\nexport const _hasOwn = {}.hasOwnProperty;\nexport function hasOwn(obj, prop) {\n return _hasOwn.call(obj, prop);\n}\n\nexport function props (proto, extension) {\n if (typeof extension === 'function') extension = extension(getProto(proto));\n keys(extension).forEach(key => {\n setProp(proto, key, extension[key]);\n });\n}\n\nexport const defineProperty = Object.defineProperty;\n\nexport function setProp(obj, prop, functionOrGetSet, options) {\n defineProperty(obj, prop, extend(functionOrGetSet && hasOwn(functionOrGetSet, \"get\") && typeof functionOrGetSet.get === 'function' ?\n {get: functionOrGetSet.get, set: functionOrGetSet.set, configurable: true} :\n {value: functionOrGetSet, configurable: true, writable: true}, options));\n}\n\nexport function derive(Child) {\n return {\n from: function (Parent) {\n Child.prototype = Object.create(Parent.prototype);\n setProp(Child.prototype, \"constructor\", Child);\n return {\n extend: props.bind(null, Child.prototype)\n };\n }\n };\n}\n\nexport const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\nexport function getPropertyDescriptor(obj, prop) {\n var pd = getOwnPropertyDescriptor(obj, prop),\n proto;\n return pd || (proto = getProto(obj)) && getPropertyDescriptor (proto, prop);\n}\n\nvar _slice = [].slice;\nexport function slice(args, start, end) {\n return _slice.call(args, start, end);\n}\n\nexport function override(origFunc, overridedFactory) {\n return overridedFactory(origFunc);\n}\n\nexport function assert (b) {\n if (!b) throw new Error(\"Assertion Failed\");\n}\n\nexport function asap(fn) {\n if (_global.setImmediate) setImmediate(fn); else setTimeout(fn, 0);\n}\n\nexport function getUniqueArray(a) {\n return a.filter((value, index, self) => self.indexOf(value) === index);\n}\n\n/** Generate an object (hash map) based on given array.\n * @param extractor Function taking an array item and its index and returning an array of 2 items ([key, value]) to\n * instert on the resulting object for each item in the array. If this function returns a falsy value, the\n * current item wont affect the resulting object.\n */\nexport function arrayToObject (array, extractor) {\n return array.reduce((result, item, i) => {\n var nameAndValue = extractor(item, i);\n if (nameAndValue) result[nameAndValue[0]] = nameAndValue[1];\n return result;\n }, {});\n}\n\nexport function trycatcher(fn, reject) {\n return function () {\n try {\n fn.apply(this, arguments);\n } catch (e) {\n reject(e);\n }\n };\n}\n\nexport function tryCatch(fn, onerror, args) {\n try {\n fn.apply(null, args);\n } catch (ex) {\n onerror && onerror(ex);\n }\n}\n\nexport function getByKeyPath(obj, keyPath) {\n // http://www.w3.org/TR/IndexedDB/#steps-for-extracting-a-key-from-a-value-using-a-key-path\n if (hasOwn(obj, keyPath)) return obj[keyPath]; // This line is moved from last to first for optimization purpose.\n if (!keyPath) return obj;\n if (typeof keyPath !== 'string') {\n var rv = [];\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n var val = getByKeyPath(obj, keyPath[i]);\n rv.push(val);\n }\n return rv;\n }\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var innerObj = obj[keyPath.substr(0, period)];\n return innerObj === undefined ? undefined : getByKeyPath(innerObj, keyPath.substr(period + 1));\n }\n return undefined;\n}\n\nexport function setByKeyPath(obj, keyPath, value) {\n if (!obj || keyPath === undefined) return;\n if ('isFrozen' in Object && Object.isFrozen(obj)) return;\n if (typeof keyPath !== 'string' && 'length' in keyPath) {\n assert(typeof value !== 'string' && 'length' in value);\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n setByKeyPath(obj, keyPath[i], value[i]);\n }\n } else {\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var currentKeyPath = keyPath.substr(0, period);\n var remainingKeyPath = keyPath.substr(period + 1);\n if (remainingKeyPath === \"\")\n if (value === undefined) delete obj[currentKeyPath]; else obj[currentKeyPath] = value;\n else {\n var innerObj = obj[currentKeyPath];\n if (!innerObj) innerObj = (obj[currentKeyPath] = {});\n setByKeyPath(innerObj, remainingKeyPath, value);\n }\n } else {\n if (value === undefined) delete obj[keyPath]; else obj[keyPath] = value;\n }\n }\n}\n\nexport function delByKeyPath(obj, keyPath) {\n if (typeof keyPath === 'string')\n setByKeyPath(obj, keyPath, undefined);\n else if ('length' in keyPath)\n [].map.call(keyPath, function(kp) {\n setByKeyPath(obj, kp, undefined);\n });\n}\n\nexport function shallowClone(obj) {\n var rv = {};\n for (var m in obj) {\n if (hasOwn(obj, m)) rv[m] = obj[m];\n }\n return rv;\n}\n\nconst concat = [].concat;\nexport function flatten (a) {\n return concat.apply([], a);\n}\n\n//https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\nvar intrinsicTypes =\n \"Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set\"\n .split(',').concat(\n flatten([8,16,32,64].map(num=>[\"Int\",\"Uint\",\"Float\"].map(t=>t+num+\"Array\")))\n ).filter(t=>_global[t]).map(t=>_global[t])\n\nexport function deepClone(any) {\n if (!any || typeof any !== 'object') return any;\n var rv;\n if (isArray(any)) {\n rv = [];\n for (var i = 0, l = any.length; i < l; ++i) {\n rv.push(deepClone(any[i]));\n }\n } else if (intrinsicTypes.indexOf(any.constructor) >= 0) {\n rv = any;\n } else {\n rv = any.constructor ? Object.create(any.constructor.prototype) : {};\n for (var prop in any) {\n if (hasOwn(any, prop)) {\n rv[prop] = deepClone(any[prop]);\n }\n }\n }\n return rv;\n}\n\nexport function getObjectDiff(a, b, rv, prfx) {\n // Compares objects a and b and produces a diff object.\n rv = rv || {};\n prfx = prfx || '';\n keys(a).forEach(prop => {\n if (!hasOwn(b, prop))\n rv[prfx+prop] = undefined; // Property removed\n else {\n var ap = a[prop],\n bp = b[prop];\n if (typeof ap === 'object' && typeof bp === 'object' &&\n ap && bp &&\n // Now compare constructors are same (not equal because wont work in Safari)\n (''+ap.constructor) === (''+bp.constructor))\n // Same type of object but its properties may have changed\n getObjectDiff (ap, bp, rv, prfx + prop + \".\");\n else if (ap !== bp)\n rv[prfx + prop] = b[prop];// Primitive value changed\n }\n });\n keys(b).forEach(prop => {\n if (!hasOwn(a, prop)) {\n rv[prfx+prop] = b[prop]; // Property added\n }\n });\n return rv;\n}\n\n// If first argument is iterable or array-like, return it as an array\nexport const iteratorSymbol = typeof Symbol !== 'undefined' && Symbol.iterator;\nexport const getIteratorOf = iteratorSymbol ? function(x) {\n var i;\n return x != null && (i = x[iteratorSymbol]) && i.apply(x);\n} : function () { return null; };\n\nexport const NO_CHAR_ARRAY = {};\n// Takes one or several arguments and returns an array based on the following criteras:\n// * If several arguments provided, return arguments converted to an array in a way that\n// still allows javascript engine to optimize the code.\n// * If single argument is an array, return a clone of it.\n// * If this-pointer equals NO_CHAR_ARRAY, don't accept strings as valid iterables as a special\n// case to the two bullets below.\n// * If single argument is an iterable, convert it to an array and return the resulting array.\n// * If single argument is array-like (has length of type number), convert it to an array.\nexport function getArrayOf (arrayLike) {\n var i, a, x, it;\n if (arguments.length === 1) {\n if (isArray(arrayLike)) return arrayLike.slice();\n if (this === NO_CHAR_ARRAY && typeof arrayLike === 'string') return [arrayLike];\n if ((it = getIteratorOf(arrayLike))) {\n a = [];\n while ((x = it.next()), !x.done) a.push(x.value);\n return a;\n }\n if (arrayLike == null) return [arrayLike];\n i = arrayLike.length;\n if (typeof i === 'number') {\n a = new Array(i);\n while (i--) a[i] = arrayLike[i];\n return a;\n }\n return [arrayLike];\n }\n i = arguments.length;\n a = new Array(i);\n while (i--) a[i] = arguments[i];\n return a;\n}\n","// By default, debug will be true only if platform is a web platform and its page is served from localhost.\n// When debug = true, error's stacks will contain asyncronic long stacks.\nexport var debug = typeof location !== 'undefined' &&\n // By default, use debug mode if served from localhost.\n /^(http|https):\\/\\/(localhost|127\\.0\\.0\\.1)/.test(location.href);\n\nexport function setDebug(value, filter) {\n debug = value;\n libraryFilter = filter;\n}\n\nexport var libraryFilter = () => true;\n\nexport const NEEDS_THROW_FOR_STACK = !new Error(\"\").stack;\n\nexport function getErrorWithStack() {\n \"use strict\";\n if (NEEDS_THROW_FOR_STACK) try {\n // Doing something naughty in strict mode here to trigger a specific error\n // that can be explicitely ignored in debugger's exception settings.\n // If we'd just throw new Error() here, IE's debugger's exception settings\n // will just consider it as \"exception thrown by javascript code\" which is\n // something you wouldn't want it to ignore.\n getErrorWithStack.arguments;\n throw new Error(); // Fallback if above line don't throw.\n } catch(e) {\n return e;\n }\n return new Error();\n}\n\nexport function prettyStack(exception, numIgnoredFrames) {\n var stack = exception.stack;\n if (!stack) return \"\";\n numIgnoredFrames = (numIgnoredFrames || 0);\n if (stack.indexOf(exception.name) === 0)\n numIgnoredFrames += (exception.name + exception.message).split('\\n').length;\n return stack.split('\\n')\n .slice(numIgnoredFrames)\n .filter(libraryFilter)\n .map(frame => \"\\n\" + frame)\n .join('');\n}\n\nexport function deprecated (what, fn) {\n return function () {\n console.warn(`${what} is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. ${prettyStack(getErrorWithStack(), 1)}`);\n return fn.apply(this, arguments);\n }\n}\n","import { derive, setProp } from './utils';\nimport { getErrorWithStack, prettyStack } from './debug';\n\nvar dexieErrorNames = [\n 'Modify',\n 'Bulk',\n 'OpenFailed',\n 'VersionChange',\n 'Schema',\n 'Upgrade',\n 'InvalidTable',\n 'MissingAPI',\n 'NoSuchDatabase',\n 'InvalidArgument',\n 'SubTransaction',\n 'Unsupported',\n 'Internal',\n 'DatabaseClosed',\n 'PrematureCommit',\n 'ForeignAwait'\n];\n\nvar idbDomErrorNames = [\n 'Unknown',\n 'Constraint',\n 'Data',\n 'TransactionInactive',\n 'ReadOnly',\n 'Version',\n 'NotFound',\n 'InvalidState',\n 'InvalidAccess',\n 'Abort',\n 'Timeout',\n 'QuotaExceeded',\n 'Syntax',\n 'DataClone'\n];\n\nvar errorList = dexieErrorNames.concat(idbDomErrorNames);\n\nvar defaultTexts = {\n VersionChanged: \"Database version changed by other database connection\",\n DatabaseClosed: \"Database has been closed\",\n Abort: \"Transaction aborted\",\n TransactionInactive: \"Transaction has already completed or failed\"\n};\n\n//\n// DexieError - base class of all out exceptions.\n//\nexport function DexieError (name, msg) {\n // Reason we don't use ES6 classes is because:\n // 1. It bloats transpiled code and increases size of minified code.\n // 2. It doesn't give us much in this case.\n // 3. It would require sub classes to call super(), which\n // is not needed when deriving from Error.\n this._e = getErrorWithStack();\n this.name = name;\n this.message = msg;\n}\n\nderive(DexieError).from(Error).extend({\n stack: {\n get: function() {\n return this._stack ||\n (this._stack = this.name + \": \" + this.message + prettyStack(this._e, 2));\n }\n },\n toString: function(){ return this.name + \": \" + this.message; }\n});\n\nfunction getMultiErrorMessage (msg, failures) {\n return msg + \". Errors: \" + failures\n .map(f=>f.toString())\n .filter((v,i,s)=>s.indexOf(v) === i) // Only unique error strings\n .join('\\n');\n}\n\n//\n// ModifyError - thrown in Collection.modify()\n// Specific constructor because it contains members failures and failedKeys.\n//\nexport function ModifyError (msg, failures, successCount, failedKeys) {\n this._e = getErrorWithStack();\n this.failures = failures;\n this.failedKeys = failedKeys;\n this.successCount = successCount;\n}\nderive(ModifyError).from(DexieError);\n\nexport function BulkError (msg, failures) {\n this._e = getErrorWithStack();\n this.name = \"BulkError\";\n this.failures = failures;\n this.message = getMultiErrorMessage(msg, failures);\n}\nderive(BulkError).from(DexieError);\n\n//\n//\n// Dynamically generate error names and exception classes based\n// on the names in errorList.\n//\n//\n\n// Map of {ErrorName -> ErrorName + \"Error\"}\nexport var errnames = errorList.reduce((obj,name)=>(obj[name]=name+\"Error\",obj),{});\n\n// Need an alias for DexieError because we're gonna create subclasses with the same name.\nconst BaseException = DexieError;\n// Map of {ErrorName -> exception constructor}\nexport var exceptions = errorList.reduce((obj,name)=>{\n // Let the name be \"DexieError\" because this name may\n // be shown in call stack and when debugging. DexieError is\n // the most true name because it derives from DexieError,\n // and we cannot change Function.name programatically without\n // dynamically create a Function object, which would be considered\n // 'eval-evil'.\n var fullName = name + \"Error\";\n function DexieError (msgOrInner, inner){\n this._e = getErrorWithStack();\n this.name = fullName;\n if (!msgOrInner) {\n this.message = defaultTexts[name] || fullName;\n this.inner = null;\n } else if (typeof msgOrInner === 'string') {\n this.message = msgOrInner;\n this.inner = inner || null;\n } else if (typeof msgOrInner === 'object') {\n this.message = `${msgOrInner.name} ${msgOrInner.message}`;\n this.inner = msgOrInner;\n }\n }\n derive(DexieError).from(BaseException);\n obj[name]=DexieError;\n return obj;\n},{});\n\n// Use ECMASCRIPT standard exceptions where applicable:\nexceptions.Syntax = SyntaxError;\nexceptions.Type = TypeError;\nexceptions.Range = RangeError;\n\nexport var exceptionMap = idbDomErrorNames.reduce((obj, name)=>{\n obj[name + \"Error\"] = exceptions[name];\n return obj;\n}, {});\n\nexport function mapError (domError, message) {\n if (!domError || domError instanceof DexieError || domError instanceof TypeError || domError instanceof SyntaxError || !domError.name || !exceptionMap[domError.name])\n return domError;\n var rv = new exceptionMap[domError.name](message || domError.message, domError);\n if (\"stack\" in domError) {\n // Derive stack from inner exception if it has a stack\n setProp(rv, \"stack\", {get: function(){\n return this.inner.stack;\n }});\n }\n return rv;\n}\n\nexport var fullNameExceptions = errorList.reduce((obj, name)=>{\n if ([\"Syntax\",\"Type\",\"Range\"].indexOf(name) === -1)\n obj[name + \"Error\"] = exceptions[name];\n return obj;\n}, {});\n\nfullNameExceptions.ModifyError = ModifyError;\nfullNameExceptions.DexieError = DexieError;\nfullNameExceptions.BulkError = BulkError;\n","import {extend} from './utils';\n\nexport function nop() { }\nexport function mirror(val) { return val; }\nexport function pureFunctionChain(f1, f2) {\n // Enables chained events that takes ONE argument and returns it to the next function in chain.\n // This pattern is used in the hook(\"reading\") event.\n if (f1 == null || f1 === mirror) return f2;\n return function (val) {\n return f2(f1(val));\n };\n}\n\nexport function callBoth(on1, on2) {\n return function () {\n on1.apply(this, arguments);\n on2.apply(this, arguments);\n };\n}\n\nexport function hookCreatingChain(f1, f2) {\n // Enables chained events that takes several arguments and may modify first argument by making a modification and then returning the same instance.\n // This pattern is used in the hook(\"creating\") event.\n if (f1 === nop) return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res !== undefined) arguments[0] = res;\n var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess\n onerror = this.onerror; // In case event listener has set this.onerror\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res2 !== undefined ? res2 : res;\n };\n}\n\nexport function hookDeletingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n f1.apply(this, arguments);\n var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess\n onerror = this.onerror; // In case event listener has set this.onerror\n this.onsuccess = this.onerror = null;\n f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n };\n}\n\nexport function hookUpdatingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function (modifications) {\n var res = f1.apply(this, arguments);\n extend(modifications, res); // If f1 returns new modifications, extend caller's modifications with the result before calling next in chain.\n var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess\n onerror = this.onerror; // In case event listener has set this.onerror\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res === undefined ?\n (res2 === undefined ? undefined : res2) :\n (extend(res, res2));\n };\n}\n\nexport function reverseStoppableEventChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n if (f2.apply(this, arguments) === false) return false;\n return f1.apply(this, arguments);\n };\n}\n\nexport function nonStoppableEventChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n f1.apply(this, arguments);\n f2.apply(this, arguments);\n };\n}\n\nexport function promisableChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res && typeof res.then === 'function') {\n var thiz = this,\n i = arguments.length,\n args = new Array(i);\n while (i--) args[i] = arguments[i];\n return res.then(function () {\n return f2.apply(thiz, args);\n });\n }\n return f2.apply(this, arguments);\n };\n}\n","/*\n * Copyright (c) 2014-2017 David Fahlander\n * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/LICENSE-2.0\n */\nimport {tryCatch, props, setProp, _global,\n getPropertyDescriptor, getArrayOf, extend} from './utils';\nimport {nop, callBoth, mirror} from './chaining-functions';\nimport {debug, prettyStack, getErrorWithStack} from './debug';\nimport {exceptions} from './errors';\n\n//\n// Promise and Zone (PSD) for Dexie library\n//\n// I started out writing this Promise class by copying promise-light (https://github.com/taylorhakes/promise-light) by\n// https://github.com/taylorhakes - an A+ and ECMASCRIPT 6 compliant Promise implementation.\n//\n// In previous versions this was fixed by not calling setTimeout when knowing that the resolve() or reject() came from another\n// tick. In Dexie v1.4.0, I've rewritten the Promise class entirely. Just some fragments of promise-light is left. I use\n// another strategy now that simplifies everything a lot: to always execute callbacks in a new micro-task, but have an own micro-task\n// engine that is indexedDB compliant across all browsers.\n// Promise class has also been optimized a lot with inspiration from bluebird - to avoid closures as much as possible.\n// Also with inspiration from bluebird, asyncronic stacks in debug mode.\n//\n// Specific non-standard features of this Promise class:\n// * Custom zone support (a.k.a. PSD) with ability to keep zones also when using native promises as well as\n// native async / await.\n// * Promise.follow() method built upon the custom zone engine, that allows user to track all promises created from current stack frame\n// and below + all promises that those promises creates or awaits.\n// * Detect any unhandled promise in a PSD-scope (PSD.onunhandled). \n//\n// David Fahlander, https://github.com/dfahlander\n//\n\n// Just a pointer that only this module knows about.\n// Used in Promise constructor to emulate a private constructor.\nvar INTERNAL = {};\n\n// Async stacks (long stacks) must not grow infinitely.\nconst\n LONG_STACKS_CLIP_LIMIT = 100,\n // When calling error.stack or promise.stack, limit the number of asyncronic stacks to print out. \n MAX_LONG_STACKS = 20,\n ZONE_ECHO_LIMIT = 7,\n nativePromiseInstanceAndProto = (()=>{\n try {\n // Be able to patch native async functions\n return new Function(`let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];`)();\n } catch(e) {\n var P = _global.Promise;\n return P ?\n [P.resolve(), P.prototype, P.resolve()] :\n []; \n }\n })(),\n resolvedNativePromise = nativePromiseInstanceAndProto[0],\n nativePromiseProto = nativePromiseInstanceAndProto[1],\n resolvedGlobalPromise = nativePromiseInstanceAndProto[2],\n nativePromiseThen = nativePromiseProto && nativePromiseProto.then;\n\nexport const NativePromise = resolvedNativePromise && resolvedNativePromise.constructor;\nexport const AsyncFunction = nativePromiseInstanceAndProto[3];\nconst patchGlobalPromise = !!resolvedGlobalPromise;\n\nvar stack_being_generated = false;\n\n/* The default function used only for the very first promise in a promise chain.\n As soon as then promise is resolved or rejected, all next tasks will be executed in micro ticks\n emulated in this module. For indexedDB compatibility, this means that every method needs to \n execute at least one promise before doing an indexedDB operation. Dexie will always call \n db.ready().then() for every operation to make sure the indexedDB event is started in an\n indexedDB-compatible emulated micro task loop.\n*/\nvar schedulePhysicalTick = resolvedGlobalPromise ?\n () => {resolvedGlobalPromise.then(physicalTick);}\n :\n _global.setImmediate ? \n // setImmediate supported. Those modern platforms also supports Function.bind().\n setImmediate.bind(null, physicalTick) :\n _global.MutationObserver ?\n // MutationObserver supported\n () => {\n var hiddenDiv = document.createElement(\"div\");\n (new MutationObserver(() => {\n physicalTick();\n hiddenDiv = null;\n })).observe(hiddenDiv, { attributes: true });\n hiddenDiv.setAttribute('i', '1');\n } :\n // No support for setImmediate or MutationObserver. No worry, setTimeout is only called\n // once time. Every tick that follows will be our emulated micro tick.\n // Could have uses setTimeout.bind(null, 0, physicalTick) if it wasnt for that FF13 and below has a bug \n ()=>{setTimeout(physicalTick,0);};\n\n// Configurable through Promise.scheduler.\n// Don't export because it would be unsafe to let unknown\n// code call it unless they do try..catch within their callback.\n// This function can be retrieved through getter of Promise.scheduler though,\n// but users must not do Promise.scheduler = myFuncThatThrowsException\nvar asap = function (callback, args) {\n microtickQueue.push([callback, args]);\n if (needsNewPhysicalTick) {\n schedulePhysicalTick();\n needsNewPhysicalTick = false;\n }\n};\n\nvar isOutsideMicroTick = true, // True when NOT in a virtual microTick.\n needsNewPhysicalTick = true, // True when a push to microtickQueue must also schedulePhysicalTick()\n unhandledErrors = [], // Rejected promises that has occured. Used for triggering 'unhandledrejection'.\n rejectingErrors = [], // Tracks if errors are being re-rejected during onRejected callback.\n currentFulfiller = null,\n rejectionMapper = mirror; // Remove in next major when removing error mapping of DOMErrors and DOMExceptions\n \nexport var globalPSD = {\n id: 'global',\n global: true,\n ref: 0,\n unhandleds: [],\n onunhandled: globalError,\n pgp: false,\n env: {},\n finalize: function () {\n this.unhandleds.forEach(uh => {\n try {\n globalError(uh[0], uh[1]);\n } catch (e) {}\n });\n }\n};\n\nexport var PSD = globalPSD;\n\nexport var microtickQueue = []; // Callbacks to call in this or next physical tick.\nexport var numScheduledCalls = 0; // Number of listener-calls left to do in this physical tick.\nexport var tickFinalizers = []; // Finalizers to call when there are no more async calls scheduled within current physical tick.\n\nexport default function Promise(fn) {\n if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new'); \n this._listeners = [];\n this.onuncatched = nop; // Deprecate in next major. Not needed. Better to use global error handler.\n \n // A library may set `promise._lib = true;` after promise is created to make resolve() or reject()\n // execute the microtask engine implicitely within the call to resolve() or reject().\n // To remain A+ compliant, a library must only set `_lib=true` if it can guarantee that the stack\n // only contains library code when calling resolve() or reject().\n // RULE OF THUMB: ONLY set _lib = true for promises explicitely resolving/rejecting directly from\n // global scope (event handler, timer etc)!\n this._lib = false;\n // Current async scope\n var psd = (this._PSD = PSD);\n\n if (debug) {\n this._stackHolder = getErrorWithStack();\n this._prev = null;\n this._numPrev = 0; // Number of previous promises (for long stacks)\n }\n \n if (typeof fn !== 'function') {\n if (fn !== INTERNAL) throw new TypeError('Not a function');\n // Private constructor (INTERNAL, state, value).\n // Used internally by Promise.resolve() and Promise.reject().\n this._state = arguments[1];\n this._value = arguments[2];\n if (this._state === false)\n handleRejection(this, this._value); // Map error, set stack and addPossiblyUnhandledError().\n return;\n }\n \n this._state = null; // null (=pending), false (=rejected) or true (=resolved)\n this._value = null; // error or result\n ++psd.ref; // Refcounting current scope\n executePromiseTask(this, fn);\n}\n\n// Prepare a property descriptor to put onto Promise.prototype.then\nconst thenProp = {\n get: function() {\n var psd = PSD, microTaskId = totalEchoes;\n\n function then (onFulfilled, onRejected) {\n var possibleAwait = !psd.global && (psd !== PSD || microTaskId !== totalEchoes);\n if (possibleAwait) decrementExpectedAwaits();\n var rv = new Promise((resolve, reject) => {\n propagateToListener(this, new Listener(\n nativeAwaitCompatibleWrap(onFulfilled, psd, possibleAwait),\n nativeAwaitCompatibleWrap(onRejected, psd, possibleAwait),\n resolve,\n reject,\n psd));\n });\n debug && linkToPreviousPromise(rv, this);\n return rv;\n }\n\n then.prototype = INTERNAL; // For idempotense, see setter below.\n\n return then;\n },\n // Be idempotent and allow another framework (such as zone.js or another instance of a Dexie.Promise module) to replace Promise.prototype.then\n // and when that framework wants to restore the original property, we must identify that and restore the original property descriptor.\n set: function (value) {\n setProp (this, 'then', value && value.prototype === INTERNAL ?\n thenProp : // Restore to original property descriptor.\n {\n get: function(){\n return value; // Getter returning provided value (behaves like value is just changed)\n },\n set: thenProp.set // Keep a setter that is prepared to restore original.\n }\n );\n }\n};\n\nprops(Promise.prototype, {\n then: thenProp, // Defined above.\n _then: function (onFulfilled, onRejected) {\n // A little tinier version of then() that don't have to create a resulting promise.\n propagateToListener(this, new Listener(null, null, onFulfilled, onRejected, PSD)); \n },\n\n catch: function (onRejected) {\n if (arguments.length === 1) return this.then(null, onRejected);\n // First argument is the Error type to catch\n var type = arguments[0],\n handler = arguments[1];\n return typeof type === 'function' ? this.then(null, err =>\n // Catching errors by its constructor type (similar to java / c++ / c#)\n // Sample: promise.catch(TypeError, function (e) { ... });\n err instanceof type ? handler(err) : PromiseReject(err))\n : this.then(null, err =>\n // Catching errors by the error.name property. Makes sense for indexedDB where error type\n // is always DOMError but where e.name tells the actual error type.\n // Sample: promise.catch('ConstraintError', function (e) { ... });\n err && err.name === type ? handler(err) : PromiseReject(err));\n },\n\n finally: function (onFinally) {\n return this.then(value => {\n onFinally();\n return value;\n }, err => {\n onFinally();\n return PromiseReject(err);\n });\n },\n \n stack: {\n get: function() {\n if (this._stack) return this._stack;\n try {\n stack_being_generated = true;\n var stacks = getStack (this, [], MAX_LONG_STACKS);\n var stack = stacks.join(\"\\nFrom previous: \");\n if (this._state !== null) this._stack = stack; // Stack may be updated on reject.\n return stack;\n } finally {\n stack_being_generated = false;\n }\n }\n },\n\n timeout: function (ms, msg) {\n return ms < Infinity ?\n new Promise((resolve, reject) => {\n var handle = setTimeout(() => reject(new exceptions.Timeout(msg)), ms);\n this.then(resolve, reject).finally(clearTimeout.bind(null, handle));\n }) : this;\n }\n});\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag)\n setProp(Promise.prototype, Symbol.toStringTag, 'Promise');\n\n// Now that Promise.prototype is defined, we have all it takes to set globalPSD.env.\n// Environment globals snapshotted on leaving global zone\nglobalPSD.env = snapShot();\n\nfunction Listener(onFulfilled, onRejected, resolve, reject, zone) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.resolve = resolve;\n this.reject = reject;\n this.psd = zone;\n}\n\n// Promise Static Properties\nprops (Promise, {\n all: function () {\n var values = getArrayOf.apply(null, arguments) // Supports iterables, implicit arguments and array-like.\n .map(onPossibleParallellAsync); // Handle parallell async/awaits \n return new Promise(function (resolve, reject) {\n if (values.length === 0) resolve([]);\n var remaining = values.length;\n values.forEach((a,i) => Promise.resolve(a).then(x => {\n values[i] = x;\n if (!--remaining) resolve(values);\n }, reject));\n });\n },\n \n resolve: value => {\n if (value instanceof Promise) return value;\n if (value && typeof value.then === 'function') return new Promise((resolve, reject)=>{\n value.then(resolve, reject);\n });\n var rv = new Promise(INTERNAL, true, value);\n linkToPreviousPromise(rv, currentFulfiller);\n return rv;\n },\n \n reject: PromiseReject,\n \n race: function () {\n var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new Promise((resolve, reject) => {\n values.map(value => Promise.resolve(value).then(resolve, reject));\n });\n },\n\n PSD: {\n get: ()=>PSD,\n set: value => PSD = value\n },\n\n //totalEchoes: {get: ()=>totalEchoes},\n\n //task: {get: ()=>task},\n \n newPSD: newScope,\n \n usePSD: usePSD,\n \n scheduler: {\n get: () => asap,\n set: value => {asap = value}\n },\n \n rejectionMapper: {\n get: () => rejectionMapper,\n set: value => {rejectionMapper = value;} // Map reject failures\n },\n \n follow: (fn, zoneProps) => {\n return new Promise((resolve, reject) => {\n return newScope((resolve, reject) => {\n var psd = PSD;\n psd.unhandleds = []; // For unhandled standard- or 3rd party Promises. Checked at psd.finalize()\n psd.onunhandled = reject; // Triggered directly on unhandled promises of this library.\n psd.finalize = callBoth(function () {\n // Unhandled standard or 3rd part promises are put in PSD.unhandleds and\n // examined upon scope completion while unhandled rejections in this Promise\n // will trigger directly through psd.onunhandled\n run_at_end_of_this_or_next_physical_tick(()=>{\n this.unhandleds.length === 0 ? resolve() : reject(this.unhandleds[0]);\n });\n }, psd.finalize);\n fn();\n }, zoneProps, resolve, reject);\n });\n }\n});\n\n/**\n* Take a potentially misbehaving resolver function and make sure\n* onFulfilled and onRejected are only called once.\n*\n* Makes no guarantees about asynchrony.\n*/\nfunction executePromiseTask (promise, fn) {\n // Promise Resolution Procedure:\n // https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n try {\n fn(value => {\n if (promise._state !== null) return; // Already settled\n if (value === promise) throw new TypeError('A promise cannot be resolved with itself.');\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n if (value && typeof value.then === 'function') {\n executePromiseTask(promise, (resolve, reject) => {\n value instanceof Promise ?\n value._then(resolve, reject) :\n value.then(resolve, reject);\n });\n } else {\n promise._state = true;\n promise._value = value;\n propagateAllListeners(promise);\n }\n if (shouldExecuteTick) endMicroTickScope();\n }, handleRejection.bind(null, promise)); // If Function.bind is not supported. Exception is handled in catch below\n } catch (ex) {\n handleRejection(promise, ex);\n }\n}\n\nfunction handleRejection (promise, reason) {\n rejectingErrors.push(reason);\n if (promise._state !== null) return;\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n reason = rejectionMapper(reason);\n promise._state = false;\n promise._value = reason;\n debug && reason !== null && typeof reason === 'object' && !reason._promise && tryCatch(()=>{\n var origProp = getPropertyDescriptor(reason, \"stack\"); \n reason._promise = promise; \n setProp(reason, \"stack\", {\n get: () =>\n stack_being_generated ?\n origProp && (origProp.get ?\n origProp.get.apply(reason) :\n origProp.value) :\n promise.stack\n });\n });\n // Add the failure to a list of possibly uncaught errors\n addPossiblyUnhandledError(promise);\n propagateAllListeners(promise);\n if (shouldExecuteTick) endMicroTickScope();\n}\n\nfunction propagateAllListeners (promise) {\n //debug && linkToPreviousPromise(promise);\n var listeners = promise._listeners;\n promise._listeners = [];\n for (var i = 0, len = listeners.length; i < len; ++i) {\n propagateToListener(promise, listeners[i]);\n }\n var psd = promise._PSD;\n --psd.ref || psd.finalize(); // if psd.ref reaches zero, call psd.finalize();\n if (numScheduledCalls === 0) {\n // If numScheduledCalls is 0, it means that our stack is not in a callback of a scheduled call,\n // and that no deferreds where listening to this rejection or success.\n // Since there is a risk that our stack can contain application code that may\n // do stuff after this code is finished that may generate new calls, we cannot\n // call finalizers here.\n ++numScheduledCalls;\n asap(()=>{\n if (--numScheduledCalls === 0) finalizePhysicalTick(); // Will detect unhandled errors\n }, []);\n }\n}\n\nfunction propagateToListener(promise, listener) {\n if (promise._state === null) {\n promise._listeners.push(listener);\n return;\n }\n\n var cb = promise._state ? listener.onFulfilled : listener.onRejected;\n if (cb === null) {\n // This Listener doesnt have a listener for the event being triggered (onFulfilled or onReject) so lets forward the event to any eventual listeners on the Promise instance returned by then() or catch()\n return (promise._state ? listener.resolve : listener.reject) (promise._value);\n }\n ++listener.psd.ref;\n ++numScheduledCalls;\n asap (callListener, [cb, promise, listener]);\n}\n\nfunction callListener (cb, promise, listener) {\n try {\n // Set static variable currentFulfiller to the promise that is being fullfilled,\n // so that we connect the chain of promises (for long stacks support)\n currentFulfiller = promise;\n \n // Call callback and resolve our listener with it's return value.\n var ret, value = promise._value;\n \n if (promise._state) {\n // cb is onResolved\n ret = cb (value);\n } else {\n // cb is onRejected\n if (rejectingErrors.length) rejectingErrors = [];\n ret = cb(value);\n if (rejectingErrors.indexOf(value) === -1)\n markErrorAsHandled(promise); // Callback didnt do Promise.reject(err) nor reject(err) onto another promise.\n }\n listener.resolve(ret);\n } catch (e) {\n // Exception thrown in callback. Reject our listener.\n listener.reject(e);\n } finally {\n // Restore env and currentFulfiller.\n currentFulfiller = null;\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n --listener.psd.ref || listener.psd.finalize();\n }\n}\n\nfunction getStack (promise, stacks, limit) {\n if (stacks.length === limit) return stacks;\n var stack = \"\";\n if (promise._state === false) {\n var failure = promise._value,\n errorName,\n message;\n \n if (failure != null) {\n errorName = failure.name || \"Error\";\n message = failure.message || failure;\n stack = prettyStack(failure, 0);\n } else {\n errorName = failure; // If error is undefined or null, show that.\n message = \"\";\n }\n stacks.push(errorName + (message ? \": \" + message : \"\") + stack);\n }\n if (debug) {\n stack = prettyStack(promise._stackHolder, 2);\n if (stack && stacks.indexOf(stack) === -1) stacks.push(stack);\n if (promise._prev) getStack(promise._prev, stacks, limit);\n }\n return stacks;\n}\n\nfunction linkToPreviousPromise(promise, prev) {\n // Support long stacks by linking to previous completed promise.\n var numPrev = prev ? prev._numPrev + 1 : 0;\n if (numPrev < LONG_STACKS_CLIP_LIMIT) { // Prohibit infinite Promise loops to get an infinite long memory consuming \"tail\".\n promise._prev = prev;\n promise._numPrev = numPrev;\n }\n}\n\n/* The callback to schedule with setImmediate() or setTimeout().\n It runs a virtual microtick and executes any callback registered in microtickQueue.\n */\nfunction physicalTick() {\n beginMicroTickScope() && endMicroTickScope();\n}\n\nfunction beginMicroTickScope() {\n var wasRootExec = isOutsideMicroTick;\n isOutsideMicroTick = false;\n needsNewPhysicalTick = false;\n return wasRootExec;\n}\n\n/* Executes micro-ticks without doing try..catch.\n This can be possible because we only use this internally and\n the registered functions are exception-safe (they do try..catch\n internally before calling any external method). If registering\n functions in the microtickQueue that are not exception-safe, this\n would destroy the framework and make it instable. So we don't export\n our asap method.\n*/\nfunction endMicroTickScope() {\n var callbacks, i, l;\n do {\n while (microtickQueue.length > 0) {\n callbacks = microtickQueue;\n microtickQueue = [];\n l = callbacks.length;\n for (i = 0; i < l; ++i) {\n var item = callbacks[i];\n item[0].apply(null, item[1]);\n }\n }\n } while (microtickQueue.length > 0);\n isOutsideMicroTick = true;\n needsNewPhysicalTick = true;\n}\n\nfunction finalizePhysicalTick() {\n var unhandledErrs = unhandledErrors;\n unhandledErrors = [];\n unhandledErrs.forEach(p => {\n p._PSD.onunhandled.call(null, p._value, p);\n });\n var finalizers = tickFinalizers.slice(0); // Clone first because finalizer may remove itself from list.\n var i = finalizers.length;\n while (i) finalizers[--i](); \n}\n\nfunction run_at_end_of_this_or_next_physical_tick (fn) {\n function finalizer() {\n fn();\n tickFinalizers.splice(tickFinalizers.indexOf(finalizer), 1);\n }\n tickFinalizers.push(finalizer);\n ++numScheduledCalls;\n asap(()=>{\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n }, []);\n}\n\nfunction addPossiblyUnhandledError(promise) {\n // Only add to unhandledErrors if not already there. The first one to add to this list\n // will be upon the first rejection so that the root cause (first promise in the\n // rejection chain) is the one listed.\n if (!unhandledErrors.some(p => p._value === promise._value))\n unhandledErrors.push(promise);\n}\n\nfunction markErrorAsHandled(promise) {\n // Called when a reject handled is actually being called.\n // Search in unhandledErrors for any promise whos _value is this promise_value (list\n // contains only rejected promises, and only one item per error)\n var i = unhandledErrors.length;\n while (i) if (unhandledErrors[--i]._value === promise._value) {\n // Found a promise that failed with this same error object pointer,\n // Remove that since there is a listener that actually takes care of it.\n unhandledErrors.splice(i, 1);\n return;\n }\n}\n\nfunction PromiseReject (reason) {\n return new Promise(INTERNAL, false, reason);\n}\n\nexport function wrap (fn, errorCatcher) {\n var psd = PSD;\n return function() {\n var wasRootExec = beginMicroTickScope(),\n outerScope = PSD;\n\n try {\n switchToZone(psd, true);\n return fn.apply(this, arguments);\n } catch (e) {\n errorCatcher && errorCatcher(e);\n } finally {\n switchToZone(outerScope, false);\n if (wasRootExec) endMicroTickScope();\n }\n };\n}\n\n\n//\n// variables used for native await support\n//\nconst task = { awaits: 0, echoes: 0, id: 0}; // The ongoing macro-task when using zone-echoing.\nvar taskCounter = 0; // ID counter for macro tasks.\nvar zoneStack = []; // Stack of left zones to restore asynchronically.\nvar zoneEchoes = 0; // zoneEchoes is a must in order to persist zones between native await expressions.\nvar totalEchoes = 0; // ID counter for micro-tasks. Used to detect possible native await in our Promise.prototype.then.\n\n\nvar zone_id_counter = 0;\nexport function newScope (fn, props, a1, a2) {\n var parent = PSD,\n psd = Object.create(parent);\n psd.parent = parent;\n psd.ref = 0;\n psd.global = false;\n psd.id = ++zone_id_counter;\n // Prepare for promise patching (done in usePSD):\n var globalEnv = globalPSD.env;\n psd.env = patchGlobalPromise ? {\n Promise: Promise, // Changing window.Promise could be omitted for Chrome and Edge, where IDB+Promise plays well!\n PromiseProp: {value: Promise, configurable: true, writable: true},\n all: Promise.all,\n race: Promise.race,\n resolve: Promise.resolve,\n reject: Promise.reject,\n nthen: getPatchedPromiseThen (globalEnv.nthen, psd), // native then\n gthen: getPatchedPromiseThen (globalEnv.gthen, psd) // global then\n } : {};\n if (props) extend(psd, props);\n \n // unhandleds and onunhandled should not be specifically set here.\n // Leave them on parent prototype.\n // unhandleds.push(err) will push to parent's prototype\n // onunhandled() will call parents onunhandled (with this scope's this-pointer though!)\n ++parent.ref;\n psd.finalize = function () {\n --this.parent.ref || this.parent.finalize();\n }\n var rv = usePSD (psd, fn, a1, a2);\n if (psd.ref === 0) psd.finalize();\n return rv;\n}\n\n// Function to call if scopeFunc returns NativePromise\n// Also for each NativePromise in the arguments to Promise.all()\nexport function incrementExpectedAwaits() {\n if (!task.id) task.id = ++taskCounter;\n ++task.awaits;\n task.echoes += ZONE_ECHO_LIMIT;\n return task.id;\n}\n// Function to call when 'then' calls back on a native promise where onAwaitExpected() had been called.\n// Also call this when a native await calls then method on a promise. In that case, don't supply\n// sourceTaskId because we already know it refers to current task.\nexport function decrementExpectedAwaits(sourceTaskId) {\n if (!task.awaits || (sourceTaskId && sourceTaskId !== task.id)) return;\n if (--task.awaits === 0) task.id = 0;\n task.echoes = task.awaits * ZONE_ECHO_LIMIT; // Will reset echoes to 0 if awaits is 0.\n}\n\n// Call from Promise.all() and Promise.race()\nexport function onPossibleParallellAsync (possiblePromise) {\n if (task.echoes && possiblePromise && possiblePromise.constructor === NativePromise) {\n incrementExpectedAwaits(); \n return possiblePromise.then(x => {\n decrementExpectedAwaits();\n return x;\n }, e => {\n decrementExpectedAwaits();\n return rejection(e);\n });\n }\n return possiblePromise;\n}\n\nfunction zoneEnterEcho(targetZone) {\n ++totalEchoes;\n if (!task.echoes || --task.echoes === 0) {\n task.echoes = task.id = 0; // Cancel zone echoing.\n }\n\n zoneStack.push(PSD);\n switchToZone(targetZone, true);\n}\n\nfunction zoneLeaveEcho() {\n var zone = zoneStack[zoneStack.length-1];\n zoneStack.pop();\n switchToZone(zone, false);\n}\n\nfunction switchToZone (targetZone, bEnteringZone) {\n var currentZone = PSD;\n if (bEnteringZone ? task.echoes && (!zoneEchoes++ || targetZone !== PSD) : zoneEchoes && (!--zoneEchoes || targetZone !== PSD)) {\n // Enter or leave zone asynchronically as well, so that tasks initiated during current tick\n // will be surrounded by the zone when they are invoked.\n enqueueNativeMicroTask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);\n }\n if (targetZone === PSD) return;\n\n PSD = targetZone; // The actual zone switch occurs at this line.\n\n // Snapshot on every leave from global zone.\n if (currentZone === globalPSD) globalPSD.env = snapShot();\n\n if (patchGlobalPromise) {\n // Let's patch the global and native Promises (may be same or may be different)\n var GlobalPromise = globalPSD.env.Promise;\n // Swich environments (may be PSD-zone or the global zone. Both apply.)\n var targetEnv = targetZone.env;\n\n // Change Promise.prototype.then for native and global Promise (they MAY differ on polyfilled environments, but both can be accessed)\n // Must be done on each zone change because the patched method contains targetZone in its closure.\n nativePromiseProto.then = targetEnv.nthen;\n GlobalPromise.prototype.then = targetEnv.gthen;\n\n if (currentZone.global || targetZone.global) {\n // Leaving or entering global zone. It's time to patch / restore global Promise.\n\n // Set this Promise to window.Promise so that transiled async functions will work on Firefox, Safari and IE, as well as with Zonejs and angular.\n Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp);\n\n // Support Promise.all() etc to work indexedDB-safe also when people are including es6-promise as a module (they might\n // not be accessing global.Promise but a local reference to it)\n GlobalPromise.all = targetEnv.all;\n GlobalPromise.race = targetEnv.race;\n GlobalPromise.resolve = targetEnv.resolve;\n GlobalPromise.reject = targetEnv.reject;\n }\n }\n}\n\nfunction snapShot () {\n var GlobalPromise = _global.Promise;\n return patchGlobalPromise ? {\n Promise: GlobalPromise,\n PromiseProp: Object.getOwnPropertyDescriptor(_global, \"Promise\"),\n all: GlobalPromise.all,\n race: GlobalPromise.race,\n resolve: GlobalPromise.resolve,\n reject: GlobalPromise.reject,\n nthen: nativePromiseProto.then,\n gthen: GlobalPromise.prototype.then\n } : {};\n}\n\nexport function usePSD (psd, fn, a1, a2, a3) {\n var outerScope = PSD;\n try {\n switchToZone(psd, true);\n return fn(a1, a2, a3);\n } finally {\n switchToZone(outerScope, false);\n }\n}\n\nfunction enqueueNativeMicroTask (job) {\n //\n // Precondition: nativePromiseThen !== undefined\n //\n nativePromiseThen.call(resolvedNativePromise, job);\n}\n\nfunction nativeAwaitCompatibleWrap(fn, zone, possibleAwait) {\n return typeof fn !== 'function' ? fn : function () {\n var outerZone = PSD;\n if (possibleAwait) incrementExpectedAwaits();\n switchToZone(zone, true);\n try {\n return fn.apply(this, arguments);\n } finally {\n switchToZone(outerZone, false);\n }\n };\n}\n\nfunction getPatchedPromiseThen (origThen, zone) {\n return function (onResolved, onRejected) {\n return origThen.call(this,\n nativeAwaitCompatibleWrap(onResolved, zone, false),\n nativeAwaitCompatibleWrap(onRejected, zone, false));\n };\n}\n\nconst UNHANDLEDREJECTION = \"unhandledrejection\";\n\nfunction globalError(err, promise) {\n var rv;\n try {\n rv = promise.onuncatched(err);\n } catch (e) {}\n if (rv !== false) try {\n var event, eventData = {promise: promise, reason: err};\n if (_global.document && document.createEvent) {\n event = document.createEvent('Event');\n event.initEvent(UNHANDLEDREJECTION, true, true);\n extend(event, eventData);\n } else if (_global.CustomEvent) {\n event = new CustomEvent(UNHANDLEDREJECTION, {detail: eventData});\n extend(event, eventData);\n }\n if (event && _global.dispatchEvent) {\n dispatchEvent(event);\n if (!_global.PromiseRejectionEvent && _global.onunhandledrejection)\n // No native support for PromiseRejectionEvent but user has set window.onunhandledrejection. Manually call it.\n try {_global.onunhandledrejection(event);} catch (_) {}\n }\n if (!event.defaultPrevented) {\n console.warn(`Unhandled rejection: ${err.stack || err}`);\n }\n } catch (e) {}\n}\n\nexport var rejection = Promise.reject;\n","import {keys, isArray, asap} from './utils';\nimport {nop, mirror, reverseStoppableEventChain} from './chaining-functions';\nimport {exceptions} from './errors';\n\nexport default function Events(ctx) {\n var evs = {};\n var rv = function (eventName, subscriber) {\n if (subscriber) {\n // Subscribe. If additional arguments than just the subscriber was provided, forward them as well.\n var i = arguments.length, args = new Array(i - 1);\n while (--i) args[i - 1] = arguments[i];\n evs[eventName].subscribe.apply(null, args);\n return ctx;\n } else if (typeof (eventName) === 'string') {\n // Return interface allowing to fire or unsubscribe from event\n return evs[eventName];\n }\n };\n rv.addEventType = add;\n \n for (var i = 1, l = arguments.length; i < l; ++i) {\n add(arguments[i]);\n }\n \n return rv;\n\n function add(eventName, chainFunction, defaultFunction) {\n if (typeof eventName === 'object') return addConfiguredEvents(eventName);\n if (!chainFunction) chainFunction = reverseStoppableEventChain;\n if (!defaultFunction) defaultFunction = nop;\n\n var context = {\n subscribers: [],\n fire: defaultFunction,\n subscribe: function (cb) {\n if (context.subscribers.indexOf(cb) === -1) {\n context.subscribers.push(cb);\n context.fire = chainFunction(context.fire, cb);\n }\n },\n unsubscribe: function (cb) {\n context.subscribers = context.subscribers.filter(function (fn) { return fn !== cb; });\n context.fire = context.subscribers.reduce(chainFunction, defaultFunction);\n }\n };\n evs[eventName] = rv[eventName] = context;\n return context;\n }\n\n function addConfiguredEvents(cfg) {\n // events(this, {reading: [functionChain, nop]});\n keys(cfg).forEach(function (eventName) {\n var args = cfg[eventName];\n if (isArray(args)) {\n add(eventName, cfg[eventName][0], cfg[eventName][1]);\n } else if (args === 'asap') {\n // Rather than approaching event subscription using a functional approach, we here do it in a for-loop where subscriber is executed in its own stack\n // enabling that any exception that occur wont disturb the initiator and also not nescessary be catched and forgotten.\n var context = add(eventName, mirror, function fire() {\n // Optimazation-safe cloning of arguments into args.\n var i = arguments.length, args = new Array(i);\n while (i--) args[i] = arguments[i];\n // All each subscriber:\n context.subscribers.forEach(function (fn) {\n asap(function fireEvent() {\n fn.apply(null, args);\n });\n });\n });\n } else throw new exceptions.InvalidArgument(\"Invalid event config\");\n });\n }\n}\n","/*\n * Dexie.js - a minimalistic wrapper for IndexedDB\n * ===============================================\n *\n * Copyright (c) 2014-2017 David Fahlander\n *\n * Version {version}, {date}\n *\n * http://dexie.org\n * \n * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/LICENSE-2.0\n * \n */\n\nimport {\n keys,\n setProp,\n isArray,\n extend,\n props,\n derive,\n slice,\n override,\n _global,\n asap,\n trycatcher,\n tryCatch,\n getByKeyPath,\n setByKeyPath,\n delByKeyPath,\n shallowClone,\n deepClone,\n getObjectDiff,\n assert,\n NO_CHAR_ARRAY,\n getArrayOf,\n arrayToObject,\n hasOwn,\n flatten\n} from './utils';\nimport { ModifyError, BulkError, errnames, exceptions, fullNameExceptions, mapError } from './errors';\nimport Promise, {wrap, PSD, newScope, usePSD, rejection, NativePromise,\n incrementExpectedAwaits, decrementExpectedAwaits, AsyncFunction} from './Promise';\nimport Events from './Events';\nimport {\n nop,\n mirror,\n pureFunctionChain,\n hookCreatingChain,\n hookUpdatingChain,\n hookDeletingChain,\n promisableChain\n} from './chaining-functions';\nimport * as Debug from './debug';\n\nvar DEXIE_VERSION = '{version}',\n maxString = String.fromCharCode(65535),\n // maxKey is an Array if indexedDB implementations supports array keys (not supported by IE,Edge or Safari at the moment)\n // Otherwise maxKey is maxString. This is handy when needing an open upper border without limit.\n maxKey = (function(){try {IDBKeyRange.only([[]]);return [[]];}catch(e){return maxString;}})(),\n minKey = -Infinity,\n INVALID_KEY_ARGUMENT = \"Invalid key provided. Keys must be of type string, number, Date or Array.\",\n STRING_EXPECTED = \"String expected.\",\n connections = [],\n isIEOrEdge = typeof navigator !== 'undefined' && /(MSIE|Trident|Edge)/.test(navigator.userAgent),\n hasIEDeleteObjectStoreBug = isIEOrEdge,\n hangsOnDeleteLargeKeyRange = isIEOrEdge,\n dexieStackFrameFilter = frame => !/(dexie\\.js|dexie\\.min\\.js)/.test(frame),\n dbNamesDB;// Global database for backing Dexie.getDatabaseNames() on browser without indexedDB.webkitGetDatabaseNames() \n\n// Init debug\nDebug.setDebug(Debug.debug, dexieStackFrameFilter);\n\nexport default function Dexie(dbName, options) {\n /// Specify only if you wich to control which addons that should run on this instance\n var deps = Dexie.dependencies;\n var opts = extend({\n // Default Options\n addons: Dexie.addons, // Pick statically registered addons by default\n autoOpen: true, // Don't require db.open() explicitely.\n indexedDB: deps.indexedDB, // Backend IndexedDB api. Default to browser env.\n IDBKeyRange: deps.IDBKeyRange // Backend IDBKeyRange api. Default to browser env.\n }, options);\n var addons = opts.addons,\n autoOpen = opts.autoOpen,\n indexedDB = opts.indexedDB,\n IDBKeyRange = opts.IDBKeyRange;\n\n var globalSchema = this._dbSchema = {};\n var versions = [];\n var dbStoreNames = [];\n var allTables = {};\n ///\n var idbdb = null; // Instance of IDBDatabase\n var dbOpenError = null;\n var isBeingOpened = false;\n var onReadyBeingFired = null;\n var openComplete = false;\n var READONLY = \"readonly\", READWRITE = \"readwrite\";\n var db = this;\n var dbReadyResolve,\n dbReadyPromise = new Promise(resolve => {\n dbReadyResolve = resolve;\n }),\n cancelOpen,\n openCanceller = new Promise((_, reject) => {\n cancelOpen = reject;\n });\n var autoSchema = true;\n var hasNativeGetDatabaseNames = !!getNativeGetDatabaseNamesFn(indexedDB),\n hasGetAll;\n\n function init() {\n // Default subscribers to \"versionchange\" and \"blocked\".\n // Can be overridden by custom handlers. If custom handlers return false, these default\n // behaviours will be prevented.\n db.on(\"versionchange\", function (ev) {\n // Default behavior for versionchange event is to close database connection.\n // Caller can override this behavior by doing db.on(\"versionchange\", function(){ return false; });\n // Let's not block the other window from making it's delete() or open() call.\n // NOTE! This event is never fired in IE,Edge or Safari.\n if (ev.newVersion > 0)\n console.warn(`Another connection wants to upgrade database '${db.name}'. Closing db now to resume the upgrade.`);\n else\n console.warn(`Another connection wants to delete database '${db.name}'. Closing db now to resume the delete request.`);\n db.close();\n // In many web applications, it would be recommended to force window.reload()\n // when this event occurs. To do that, subscribe to the versionchange event\n // and call window.location.reload(true) if ev.newVersion > 0 (not a deletion)\n // The reason for this is that your current web app obviously has old schema code that needs\n // to be updated. Another window got a newer version of the app and needs to upgrade DB but\n // your window is blocking it unless we close it here.\n });\n db.on(\"blocked\", ev => {\n if (!ev.newVersion || ev.newVersion < ev.oldVersion)\n console.warn(`Dexie.delete('${db.name}') was blocked`);\n else\n console.warn(`Upgrade '${db.name}' blocked by other connection holding version ${ev.oldVersion/10}`);\n });\n }\n\n //\n //\n //\n // ------------------------- Versioning Framework---------------------------\n //\n //\n //\n\n this.version = function (versionNumber) {\n /// \n /// \n if (idbdb || isBeingOpened) throw new exceptions.Schema(\"Cannot add version when database is open\");\n this.verno = Math.max(this.verno, versionNumber);\n var versionInstance = versions.filter(function (v) { return v._cfg.version === versionNumber; })[0];\n if (versionInstance) return versionInstance;\n versionInstance = new Version(versionNumber);\n versions.push(versionInstance);\n versions.sort(lowerVersionFirst);\n // Disable autoschema mode, as at least one version is specified.\n autoSchema = false;\n return versionInstance;\n };\n\n function Version(versionNumber) {\n this._cfg = {\n version: versionNumber,\n storesSource: null,\n dbschema: {},\n tables: {},\n contentUpgrade: null\n };\n this.stores({}); // Derive earlier schemas by default.\n }\n\n extend(Version.prototype, {\n stores: function (stores) {\n /// \n /// Defines the schema for a particular version\n /// \n /// \n /// Example:
\n /// {users: \"id++,first,last,&username,*email\",
\n /// passwords: \"id++,&username\"}
\n ///
\n /// Syntax: {Table: \"[primaryKey][++],[&][*]index1,[&][*]index2,...\"}

\n /// Special characters:
\n /// \"&\" means unique key,
\n /// \"*\" means value is multiEntry,
\n /// \"++\" means auto-increment and only applicable for primary key
\n /// \n this._cfg.storesSource = this._cfg.storesSource ? extend(this._cfg.storesSource, stores) : stores;\n\n // Derive stores from earlier versions if they are not explicitely specified as null or a new syntax.\n var storesSpec = {};\n versions.forEach(function (version) { // 'versions' is always sorted by lowest version first.\n extend(storesSpec, version._cfg.storesSource);\n });\n\n var dbschema = (this._cfg.dbschema = {});\n this._parseStoresSpec(storesSpec, dbschema);\n // Update the latest schema to this version\n // Update API\n globalSchema = db._dbSchema = dbschema;\n removeTablesApi([allTables, db, Transaction.prototype]); // Keep Transaction.prototype even though it should be depr.\n setApiOnPlace([allTables, db, Transaction.prototype, this._cfg.tables], keys(dbschema), dbschema);\n dbStoreNames = keys(dbschema);\n return this;\n },\n upgrade: function (upgradeFunction) {\n this._cfg.contentUpgrade = upgradeFunction;\n return this;\n },\n _parseStoresSpec: function (stores, outSchema) {\n keys(stores).forEach(function (tableName) {\n if (stores[tableName] !== null) {\n var instanceTemplate = {};\n var indexes = parseIndexSyntax(stores[tableName]);\n var primKey = indexes.shift();\n if (primKey.multi) throw new exceptions.Schema(\"Primary key cannot be multi-valued\");\n if (primKey.keyPath) setByKeyPath(instanceTemplate, primKey.keyPath, primKey.auto ? 0 : primKey.keyPath);\n indexes.forEach(function (idx) {\n if (idx.auto) throw new exceptions.Schema(\"Only primary key can be marked as autoIncrement (++)\");\n if (!idx.keyPath) throw new exceptions.Schema(\"Index must have a name and cannot be an empty string\");\n setByKeyPath(instanceTemplate, idx.keyPath, idx.compound ? idx.keyPath.map(function () { return \"\"; }) : \"\");\n });\n outSchema[tableName] = new TableSchema(tableName, primKey, indexes, instanceTemplate);\n }\n });\n }\n });\n \n function runUpgraders (oldVersion, idbtrans, reject) {\n var trans = db._createTransaction(READWRITE, dbStoreNames, globalSchema);\n trans.create(idbtrans);\n trans._completion.catch(reject);\n var rejectTransaction = trans._reject.bind(trans);\n newScope(function () {\n PSD.trans = trans;\n if (oldVersion === 0) {\n // Create tables:\n keys(globalSchema).forEach(function (tableName) {\n createTable(idbtrans, tableName, globalSchema[tableName].primKey, globalSchema[tableName].indexes);\n });\n Promise.follow(()=>db.on.populate.fire(trans)).catch(rejectTransaction);\n } else\n updateTablesAndIndexes(oldVersion, trans, idbtrans).catch(rejectTransaction);\n });\n }\n\n function updateTablesAndIndexes (oldVersion, trans, idbtrans) {\n // Upgrade version to version, step-by-step from oldest to newest version.\n // Each transaction object will contain the table set that was current in that version (but also not-yet-deleted tables from its previous version)\n var queue = [];\n var oldVersionStruct = versions.filter(version => version._cfg.version === oldVersion)[0];\n if (!oldVersionStruct) throw new exceptions.Upgrade(\"Dexie specification of currently installed DB version is missing\");\n globalSchema = db._dbSchema = oldVersionStruct._cfg.dbschema;\n var anyContentUpgraderHasRun = false;\n\n var versToRun = versions.filter(v => v._cfg.version > oldVersion);\n versToRun.forEach(function (version) {\n /// \n queue.push(()=>{\n var oldSchema = globalSchema;\n var newSchema = version._cfg.dbschema;\n adjustToExistingIndexNames(oldSchema, idbtrans);\n adjustToExistingIndexNames(newSchema, idbtrans);\n globalSchema = db._dbSchema = newSchema;\n var diff = getSchemaDiff(oldSchema, newSchema); \n // Add tables \n diff.add.forEach(function (tuple) {\n createTable(idbtrans, tuple[0], tuple[1].primKey, tuple[1].indexes);\n });\n // Change tables\n diff.change.forEach(function (change) {\n if (change.recreate) {\n throw new exceptions.Upgrade(\"Not yet support for changing primary key\");\n } else {\n var store = idbtrans.objectStore(change.name);\n // Add indexes\n change.add.forEach(function (idx) {\n addIndex(store, idx);\n });\n // Update indexes\n change.change.forEach(function (idx) {\n store.deleteIndex(idx.name);\n addIndex(store, idx);\n });\n // Delete indexes\n change.del.forEach(function (idxName) {\n store.deleteIndex(idxName);\n });\n }\n });\n if (version._cfg.contentUpgrade) {\n anyContentUpgraderHasRun = true;\n return Promise.follow(()=>{\n version._cfg.contentUpgrade(trans);\n });\n }\n });\n queue.push(function (idbtrans) {\n if (!anyContentUpgraderHasRun || !hasIEDeleteObjectStoreBug) { // Dont delete old tables if ieBug is present and a content upgrader has run. Let tables be left in DB so far. This needs to be taken care of.\n var newSchema = version._cfg.dbschema;\n // Delete old tables\n deleteRemovedTables(newSchema, idbtrans);\n }\n });\n });\n\n // Now, create a queue execution engine\n function runQueue () {\n return queue.length ? Promise.resolve(queue.shift()(trans.idbtrans)).then(runQueue) :\n Promise.resolve();\n }\n \n return runQueue().then(()=>{\n createMissingTables(globalSchema, idbtrans); // At last, make sure to create any missing tables. (Needed by addons that add stores to DB without specifying version)\n });\n }\n\n function getSchemaDiff(oldSchema, newSchema) {\n var diff = {\n del: [], // Array of table names\n add: [], // Array of [tableName, newDefinition]\n change: [] // Array of {name: tableName, recreate: newDefinition, del: delIndexNames, add: newIndexDefs, change: changedIndexDefs}\n };\n for (var table in oldSchema) {\n if (!newSchema[table]) diff.del.push(table);\n }\n for (table in newSchema) {\n var oldDef = oldSchema[table],\n newDef = newSchema[table];\n if (!oldDef) {\n diff.add.push([table, newDef]);\n } else {\n var change = {\n name: table,\n def: newDef,\n recreate: false,\n del: [],\n add: [],\n change: []\n };\n if (oldDef.primKey.src !== newDef.primKey.src) {\n // Primary key has changed. Remove and re-add table.\n change.recreate = true;\n diff.change.push(change);\n } else {\n // Same primary key. Just find out what differs:\n var oldIndexes = oldDef.idxByName;\n var newIndexes = newDef.idxByName;\n for (var idxName in oldIndexes) {\n if (!newIndexes[idxName]) change.del.push(idxName);\n }\n for (idxName in newIndexes) {\n var oldIdx = oldIndexes[idxName],\n newIdx = newIndexes[idxName];\n if (!oldIdx) change.add.push(newIdx);\n else if (oldIdx.src !== newIdx.src) change.change.push(newIdx);\n }\n if (change.del.length > 0 || change.add.length > 0 || change.change.length > 0) {\n diff.change.push(change);\n }\n }\n }\n }\n return diff;\n }\n\n function createTable(idbtrans, tableName, primKey, indexes) {\n /// \n var store = idbtrans.db.createObjectStore(tableName, primKey.keyPath ? { keyPath: primKey.keyPath, autoIncrement: primKey.auto } : { autoIncrement: primKey.auto });\n indexes.forEach(function (idx) { addIndex(store, idx); });\n return store;\n }\n\n function createMissingTables(newSchema, idbtrans) {\n keys(newSchema).forEach(function (tableName) {\n if (!idbtrans.db.objectStoreNames.contains(tableName)) {\n createTable(idbtrans, tableName, newSchema[tableName].primKey, newSchema[tableName].indexes);\n }\n });\n }\n\n function deleteRemovedTables(newSchema, idbtrans) {\n for (var i = 0; i < idbtrans.db.objectStoreNames.length; ++i) {\n var storeName = idbtrans.db.objectStoreNames[i];\n if (newSchema[storeName] == null) {\n idbtrans.db.deleteObjectStore(storeName);\n }\n }\n }\n\n function addIndex(store, idx) {\n store.createIndex(idx.name, idx.keyPath, { unique: idx.unique, multiEntry: idx.multi });\n }\n\n //\n //\n // Dexie Protected API\n //\n //\n\n this._allTables = allTables;\n\n this._createTransaction = function (mode, storeNames, dbschema, parentTransaction) {\n return new Transaction(mode, storeNames, dbschema, parentTransaction);\n };\n\n /* Generate a temporary transaction when db operations are done outside a transaction scope.\n */\n function tempTransaction(mode, storeNames, fn) { // Last argument is \"writeLocked\". But this doesnt apply to oneshot direct db operations, so we ignore it.\n if (!openComplete && (!PSD.letThrough)) {\n if (!isBeingOpened) {\n if (!autoOpen)\n return rejection (new exceptions.DatabaseClosed());\n db.open().catch(nop); // Open in background. If if fails, it will be catched by the final promise anyway.\n }\n return dbReadyPromise.then(()=>tempTransaction(mode, storeNames, fn));\n } else {\n var trans = db._createTransaction(mode, storeNames, globalSchema);\n try { trans.create(); } catch (ex) { return rejection(ex); }\n return trans._promise(mode, function (resolve, reject) {\n return newScope(function () { // OPTIMIZATION POSSIBLE? newScope() not needed because it's already done in _promise.\n PSD.trans = trans;\n return fn(resolve, reject, trans);\n });\n }).then(result => {\n // Instead of resolving value directly, wait with resolving it until transaction has completed.\n // Otherwise the data would not be in the DB if requesting it in the then() operation.\n // Specifically, to ensure that the following expression will work:\n //\n // db.friends.put({name: \"Arne\"}).then(function () {\n // db.friends.where(\"name\").equals(\"Arne\").count(function(count) {\n // assert (count === 1);\n // });\n // });\n //\n return trans._completion.then(()=>result);\n });/*.catch(err => { // Don't do this as of now. If would affect bulk- and modify methods in a way that could be more intuitive. But wait! Maybe change in next major.\n trans._reject(err);\n return rejection(err);\n });*/\n }\n }\n\n this._whenReady = function (fn) {\n return openComplete || PSD.letThrough ? fn() : new Promise ((resolve, reject) => {\n if (!isBeingOpened) {\n if (!autoOpen) {\n reject(new exceptions.DatabaseClosed());\n return;\n }\n db.open().catch(nop); // Open in background. If if fails, it will be catched by the final promise anyway.\n }\n dbReadyPromise.then(resolve, reject);\n }).then(fn);\n };\n \n //\n //\n //\n //\n // Dexie API\n //\n //\n //\n\n this.verno = 0;\n\n this.open = function () {\n if (isBeingOpened || idbdb)\n return dbReadyPromise.then(()=> dbOpenError ? rejection (dbOpenError) : db);\n Debug.debug && (openCanceller._stackHolder = Debug.getErrorWithStack()); // Let stacks point to when open() was called rather than where new Dexie() was called.\n isBeingOpened = true;\n dbOpenError = null;\n openComplete = false;\n \n // Function pointers to call when the core opening process completes.\n var resolveDbReady = dbReadyResolve,\n // upgradeTransaction to abort on failure.\n upgradeTransaction = null;\n \n return Promise.race([openCanceller, new Promise((resolve, reject) => {\n // Multiply db.verno with 10 will be needed to workaround upgrading bug in IE:\n // IE fails when deleting objectStore after reading from it.\n // A future version of Dexie.js will stopover an intermediate version to workaround this.\n // At that point, we want to be backward compatible. Could have been multiplied with 2, but by using 10, it is easier to map the number to the real version number.\n \n // If no API, throw!\n if (!indexedDB) throw new exceptions.MissingAPI(\n \"indexedDB API not found. If using IE10+, make sure to run your code on a server URL \"+\n \"(not locally). If using old Safari versions, make sure to include indexedDB polyfill.\");\n \n var req = autoSchema ? indexedDB.open(dbName) : indexedDB.open(dbName, Math.round(db.verno * 10));\n if (!req) throw new exceptions.MissingAPI(\"IndexedDB API not available\"); // May happen in Safari private mode, see https://github.com/dfahlander/Dexie.js/issues/134\n req.onerror = eventRejectHandler(reject);\n req.onblocked = wrap(fireOnBlocked);\n req.onupgradeneeded = wrap (function (e) {\n upgradeTransaction = req.transaction;\n if (autoSchema && !db._allowEmptyDB) { // Unless an addon has specified db._allowEmptyDB, lets make the call fail.\n // Caller did not specify a version or schema. Doing that is only acceptable for opening alread existing databases.\n // If onupgradeneeded is called it means database did not exist. Reject the open() promise and make sure that we\n // do not create a new database by accident here.\n req.onerror = preventDefault; // Prohibit onabort error from firing before we're done!\n upgradeTransaction.abort(); // Abort transaction (would hope that this would make DB disappear but it doesnt.)\n // Close database and delete it.\n req.result.close();\n var delreq = indexedDB.deleteDatabase(dbName); // The upgrade transaction is atomic, and javascript is single threaded - meaning that there is no risk that we delete someone elses database here!\n delreq.onsuccess = delreq.onerror = wrap(function () {\n reject (new exceptions.NoSuchDatabase(`Database ${dbName} doesnt exist`));\n });\n } else {\n upgradeTransaction.onerror = eventRejectHandler(reject);\n var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion; // Safari 8 fix.\n runUpgraders(oldVer / 10, upgradeTransaction, reject, req);\n }\n }, reject);\n \n req.onsuccess = wrap (function () {\n // Core opening procedure complete. Now let's just record some stuff.\n upgradeTransaction = null;\n idbdb = req.result;\n connections.push(db); // Used for emulating versionchange event on IE/Edge/Safari.\n\n if (autoSchema) readGlobalSchema();\n else if (idbdb.objectStoreNames.length > 0) {\n try {\n adjustToExistingIndexNames(globalSchema, idbdb.transaction(safariMultiStoreFix(idbdb.objectStoreNames), READONLY));\n } catch (e) {\n // Safari may bail out if > 1 store names. However, this shouldnt be a showstopper. Issue #120.\n }\n }\n \n idbdb.onversionchange = wrap(ev => {\n db._vcFired = true; // detect implementations that not support versionchange (IE/Edge/Safari)\n db.on(\"versionchange\").fire(ev);\n });\n \n if (!hasNativeGetDatabaseNames && dbName !== '__dbnames') {\n dbNamesDB.dbnames.put({name: dbName}).catch(nop);\n }\n\n resolve();\n\n }, reject);\n })]).then(() => {\n // Before finally resolving the dbReadyPromise and this promise,\n // call and await all on('ready') subscribers:\n // Dexie.vip() makes subscribers able to use the database while being opened.\n // This is a must since these subscribers take part of the opening procedure.\n onReadyBeingFired = [];\n return Promise.resolve(Dexie.vip(db.on.ready.fire)).then(function fireRemainders() {\n if (onReadyBeingFired.length > 0) {\n // In case additional subscribers to db.on('ready') were added during the time db.on.ready.fire was executed.\n let remainders = onReadyBeingFired.reduce(promisableChain, nop);\n onReadyBeingFired = [];\n return Promise.resolve(Dexie.vip(remainders)).then(fireRemainders)\n }\n });\n }).finally(()=>{\n onReadyBeingFired = null;\n }).then(()=>{\n // Resolve the db.open() with the db instance.\n isBeingOpened = false;\n return db;\n }).catch(err => {\n try {\n // Did we fail within onupgradeneeded? Make sure to abort the upgrade transaction so it doesnt commit.\n upgradeTransaction && upgradeTransaction.abort();\n } catch (e) { }\n isBeingOpened = false; // Set before calling db.close() so that it doesnt reject openCanceller again (leads to unhandled rejection event).\n db.close(); // Closes and resets idbdb, removes connections, resets dbReadyPromise and openCanceller so that a later db.open() is fresh.\n // A call to db.close() may have made on-ready subscribers fail. Use dbOpenError if set, since err could be a follow-up error on that.\n dbOpenError = err; // Record the error. It will be used to reject further promises of db operations.\n return rejection (dbOpenError);\n }).finally(()=>{\n openComplete = true;\n resolveDbReady(); // dbReadyPromise is resolved no matter if open() rejects or resolved. It's just to wake up waiters.\n });\n };\n \n this.close = function () {\n var idx = connections.indexOf(db);\n if (idx >= 0) connections.splice(idx, 1); \n if (idbdb) {\n try {idbdb.close();} catch(e){}\n idbdb = null;\n }\n autoOpen = false;\n dbOpenError = new exceptions.DatabaseClosed();\n if (isBeingOpened)\n cancelOpen(dbOpenError);\n // Reset dbReadyPromise promise:\n dbReadyPromise = new Promise(resolve => {\n dbReadyResolve = resolve;\n });\n openCanceller = new Promise((_, reject) => {\n cancelOpen = reject;\n });\n };\n \n this.delete = function () {\n var hasArguments = arguments.length > 0;\n return new Promise(function (resolve, reject) {\n if (hasArguments) throw new exceptions.InvalidArgument(\"Arguments not allowed in db.delete()\");\n if (isBeingOpened) {\n dbReadyPromise.then(doDelete);\n } else {\n doDelete();\n }\n function doDelete() {\n db.close();\n var req = indexedDB.deleteDatabase(dbName);\n req.onsuccess = wrap(function () {\n if (!hasNativeGetDatabaseNames) {\n dbNamesDB.dbnames.delete(dbName).catch(nop);\n }\n resolve();\n });\n req.onerror = eventRejectHandler(reject);\n req.onblocked = fireOnBlocked;\n }\n });\n };\n\n this.backendDB = function () {\n return idbdb;\n };\n\n this.isOpen = function () {\n return idbdb !== null;\n };\n this.hasBeenClosed = function () {\n return dbOpenError && (dbOpenError instanceof exceptions.DatabaseClosed);\n }\n this.hasFailed = function () {\n return dbOpenError !== null;\n };\n this.dynamicallyOpened = function() {\n return autoSchema;\n };\n\n //\n // Properties\n //\n this.name = dbName;\n\n // db.tables - an array of all Table instances.\n props(this, {\n tables: {\n get () {\n /// \n return keys(allTables).map(function (name) { return allTables[name]; });\n }\n }\n });\n\n //\n // Events\n //\n this.on = Events(this, \"populate\", \"blocked\", \"versionchange\", {ready: [promisableChain, nop]});\n\n this.on.ready.subscribe = override (this.on.ready.subscribe, function (subscribe) {\n return (subscriber, bSticky) => {\n Dexie.vip(()=>{\n if (openComplete) {\n // Database already open. Call subscriber asap.\n if (!dbOpenError) Promise.resolve().then(subscriber);\n // bSticky: Also subscribe to future open sucesses (after close / reopen) \n if (bSticky) subscribe(subscriber);\n } else if (onReadyBeingFired) {\n // db.on('ready') subscribers are currently being executed and have not yet resolved or rejected\n onReadyBeingFired.push(subscriber);\n if (bSticky) subscribe(subscriber);\n } else {\n // Database not yet open. Subscribe to it.\n subscribe(subscriber);\n // If bSticky is falsy, make sure to unsubscribe subscriber when fired once.\n if (!bSticky) subscribe(function unsubscribe() {\n db.on.ready.unsubscribe(subscriber);\n db.on.ready.unsubscribe(unsubscribe);\n });\n }\n });\n }\n });\n\n this.transaction = function () {\n /// \n ///\n /// \n /// \"r\" for readonly, or \"rw\" for readwrite\n /// Table instance, Array of Table instances, String or String Array of object stores to include in the transaction\n /// Function to execute with transaction\n\n var args = extractTransactionArgs.apply(this, arguments);\n return this._transaction.apply(this, args);\n }\n \n function extractTransactionArgs (mode, _tableArgs_, scopeFunc) {\n // Let table arguments be all arguments between mode and last argument.\n var i = arguments.length;\n if (i < 2) throw new exceptions.InvalidArgument(\"Too few arguments\");\n // Prevent optimzation killer (https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments)\n // and clone arguments except the first one into local var 'args'.\n var args = new Array(i - 1);\n while (--i) args[i-1] = arguments[i];\n // Let scopeFunc be the last argument and pop it so that args now only contain the table arguments.\n scopeFunc = args.pop();\n var tables = flatten(args); // Support using array as middle argument, or a mix of arrays and non-arrays.\n return [mode, tables, scopeFunc];\n }\n\n this._transaction = function (mode, tables, scopeFunc) {\n var parentTransaction = PSD.trans;\n // Check if parent transactions is bound to this db instance, and if caller wants to reuse it\n if (!parentTransaction || parentTransaction.db !== db || mode.indexOf('!') !== -1) parentTransaction = null;\n var onlyIfCompatible = mode.indexOf('?') !== -1;\n mode = mode.replace('!', '').replace('?', ''); // Ok. Will change arguments[0] as well but we wont touch arguments henceforth.\n \n try {\n //\n // Get storeNames from arguments. Either through given table instances, or through given table names.\n //\n var storeNames = tables.map(table => {\n var storeName = table instanceof Table ? table.name : table;\n if (typeof storeName !== 'string') throw new TypeError(\"Invalid table argument to Dexie.transaction(). Only Table or String are allowed\");\n return storeName;\n });\n\n //\n // Resolve mode. Allow shortcuts \"r\" and \"rw\".\n //\n if (mode == \"r\" || mode == READONLY)\n mode = READONLY;\n else if (mode == \"rw\" || mode == READWRITE)\n mode = READWRITE;\n else\n throw new exceptions.InvalidArgument(\"Invalid transaction mode: \" + mode);\n\n if (parentTransaction) {\n // Basic checks\n if (parentTransaction.mode === READONLY && mode === READWRITE) {\n if (onlyIfCompatible) {\n // Spawn new transaction instead.\n parentTransaction = null; \n }\n else throw new exceptions.SubTransaction(\"Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY\");\n }\n if (parentTransaction) {\n storeNames.forEach(function (storeName) {\n if (parentTransaction && parentTransaction.storeNames.indexOf(storeName) === -1) {\n if (onlyIfCompatible) {\n // Spawn new transaction instead.\n parentTransaction = null; \n }\n else throw new exceptions.SubTransaction(\"Table \" + storeName +\n \" not included in parent transaction.\");\n }\n });\n }\n if (onlyIfCompatible && parentTransaction && !parentTransaction.active) {\n // '?' mode should not keep using an inactive transaction.\n parentTransaction = null;\n }\n }\n } catch (e) {\n return parentTransaction ?\n parentTransaction._promise(null, (_, reject) => {reject(e);}) :\n rejection (e);\n }\n // If this is a sub-transaction, lock the parent and then launch the sub-transaction.\n return (parentTransaction ?\n parentTransaction._promise(mode, enterTransactionScope, \"lock\") :\n PSD.trans ?\n // no parent transaction despite PSD.trans exists. Make sure also\n // that the zone we create is not a sub-zone of current, because\n // Promise.follow() should not wait for it if so.\n usePSD(PSD.transless, ()=>db._whenReady(enterTransactionScope)) :\n db._whenReady (enterTransactionScope));\n \n function enterTransactionScope() {\n return Promise.resolve().then(()=>{\n // Keep a pointer to last non-transactional PSD to use if someone calls Dexie.ignoreTransaction().\n var transless = PSD.transless || PSD;\n // Our transaction.\n //return new Promise((resolve, reject) => {\n var trans = db._createTransaction(mode, storeNames, globalSchema, parentTransaction);\n // Let the transaction instance be part of a Promise-specific data (PSD) value.\n var zoneProps = {\n trans: trans,\n transless: transless\n };\n\n if (parentTransaction) {\n // Emulate transaction commit awareness for inner transaction (must 'commit' when the inner transaction has no more operations ongoing)\n trans.idbtrans = parentTransaction.idbtrans;\n } else {\n trans.create(); // Create the backend transaction so that complete() or error() will trigger even if no operation is made upon it.\n }\n\n // Support for native async await.\n if (scopeFunc.constructor === AsyncFunction) {\n incrementExpectedAwaits();\n }\n\n var returnValue;\n var promiseFollowed = Promise.follow(()=>{\n // Finally, call the scope function with our table and transaction arguments.\n returnValue = scopeFunc.call(trans, trans);\n if (returnValue) {\n if (returnValue.constructor === NativePromise) {\n var decrementor = decrementExpectedAwaits.bind(null, null);\n returnValue.then(decrementor, decrementor);\n } else if (typeof returnValue.next === 'function' && typeof returnValue.throw === 'function') {\n // scopeFunc returned an iterator with throw-support. Handle yield as await.\n returnValue = awaitIterator(returnValue);\n }\n }\n }, zoneProps);\n return (returnValue && typeof returnValue.then === 'function' ?\n // Promise returned. User uses promise-style transactions.\n Promise.resolve(returnValue).then(x => trans.active ?\n x // Transaction still active. Continue.\n : rejection(new exceptions.PrematureCommit(\n \"Transaction committed too early. See http://bit.ly/2kdckMn\")))\n // No promise returned. Wait for all outstanding promises before continuing. \n : promiseFollowed.then(()=>returnValue)\n ).then(x => {\n // sub transactions don't react to idbtrans.oncomplete. We must trigger a completion:\n if (parentTransaction) trans._resolve();\n // wait for trans._completion\n // (if root transaction, this means 'complete' event. If sub-transaction, we've just fired it ourselves)\n return trans._completion.then(()=>x);\n }).catch (e => {\n trans._reject(e); // Yes, above then-handler were maybe not called because of an unhandled rejection in scopeFunc!\n return rejection(e);\n });\n });\n }\n };\n\n this.table = function (tableName) {\n /// \n if (!hasOwn(allTables, tableName)) { throw new exceptions.InvalidTable(`Table ${tableName} does not exist`); }\n return allTables[tableName];\n };\n\n //\n //\n //\n // Table Class\n //\n //\n //\n function Table(name, tableSchema, optionalTrans) {\n /// \n this.name = name;\n this.schema = tableSchema;\n this._tx = optionalTrans;\n this.hook = allTables[name] ? allTables[name].hook : Events(null, {\n \"creating\": [hookCreatingChain, nop],\n \"reading\": [pureFunctionChain, mirror],\n \"updating\": [hookUpdatingChain, nop],\n \"deleting\": [hookDeletingChain, nop]\n });\n }\n\n function BulkErrorHandlerCatchAll(errorList, done, supportHooks) {\n return (supportHooks ? hookedEventRejectHandler : eventRejectHandler)(e => {\n errorList.push(e);\n done && done();\n });\n }\n\n function bulkDelete(idbstore, trans, keysOrTuples, hasDeleteHook, deletingHook) {\n // If hasDeleteHook, keysOrTuples must be an array of tuples: [[key1, value2],[key2,value2],...],\n // else keysOrTuples must be just an array of keys: [key1, key2, ...].\n return new Promise((resolve, reject)=>{\n var len = keysOrTuples.length,\n lastItem = len - 1;\n if (len === 0) return resolve();\n if (!hasDeleteHook) {\n for (var i=0; i < len; ++i) {\n var req = idbstore.delete(keysOrTuples[i]);\n req.onerror = eventRejectHandler(reject);\n if (i === lastItem) req.onsuccess = wrap(()=>resolve());\n }\n } else {\n var hookCtx,\n errorHandler = hookedEventRejectHandler(reject),\n successHandler = hookedEventSuccessHandler(null);\n tryCatch(()=> {\n for (var i = 0; i < len; ++i) {\n hookCtx = {onsuccess: null, onerror: null};\n var tuple = keysOrTuples[i];\n deletingHook.call(hookCtx, tuple[0], tuple[1], trans);\n var req = idbstore.delete(tuple[0]);\n req._hookCtx = hookCtx;\n req.onerror = errorHandler;\n if (i === lastItem)\n req.onsuccess = hookedEventSuccessHandler(resolve);\n else\n req.onsuccess = successHandler;\n }\n }, err=>{\n hookCtx.onerror && hookCtx.onerror(err);\n throw err;\n });\n }\n });\n } \n\n props(Table.prototype, {\n\n //\n // Table Protected Methods\n //\n\n _trans: function getTransaction(mode, fn, writeLocked) {\n var trans = this._tx || PSD.trans;\n return trans && trans.db === db ?\n trans === PSD.trans ?\n trans._promise (mode, fn, writeLocked) :\n newScope(()=>trans._promise(mode, fn, writeLocked), {trans: trans, transless: PSD.transless || PSD}) :\n tempTransaction (mode, [this.name], fn);\n },\n _idbstore: function getIDBObjectStore(mode, fn, writeLocked) {\n var tableName = this.name;\n function supplyIdbStore (resolve, reject, trans) {\n if (trans.storeNames.indexOf(tableName) === -1)\n throw new exceptions.NotFound(\"Table\" + tableName + \" not part of transaction\");\n return fn(resolve, reject, trans.idbtrans.objectStore(tableName), trans);\n }\n return this._trans(mode, supplyIdbStore, writeLocked);\n },\n\n //\n // Table Public Methods\n //\n get: function (keyOrCrit, cb) {\n if (keyOrCrit && keyOrCrit.constructor === Object)\n return this.where(keyOrCrit).first(cb);\n var self = this;\n return this._idbstore(READONLY, function (resolve, reject, idbstore) {\n var req = idbstore.get(keyOrCrit);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function () {\n resolve(self.hook.reading.fire(req.result));\n }, reject);\n }).then(cb);\n },\n where: function (indexOrCrit) {\n if (typeof indexOrCrit === 'string')\n return new WhereClause(this, indexOrCrit);\n if (isArray(indexOrCrit))\n return new WhereClause(this, `[${indexOrCrit.join('+')}]`);\n // indexOrCrit is an object map of {[keyPath]:value} \n var keyPaths = keys(indexOrCrit);\n if (keyPaths.length === 1)\n // Only one critera. This was the easy case:\n return this\n .where(keyPaths[0])\n .equals(indexOrCrit[keyPaths[0]]);\n \n // Multiple criterias.\n // Let's try finding a compound index that matches all keyPaths in\n // arbritary order:\n var compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(ix =>\n ix.compound &&\n keyPaths.every(keyPath => ix.keyPath.indexOf(keyPath) >= 0) &&\n ix.keyPath.every(keyPath => keyPaths.indexOf(keyPath) >= 0))[0];\n\n if (compoundIndex && maxKey !== maxString)\n // Cool! We found such compound index\n // and this browser supports compound indexes (maxKey !== maxString)!\n return this\n .where(compoundIndex.name)\n .equals(compoundIndex.keyPath.map(kp => indexOrCrit[kp]));\n\n if (!compoundIndex) console.warn(\n `The query ${JSON.stringify(indexOrCrit)} on ${this.name} would benefit of a ` +\n `compound index [${keyPaths.join('+')}]`);\n \n // Ok, now let's fallback to finding at least one matching index\n // and filter the rest.\n var idxByName = this.schema.idxByName;\n var simpleIndex = keyPaths.reduce((r,keyPath)=>[\n r[0] || idxByName[keyPath],\n r[0] || !idxByName[keyPath] ?\n combine(\n r[1],\n x =>''+getByKeyPath(x, keyPath) ==\n ''+indexOrCrit[keyPath])\n : r[1]\n ], [null, null]);\n \n var idx = simpleIndex[0];\n return idx ?\n this.where(idx.name).equals(indexOrCrit[idx.keyPath])\n .filter(simpleIndex[1]) :\n compoundIndex ?\n this.filter(simpleIndex[1]) : // Has compound but browser bad. Allow filter.\n this.where(keyPaths).equals(''); // No index at all. Fail lazily.\n },\n count: function (cb) {\n return this.toCollection().count(cb);\n },\n offset: function (offset) {\n return this.toCollection().offset(offset);\n },\n limit: function (numRows) {\n return this.toCollection().limit(numRows);\n },\n reverse: function () {\n return this.toCollection().reverse();\n },\n filter: function (filterFunction) {\n return this.toCollection().and(filterFunction);\n },\n each: function (fn) {\n return this.toCollection().each(fn);\n },\n toArray: function (cb) {\n return this.toCollection().toArray(cb);\n },\n orderBy: function (index) {\n return new Collection(\n new WhereClause(this, isArray(index) ?\n `[${index.join('+')}]` :\n index));\n },\n\n toCollection: function () {\n return new Collection(new WhereClause(this));\n },\n\n mapToClass: function (constructor, structure) {\n /// \n /// Map table to a javascript constructor function. Objects returned from the database will be instances of this class, making\n /// it possible to the instanceOf operator as well as extending the class using constructor.prototype.method = function(){...}.\n /// \n /// Constructor function representing the class.\n /// Helps IDE code completion by knowing the members that objects contain and not just the indexes. Also\n /// know what type each member has. Example: {name: String, emailAddresses: [String], password}\n this.schema.mappedClass = constructor;\n var instanceTemplate = Object.create(constructor.prototype);\n if (structure) {\n // structure and instanceTemplate is for IDE code competion only while constructor.prototype is for actual inheritance.\n applyStructure(instanceTemplate, structure);\n }\n this.schema.instanceTemplate = instanceTemplate;\n\n // Now, subscribe to the when(\"reading\") event to make all objects that come out from this table inherit from given class\n // no matter which method to use for reading (Table.get() or Table.where(...)... )\n var readHook = function (obj) {\n if (!obj) return obj; // No valid object. (Value is null). Return as is.\n // Create a new object that derives from constructor:\n var res = Object.create(constructor.prototype);\n // Clone members:\n for (var m in obj) if (hasOwn(obj, m)) try {res[m] = obj[m];} catch(_){}\n return res;\n };\n\n if (this.schema.readHook) {\n this.hook.reading.unsubscribe(this.schema.readHook);\n }\n this.schema.readHook = readHook;\n this.hook(\"reading\", readHook);\n return constructor;\n },\n defineClass: function (structure) {\n /// \n /// Define all members of the class that represents the table. This will help code completion of when objects are read from the database\n /// as well as making it possible to extend the prototype of the returned constructor function.\n /// \n /// Helps IDE code completion by knowing the members that objects contain and not just the indexes. Also\n /// know what type each member has. Example: {name: String, emailAddresses: [String], properties: {shoeSize: Number}}\n return this.mapToClass(Dexie.defineClass(structure), structure);\n },\n\n bulkDelete: function (keys) {\n if (this.hook.deleting.fire === nop) {\n return this._idbstore(READWRITE, (resolve, reject, idbstore, trans) => {\n resolve (bulkDelete(idbstore, trans, keys, false, nop));\n });\n } else {\n return this\n .where(':id')\n .anyOf(keys)\n .delete()\n .then(()=>{}); // Resolve with undefined.\n }\n },\n bulkPut: function(objects, keys) {\n return this._idbstore(READWRITE, (resolve, reject, idbstore) => {\n if (!idbstore.keyPath && !this.schema.primKey.auto && !keys)\n throw new exceptions.InvalidArgument(\"bulkPut() with non-inbound keys requires keys array in second argument\");\n if (idbstore.keyPath && keys)\n throw new exceptions.InvalidArgument(\"bulkPut(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length)\n throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n if (objects.length === 0) return resolve(); // Caller provided empty list.\n const done = result => {\n if (errorList.length === 0) resolve(result);\n else reject(new BulkError(`${this.name}.bulkPut(): ${errorList.length} of ${numObjs} operations failed`, errorList));\n };\n var req,\n errorList = [],\n errorHandler,\n numObjs = objects.length,\n table = this;\n if (this.hook.creating.fire === nop && this.hook.updating.fire === nop) {\n //\n // Standard Bulk (no 'creating' or 'updating' hooks to care about)\n //\n errorHandler = BulkErrorHandlerCatchAll(errorList);\n for (var i = 0, l = objects.length; i < l; ++i) {\n req = keys ? idbstore.put(objects[i], keys[i]) : idbstore.put(objects[i]);\n req.onerror = errorHandler;\n }\n // Only need to catch success or error on the last operation\n // according to the IDB spec.\n req.onerror = BulkErrorHandlerCatchAll(errorList, done);\n req.onsuccess = eventSuccessHandler(done);\n } else {\n var effectiveKeys = keys || idbstore.keyPath && objects.map(o=>getByKeyPath(o, idbstore.keyPath));\n // Generate map of {[key]: object}\n var objectLookup = effectiveKeys && arrayToObject(effectiveKeys, (key, i) => key != null && [key, objects[i]]); \n var promise = !effectiveKeys ?\n\n // Auto-incremented key-less objects only without any keys argument.\n table.bulkAdd(objects) :\n\n // Keys provided. Either as inbound in provided objects, or as a keys argument.\n // Begin with updating those that exists in DB:\n table.where(':id').anyOf(effectiveKeys.filter(key => key != null)).modify(function () {\n this.value = objectLookup[this.primKey];\n objectLookup[this.primKey] = null; // Mark as \"don't add this\"\n }).catch(ModifyError, e => {\n errorList = e.failures; // No need to concat here. These are the first errors added.\n }).then(()=> {\n // Now, let's examine which items didnt exist so we can add them:\n var objsToAdd = [],\n keysToAdd = keys && [];\n // Iterate backwards. Why? Because if same key was used twice, just add the last one.\n for (var i=effectiveKeys.length-1; i>=0; --i) {\n var key = effectiveKeys[i];\n if (key == null || objectLookup[key]) {\n objsToAdd.push(objects[i]);\n keys && keysToAdd.push(key);\n if (key != null) objectLookup[key] = null; // Mark as \"dont add again\"\n }\n }\n // The items are in reverse order so reverse them before adding.\n // Could be important in order to get auto-incremented keys the way the caller\n // would expect. Could have used unshift instead of push()/reverse(),\n // but: http://jsperf.com/unshift-vs-reverse\n objsToAdd.reverse();\n keys && keysToAdd.reverse();\n return table.bulkAdd(objsToAdd, keysToAdd);\n }).then(lastAddedKey => {\n // Resolve with key of the last object in given arguments to bulkPut():\n var lastEffectiveKey = effectiveKeys[effectiveKeys.length - 1]; // Key was provided.\n return lastEffectiveKey != null ? lastEffectiveKey : lastAddedKey;\n });\n\n promise.then(done).catch(BulkError, e => {\n // Concat failure from ModifyError and reject using our 'done' method.\n errorList = errorList.concat(e.failures);\n done();\n }).catch(reject);\n }\n }, \"locked\"); // If called from transaction scope, lock transaction til all steps are done.\n },\n bulkAdd: function(objects, keys) {\n var self = this,\n creatingHook = this.hook.creating.fire;\n return this._idbstore(READWRITE, function (resolve, reject, idbstore, trans) {\n if (!idbstore.keyPath && !self.schema.primKey.auto && !keys)\n throw new exceptions.InvalidArgument(\"bulkAdd() with non-inbound keys requires keys array in second argument\");\n if (idbstore.keyPath && keys)\n throw new exceptions.InvalidArgument(\"bulkAdd(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length)\n throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n if (objects.length === 0) return resolve(); // Caller provided empty list.\n function done(result) {\n if (errorList.length === 0) resolve(result);\n else reject(new BulkError(`${self.name}.bulkAdd(): ${errorList.length} of ${numObjs} operations failed`, errorList));\n }\n var req,\n errorList = [],\n errorHandler,\n successHandler,\n numObjs = objects.length;\n if (creatingHook !== nop) {\n //\n // There are subscribers to hook('creating')\n // Must behave as documented.\n //\n var keyPath = idbstore.keyPath,\n hookCtx;\n errorHandler = BulkErrorHandlerCatchAll(errorList, null, true);\n successHandler = hookedEventSuccessHandler(null);\n\n tryCatch(() => {\n for (var i=0, l = objects.length; i < l; ++i) {\n hookCtx = { onerror: null, onsuccess: null };\n var key = keys && keys[i];\n var obj = objects[i],\n effectiveKey = keys ? key : keyPath ? getByKeyPath(obj, keyPath) : undefined,\n keyToUse = creatingHook.call(hookCtx, effectiveKey, obj, trans);\n if (effectiveKey == null && keyToUse != null) {\n if (keyPath) {\n obj = deepClone(obj);\n setByKeyPath(obj, keyPath, keyToUse);\n } else {\n key = keyToUse;\n }\n }\n req = key != null ? idbstore.add(obj, key) : idbstore.add(obj);\n req._hookCtx = hookCtx;\n if (i < l - 1) {\n req.onerror = errorHandler;\n if (hookCtx.onsuccess)\n req.onsuccess = successHandler;\n }\n }\n }, err => {\n hookCtx.onerror && hookCtx.onerror(err);\n throw err;\n });\n\n req.onerror = BulkErrorHandlerCatchAll(errorList, done, true);\n req.onsuccess = hookedEventSuccessHandler(done);\n } else {\n //\n // Standard Bulk (no 'creating' hook to care about)\n //\n errorHandler = BulkErrorHandlerCatchAll(errorList);\n for (var i = 0, l = objects.length; i < l; ++i) {\n req = keys ? idbstore.add(objects[i], keys[i]) : idbstore.add(objects[i]);\n req.onerror = errorHandler;\n }\n // Only need to catch success or error on the last operation\n // according to the IDB spec.\n req.onerror = BulkErrorHandlerCatchAll(errorList, done);\n req.onsuccess = eventSuccessHandler(done);\n }\n });\n },\n add: function (obj, key) {\n /// \n /// Add an object to the database. In case an object with same primary key already exists, the object will not be added.\n /// \n /// A javascript object to insert\n /// Primary key\n var creatingHook = this.hook.creating.fire;\n return this._idbstore(READWRITE, function (resolve, reject, idbstore, trans) {\n var hookCtx = {onsuccess: null, onerror: null};\n if (creatingHook !== nop) {\n var effectiveKey = (key != null) ? key : (idbstore.keyPath ? getByKeyPath(obj, idbstore.keyPath) : undefined);\n var keyToUse = creatingHook.call(hookCtx, effectiveKey, obj, trans); // Allow subscribers to when(\"creating\") to generate the key.\n if (effectiveKey == null && keyToUse != null) { // Using \"==\" and \"!=\" to check for either null or undefined!\n if (idbstore.keyPath)\n setByKeyPath(obj, idbstore.keyPath, keyToUse);\n else\n key = keyToUse;\n }\n }\n try {\n var req = key != null ? idbstore.add(obj, key) : idbstore.add(obj);\n req._hookCtx = hookCtx;\n req.onerror = hookedEventRejectHandler(reject);\n req.onsuccess = hookedEventSuccessHandler(function (result) {\n // TODO: Remove these two lines in next major release (2.0?)\n // It's no good practice to have side effects on provided parameters\n var keyPath = idbstore.keyPath;\n if (keyPath) setByKeyPath(obj, keyPath, result);\n resolve(result);\n });\n } catch (e) {\n if (hookCtx.onerror) hookCtx.onerror(e);\n throw e;\n }\n });\n },\n\n put: function (obj, key) {\n /// \n /// Add an object to the database but in case an object with same primary key alread exists, the existing one will get updated.\n /// \n /// A javascript object to insert or update\n /// Primary key\n var creatingHook = this.hook.creating.fire,\n updatingHook = this.hook.updating.fire;\n if (creatingHook !== nop || updatingHook !== nop) {\n //\n // People listens to when(\"creating\") or when(\"updating\") events!\n // We must know whether the put operation results in an CREATE or UPDATE.\n //\n var keyPath = this.schema.primKey.keyPath;\n var effectiveKey = (key !== undefined) ? key : (keyPath && getByKeyPath(obj, keyPath));\n if (effectiveKey == null) // \"== null\" means checking for either null or undefined.\n return this.add(obj);\n \n // Since key is optional, make sure we get it from obj if not provided\n \n // Primary key exist. Lock transaction and try modifying existing. If nothing modified, call add().\n // clone obj before this async call. If caller modifies obj the line after put(), the IDB spec requires that it should not affect operation.\n obj = deepClone(obj);\n return this._trans(READWRITE, () =>\n this.where(\":id\").equals(effectiveKey).modify(function () {\n // Replace extisting value with our object\n // CRUD event firing handled in Collection.modify()\n this.value = obj;\n }).then(count => count === 0 ? this.add(obj, key) : effectiveKey),\n \"locked\"); // Lock needed because operation is splitted into modify() and add().\n } else {\n // Use the standard IDB put() method.\n return this._idbstore(READWRITE, function (resolve, reject, idbstore) {\n var req = key !== undefined ? idbstore.put(obj, key) : idbstore.put(obj);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function (ev) {\n var keyPath = idbstore.keyPath;\n if (keyPath) setByKeyPath(obj, keyPath, ev.target.result);\n resolve(req.result);\n });\n });\n }\n },\n\n 'delete': function (key) {\n /// Primary key of the object to delete\n if (this.hook.deleting.subscribers.length) {\n // People listens to when(\"deleting\") event. Must implement delete using Collection.delete() that will\n // call the CRUD event. Only Collection.delete() will know whether an object was actually deleted.\n return this.where(\":id\").equals(key).delete();\n } else {\n // No one listens. Use standard IDB delete() method.\n return this._idbstore(READWRITE, function (resolve, reject, idbstore) {\n var req = idbstore.delete(key);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function () {\n resolve(req.result);\n });\n });\n }\n },\n\n clear: function () {\n if (this.hook.deleting.subscribers.length) {\n // People listens to when(\"deleting\") event. Must implement delete using Collection.delete() that will\n // call the CRUD event. Only Collection.delete() will knows which objects that are actually deleted.\n return this.toCollection().delete();\n } else {\n return this._idbstore(READWRITE, function (resolve, reject, idbstore) {\n var req = idbstore.clear();\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function () {\n resolve(req.result);\n });\n });\n }\n },\n\n update: function (keyOrObject, modifications) {\n if (typeof modifications !== 'object' || isArray(modifications))\n throw new exceptions.InvalidArgument(\"Modifications must be an object.\");\n if (typeof keyOrObject === 'object' && !isArray(keyOrObject)) {\n // object to modify. Also modify given object with the modifications:\n keys(modifications).forEach(function (keyPath) {\n setByKeyPath(keyOrObject, keyPath, modifications[keyPath]);\n });\n var key = getByKeyPath(keyOrObject, this.schema.primKey.keyPath);\n if (key === undefined) return rejection (new exceptions.InvalidArgument(\n \"Given object does not contain its primary key\"));\n return this.where(\":id\").equals(key).modify(modifications);\n } else {\n // key to modify\n return this.where(\":id\").equals(keyOrObject).modify(modifications);\n }\n }\n });\n \n //\n //\n //\n // Transaction Class\n //\n //\n //\n function Transaction(mode, storeNames, dbschema, parent) {\n /// \n /// Transaction class. Represents a database transaction. All operations on db goes through a Transaction.\n /// \n /// Any of \"readwrite\" or \"readonly\"\n /// Array of table names to operate on\n this.db = db;\n this.mode = mode;\n this.storeNames = storeNames;\n this.idbtrans = null;\n this.on = Events(this, \"complete\", \"error\", \"abort\");\n this.parent = parent || null;\n this.active = true;\n this._reculock = 0;\n this._blockedFuncs = [];\n this._resolve = null;\n this._reject = null;\n this._waitingFor = null;\n this._waitingQueue = null;\n this._spinCount = 0; // Just for debugging waitFor()\n this._completion = new Promise ((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n \n this._completion.then(\n ()=> {\n this.active = false;\n this.on.complete.fire();\n },\n e => {\n var wasActive = this.active;\n this.active = false;\n this.on.error.fire(e);\n this.parent ?\n this.parent._reject(e) :\n wasActive && this.idbtrans && this.idbtrans.abort();\n return rejection(e); // Indicate we actually DO NOT catch this error.\n });\n }\n\n props(Transaction.prototype, {\n //\n // Transaction Protected Methods (not required by API users, but needed internally and eventually by dexie extensions)\n //\n _lock: function () {\n assert (!PSD.global); // Locking and unlocking reuires to be within a PSD scope.\n // Temporary set all requests into a pending queue if they are called before database is ready.\n ++this._reculock; // Recursive read/write lock pattern using PSD (Promise Specific Data) instead of TLS (Thread Local Storage)\n if (this._reculock === 1 && !PSD.global) PSD.lockOwnerFor = this;\n return this;\n },\n _unlock: function () {\n assert (!PSD.global); // Locking and unlocking reuires to be within a PSD scope.\n if (--this._reculock === 0) {\n if (!PSD.global) PSD.lockOwnerFor = null;\n while (this._blockedFuncs.length > 0 && !this._locked()) {\n var fnAndPSD = this._blockedFuncs.shift();\n try { usePSD(fnAndPSD[1], fnAndPSD[0]); } catch (e) { }\n }\n }\n return this;\n },\n _locked: function () {\n // Checks if any write-lock is applied on this transaction.\n // To simplify the Dexie API for extension implementations, we support recursive locks.\n // This is accomplished by using \"Promise Specific Data\" (PSD).\n // PSD data is bound to a Promise and any child Promise emitted through then() or resolve( new Promise() ).\n // PSD is local to code executing on top of the call stacks of any of any code executed by Promise():\n // * callback given to the Promise() constructor (function (resolve, reject){...})\n // * callbacks given to then()/catch()/finally() methods (function (value){...})\n // If creating a new independant Promise instance from within a Promise call stack, the new Promise will derive the PSD from the call stack of the parent Promise.\n // Derivation is done so that the inner PSD __proto__ points to the outer PSD.\n // PSD.lockOwnerFor will point to current transaction object if the currently executing PSD scope owns the lock.\n return this._reculock && PSD.lockOwnerFor !== this;\n },\n create: function (idbtrans) {\n if (!this.mode) return this;\n assert(!this.idbtrans);\n if (!idbtrans && !idbdb) {\n switch (dbOpenError && dbOpenError.name) {\n case \"DatabaseClosedError\":\n // Errors where it is no difference whether it was caused by the user operation or an earlier call to db.open()\n throw new exceptions.DatabaseClosed(dbOpenError);\n case \"MissingAPIError\":\n // Errors where it is no difference whether it was caused by the user operation or an earlier call to db.open()\n throw new exceptions.MissingAPI(dbOpenError.message, dbOpenError);\n default:\n // Make it clear that the user operation was not what caused the error - the error had occurred earlier on db.open()!\n throw new exceptions.OpenFailed(dbOpenError);\n }\n }\n if (!this.active) throw new exceptions.TransactionInactive();\n assert(this._completion._state === null);\n\n idbtrans = this.idbtrans = idbtrans || idbdb.transaction(safariMultiStoreFix(this.storeNames), this.mode);\n idbtrans.onerror = wrap(ev => {\n preventDefault(ev);// Prohibit default bubbling to window.error\n this._reject(idbtrans.error);\n });\n idbtrans.onabort = wrap(ev => {\n preventDefault(ev);\n this.active && this._reject(new exceptions.Abort(idbtrans.error));\n this.active = false;\n this.on(\"abort\").fire(ev);\n });\n idbtrans.oncomplete = wrap(() => {\n this.active = false;\n this._resolve();\n });\n return this;\n },\n _promise: function (mode, fn, bWriteLock) {\n\n if (mode === READWRITE && this.mode !== READWRITE)\n return rejection (new exceptions.ReadOnly(\"Transaction is readonly\"));\n\n if (!this.active)\n return rejection (new exceptions.TransactionInactive());\n\n if (this._locked()) {\n return new Promise((resolve, reject) => {\n this._blockedFuncs.push([() => {\n this._promise(mode, fn, bWriteLock).then(resolve, reject);\n }, PSD]);\n });\n\n } else if (bWriteLock) {\n return newScope(()=>{\n var p = new Promise((resolve, reject) => {\n this._lock();\n var rv = fn(resolve, reject, this);\n if (rv && rv.then) rv.then(resolve, reject);\n });\n p.finally(()=>this._unlock());\n p._lib = true;\n return p;\n });\n\n } else {\n var p = new Promise((resolve, reject) => {\n var rv = fn(resolve, reject, this);\n if (rv && rv.then) rv.then(resolve, reject);\n });\n p._lib = true;\n return p;\n }\n },\n\n _root: function () {\n return this.parent ? this.parent._root() : this;\n },\n\n waitFor (promise) {\n // Always operate on the root transaction (in case this is a sub stransaction)\n var root = this._root();\n // For stability reasons, convert parameter to promise no matter what type is passed to waitFor().\n // (We must be able to call .then() on it.)\n promise = Promise.resolve(promise);\n if (root._waitingFor) {\n // Already called waitFor(). Wait for both to complete.\n root._waitingFor = root._waitingFor.then(()=>promise);\n } else {\n // We're not in waiting state. Start waiting state.\n root._waitingFor = promise;\n root._waitingQueue = [];\n // Start interacting with indexedDB until promise completes:\n var store = root.idbtrans.objectStore(root.storeNames[0]);\n (function spin(){\n ++root._spinCount; // For debugging only\n while (root._waitingQueue.length) (root._waitingQueue.shift())();\n if (root._waitingFor) store.get(-Infinity).onsuccess = spin;\n }());\n }\n var currentWaitPromise = root._waitingFor;\n return new Promise ((resolve, reject) => {\n promise.then (\n res => root._waitingQueue.push(wrap(resolve.bind(null, res))),\n err => root._waitingQueue.push(wrap(reject.bind(null, err)))\n ).finally(() => {\n if (root._waitingFor === currentWaitPromise) {\n // No one added a wait after us. Safe to stop the spinning.\n root._waitingFor = null;\n }\n });\n });\n },\n\n //\n // Transaction Public Properties and Methods\n //\n abort: function () {\n this.active && this._reject(new exceptions.Abort());\n this.active = false;\n },\n\n tables: {\n get: Debug.deprecated (\"Transaction.tables\", ()=>allTables)\n },\n\n table: function (name) {\n var table = db.table(name); // Don't check that table is part of transaction. It must fail lazily!\n return new Table(name, table.schema, this);\n }\n });\n\n //\n //\n //\n // WhereClause\n //\n //\n //\n function WhereClause(table, index, orCollection) {\n /// \n /// \n /// \n this._ctx = {\n table: table,\n index: index === \":id\" ? null : index,\n or: orCollection\n };\n }\n\n props(WhereClause.prototype, function () {\n\n // WhereClause private methods\n\n function fail(collectionOrWhereClause, err, T) {\n var collection = collectionOrWhereClause instanceof WhereClause ?\n new Collection (collectionOrWhereClause) :\n collectionOrWhereClause;\n \n collection._ctx.error = T ? new T(err) : new TypeError(err);\n return collection;\n }\n\n function emptyCollection(whereClause) {\n return new Collection (whereClause, function() { return IDBKeyRange.only(\"\"); }).limit(0);\n }\n\n function upperFactory(dir) {\n return dir === \"next\" ? function (s) { return s.toUpperCase(); } : function (s) { return s.toLowerCase(); };\n }\n function lowerFactory(dir) {\n return dir === \"next\" ? function (s) { return s.toLowerCase(); } : function (s) { return s.toUpperCase(); };\n }\n function nextCasing(key, lowerKey, upperNeedle, lowerNeedle, cmp, dir) {\n var length = Math.min(key.length, lowerNeedle.length);\n var llp = -1;\n for (var i = 0; i < length; ++i) {\n var lwrKeyChar = lowerKey[i];\n if (lwrKeyChar !== lowerNeedle[i]) {\n if (cmp(key[i], upperNeedle[i]) < 0) return key.substr(0, i) + upperNeedle[i] + upperNeedle.substr(i + 1);\n if (cmp(key[i], lowerNeedle[i]) < 0) return key.substr(0, i) + lowerNeedle[i] + upperNeedle.substr(i + 1);\n if (llp >= 0) return key.substr(0, llp) + lowerKey[llp] + upperNeedle.substr(llp + 1);\n return null;\n }\n if (cmp(key[i], lwrKeyChar) < 0) llp = i;\n }\n if (length < lowerNeedle.length && dir === \"next\") return key + upperNeedle.substr(key.length);\n if (length < key.length && dir === \"prev\") return key.substr(0, upperNeedle.length);\n return (llp < 0 ? null : key.substr(0, llp) + lowerNeedle[llp] + upperNeedle.substr(llp + 1));\n }\n\n function addIgnoreCaseAlgorithm(whereClause, match, needles, suffix) {\n /// \n var upper, lower, compare, upperNeedles, lowerNeedles, direction, nextKeySuffix,\n needlesLen = needles.length;\n if (!needles.every(s => typeof s === 'string')) {\n return fail(whereClause, STRING_EXPECTED);\n }\n function initDirection(dir) {\n upper = upperFactory(dir);\n lower = lowerFactory(dir);\n compare = (dir === \"next\" ? simpleCompare : simpleCompareReverse);\n var needleBounds = needles.map(function (needle){\n return {lower: lower(needle), upper: upper(needle)};\n }).sort(function(a,b) {\n return compare(a.lower, b.lower);\n });\n upperNeedles = needleBounds.map(function (nb){ return nb.upper; });\n lowerNeedles = needleBounds.map(function (nb){ return nb.lower; });\n direction = dir;\n nextKeySuffix = (dir === \"next\" ? \"\" : suffix);\n }\n initDirection(\"next\");\n\n var c = new Collection (whereClause, function() {\n return IDBKeyRange.bound(upperNeedles[0], lowerNeedles[needlesLen-1] + suffix);\n });\n\n c._ondirectionchange = function (direction) {\n // This event onlys occur before filter is called the first time.\n initDirection(direction);\n };\n\n var firstPossibleNeedle = 0;\n\n c._addAlgorithm(function (cursor, advance, resolve) {\n /// \n /// \n /// \n var key = cursor.key;\n if (typeof key !== 'string') return false;\n var lowerKey = lower(key);\n if (match(lowerKey, lowerNeedles, firstPossibleNeedle)) {\n return true;\n } else {\n var lowestPossibleCasing = null;\n for (var i=firstPossibleNeedle; i 0) {\n lowestPossibleCasing = casing;\n }\n }\n if (lowestPossibleCasing !== null) {\n advance(function () { cursor.continue(lowestPossibleCasing + nextKeySuffix); });\n } else {\n advance(resolve);\n }\n return false;\n }\n });\n return c;\n }\n\n //\n // WhereClause public methods\n //\n return {\n between: function (lower, upper, includeLower, includeUpper) {\n /// \n /// Filter out records whose where-field lays between given lower and upper values. Applies to Strings, Numbers and Dates.\n /// \n /// \n /// \n /// Whether items that equals lower should be included. Default true.\n /// Whether items that equals upper should be included. Default false.\n /// \n includeLower = includeLower !== false; // Default to true\n includeUpper = includeUpper === true; // Default to false\n try {\n if ((cmp(lower, upper) > 0) ||\n (cmp(lower, upper) === 0 && (includeLower || includeUpper) && !(includeLower && includeUpper)))\n return emptyCollection(this); // Workaround for idiotic W3C Specification that DataError must be thrown if lower > upper. The natural result would be to return an empty collection.\n return new Collection (this, function() { return IDBKeyRange.bound(lower, upper, !includeLower, !includeUpper); });\n } catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n },\n equals: function (value) {\n return new Collection (this, function() { return IDBKeyRange.only(value); });\n },\n above: function (value) {\n return new Collection (this, function() { return IDBKeyRange.lowerBound(value, true); });\n },\n aboveOrEqual: function (value) {\n return new Collection (this, function() { return IDBKeyRange.lowerBound(value); });\n },\n below: function (value) {\n return new Collection (this, function() { return IDBKeyRange.upperBound(value, true); });\n },\n belowOrEqual: function (value) {\n return new Collection (this, function() { return IDBKeyRange.upperBound(value); });\n },\n startsWith: function (str) {\n /// \n if (typeof str !== 'string') return fail(this, STRING_EXPECTED);\n return this.between(str, str + maxString, true, true);\n },\n startsWithIgnoreCase: function (str) {\n /// \n if (str === \"\") return this.startsWith(str);\n return addIgnoreCaseAlgorithm(this, function (x, a) { return x.indexOf(a[0]) === 0; }, [str], maxString);\n },\n equalsIgnoreCase: function (str) {\n /// \n return addIgnoreCaseAlgorithm(this, function (x, a) { return x === a[0]; }, [str], \"\");\n },\n anyOfIgnoreCase: function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, function (x, a) { return a.indexOf(x) !== -1; }, set, \"\");\n },\n startsWithAnyOfIgnoreCase: function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, function (x, a) {\n return a.some(function(n){\n return x.indexOf(n) === 0;\n });}, set, maxString);\n },\n anyOf: function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n var compare = ascending;\n try { set.sort(compare); } catch(e) { return fail(this, INVALID_KEY_ARGUMENT); }\n if (set.length === 0) return emptyCollection(this);\n var c = new Collection (this, function () { return IDBKeyRange.bound(set[0], set[set.length - 1]); });\n\n c._ondirectionchange = function (direction) {\n compare = (direction === \"next\" ? ascending : descending);\n set.sort(compare);\n };\n var i = 0;\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n while (compare(key, set[i]) > 0) {\n // The cursor has passed beyond this key. Check next.\n ++i;\n if (i === set.length) {\n // There is no next. Stop searching.\n advance(resolve);\n return false;\n }\n }\n if (compare(key, set[i]) === 0) {\n // The current cursor value should be included and we should continue a single step in case next item has the same key or possibly our next key in set.\n return true;\n } else {\n // cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.\n advance(function () { cursor.continue(set[i]); });\n return false;\n }\n });\n return c;\n },\n\n notEqual: function(value) {\n return this.inAnyRange([[minKey, value],[value, maxKey]], {includeLowers: false, includeUppers: false});\n },\n\n noneOf: function() {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return new Collection (this); // Return entire collection.\n try { set.sort(ascending); } catch(e) { return fail(this, INVALID_KEY_ARGUMENT);}\n // Transform [\"a\",\"b\",\"c\"] to a set of ranges for between/above/below: [[minKey,\"a\"], [\"a\",\"b\"], [\"b\",\"c\"], [\"c\",maxKey]]\n var ranges = set.reduce(function (res, val) { return res ? res.concat([[res[res.length - 1][1], val]]) : [[minKey, val]]; }, null);\n ranges.push([set[set.length - 1], maxKey]);\n return this.inAnyRange(ranges, {includeLowers: false, includeUppers: false});\n },\n\n /** Filter out values withing given set of ranges.\n * Example, give children and elders a rebate of 50%:\n *\n * db.friends.where('age').inAnyRange([[0,18],[65,Infinity]]).modify({Rebate: 1/2});\n *\n * @param {(string|number|Date|Array)[][]} ranges\n * @param {{includeLowers: boolean, includeUppers: boolean}} options\n */\n inAnyRange: function (ranges, options) {\n if (ranges.length === 0) return emptyCollection(this);\n if (!ranges.every(function (range) { return range[0] !== undefined && range[1] !== undefined && ascending(range[0], range[1]) <= 0;})) {\n return fail(this, \"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower\", exceptions.InvalidArgument);\n }\n var includeLowers = !options || options.includeLowers !== false; // Default to true\n var includeUppers = options && options.includeUppers === true; // Default to false\n\n function addRange (ranges, newRange) {\n for (var i=0,l=ranges.length;i 0) {\n range[0] = min(range[0], newRange[0]);\n range[1] = max(range[1], newRange[1]);\n break;\n }\n }\n if (i === l)\n ranges.push(newRange);\n return ranges;\n }\n\n var sortDirection = ascending;\n function rangeSorter(a,b) { return sortDirection(a[0], b[0]);}\n\n // Join overlapping ranges\n var set;\n try {\n set = ranges.reduce(addRange, []);\n set.sort(rangeSorter);\n } catch(ex) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n\n var i = 0;\n var keyIsBeyondCurrentEntry = includeUppers ?\n function(key) { return ascending(key, set[i][1]) > 0; } :\n function(key) { return ascending(key, set[i][1]) >= 0; };\n\n var keyIsBeforeCurrentEntry = includeLowers ?\n function(key) { return descending(key, set[i][0]) > 0; } :\n function(key) { return descending(key, set[i][0]) >= 0; };\n\n function keyWithinCurrentRange (key) {\n return !keyIsBeyondCurrentEntry(key) && !keyIsBeforeCurrentEntry(key);\n }\n\n var checkKey = keyIsBeyondCurrentEntry;\n\n var c = new Collection (this, function () {\n return IDBKeyRange.bound(set[0][0], set[set.length - 1][1], !includeLowers, !includeUppers);\n });\n\n c._ondirectionchange = function (direction) {\n if (direction === \"next\") {\n checkKey = keyIsBeyondCurrentEntry;\n sortDirection = ascending;\n } else {\n checkKey = keyIsBeforeCurrentEntry;\n sortDirection = descending;\n }\n set.sort(rangeSorter);\n };\n\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n while (checkKey(key)) {\n // The cursor has passed beyond this key. Check next.\n ++i;\n if (i === set.length) {\n // There is no next. Stop searching.\n advance(resolve);\n return false;\n }\n }\n if (keyWithinCurrentRange(key)) {\n // The current cursor value should be included and we should continue a single step in case next item has the same key or possibly our next key in set.\n return true;\n } else if (cmp(key,set[i][1]) === 0 || cmp(key,set[i][0]) === 0) {\n // includeUpper or includeLower is false so keyWithinCurrentRange() returns false even though we are at range border.\n // Continue to next key but don't include this one.\n return false;\n } else {\n // cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.\n advance(function() {\n if (sortDirection === ascending) cursor.continue(set[i][0]);\n else cursor.continue(set[i][1]);\n });\n return false;\n }\n });\n return c;\n },\n startsWithAnyOf: function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n\n if (!set.every(function (s) { return typeof s === 'string'; })) {\n return fail(this, \"startsWithAnyOf() only works with strings\");\n }\n if (set.length === 0) return emptyCollection(this);\n\n return this.inAnyRange(set.map(function(str) {\n return [str, str + maxString];\n }));\n }\n };\n });\n\n\n\n\n //\n //\n //\n // Collection Class\n //\n //\n //\n function Collection(whereClause, keyRangeGenerator) {\n /// \n ///\n /// \n /// Where clause instance\n /// \n var keyRange = null, error = null;\n if (keyRangeGenerator) try {\n keyRange = keyRangeGenerator();\n } catch (ex) {\n error = ex;\n }\n\n var whereCtx = whereClause._ctx,\n table = whereCtx.table;\n this._ctx = {\n table: table,\n index: whereCtx.index,\n isPrimKey: (!whereCtx.index || (table.schema.primKey.keyPath && whereCtx.index === table.schema.primKey.name)),\n range: keyRange,\n keysOnly: false,\n dir: \"next\",\n unique: \"\",\n algorithm: null,\n filter: null,\n replayFilter: null,\n justLimit: true, // True if a replayFilter is just a filter that performs a \"limit\" operation (or none at all)\n isMatch: null,\n offset: 0,\n limit: Infinity,\n error: error, // If set, any promise must be rejected with this error\n or: whereCtx.or,\n valueMapper: table.hook.reading.fire\n };\n }\n \n function isPlainKeyRange (ctx, ignoreLimitFilter) {\n return !(ctx.filter || ctx.algorithm || ctx.or) &&\n (ignoreLimitFilter ? ctx.justLimit : !ctx.replayFilter);\n } \n\n props(Collection.prototype, function () {\n\n //\n // Collection Private Functions\n //\n\n function addFilter(ctx, fn) {\n ctx.filter = combine(ctx.filter, fn);\n }\n\n function addReplayFilter (ctx, factory, isLimitFilter) {\n var curr = ctx.replayFilter;\n ctx.replayFilter = curr ? ()=>combine(curr(), factory()) : factory;\n ctx.justLimit = isLimitFilter && !curr;\n }\n\n function addMatchFilter(ctx, fn) {\n ctx.isMatch = combine(ctx.isMatch, fn);\n }\n\n /** @param ctx {\n * isPrimKey: boolean,\n * table: Table,\n * index: string\n * }\n * @param store IDBObjectStore\n **/\n function getIndexOrStore(ctx, store) {\n if (ctx.isPrimKey) return store;\n var indexSpec = ctx.table.schema.idxByName[ctx.index];\n if (!indexSpec) throw new exceptions.Schema(\"KeyPath \" + ctx.index + \" on object store \" + store.name + \" is not indexed\");\n return store.index(indexSpec.name);\n }\n\n /** @param ctx {\n * isPrimKey: boolean,\n * table: Table,\n * index: string,\n * keysOnly: boolean,\n * range?: IDBKeyRange,\n * dir: \"next\" | \"prev\"\n * }\n */\n function openCursor(ctx, store) {\n var idxOrStore = getIndexOrStore(ctx, store);\n return ctx.keysOnly && 'openKeyCursor' in idxOrStore ?\n idxOrStore.openKeyCursor(ctx.range || null, ctx.dir + ctx.unique) :\n idxOrStore.openCursor(ctx.range || null, ctx.dir + ctx.unique);\n }\n\n function iter(ctx, fn, resolve, reject, idbstore) {\n var filter = ctx.replayFilter ? combine(ctx.filter, ctx.replayFilter()) : ctx.filter;\n if (!ctx.or) {\n iterate(openCursor(ctx, idbstore), combine(ctx.algorithm, filter), fn, resolve, reject, !ctx.keysOnly && ctx.valueMapper);\n } else (()=>{\n var set = {};\n var resolved = 0;\n\n function resolveboth() {\n if (++resolved === 2) resolve(); // Seems like we just support or btwn max 2 expressions, but there are no limit because we do recursion.\n }\n\n function union(item, cursor, advance) {\n if (!filter || filter(cursor, advance, resolveboth, reject)) {\n var primaryKey = cursor.primaryKey;\n var key = '' + primaryKey;\n if (key === '[object ArrayBuffer]') key = '' + new Uint8Array(primaryKey);\n if (!hasOwn(set, key)) {\n set[key] = true;\n fn(item, cursor, advance);\n }\n }\n }\n\n ctx.or._iterate(union, resolveboth, reject, idbstore);\n iterate(openCursor(ctx, idbstore), ctx.algorithm, union, resolveboth, reject, !ctx.keysOnly && ctx.valueMapper);\n })();\n }\n \n return {\n\n //\n // Collection Protected Functions\n //\n\n _read: function (fn, cb) {\n var ctx = this._ctx;\n return ctx.error ?\n ctx.table._trans(null, rejection.bind(null, ctx.error)) :\n ctx.table._idbstore(READONLY, fn).then(cb);\n },\n _write: function (fn) {\n var ctx = this._ctx;\n return ctx.error ?\n ctx.table._trans(null, rejection.bind(null, ctx.error)) :\n ctx.table._idbstore(READWRITE, fn, \"locked\"); // When doing write operations on collections, always lock the operation so that upcoming operations gets queued.\n },\n _addAlgorithm: function (fn) {\n var ctx = this._ctx;\n ctx.algorithm = combine(ctx.algorithm, fn);\n },\n\n _iterate: function (fn, resolve, reject, idbstore) {\n return iter(this._ctx, fn, resolve, reject, idbstore);\n },\n\n clone: function (props) {\n var rv = Object.create(this.constructor.prototype),\n ctx = Object.create(this._ctx);\n if (props) extend(ctx, props);\n rv._ctx = ctx;\n return rv;\n },\n\n raw: function () {\n this._ctx.valueMapper = null;\n return this;\n },\n\n //\n // Collection Public methods\n //\n\n each: function (fn) {\n var ctx = this._ctx;\n\n return this._read(function (resolve, reject, idbstore) {\n iter(ctx, fn, resolve, reject, idbstore);\n });\n },\n\n count: function (cb) {\n var ctx = this._ctx;\n\n if (isPlainKeyRange(ctx, true)) {\n // This is a plain key range. We can use the count() method if the index.\n return this._read(function (resolve, reject, idbstore) {\n var idx = getIndexOrStore(ctx, idbstore);\n var req = (ctx.range ? idx.count(ctx.range) : idx.count());\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = function (e) {\n resolve(Math.min(e.target.result, ctx.limit));\n };\n }, cb);\n } else {\n // Algorithms, filters or expressions are applied. Need to count manually.\n var count = 0;\n return this._read(function (resolve, reject, idbstore) {\n iter(ctx, function () { ++count; return false; }, function () { resolve(count); }, reject, idbstore);\n }, cb);\n }\n },\n\n sortBy: function (keyPath, cb) {\n /// \n var parts = keyPath.split('.').reverse(),\n lastPart = parts[0],\n lastIndex = parts.length - 1;\n function getval(obj, i) {\n if (i) return getval(obj[parts[i]], i - 1);\n return obj[lastPart];\n }\n var order = this._ctx.dir === \"next\" ? 1 : -1;\n\n function sorter(a, b) {\n var aVal = getval(a, lastIndex),\n bVal = getval(b, lastIndex);\n return aVal < bVal ? -order : aVal > bVal ? order : 0;\n }\n return this.toArray(function (a) {\n return a.sort(sorter);\n }).then(cb);\n },\n\n toArray: function (cb) {\n var ctx = this._ctx;\n return this._read(function (resolve, reject, idbstore) {\n if (hasGetAll && ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n // Special optimation if we could use IDBObjectStore.getAll() or\n // IDBKeyRange.getAll():\n var readingHook = ctx.table.hook.reading.fire;\n var idxOrStore = getIndexOrStore(ctx, idbstore);\n var req = ctx.limit < Infinity ?\n idxOrStore.getAll(ctx.range, ctx.limit) :\n idxOrStore.getAll(ctx.range);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = readingHook === mirror ?\n eventSuccessHandler(resolve) :\n eventSuccessHandler(res => {\n try {resolve (res.map(readingHook));} catch(e) {reject(e);}\n });\n } else {\n // Getting array through a cursor.\n var a = [];\n iter(ctx, function (item) { a.push(item); }, function arrayComplete() {\n resolve(a);\n }, reject, idbstore);\n }\n }, cb);\n },\n\n offset: function (offset) {\n var ctx = this._ctx;\n if (offset <= 0) return this;\n ctx.offset += offset; // For count()\n if (isPlainKeyRange(ctx)) {\n addReplayFilter(ctx, ()=> {\n var offsetLeft = offset;\n return (cursor, advance) => {\n if (offsetLeft === 0) return true;\n if (offsetLeft === 1) { --offsetLeft; return false; }\n advance(()=> {\n cursor.advance(offsetLeft);\n offsetLeft = 0;\n });\n return false;\n };\n });\n } else {\n addReplayFilter(ctx, ()=> {\n var offsetLeft = offset;\n return () => (--offsetLeft < 0);\n });\n }\n return this;\n },\n\n limit: function (numRows) {\n this._ctx.limit = Math.min(this._ctx.limit, numRows); // For count()\n addReplayFilter(this._ctx, ()=> {\n var rowsLeft = numRows;\n return function (cursor, advance, resolve) {\n if (--rowsLeft <= 0) advance(resolve); // Stop after this item has been included\n return rowsLeft >= 0; // If numRows is already below 0, return false because then 0 was passed to numRows initially. Otherwise we wouldnt come here.\n };\n }, true);\n return this;\n },\n\n until: function (filterFunction, bIncludeStopEntry) {\n addFilter(this._ctx, function (cursor, advance, resolve) {\n if (filterFunction(cursor.value)) {\n advance(resolve);\n return bIncludeStopEntry;\n } else {\n return true;\n }\n });\n return this;\n },\n\n first: function (cb) {\n return this.limit(1).toArray(function (a) { return a[0]; }).then(cb);\n },\n\n last: function (cb) {\n return this.reverse().first(cb);\n },\n\n filter: function (filterFunction) {\n /// function(val){return true/false}\n addFilter(this._ctx, function (cursor) {\n return filterFunction(cursor.value);\n });\n // match filters not used in Dexie.js but can be used by 3rd part libraries to test a\n // collection for a match without querying DB. Used by Dexie.Observable.\n addMatchFilter(this._ctx, filterFunction); \n return this;\n },\n \n and: function (filterFunction) {\n return this.filter(filterFunction);\n },\n\n or: function (indexName) {\n return new WhereClause(this._ctx.table, indexName, this);\n },\n\n reverse: function () {\n this._ctx.dir = (this._ctx.dir === \"prev\" ? \"next\" : \"prev\");\n if (this._ondirectionchange) this._ondirectionchange(this._ctx.dir);\n return this;\n },\n\n desc: function () {\n return this.reverse();\n },\n\n eachKey: function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) { cb(cursor.key, cursor); });\n },\n\n eachUniqueKey: function (cb) {\n this._ctx.unique = \"unique\";\n return this.eachKey(cb);\n },\n \n eachPrimaryKey: function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) { cb(cursor.primaryKey, cursor); });\n },\n\n keys: function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.key);\n }).then(function () {\n return a;\n }).then(cb);\n },\n \n primaryKeys: function (cb) {\n var ctx = this._ctx;\n if (hasGetAll && ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n // Special optimation if we could use IDBObjectStore.getAllKeys() or\n // IDBKeyRange.getAllKeys():\n return this._read((resolve, reject, idbstore) =>{\n var idxOrStore = getIndexOrStore(ctx, idbstore);\n var req = ctx.limit < Infinity ?\n idxOrStore.getAllKeys(ctx.range, ctx.limit) :\n idxOrStore.getAllKeys(ctx.range);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = eventSuccessHandler(resolve);\n }).then(cb);\n }\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.primaryKey);\n }).then(function () {\n return a;\n }).then(cb);\n },\n\n uniqueKeys: function (cb) {\n this._ctx.unique = \"unique\";\n return this.keys(cb);\n },\n\n firstKey: function (cb) {\n return this.limit(1).keys(function (a) { return a[0]; }).then(cb);\n },\n\n lastKey: function (cb) {\n return this.reverse().firstKey(cb);\n },\n\n distinct: function () {\n var ctx = this._ctx,\n idx = ctx.index && ctx.table.schema.idxByName[ctx.index];\n if (!idx || !idx.multi) return this; // distinct() only makes differencies on multiEntry indexes.\n var set = {};\n addFilter(this._ctx, function (cursor) {\n var strKey = cursor.primaryKey.toString(); // Converts any Date to String, String to String, Number to String and Array to comma-separated string\n var found = hasOwn(set, strKey);\n set[strKey] = true;\n return !found;\n });\n return this;\n },\n\n //\n // Methods that mutate storage\n //\n\n modify: function (changes) {\n var self = this,\n ctx = this._ctx,\n hook = ctx.table.hook,\n updatingHook = hook.updating.fire,\n deletingHook = hook.deleting.fire;\n\n return this._write(function (resolve, reject, idbstore, trans) {\n var modifyer;\n if (typeof changes === 'function') {\n // Changes is a function that may update, add or delete propterties or even require a deletion the object itself (delete this.item)\n if (updatingHook === nop && deletingHook === nop) {\n // Noone cares about what is being changed. Just let the modifier function be the given argument as is.\n modifyer = changes;\n } else {\n // People want to know exactly what is being modified or deleted.\n // Let modifyer be a proxy function that finds out what changes the caller is actually doing\n // and call the hooks accordingly!\n modifyer = function (item) {\n var origItem = deepClone(item); // Clone the item first so we can compare laters.\n if (changes.call(this, item, this) === false) return false; // Call the real modifyer function (If it returns false explicitely, it means it dont want to modify anyting on this object)\n if (!hasOwn(this, \"value\")) {\n // The real modifyer function requests a deletion of the object. Inform the deletingHook that a deletion is taking place.\n deletingHook.call(this, this.primKey, item, trans);\n } else {\n // No deletion. Check what was changed\n var objectDiff = getObjectDiff(origItem, this.value);\n var additionalChanges = updatingHook.call(this, objectDiff, this.primKey, origItem, trans);\n if (additionalChanges) {\n // Hook want to apply additional modifications. Make sure to fullfill the will of the hook.\n item = this.value;\n keys(additionalChanges).forEach(function (keyPath) {\n setByKeyPath(item, keyPath, additionalChanges[keyPath]); // Adding {keyPath: undefined} means that the keyPath should be deleted. Handled by setByKeyPath\n });\n }\n }\n };\n }\n } else if (updatingHook === nop) {\n // changes is a set of {keyPath: value} and no one is listening to the updating hook.\n var keyPaths = keys(changes);\n var numKeys = keyPaths.length;\n modifyer = function (item) {\n var anythingModified = false;\n for (var i = 0; i < numKeys; ++i) {\n var keyPath = keyPaths[i], val = changes[keyPath];\n if (getByKeyPath(item, keyPath) !== val) {\n setByKeyPath(item, keyPath, val); // Adding {keyPath: undefined} means that the keyPath should be deleted. Handled by setByKeyPath\n anythingModified = true;\n }\n }\n return anythingModified;\n };\n } else {\n // changes is a set of {keyPath: value} and people are listening to the updating hook so we need to call it and\n // allow it to add additional modifications to make.\n var origChanges = changes;\n changes = shallowClone(origChanges); // Let's work with a clone of the changes keyPath/value set so that we can restore it in case a hook extends it.\n modifyer = function (item) {\n var anythingModified = false;\n var additionalChanges = updatingHook.call(this, changes, this.primKey, deepClone(item), trans);\n if (additionalChanges) extend(changes, additionalChanges);\n keys(changes).forEach(function (keyPath) {\n var val = changes[keyPath];\n if (getByKeyPath(item, keyPath) !== val) {\n setByKeyPath(item, keyPath, val);\n anythingModified = true;\n }\n });\n if (additionalChanges) changes = shallowClone(origChanges); // Restore original changes for next iteration\n return anythingModified;\n };\n }\n\n var count = 0;\n var successCount = 0;\n var iterationComplete = false;\n var failures = [];\n var failKeys = [];\n var currentKey = null;\n\n function modifyItem(item, cursor) {\n currentKey = cursor.primaryKey;\n var thisContext = {\n primKey: cursor.primaryKey,\n value: item,\n onsuccess: null,\n onerror: null\n };\n\n function onerror(e) {\n failures.push(e);\n failKeys.push(thisContext.primKey);\n checkFinished();\n return true; // Catch these errors and let a final rejection decide whether or not to abort entire transaction\n }\n\n if (modifyer.call(thisContext, item, thisContext) !== false) { // If a callback explicitely returns false, do not perform the update!\n var bDelete = !hasOwn(thisContext, \"value\");\n ++count;\n tryCatch(function () {\n var req = (bDelete ? cursor.delete() : cursor.update(thisContext.value));\n req._hookCtx = thisContext;\n req.onerror = hookedEventRejectHandler(onerror);\n req.onsuccess = hookedEventSuccessHandler(function () {\n ++successCount;\n checkFinished();\n });\n }, onerror);\n } else if (thisContext.onsuccess) {\n // Hook will expect either onerror or onsuccess to always be called!\n thisContext.onsuccess(thisContext.value);\n }\n }\n\n function doReject(e) {\n if (e) {\n failures.push(e);\n failKeys.push(currentKey);\n }\n return reject(new ModifyError(\"Error modifying one or more objects\", failures, successCount, failKeys));\n }\n\n function checkFinished() {\n if (iterationComplete && successCount + failures.length === count) {\n if (failures.length > 0)\n doReject();\n else\n resolve(successCount);\n }\n }\n self.clone().raw()._iterate(modifyItem, function () {\n iterationComplete = true;\n checkFinished();\n }, doReject, idbstore);\n });\n },\n\n 'delete': function () {\n var ctx = this._ctx,\n range = ctx.range,\n deletingHook = ctx.table.hook.deleting.fire,\n hasDeleteHook = deletingHook !== nop;\n if (!hasDeleteHook &&\n isPlainKeyRange(ctx) &&\n ((ctx.isPrimKey && !hangsOnDeleteLargeKeyRange) || !range)) // if no range, we'll use clear().\n {\n // May use IDBObjectStore.delete(IDBKeyRange) in this case (Issue #208)\n // For chromium, this is the way most optimized version.\n // For IE/Edge, this could hang the indexedDB engine and make operating system instable\n // (https://gist.github.com/dfahlander/5a39328f029de18222cf2125d56c38f7)\n return this._write((resolve, reject, idbstore) => {\n // Our API contract is to return a count of deleted items, so we have to count() before delete().\n var onerror = eventRejectHandler(reject),\n countReq = (range ? idbstore.count(range) : idbstore.count());\n countReq.onerror = onerror;\n countReq.onsuccess = () => {\n var count = countReq.result;\n tryCatch(()=> {\n var delReq = (range ? idbstore.delete(range) : idbstore.clear());\n delReq.onerror = onerror;\n delReq.onsuccess = () => resolve(count);\n }, err => reject(err));\n };\n });\n }\n\n // Default version to use when collection is not a vanilla IDBKeyRange on the primary key.\n // Divide into chunks to not starve RAM.\n // If has delete hook, we will have to collect not just keys but also objects, so it will use\n // more memory and need lower chunk size.\n const CHUNKSIZE = hasDeleteHook ? 2000 : 10000;\n\n return this._write((resolve, reject, idbstore, trans) => {\n var totalCount = 0;\n // Clone collection and change its table and set a limit of CHUNKSIZE on the cloned Collection instance.\n var collection = this\n .clone({\n keysOnly: !ctx.isMatch && !hasDeleteHook}) // load just keys (unless filter() or and() or deleteHook has subscribers)\n .distinct() // In case multiEntry is used, never delete same key twice because resulting count\n // would become larger than actual delete count.\n .limit(CHUNKSIZE)\n .raw(); // Don't filter through reading-hooks (like mapped classes etc)\n\n var keysOrTuples = [];\n\n // We're gonna do things on as many chunks that are needed.\n // Use recursion of nextChunk function:\n const nextChunk = () => collection.each(hasDeleteHook ? (val, cursor) => {\n // Somebody subscribes to hook('deleting'). Collect all primary keys and their values,\n // so that the hook can be called with its values in bulkDelete().\n keysOrTuples.push([cursor.primaryKey, cursor.value]);\n } : (val, cursor) => {\n // No one subscribes to hook('deleting'). Collect only primary keys:\n keysOrTuples.push(cursor.primaryKey);\n }).then(() => {\n // Chromium deletes faster when doing it in sort order.\n hasDeleteHook ?\n keysOrTuples.sort((a, b)=>ascending(a[0], b[0])) :\n keysOrTuples.sort(ascending);\n return bulkDelete(idbstore, trans, keysOrTuples, hasDeleteHook, deletingHook);\n\n }).then(()=> {\n var count = keysOrTuples.length;\n totalCount += count;\n keysOrTuples = [];\n return count < CHUNKSIZE ? totalCount : nextChunk();\n });\n\n resolve (nextChunk());\n });\n }\n };\n });\n\n\n //\n //\n //\n // ------------------------- Help functions ---------------------------\n //\n //\n //\n\n function lowerVersionFirst(a, b) {\n return a._cfg.version - b._cfg.version;\n }\n\n function setApiOnPlace(objs, tableNames, dbschema) {\n tableNames.forEach(function (tableName) {\n var schema = dbschema[tableName];\n objs.forEach(obj => {\n if (!(tableName in obj)) {\n if (obj === Transaction.prototype || obj instanceof Transaction) {\n // obj is a Transaction prototype (or prototype of a subclass to Transaction)\n // Make the API a getter that returns this.table(tableName)\n setProp(obj, tableName, {get() { return this.table(tableName); }});\n } else {\n // Table will not be bound to a transaction (will use Dexie.currentTransaction)\n obj[tableName] = new Table(tableName, schema);\n }\n }\n });\n });\n }\n\n function removeTablesApi(objs) {\n objs.forEach(function (obj) {\n for (var key in obj) {\n if (obj[key] instanceof Table) delete obj[key];\n }\n });\n }\n\n function iterate(req, filter, fn, resolve, reject, valueMapper) {\n \n // Apply valueMapper (hook('reading') or mappped class)\n var mappedFn = valueMapper ? (x,c,a) => fn(valueMapper(x),c,a) : fn;\n // Wrap fn with PSD and microtick stuff from Promise.\n var wrappedFn = wrap(mappedFn, reject);\n \n if (!req.onerror) req.onerror = eventRejectHandler(reject);\n if (filter) {\n req.onsuccess = trycatcher(function filter_record() {\n var cursor = req.result;\n if (cursor) {\n var c = function () { cursor.continue(); };\n if (filter(cursor, function (advancer) { c = advancer; }, resolve, reject))\n wrappedFn(cursor.value, cursor, function (advancer) { c = advancer; });\n c();\n } else {\n resolve();\n }\n }, reject);\n } else {\n req.onsuccess = trycatcher(function filter_record() {\n var cursor = req.result;\n if (cursor) {\n var c = function () { cursor.continue(); };\n wrappedFn(cursor.value, cursor, function (advancer) { c = advancer; });\n c();\n } else {\n resolve();\n }\n }, reject);\n }\n }\n\n function parseIndexSyntax(indexes) {\n /// \n /// \n var rv = [];\n indexes.split(',').forEach(function (index) {\n index = index.trim();\n var name = index.replace(/([&*]|\\+\\+)/g, \"\"); // Remove \"&\", \"++\" and \"*\"\n // Let keyPath of \"[a+b]\" be [\"a\",\"b\"]:\n var keyPath = /^\\[/.test(name) ? name.match(/^\\[(.*)\\]$/)[1].split('+') : name;\n\n rv.push(new IndexSpec(\n name,\n keyPath || null,\n /\\&/.test(index),\n /\\*/.test(index),\n /\\+\\+/.test(index),\n isArray(keyPath),\n /\\./.test(index)\n ));\n });\n return rv;\n }\n\n function cmp(key1, key2) {\n return indexedDB.cmp(key1, key2);\n }\n\n function min(a, b) {\n return cmp(a, b) < 0 ? a : b;\n }\n\n function max(a, b) {\n return cmp(a, b) > 0 ? a : b;\n }\n\n function ascending(a,b) {\n return indexedDB.cmp(a,b);\n }\n\n function descending(a, b) {\n return indexedDB.cmp(b,a);\n }\n\n function simpleCompare(a, b) {\n return a < b ? -1 : a === b ? 0 : 1;\n }\n\n function simpleCompareReverse(a, b) {\n return a > b ? -1 : a === b ? 0 : 1;\n }\n\n function combine(filter1, filter2) {\n return filter1 ?\n filter2 ?\n function () { return filter1.apply(this, arguments) && filter2.apply(this, arguments); } :\n filter1 :\n filter2;\n }\n\n function readGlobalSchema() {\n db.verno = idbdb.version / 10;\n db._dbSchema = globalSchema = {};\n dbStoreNames = slice(idbdb.objectStoreNames, 0);\n if (dbStoreNames.length === 0) return; // Database contains no stores.\n var trans = idbdb.transaction(safariMultiStoreFix(dbStoreNames), 'readonly');\n dbStoreNames.forEach(function (storeName) {\n var store = trans.objectStore(storeName),\n keyPath = store.keyPath,\n dotted = keyPath && typeof keyPath === 'string' && keyPath.indexOf('.') !== -1;\n var primKey = new IndexSpec(keyPath, keyPath || \"\", false, false, !!store.autoIncrement, keyPath && typeof keyPath !== 'string', dotted);\n var indexes = [];\n for (var j = 0; j < store.indexNames.length; ++j) {\n var idbindex = store.index(store.indexNames[j]);\n keyPath = idbindex.keyPath;\n dotted = keyPath && typeof keyPath === 'string' && keyPath.indexOf('.') !== -1;\n var index = new IndexSpec(idbindex.name, keyPath, !!idbindex.unique, !!idbindex.multiEntry, false, keyPath && typeof keyPath !== 'string', dotted);\n indexes.push(index);\n }\n globalSchema[storeName] = new TableSchema(storeName, primKey, indexes, {});\n });\n setApiOnPlace([allTables], keys(globalSchema), globalSchema);\n }\n\n function adjustToExistingIndexNames(schema, idbtrans) {\n /// \n /// Issue #30 Problem with existing db - adjust to existing index names when migrating from non-dexie db\n /// \n /// Map between name and TableSchema\n /// \n var storeNames = idbtrans.db.objectStoreNames;\n\n for (var i = 0; i < storeNames.length; ++i) {\n var storeName = storeNames[i];\n var store = idbtrans.objectStore(storeName);\n hasGetAll = 'getAll' in store;\n \n for (var j = 0; j < store.indexNames.length; ++j) {\n var indexName = store.indexNames[j];\n var keyPath = store.index(indexName).keyPath;\n var dexieName = typeof keyPath === 'string' ? keyPath : \"[\" + slice(keyPath).join('+') + \"]\";\n if (schema[storeName]) {\n var indexSpec = schema[storeName].idxByName[dexieName];\n if (indexSpec) indexSpec.name = indexName;\n }\n }\n }\n\n // Bug with getAll() on Safari ver<604 on Workers only, see discussion following PR #579\n if (/Safari/.test(navigator.userAgent) &&\n !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) &&\n _global.WorkerGlobalScope && _global instanceof _global.WorkerGlobalScope &&\n [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604)\n {\n hasGetAll = false;\n } \n }\n\n function fireOnBlocked(ev) {\n db.on(\"blocked\").fire(ev);\n // Workaround (not fully*) for missing \"versionchange\" event in IE,Edge and Safari:\n connections\n .filter(c=>c.name === db.name && c !== db && !c._vcFired)\n .map(c => c.on(\"versionchange\").fire(ev));\n }\n\n extend(this, {\n Collection: Collection,\n Table: Table,\n Transaction: Transaction,\n Version: Version,\n WhereClause: WhereClause\n });\n\n init();\n\n addons.forEach(function (fn) {\n fn(db);\n });\n}\n\nfunction parseType(type) {\n if (typeof type === 'function') {\n return new type();\n } else if (isArray(type)) {\n return [parseType(type[0])];\n } else if (type && typeof type === 'object') {\n var rv = {};\n applyStructure(rv, type);\n return rv;\n } else {\n return type;\n }\n}\n\nfunction applyStructure(obj, structure) {\n keys(structure).forEach(function (member) {\n var value = parseType(structure[member]);\n obj[member] = value;\n });\n return obj;\n}\n\nfunction hookedEventSuccessHandler(resolve) {\n // wrap() is needed when calling hooks because the rare scenario of:\n // * hook does a db operation that fails immediately (IDB throws exception)\n // For calling db operations on correct transaction, wrap makes sure to set PSD correctly.\n // wrap() will also execute in a virtual tick.\n // * If not wrapped in a virtual tick, direct exception will launch a new physical tick.\n // * If this was the last event in the bulk, the promise will resolve after a physical tick\n // and the transaction will have committed already.\n // If no hook, the virtual tick will be executed in the reject()/resolve of the final promise,\n // because it is always marked with _lib = true when created using Transaction._promise().\n return wrap(function(event) {\n var req = event.target,\n ctx = req._hookCtx,// Contains the hook error handler. Put here instead of closure to boost performance.\n result = ctx.value || req.result, // Pass the object value on updates. The result from IDB is the primary key.\n hookSuccessHandler = ctx && ctx.onsuccess;\n hookSuccessHandler && hookSuccessHandler(result);\n resolve && resolve(result);\n }, resolve);\n}\n\nfunction eventRejectHandler(reject) {\n return wrap(function (event) {\n preventDefault(event);\n reject (event.target.error);\n return false;\n });\n}\n\nfunction eventSuccessHandler (resolve) {\n return wrap(function (event){\n resolve(event.target.result);\n });\n}\n\nfunction hookedEventRejectHandler (reject) {\n return wrap(function (event) {\n // See comment on hookedEventSuccessHandler() why wrap() is needed only when supporting hooks.\n \n var req = event.target,\n err = req.error,\n ctx = req._hookCtx,// Contains the hook error handler. Put here instead of closure to boost performance.\n hookErrorHandler = ctx && ctx.onerror;\n hookErrorHandler && hookErrorHandler(err);\n preventDefault(event);\n reject (err);\n return false;\n });\n}\n\nfunction preventDefault(event) {\n if (event.stopPropagation) // IndexedDBShim doesnt support this on Safari 8 and below.\n event.stopPropagation();\n if (event.preventDefault) // IndexedDBShim doesnt support this on Safari 8 and below.\n event.preventDefault();\n}\n\nfunction awaitIterator (iterator) {\n var callNext = result => iterator.next(result),\n doThrow = error => iterator.throw(error),\n onSuccess = step(callNext),\n onError = step(doThrow);\n\n function step(getNext) {\n return val => {\n var next = getNext(val),\n value = next.value;\n\n return next.done ? value :\n (!value || typeof value.then !== 'function' ?\n isArray(value) ? Promise.all(value).then(onSuccess, onError) : onSuccess(value) :\n value.then(onSuccess, onError));\n };\n }\n\n return step(callNext)();\n}\n\n//\n// IndexSpec struct\n//\nfunction IndexSpec(name, keyPath, unique, multi, auto, compound, dotted) {\n /// \n /// \n /// \n /// \n /// \n /// \n /// \n this.name = name;\n this.keyPath = keyPath;\n this.unique = unique;\n this.multi = multi;\n this.auto = auto;\n this.compound = compound;\n this.dotted = dotted;\n var keyPathSrc = typeof keyPath === 'string' ? keyPath : keyPath && ('[' + [].join.call(keyPath, '+') + ']');\n this.src = (unique ? '&' : '') + (multi ? '*' : '') + (auto ? \"++\" : \"\") + keyPathSrc;\n}\n\n//\n// TableSchema struct\n//\nfunction TableSchema(name, primKey, indexes, instanceTemplate) {\n /// \n /// \n /// \n /// \n this.name = name;\n this.primKey = primKey || new IndexSpec();\n this.indexes = indexes || [new IndexSpec()];\n this.instanceTemplate = instanceTemplate;\n this.mappedClass = null;\n this.idxByName = arrayToObject(indexes, index => [index.name, index]);\n}\n\nfunction safariMultiStoreFix(storeNames) {\n return storeNames.length === 1 ? storeNames[0] : storeNames;\n}\n\nfunction getNativeGetDatabaseNamesFn(indexedDB) {\n var fn = indexedDB && (indexedDB.getDatabaseNames || indexedDB.webkitGetDatabaseNames);\n return fn && fn.bind(indexedDB);\n}\n\n// Export Error classes\nprops(Dexie, fullNameExceptions); // Dexie.XXXError = class XXXError {...};\n\n//\n// Static methods and properties\n// \nprops(Dexie, {\n \n //\n // Static delete() method.\n //\n delete: function (databaseName) {\n var db = new Dexie(databaseName),\n promise = db.delete();\n promise.onblocked = function (fn) {\n db.on(\"blocked\", fn);\n return this;\n };\n return promise;\n },\n \n //\n // Static exists() method.\n //\n exists: function(name) {\n return new Dexie(name).open().then(db=>{\n db.close();\n return true;\n }).catch(Dexie.NoSuchDatabaseError, () => false);\n },\n \n //\n // Static method for retrieving a list of all existing databases at current host.\n //\n getDatabaseNames: function (cb) {\n var getDatabaseNames = getNativeGetDatabaseNamesFn(Dexie.dependencies.indexedDB);\n return getDatabaseNames ? new Promise((resolve, reject) => {\n var req = getDatabaseNames();\n req.onsuccess = function (event) {\n resolve(slice(event.target.result, 0)); // Converst DOMStringList to Array\n };\n req.onerror = eventRejectHandler(reject);\n }).then(cb) : dbNamesDB.dbnames.toCollection().primaryKeys(cb);\n },\n \n defineClass: function () {\n // Default constructor able to copy given properties into this object.\n function Class(properties) {\n /// Properties to initialize object with.\n /// \n if (properties) extend(this, properties);\n }\n return Class;\n },\n \n applyStructure: applyStructure,\n \n ignoreTransaction: function (scopeFunc) {\n // In case caller is within a transaction but needs to create a separate transaction.\n // Example of usage:\n //\n // Let's say we have a logger function in our app. Other application-logic should be unaware of the\n // logger function and not need to include the 'logentries' table in all transaction it performs.\n // The logging should always be done in a separate transaction and not be dependant on the current\n // running transaction context. Then you could use Dexie.ignoreTransaction() to run code that starts a new transaction.\n //\n // Dexie.ignoreTransaction(function() {\n // db.logentries.add(newLogEntry);\n // });\n //\n // Unless using Dexie.ignoreTransaction(), the above example would try to reuse the current transaction\n // in current Promise-scope.\n //\n // An alternative to Dexie.ignoreTransaction() would be setImmediate() or setTimeout(). The reason we still provide an\n // API for this because\n // 1) The intention of writing the statement could be unclear if using setImmediate() or setTimeout().\n // 2) setTimeout() would wait unnescessary until firing. This is however not the case with setImmediate().\n // 3) setImmediate() is not supported in the ES standard.\n // 4) You might want to keep other PSD state that was set in a parent PSD, such as PSD.letThrough.\n return PSD.trans ?\n usePSD(PSD.transless, scopeFunc) : // Use the closest parent that was non-transactional.\n scopeFunc(); // No need to change scope because there is no ongoing transaction.\n },\n \n vip: function (fn) {\n // To be used by subscribers to the on('ready') event.\n // This will let caller through to access DB even when it is blocked while the db.ready() subscribers are firing.\n // This would have worked automatically if we were certain that the Provider was using Dexie.Promise for all asyncronic operations. The promise PSD\n // from the provider.connect() call would then be derived all the way to when provider would call localDatabase.applyChanges(). But since\n // the provider more likely is using non-promise async APIs or other thenable implementations, we cannot assume that.\n // Note that this method is only useful for on('ready') subscribers that is returning a Promise from the event. If not using vip()\n // the database could deadlock since it wont open until the returned Promise is resolved, and any non-VIPed operation started by\n // the caller will not resolve until database is opened.\n return newScope(function () {\n PSD.letThrough = true; // Make sure we are let through if still blocking db due to onready is firing.\n return fn();\n });\n },\n\n async: function (generatorFn) {\n return function () {\n try {\n var rv = awaitIterator(generatorFn.apply(this, arguments));\n if (!rv || typeof rv.then !== 'function')\n return Promise.resolve(rv);\n return rv;\n } catch (e) {\n return rejection (e);\n }\n };\n },\n\n spawn: function (generatorFn, args, thiz) {\n try {\n var rv = awaitIterator(generatorFn.apply(thiz, args || []));\n if (!rv || typeof rv.then !== 'function')\n return Promise.resolve(rv);\n return rv;\n } catch (e) {\n return rejection(e);\n }\n },\n \n // Dexie.currentTransaction property\n currentTransaction: {\n get: () => PSD.trans || null\n },\n\n waitFor: function (promiseOrFunction, optionalTimeout) {\n // If a function is provided, invoke it and pass the returning value to Transaction.waitFor()\n var promise = Promise.resolve(\n typeof promiseOrFunction === 'function' ? Dexie.ignoreTransaction(promiseOrFunction) : promiseOrFunction)\n .timeout(optionalTimeout || 60000); // Default the timeout to one minute. Caller may specify Infinity if required. \n\n // Run given promise on current transaction. If no current transaction, just return a Dexie promise based\n // on given value.\n return PSD.trans ? PSD.trans.waitFor(promise) : promise;\n },\n \n // Export our Promise implementation since it can be handy as a standalone Promise implementation\n Promise: Promise,\n \n // Dexie.debug proptery:\n // Dexie.debug = false\n // Dexie.debug = true\n // Dexie.debug = \"dexie\" - don't hide dexie's stack frames.\n debug: {\n get: () => Debug.debug,\n set: value => {\n Debug.setDebug(value, value === 'dexie' ? ()=>true : dexieStackFrameFilter);\n }\n },\n \n // Export our derive/extend/override methodology\n derive: derive,\n extend: extend,\n props: props,\n override: override,\n // Export our Events() function - can be handy as a toolkit\n Events: Events,\n // Utilities\n getByKeyPath: getByKeyPath,\n setByKeyPath: setByKeyPath,\n delByKeyPath: delByKeyPath,\n shallowClone: shallowClone,\n deepClone: deepClone,\n getObjectDiff: getObjectDiff,\n asap: asap,\n maxKey: maxKey,\n minKey: minKey,\n // Addon registry\n addons: [],\n // Global DB connection list\n connections: connections,\n \n MultiModifyError: exceptions.Modify, // Backward compatibility 0.9.8. Deprecate.\n errnames: errnames,\n \n // Export other static classes\n IndexSpec: IndexSpec,\n TableSchema: TableSchema,\n \n //\n // Dependencies\n //\n // These will automatically work in browsers with indexedDB support, or where an indexedDB polyfill has been included.\n //\n // In node.js, however, these properties must be set \"manually\" before instansiating a new Dexie().\n // For node.js, you need to require indexeddb-js or similar and then set these deps.\n //\n dependencies: (()=>{\n try {\n return {\n // Required:\n indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,\n IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange\n };\n } catch (e) {\n return {\n indexedDB: null,\n IDBKeyRange: null\n };\n }\n })(),\n \n // API Version Number: Type Number, make sure to always set a version number that can be comparable correctly. Example: 0.9, 0.91, 0.92, 1.0, 1.01, 1.1, 1.2, 1.21, etc.\n semVer: DEXIE_VERSION,\n version: DEXIE_VERSION.split('.')\n .map(n => parseInt(n))\n .reduce((p,c,i) => p + (c/Math.pow(10,i*2))),\n \n // https://github.com/dfahlander/Dexie.js/issues/186\n // typescript compiler tsc in mode ts-->es5 & commonJS, will expect require() to return\n // x.default. Workaround: Set Dexie.default = Dexie.\n default: Dexie,\n // Make it possible to import {Dexie} (non-default import)\n // Reason 1: May switch to that in future.\n // Reason 2: We declare it both default and named exported in d.ts to make it possible\n // to let addons extend the Dexie interface with Typescript 2.1 (works only when explicitely\n // exporting the symbol, not just default exporting)\n Dexie: Dexie\n});\n\n// Map DOMErrors and DOMExceptions to corresponding Dexie errors. May change in Dexie v2.0.\nPromise.rejectionMapper = mapError;\n\n// Initialize dbNamesDB (won't ever be opened on chromium browsers')\ndbNamesDB = new Dexie('__dbnames'); \ndbNamesDB.version(1).stores({dbnames: 'name'});\n\n(()=>{\n // Migrate from Dexie 1.x database names stored in localStorage:\n var DBNAMES = 'Dexie.DatabaseNames';\n try { // https://github.com/dfahlander/Dexie.js/issues/617\n if (typeof localStorage !== undefined && _global.document !== undefined) {\n // Have localStorage and is not executing in a worker. Lets migrate from Dexie 1.x.\n JSON.parse(localStorage.getItem(DBNAMES) || \"[]\")\n .forEach(name => dbNamesDB.dbnames.put({name: name}).catch(nop));\n localStorage.removeItem(DBNAMES);\n }\n } catch (_e) {}\n})();\n","\"use strict\";\nimport DataUtils,\n{\n REQUEST_TYPE_GET,\n REQUEST_TYPE_PUT,\n REQUEST_TYPE_POST,\n REQUEST_TYPE_DELETE,\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_FORM\n}\nfrom '../utilities/DataUtils';\nimport Dexie from 'dexie';\nimport * as DataEvent from '../events/DataEvent';\nexport var COUNT;\nexport var FINAL_KEY;\nexport default class DBUtils\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n this.dataUtils = new DataUtils();\n this.db = new Dexie(\"fipamo_posts\");\n this.db.version(1).stores(\n {\n postList: 'id,post'\n });\n this.db.postList.toArray(array =>\n {\n COUNT = array.length;\n FINAL_KEY = array[COUNT - 1].id;\n })\n }\n //--------------------------\n // methods\n //--------------------------\n modify(id, postData)\n {\n let self = this;\n let freshID;\n return new Promise(function(resolve, reject)\n {\n if (id == null)\n {\n self.db.postList.put(postData).then(fresh =>\n {\n freshID = fresh;\n }).catch(e =>\n {\n let err = {\n message: \"PUT ERROR\",\n error: e\n }\n });\n }\n else\n {\n self.db.postList.update(Number(id),\n {\n post: postData\n }).then(updated =>\n {}).catch(e =>\n {\n let err = {\n message: \"UPDATE ERROR\",\n error: e\n }\n });\n }\n self.db.postList.toArray(array =>\n {\n self.syncRemote(array, freshID).then(response =>\n {\n resolve(\n {\n response\n })\n }).catch(err =>\n {\n reject(\n {\n err\n });\n });\n })\n })\n }\n syncLocal(array)\n {\n let self = this;\n return new Promise(function(resolve, reject)\n {\n self.db.postList.clear().then(result =>\n {\n self.db.postList.bulkAdd(array).then(key =>\n {\n self.db.postList.toArray(array =>\n {\n let event = DataEvent.LOCAL_DB_READY\n resolve(\n {\n event\n })\n })\n }).catch(Dexie.BulkError, e =>\n {\n reject(\n {\n e\n })\n })\n })\n })\n }\n syncRemote(db, newPostId)\n {\n let self = this;\n return new Promise(function(resolve, reject)\n {\n self.dataUtils.request('/api/post/sync', DataEvent.POSTS_SYNCED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, db).then((response) =>\n {\n let bounce = {\n message: response,\n newPost: newPostId\n }\n resolve(bounce)\n }).catch((err) =>\n {\n reject(err);\n })\n })\n }\n getPost(id)\n {\n let self = this;\n if (id == null)\n {\n return new Promise(function(resolve, reject)\n {\n self.db.postList.toArray(array =>\n {\n resolve(array)\n }).catch(err =>\n {\n reject(err)\n })\n })\n }\n else\n {\n return new Promise(function(resolve, reject)\n {\n self.db.postList.get(Number(id)).then(obj =>\n {\n resolve(obj)\n }).catch(err =>\n {\n reject(err)\n })\n })\n }\n }\n archivePost(id, archive)\n {\n let self = this;\n return new Promise(function(resolve, reject)\n {\n self.db.postList.update(Number(id),\n {\n post: archive\n }).then(deleted =>\n {\n self.db.postList.toArray(array =>\n {\n self.syncRemote(array, null).then(response =>\n {\n resolve(\n {\n response\n })\n }).catch(err =>\n {\n reject(\n {\n err\n });\n });\n })\n }).catch(e =>\n {\n console.log(\"ERROR\", e)\n });\n })\n }\n //--------------------------\n // event handlers\n //--------------------------\n}","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([bth[buf[i++]], bth[buf[i++]], \n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]],\n\tbth[buf[i++]], bth[buf[i++]],\n\tbth[buf[i++]], bth[buf[i++]]]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","import DataUtils,\n{\n REQUEST_TYPE_GET,\n REQUEST_TYPE_PUT,\n REQUEST_TYPE_POST,\n REQUEST_TYPE_DELETE,\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_FORM\n}\nfrom '../../../../../brain//tools/utilities/DataUtils';\nimport StringUtils from '../../../../../brain//tools/utilities/StringUtils';\nimport DateUtils from '../../../../../brain/tools/utilities/DateUtils';\nimport DBUtils from '../../../../../brain/tools/utilities/DBUtils';\nvar uuidv4 = require('uuid/v4');\nexport default class PostActions\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n this.dataUtils = new DataUtils();\n this.dateUtils = new DateUtils();\n this.dbUtils = new DBUtils();\n }\n //--------------------------\n // methods\n //--------------------------\n update(id, data, files, lastKey)\n {\n let self = this;\n let freshData;\n return new Promise(function(resolve, reject)\n {\n let txt = document.createElement(\"textarea\");\n txt.innerHTML = document.getElementById('edit-post-text').innerHTML;\n let html = txt.value;\n html = html.replace(/<\\/?span[^>]*>/g, \"\"); //removes highightjs styling\n html = html.replace(/<\\/?br[^>]*>/g, \"\\n\"); //convert back to encoded line break for storage\n data.title = document.getElementById('post_title').value;\n data.slug = new StringUtils().cleanString(document.getElementById('post_title').value)\n data.plaintext = html;\n data.html = html;\n data.created = document.getElementById('post-date').value;\n data.tags = document.getElementById('post_tags').value;\n data.page = document.getElementById('option-page').getAttribute('data-active')\n data.featured = document.getElementById('option-feature').getAttribute('data-active')\n data.published = document.getElementById('option-published').getAttribute('data-active')\n if (files.length != 0)\n {\n for (var i = 0; i < files.length; i++)\n {\n var file = files[i];\n // Check the file type.\n if (!file.type.match('image.*'))\n {\n continue;\n }\n data.feature = \"/content/blog-images/\" + self.dateUtils.getDate('year', new Date()) + \"/\" + self.dateUtils.getDate('month', new Date()) + \"/\" + file.name;\n }\n }\n else\n {\n if (typeof data.feature == 'undefined') data.feature = \"\"\n }\n if (id == null)\n {\n freshData = {\n id: lastKey + 1,\n post:\n {\n uuid: uuidv4(),\n title: data.title,\n slug: data.slug,\n plaintext: data.plaintext,\n html: data.html,\n feature: data.feature,\n created: data.created,\n tags: data.tags,\n page: data.page,\n featured: data.featured,\n published: data.published,\n deleted: \"\",\n author: \"user\"\n }\n }\n }\n else\n {\n freshData = data;\n }\n self.dbUtils.modify(id, freshData).then((response) =>\n {\n resolve(response)\n }).catch((err) =>\n {\n reject(err)\n })\n })\n }\n deletePost(id, body)\n {\n let self = this;\n body.deleted = new Date().toString();\n return new Promise(function(resolve, reject)\n {\n self.dbUtils.archivePost(id, body).then(response =>\n {\n console.log(response)\n resolve(response)\n }).catch(err =>\n {\n console.log(err)\n reject(error)\n })\n })\n }\n //--------------------------\n // event handlers\n //--------------------------\n}","export const EDITOR_DELETE = 'editorDelete';\nexport const EDITOR_UPLOAD_POST_IMAGE = 'editorUploadImage';\nexport const EDITOR_SAVE = 'editorSave';\nexport const EDITOR_UPDATE = 'editorUpdate';\n\nclass EditorEvent\n{\n\n //--------------------------\n // methods\n //--------------------------\n\n\n\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default new EditorEvent\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.TinyDatePicker = factory());\n}(this, (function () { 'use strict';\n\n /**\n * @file A generic set of mutation-free date functions.\n */\n\n /**\n * now returns the current date without any time values\n *\n * @returns {Date}\n */\n function now() {\n var dt = new Date();\n dt.setHours(0, 0, 0, 0);\n return dt;\n }\n\n /**\n * dateEq compares two dates\n *\n * @param {Date} date1 the first date\n * @param {Date} date2 the second date\n * @returns {boolean}\n */\n function datesEq(date1, date2) {\n return (date1 && date1.toDateString()) === (date2 && date2.toDateString());\n }\n\n /**\n * shiftDay shifts the specified date by n days\n *\n * @param {Date} dt\n * @param {number} n\n * @returns {Date}\n */\n function shiftDay(dt, n) {\n dt = new Date(dt);\n dt.setDate(dt.getDate() + n);\n return dt;\n }\n\n /**\n * shiftMonth shifts the specified date by a specified number of months\n *\n * @param {Date} dt\n * @param {number} n\n * @param {boolean} wrap optional, if true, does not change year\n * value, defaults to false\n * @returns {Date}\n */\n function shiftMonth(dt, n, wrap) {\n dt = new Date(dt);\n\n var dayOfMonth = dt.getDate();\n var month = dt.getMonth() + n;\n\n dt.setDate(1);\n dt.setMonth(wrap ? (12 + month) % 12 : month);\n dt.setDate(dayOfMonth);\n\n // If dayOfMonth = 31, but the target month only has 30 or 29 or whatever...\n // head back to the max of the target month\n if (dt.getDate() < dayOfMonth) {\n dt.setDate(0);\n }\n\n return dt;\n }\n\n /**\n * shiftYear shifts the specified date by n years\n *\n * @param {Date} dt\n * @param {number} n\n * @returns {Date}\n */\n function shiftYear(dt, n) {\n dt = new Date(dt);\n dt.setFullYear(dt.getFullYear() + n);\n return dt;\n }\n\n /**\n * setYear changes the specified date to the specified year\n *\n * @param {Date} dt\n * @param {number} year\n */\n function setYear(dt, year) {\n dt = new Date(dt);\n dt.setFullYear(year);\n return dt;\n }\n\n /**\n * setMonth changes the specified date to the specified month\n *\n * @param {Date} dt\n * @param {number} month\n */\n function setMonth(dt, month) {\n return shiftMonth(dt, month - dt.getMonth());\n }\n\n /**\n * dateOrParse creates a function which, given a date or string, returns a date\n *\n * @param {function} parse the function used to parse strings\n * @returns {function}\n */\n function dateOrParse(parse) {\n return function (dt) {\n return dropTime(typeof dt === 'string' ? parse(dt) : dt);\n };\n }\n\n /**\n * constrainDate returns dt or min/max depending on whether dt is out of bounds (inclusive)\n *\n * @export\n * @param {Date} dt\n * @param {Date} min\n * @param {Date} max\n * @returns {Date}\n */\n function constrainDate(dt, min, max) {\n return (dt < min) ? min :\n (dt > max) ? max :\n dt;\n }\n\n function dropTime(dt) {\n dt = new Date(dt);\n dt.setHours(0, 0, 0, 0);\n return dt;\n }\n\n /**\n * @file Utility functions for function manipulation.\n */\n\n /**\n * bufferFn buffers calls to fn so they only happen every ms milliseconds\n *\n * @param {number} ms number of milliseconds\n * @param {function} fn the function to be buffered\n * @returns {function}\n */\n function bufferFn(ms, fn) {\n var timeout = undefined;\n return function () {\n clearTimeout(timeout);\n timeout = setTimeout(fn, ms);\n };\n }\n\n /**\n * noop is a function which does nothing at all.\n */\n function noop() { }\n\n /**\n * copy properties from object o2 to object o1.\n *\n * @params {Object} o1\n * @params {Object} o2\n * @returns {Object}\n */\n function cp() {\n var args = arguments;\n var o1 = args[0];\n for (var i = 1; i < args.length; ++i) {\n var o2 = args[i] || {};\n for (var key in o2) {\n o1[key] = o2[key];\n }\n }\n return o1;\n }\n\n /**\n * @file Responsible for sanitizing and creating date picker options.\n */\n\n var english = {\n days: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n today: 'Today',\n clear: 'Clear',\n close: 'Close',\n };\n\n /**\n * DatePickerOptions constructs a new date picker options object, overriding\n * default values with any values specified in opts.\n *\n * @param {DatePickerOptions} opts\n * @returns {DatePickerOptions}\n */\n function DatePickerOptions(opts) {\n opts = opts || {};\n opts = cp(defaults(), opts);\n var parse = dateOrParse(opts.parse);\n opts.lang = cp(english, opts.lang);\n opts.parse = parse;\n opts.inRange = makeInRangeFn(opts);\n opts.min = parse(opts.min || shiftYear(now(), -100));\n opts.max = parse(opts.max || shiftYear(now(), 100));\n opts.hilightedDate = opts.parse(opts.hilightedDate);\n\n return opts;\n }\n\n function defaults() {\n return {\n lang: english,\n\n // Possible values: dp-modal, dp-below, dp-permanent\n mode: 'dp-modal',\n\n // The date to hilight initially if the date picker has no\n // initial value.\n hilightedDate: now(),\n\n format: function (dt) {\n return (dt.getMonth() + 1) + '/' + dt.getDate() + '/' + dt.getFullYear();\n },\n\n parse: function (str) {\n var date = new Date(str);\n return isNaN(date) ? now() : date;\n },\n\n dateClass: function () { },\n\n inRange: function () {\n return true;\n }\n };\n }\n\n function makeInRangeFn(opts) {\n var inRange = opts.inRange; // Cache this version, and return a variant\n\n return function (dt, dp) {\n return inRange(dt, dp) && opts.min <= dt && opts.max >= dt;\n };\n }\n\n /**\n * @file Helper functions for dealing with dom elements.\n */\n\n var Key = {\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n enter: 13,\n esc: 27,\n };\n\n /**\n * on attaches an event handler to the specified element, and returns an\n * off function which can be used to remove the handler.\n *\n * @param {string} evt the name of the event to handle\n * @param {HTMLElement} el the element to attach to\n * @param {function} handler the event handler\n * @returns {function} the off function\n */\n function on(evt, el, handler) {\n el.addEventListener(evt, handler, true);\n\n return function () {\n el.removeEventListener(evt, handler, true);\n };\n }\n\n var CustomEvent = shimCustomEvent();\n\n function shimCustomEvent() {\n var CustomEvent = window.CustomEvent;\n\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function (event, params) {\n params = params || {bubbles: false, cancelable: false, detail: undefined};\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n }\n\n return CustomEvent;\n }\n\n /**\n * @file Manages the calendar / day-picker view.\n */\n\n var dayPicker = {\n onKeyDown: keyDown,\n onClick: {\n 'dp-day': selectDay,\n 'dp-next': gotoNextMonth,\n 'dp-prev': gotoPrevMonth,\n 'dp-today': selectToday,\n 'dp-clear': clear,\n 'dp-close': close,\n 'dp-cal-month': showMonthPicker,\n 'dp-cal-year': showYearPicker,\n },\n render: render\n };\n\n /**\n * view renders the calendar (day picker) as an HTML string.\n *\n * @param {DatePickerContext} context the date picker being rendered\n * @returns {string}\n */\n function render(dp) {\n var opts = dp.opts;\n var lang = opts.lang;\n var state = dp.state;\n var dayNames = lang.days;\n var dayOffset = opts.dayOffset || 0;\n var selectedDate = state.selectedDate;\n var hilightedDate = state.hilightedDate;\n var hilightedMonth = hilightedDate.getMonth();\n var today = now().getTime();\n\n return (\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n dayNames.map(function (name, i) {\n return (\n '' + dayNames[(i + dayOffset) % dayNames.length] + ''\n );\n }).join('') +\n mapDays(hilightedDate, dayOffset, function (date) {\n var isNotInMonth = date.getMonth() !== hilightedMonth;\n var isDisabled = !opts.inRange(date);\n var isToday = date.getTime() === today;\n var className = 'dp-day';\n className += (isNotInMonth ? ' dp-edge-day' : '');\n className += (datesEq(date, hilightedDate) ? ' dp-current' : '');\n className += (datesEq(date, selectedDate) ? ' dp-selected' : '');\n className += (isDisabled ? ' dp-day-disabled' : '');\n className += (isToday ? ' dp-day-today' : '');\n className += ' ' + opts.dateClass(date, dp);\n\n return (\n ''\n );\n }) +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
'\n );\n }\n\n /**\n * keyDown handles the key down event for the day-picker\n *\n * @param {Event} e\n * @param {DatePickerContext} dp\n */\n function keyDown(e, dp) {\n var key = e.keyCode;\n var shiftBy =\n (key === Key.left) ? -1 :\n (key === Key.right) ? 1 :\n (key === Key.up) ? -7 :\n (key === Key.down) ? 7 :\n 0;\n\n if (key === Key.esc) {\n dp.close();\n } else if (shiftBy) {\n e.preventDefault();\n dp.setState({\n hilightedDate: shiftDay(dp.state.hilightedDate, shiftBy)\n });\n }\n }\n\n function selectToday(e, dp) {\n dp.setState({\n selectedDate: now(),\n });\n }\n\n function clear(e, dp) {\n dp.setState({\n selectedDate: null,\n });\n }\n\n function close(e, dp) {\n dp.close();\n }\n\n function showMonthPicker(e, dp) {\n dp.setState({\n view: 'month'\n });\n }\n\n function showYearPicker(e, dp) {\n dp.setState({\n view: 'year'\n });\n }\n\n function gotoNextMonth(e, dp) {\n var hilightedDate = dp.state.hilightedDate;\n dp.setState({\n hilightedDate: shiftMonth(hilightedDate, 1)\n });\n }\n\n function gotoPrevMonth(e, dp) {\n var hilightedDate = dp.state.hilightedDate;\n dp.setState({\n hilightedDate: shiftMonth(hilightedDate, -1)\n });\n }\n\n function selectDay(e, dp) {\n dp.setState({\n selectedDate: new Date(parseInt(e.target.getAttribute('data-date'))),\n });\n }\n\n function mapDays(currentDate, dayOffset, fn) {\n var result = '';\n var iter = new Date(currentDate);\n iter.setDate(1);\n iter.setDate(1 - iter.getDay() + dayOffset);\n\n // If we are showing monday as the 1st of the week,\n // and the monday is the 2nd of the month, the sunday won't\n // show, so we need to shift backwards\n if (dayOffset && iter.getDate() === dayOffset + 1) {\n iter.setDate(dayOffset - 6);\n }\n\n // We are going to have 6 weeks always displayed to keep a consistent\n // calendar size\n for (var day = 0; day < (6 * 7); ++day) {\n result += fn(iter);\n iter.setDate(iter.getDate() + 1);\n }\n\n return result;\n }\n\n /**\n * @file Manages the month-picker view.\n */\n\n var monthPicker = {\n onKeyDown: keyDown$1,\n onClick: {\n 'dp-month': onChooseMonth\n },\n render: render$1\n };\n\n function onChooseMonth(e, dp) {\n dp.setState({\n hilightedDate: setMonth(dp.state.hilightedDate, parseInt(e.target.getAttribute('data-month'))),\n view: 'day',\n });\n }\n\n /**\n * render renders the month picker as an HTML string\n *\n * @param {DatePickerContext} dp the date picker context\n * @returns {string}\n */\n function render$1(dp) {\n var opts = dp.opts;\n var lang = opts.lang;\n var months = lang.months;\n var currentDate = dp.state.hilightedDate;\n var currentMonth = currentDate.getMonth();\n\n return (\n '
' +\n months.map(function (month, i) {\n var className = 'dp-month';\n className += (currentMonth === i ? ' dp-current' : '');\n\n return (\n ''\n );\n }).join('') +\n '
'\n );\n }\n\n /**\n * keyDown handles keydown events that occur in the month picker\n *\n * @param {Event} e\n * @param {DatePickerContext} dp\n */\n function keyDown$1(e, dp) {\n var key = e.keyCode;\n var shiftBy =\n (key === Key.left) ? -1 :\n (key === Key.right) ? 1 :\n (key === Key.up) ? -3 :\n (key === Key.down) ? 3 :\n 0;\n\n if (key === Key.esc) {\n dp.setState({\n view: 'day',\n });\n } else if (shiftBy) {\n e.preventDefault();\n dp.setState({\n hilightedDate: shiftMonth(dp.state.hilightedDate, shiftBy, true)\n });\n }\n }\n\n /**\n * @file Manages the year-picker view.\n */\n\n var yearPicker = {\n render: render$2,\n onKeyDown: keyDown$2,\n onClick: {\n 'dp-year': onChooseYear\n },\n };\n\n /**\n * view renders the year picker as an HTML string.\n *\n * @param {DatePickerContext} dp the date picker context\n * @returns {string}\n */\n function render$2(dp) {\n var state = dp.state;\n var currentYear = state.hilightedDate.getFullYear();\n var selectedYear = state.selectedDate.getFullYear();\n\n return (\n '
' +\n mapYears(dp, function (year) {\n var className = 'dp-year';\n className += (year === currentYear ? ' dp-current' : '');\n className += (year === selectedYear ? ' dp-selected' : '');\n\n return (\n ''\n );\n }) +\n '
'\n );\n }\n\n function onChooseYear(e, dp) {\n dp.setState({\n hilightedDate: setYear(dp.state.hilightedDate, parseInt(e.target.getAttribute('data-year'))),\n view: 'day',\n });\n }\n\n function keyDown$2(e, dp) {\n var key = e.keyCode;\n var opts = dp.opts;\n var shiftBy =\n (key === Key.left || key === Key.up) ? 1 :\n (key === Key.right || key === Key.down) ? -1 :\n 0;\n\n if (key === Key.esc) {\n dp.setState({\n view: 'day',\n });\n } else if (shiftBy) {\n e.preventDefault();\n var shiftedYear = shiftYear(dp.state.hilightedDate, shiftBy);\n\n dp.setState({\n hilightedDate: constrainDate(shiftedYear, opts.min, opts.max),\n });\n }\n }\n\n function mapYears(dp, fn) {\n var result = '';\n var max = dp.opts.max.getFullYear();\n\n for (var i = max; i >= dp.opts.min.getFullYear(); --i) {\n result += fn(i);\n }\n\n return result;\n }\n\n /**\n * @file Defines the base date picker behavior, overridden by various modes.\n */\n\n var views = {\n day: dayPicker,\n year: yearPicker,\n month: monthPicker\n };\n\n function BaseMode(input, emit, opts) {\n var detatchInputEvents; // A function that detaches all events from the input\n var closing = false; // A hack to prevent calendar from re-opening when closing.\n var selectedDate; // The currently selected date\n var dp = {\n // The root DOM element for the date picker, initialized on first open.\n el: undefined,\n opts: opts,\n shouldFocusOnBlur: true,\n shouldFocusOnRender: true,\n state: initialState(),\n adjustPosition: noop,\n containerHTML: '
',\n\n attachToDom: function () {\n document.body.appendChild(dp.el);\n },\n\n updateInput: function (selectedDate) {\n var e = new CustomEvent('change', {bubbles: true});\n e.simulated = true;\n input.value = selectedDate ? opts.format(selectedDate) : '';\n input.dispatchEvent(e);\n },\n\n computeSelectedDate: function () {\n return opts.parse(input.value);\n },\n\n currentView: function() {\n return views[dp.state.view];\n },\n\n open: function () {\n if (closing) {\n return;\n }\n\n if (!dp.el) {\n dp.el = createContainerElement(opts, dp.containerHTML);\n attachContainerEvents(dp);\n }\n\n selectedDate = constrainDate(dp.computeSelectedDate(), opts.min, opts.max);\n dp.state.hilightedDate = selectedDate || opts.hilightedDate;\n dp.state.view = 'day';\n\n dp.attachToDom();\n dp.render();\n\n emit('open');\n },\n\n isVisible: function () {\n return !!dp.el && !!dp.el.parentNode;\n },\n\n hasFocus: function () {\n var focused = document.activeElement;\n return dp.el &&\n dp.el.contains(focused) &&\n focused.className.indexOf('dp-focuser') < 0;\n },\n\n shouldHide: function () {\n return dp.isVisible();\n },\n\n close: function (becauseOfBlur) {\n var el = dp.el;\n\n if (!dp.isVisible()) {\n return;\n }\n\n if (el) {\n var parent = el.parentNode;\n parent && parent.removeChild(el);\n }\n\n closing = true;\n\n if (becauseOfBlur && dp.shouldFocusOnBlur) {\n focusInput(input);\n }\n\n // When we close, the input often gains refocus, which\n // can then launch the date picker again, so we buffer\n // a bit and don't show the date picker within N ms of closing\n setTimeout(function() {\n closing = false;\n }, 100);\n\n emit('close');\n },\n\n destroy: function () {\n dp.close();\n detatchInputEvents();\n },\n\n render: function () {\n if (!dp.el) {\n return;\n }\n\n var hadFocus = dp.hasFocus();\n var html = dp.currentView().render(dp);\n html && (dp.el.firstChild.innerHTML = html);\n\n dp.adjustPosition();\n\n if (hadFocus || dp.shouldFocusOnRender) {\n focusCurrent(dp);\n }\n },\n\n // Conceptually similar to setState in React, updates\n // the view state and re-renders.\n setState: function (state) {\n for (var key in state) {\n dp.state[key] = state[key];\n }\n\n emit('statechange');\n dp.render();\n },\n };\n\n detatchInputEvents = attachInputEvents(input, dp);\n\n // Builds the initial view state\n // selectedDate is a special case and causes changes to hilightedDate\n // hilightedDate is set on open, so remains undefined initially\n // view is the current view (day, month, year)\n function initialState() {\n return {\n get selectedDate() {\n return selectedDate;\n },\n set selectedDate(dt) {\n if (dt && !opts.inRange(dt)) {\n return;\n }\n\n if (dt) {\n selectedDate = new Date(dt);\n dp.state.hilightedDate = selectedDate;\n } else {\n selectedDate = dt;\n }\n\n dp.updateInput(selectedDate);\n emit('select');\n dp.close();\n },\n view: 'day',\n };\n }\n\n return dp;\n }\n\n function createContainerElement(opts, containerHTML) {\n var el = document.createElement('div');\n\n el.className = opts.mode;\n el.innerHTML = containerHTML;\n\n return el;\n }\n\n function attachInputEvents(input, dp) {\n var bufferShow = bufferFn(5, function () {\n if (dp.shouldHide()) {\n dp.close();\n } else {\n dp.open();\n }\n });\n\n var off = [\n on('blur', input, bufferFn(150, function () {\n if (!dp.hasFocus()) {\n dp.close(true);\n }\n })),\n\n on('mousedown', input, function () {\n if (input === document.activeElement) {\n bufferShow();\n }\n }),\n\n on('focus', input, bufferShow),\n\n on('input', input, function (e) {\n var date = dp.opts.parse(e.target.value);\n isNaN(date) || dp.setState({\n hilightedDate: date\n });\n }),\n ];\n\n // Unregister all events that were registered above.\n return function() {\n off.forEach(function (f) {\n f();\n });\n };\n }\n\n function focusCurrent(dp) {\n var current = dp.el.querySelector('.dp-current');\n return current && current.focus();\n }\n\n function attachContainerEvents(dp) {\n var el = dp.el;\n var calEl = el.querySelector('.dp');\n\n // Hack to get iOS to show active CSS states\n el.ontouchstart = noop;\n\n function onClick(e) {\n e.target.className.split(' ').forEach(function(evt) {\n var handler = dp.currentView().onClick[evt];\n handler && handler(e, dp);\n });\n }\n\n // The calender fires a blur event *every* time we redraw\n // this means we need to buffer the blur event to see if\n // it still has no focus after redrawing, and only then\n // do we return focus to the input. A possible other approach\n // would be to set context.redrawing = true on redraw and\n // set it to false in the blur event.\n on('blur', calEl, bufferFn(150, function () {\n if (!dp.hasFocus()) {\n dp.close(true);\n }\n }));\n\n on('keydown', el, function (e) {\n if (e.keyCode === Key.enter) {\n onClick(e);\n } else {\n dp.currentView().onKeyDown(e, dp);\n }\n });\n\n // If the user clicks in non-focusable space, but\n // still within the date picker, we don't want to\n // hide, so we need to hack some things...\n on('mousedown', calEl, function (e) {\n e.target.focus && e.target.focus(); // IE hack\n if (document.activeElement !== e.target) {\n e.preventDefault();\n focusCurrent(dp);\n }\n });\n\n on('click', el, onClick);\n }\n\n function focusInput(input) {\n // When the modal closes, we need to focus the original input so the\n // user can continue tabbing from where they left off.\n input.focus();\n\n // iOS zonks out if we don't blur the input, so...\n if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {\n input.blur();\n }\n }\n\n /**\n * @file Defines the modal date picker behavior.\n */\n\n function ModalMode(input, emit, opts) {\n var dp = BaseMode(input, emit, opts);\n\n // In modal mode, users really shouldn't be able to type in\n // the input, as all input is done via the calendar.\n input.readonly = true;\n\n // In modal mode, we need to know when the user has tabbed\n // off the end of the calendar, and set focus to the original\n // input. To do this, we add a special element to the DOM.\n // When the user tabs off the bottom of the calendar, they\n // will tab onto this element.\n dp.containerHTML += '.';\n\n return dp;\n }\n\n /**\n * @file Defines the dropdown date picker behavior.\n */\n\n function DropdownMode(input, emit, opts) {\n var dp = BaseMode(input, emit, opts);\n\n dp.shouldFocusOnBlur = false;\n\n Object.defineProperty(dp, 'shouldFocusOnRender', {\n get: function() {\n return input !== document.activeElement;\n }\n });\n\n dp.adjustPosition = function () {\n autoPosition(input, dp);\n };\n\n return dp;\n }\n\n function autoPosition(input, dp) {\n var inputPos = input.getBoundingClientRect();\n var win = window;\n\n adjustCalY(dp, inputPos, win);\n adjustCalX(dp, inputPos, win);\n\n dp.el.style.visibility = '';\n }\n\n function adjustCalX(dp, inputPos, win) {\n var cal = dp.el;\n var scrollLeft = win.pageXOffset;\n var inputLeft = inputPos.left + scrollLeft;\n var maxRight = win.innerWidth + scrollLeft;\n var offsetWidth = cal.offsetWidth;\n var calRight = inputLeft + offsetWidth;\n var shiftedLeft = maxRight - offsetWidth;\n var left = calRight > maxRight && shiftedLeft > 0 ? shiftedLeft : inputLeft;\n\n cal.style.left = left + 'px';\n }\n\n function adjustCalY(dp, inputPos, win) {\n var cal = dp.el;\n var scrollTop = win.pageYOffset;\n var inputTop = scrollTop + inputPos.top;\n var calHeight = cal.offsetHeight;\n var belowTop = inputTop + inputPos.height + 8;\n var aboveTop = inputTop - calHeight - 8;\n var isAbove = (aboveTop > 0 && belowTop + calHeight > scrollTop + win.innerHeight);\n var top = isAbove ? aboveTop : belowTop;\n\n if (cal.classList) {\n cal.classList.toggle('dp-is-above', isAbove);\n cal.classList.toggle('dp-is-below', !isAbove);\n }\n cal.style.top = top + 'px';\n }\n\n /**\n * @file Defines the permanent date picker behavior.\n */\n\n function PermanentMode(root, emit, opts) {\n var dp = BaseMode(root, emit, opts);\n\n dp.close = noop;\n dp.destroy = noop;\n dp.updateInput = noop;\n dp.shouldFocusOnRender = opts.shouldFocusOnRender;\n\n dp.computeSelectedDate = function () {\n return opts.hilightedDate;\n };\n\n dp.attachToDom = function () {\n root.appendChild(dp.el);\n };\n\n dp.open();\n\n return dp;\n }\n\n /**\n * @file Defines the various date picker modes (modal, dropdown, permanent)\n */\n\n function Mode(input, emit, opts) {\n input = input && input.tagName ? input : document.querySelector(input);\n\n if (opts.mode === 'dp-modal') {\n return ModalMode(input, emit, opts);\n }\n\n if (opts.mode === 'dp-below') {\n return DropdownMode(input, emit, opts);\n }\n\n if (opts.mode === 'dp-permanent') {\n return PermanentMode(input, emit, opts);\n }\n }\n\n /**\n * @file Defines simple event emitter behavior.\n */\n\n /**\n * Emitter constructs a new emitter object which has on/off methods.\n *\n * @returns {EventEmitter}\n */\n function Emitter() {\n var handlers = {};\n\n function onOne(name, handler) {\n (handlers[name] = (handlers[name] || [])).push(handler);\n }\n\n function onMany(fns) {\n for (var name in fns) {\n onOne(name, fns[name]);\n }\n }\n\n return {\n on: function (name, handler) {\n if (handler) {\n onOne(name, handler);\n } else {\n onMany(name);\n }\n\n return this;\n },\n\n emit: function (name, arg) {\n (handlers[name] || []).forEach(function (handler) {\n handler(name, arg);\n });\n },\n\n off: function (name, handler) {\n if (!name) {\n handlers = {};\n } else if (!handler) {\n handlers[name] = [];\n } else {\n handlers[name] = (handlers[name] || []).filter(function (h) {\n return h !== handler;\n });\n }\n\n return this;\n }\n };\n }\n\n /**\n * @file The root date picker file, defines public exports for the library.\n */\n\n /**\n * The date picker language configuration\n * @typedef {Object} LangOptions\n * @property {Array.} [days] - Days of the week\n * @property {Array.} [months] - Months of the year\n * @property {string} today - The label for the 'today' button\n * @property {string} close - The label for the 'close' button\n * @property {string} clear - The label for the 'clear' button\n */\n\n /**\n * The configuration options for a date picker.\n *\n * @typedef {Object} DatePickerOptions\n * @property {LangOptions} [lang] - Configures the label text, defaults to English\n * @property {('dp-modal'|'dp-below'|'dp-permanent')} [mode] - The date picker mode, defaults to 'dp-modal'\n * @property {(string|Date)} [hilightedDate] - The date to hilight if no date is selected\n * @property {function(string|Date):Date} [parse] - Parses a date, the complement of the \"format\" function\n * @property {function(Date):string} [format] - Formats a date for displaying to user\n * @property {function(Date):string} [dateClass] - Associates a custom CSS class with a date\n * @property {function(Date):boolean} [inRange] - Indicates whether or not a date is selectable\n * @property {(string|Date)} [min] - The minimum selectable date (inclusive, default 100 years ago)\n * @property {(string|Date)} [max] - The maximum selectable date (inclusive, default 100 years from now)\n */\n\n /**\n * The state values for the date picker\n *\n * @typedef {Object} DatePickerState\n * @property {string} view - The current view 'day' | 'month' | 'year'\n * @property {Date} selectedDate - The date which has been selected by the user\n * @property {Date} hilightedDate - The date which is currently hilighted / active\n */\n\n /**\n * An instance of TinyDatePicker\n *\n * @typedef {Object} DatePicker\n * @property {DatePickerState} state - The values currently displayed.\n * @property {function} on - Adds an event handler\n * @property {function} off - Removes an event handler\n * @property {function} setState - Changes the current state of the date picker\n * @property {function} open - Opens the date picker\n * @property {function} close - Closes the date picker\n * @property {function} destroy - Destroys the date picker (removing all handlers from the input, too)\n */\n\n /**\n * TinyDatePicker constructs a new date picker for the specified input\n *\n * @param {HTMLElement | string} input The input or CSS selector associated with the datepicker\n * @param {DatePickerOptions} opts The options for initializing the date picker\n * @returns {DatePicker}\n */\n function TinyDatePicker(input, opts) {\n var emitter = Emitter();\n var options = DatePickerOptions(opts);\n var mode = Mode(input, emit, options);\n var me = {\n get state() {\n return mode.state;\n },\n on: emitter.on,\n off: emitter.off,\n setState: mode.setState,\n open: mode.open,\n close: mode.close,\n destroy: mode.destroy,\n };\n\n function emit(evt) {\n emitter.emit(evt, me);\n }\n\n return me;\n }\n\n return TinyDatePicker;\n\n})));\n","const attributes = [\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderRightWidth',\n 'borderTopStyle',\n 'borderRightStyle',\n 'borderBottomStyle',\n 'borderLeftStyle',\n 'borderTopWidth',\n 'boxSizing',\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'height',\n 'letterSpacing',\n 'lineHeight',\n 'marginBottom',\n 'marginLeft',\n 'marginRight',\n 'marginTop',\n 'outlineWidth',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'textAlign',\n 'textOverflow',\n 'textTransform',\n 'whiteSpace',\n 'wordBreak',\n 'wordWrap',\n];\n\n/**\n * Create a mirror\n *\n * @param {Element} element The element\n * @param {string} html The html\n *\n * @return {object} The mirror object\n */\nconst createMirror = (element, html) => {\n\n /**\n * The mirror element\n */\n const mirror = document.createElement('div');\n\n /**\n * Create the CSS for the mirror object\n *\n * @return {object} The style object\n */\n const mirrorCss = () => {\n const css = {\n position: 'absolute',\n left: -9999,\n top: 0,\n zIndex: -2000\n };\n\n if (element.tagName === 'TEXTAREA') {\n attributes.push('width');\n }\n\n attributes.forEach((attr) => {\n css[attr] = getComputedStyle(element)[attr];\n });\n\n return css;\n };\n\n /**\n * Initialize the mirror\n *\n * @param {string} html The html\n *\n * @return {void}\n */\n const initialize = (html) => {\n const styles = mirrorCss();\n Object.keys(styles).forEach(key => {\n mirror.style[key] = styles[key];\n });\n mirror.innerHTML = html;\n element.parentNode.insertBefore(mirror, element.nextSibling);\n };\n\n /**\n * Get the rect\n *\n * @return {Rect} The bounding rect\n */\n const rect = () => {\n const marker = mirror.ownerDocument.getElementById('caret-position-marker');\n const boundingRect = {\n left: marker.offsetLeft,\n top: marker.offsetTop,\n height: marker.offsetHeight\n };\n mirror.parentNode.removeChild(mirror);\n\n return boundingRect;\n };\n\n initialize(html);\n\n return {\n rect,\n };\n};\n\nexport default createMirror;\n","/**\n * Check if a DOM Element is content editable\n *\n * @param {Element} element The DOM element\n *\n * @return {bool} If it is content editable\n */\nexport const isContentEditable = (element) => !!(\n element.contentEditable &&\n element.contentEditable === 'true'\n);\n\n/**\n * Get the context from settings passed in\n *\n * @param {object} settings The settings object\n *\n * @return {object} window and document\n */\nexport const getContext = (settings = {}) => {\n const { customPos, iframe, noShadowCaret } = settings;\n if (iframe) {\n return {\n iframe,\n window: iframe.contentWindow,\n document: iframe.contentDocument || iframe.contentWindow.document,\n noShadowCaret,\n customPos,\n };\n }\n\n return {\n window,\n document,\n noShadowCaret,\n customPos,\n };\n};\n\n/**\n * Get the offset of an element\n *\n * @param {Element} element The DOM element\n * @param {object} ctx The context\n *\n * @return {object} top and left\n */\nexport const getOffset = (element, ctx) => {\n const win = ctx && ctx.window || window;\n const doc = ctx && ctx.document || document;\n const rect = element.getBoundingClientRect();\n const docEl = doc.documentElement;\n const scrollLeft = win.pageXOffset || docEl.scrollLeft;\n const scrollTop = win.pageYOffset || docEl.scrollTop;\n\n return {\n top: rect.top + scrollTop,\n left: rect.left + scrollLeft\n };\n};\n\n/**\n * Check if a value is an object\n *\n * @param {any} value The value to check\n *\n * @return {bool} If it is an object\n */\nexport const isObject = (value) => typeof value === 'object' && value !== null;\n","import createMirror from './mirror';\nimport { getOffset as elementOffset } from './utils';\n\n/**\n * Create a Input caret object.\n *\n * @param {Element} element The element\n * @param {Object} ctx The context\n */\nconst createInputCaret = (element, ctx) => {\n\n /**\n * Get the current position\n *\n * @returns {int} The caret position\n */\n const getPos = () => {\n return element.selectionStart;\n };\n\n /**\n * Set the position\n *\n * @param {int} pos The position\n *\n * @return {Element} The element\n */\n const setPos = (pos) => {\n element.setSelectionRange(pos, pos);\n\n return element;\n };\n\n /**\n * The offset\n *\n * @param {int} pos The position\n *\n * @return {object} The offset\n */\n const getOffset = (pos) => {\n const rect = elementOffset(element);\n const position = getPosition(pos);\n\n return {\n top: rect.top + position.top + ctx.document.body.scrollTop,\n left: rect.left + position.left + ctx.document.body.scrollLeft,\n height: position.height,\n };\n };\n\n /**\n * Get the current position\n *\n * @param {int} pos The position\n *\n * @return {object} The position\n */\n const getPosition = (pos) => {\n const format = (val) => {\n let value = val.replace(/<|>|`|\"|&/g, '?')\n .replace(/\\r\\n|\\r|\\n/g,'
');\n return value;\n };\n\n if (ctx.customPos || ctx.customPos === 0) {\n pos = ctx.customPos;\n }\n\n const position = pos === undefined ? getPos() : pos;\n const startRange = element.value.slice(0, position);\n const endRange = element.value.slice(position);\n let html = `${format(startRange)}`;\n html += '|';\n html += `${format(endRange)}`;\n\n const mirror = createMirror(element, html);\n const rect = mirror.rect();\n rect.pos = getPos();\n\n return rect;\n };\n\n return {\n getPos,\n setPos,\n getOffset,\n getPosition,\n };\n};\n\nexport default createInputCaret;\n","/**\n * Create an Editable Caret\n * @param {Element} element The editable element\n * @param {object|null} ctx The context\n *\n * @return {EditableCaret}\n */\nconst createEditableCaret = (element, ctx) => {\n\n /**\n * Set the caret position\n *\n * @param {int} pos The position to se\n *\n * @return {Element} The element\n */\n const setPos = (pos) => {\n const sel = ctx.window.getSelection();\n if (sel) {\n let offset = 0;\n let found = false;\n const find = (position, parent) => {\n for (let i = 0; i < parent.childNodes.length; i++) {\n const node = parent.childNodes[i];\n if (found) {\n break;\n }\n if (node.nodeType === 3) {\n if (offset + node.length >= position) {\n found = true;\n const range = ctx.document.createRange();\n range.setStart(node, position - offset);\n sel.removeAllRanges();\n sel.addRange(range);\n break;\n } else {\n offset += node.length;\n }\n } else {\n find(pos, node);\n }\n }\n };\n find(pos, element);\n }\n\n return element;\n };\n\n /**\n * Get the offset\n *\n * @return {object} The offset\n */\n const getOffset = () => {\n const range = getRange();\n let offset = {\n height: 0,\n left: 0,\n right: 0,\n };\n\n if (!range) {\n return offset;\n }\n\n const hasCustomPos = ctx.customPos || ctx.customPos === 0;\n\n // endContainer in Firefox would be the element at the start of\n // the line\n if ((range.endOffset - 1 > 0 && range.endContainer !== element) || hasCustomPos) {\n const clonedRange = range.cloneRange();\n const fixedPosition = hasCustomPos ? ctx.customPos : range.endOffset;\n clonedRange.setStart(range.endContainer, fixedPosition - 1 < 0 ? 0 : fixedPosition - 1);\n clonedRange.setEnd(range.endContainer, fixedPosition);\n const rect = clonedRange.getBoundingClientRect();\n offset = {\n height: rect.height,\n left: rect.left + rect.width,\n top: rect.top,\n };\n clonedRange.detach();\n }\n\n if ((!offset || (offset && offset.height === 0)) && !ctx.noShadowCaret) {\n const clonedRange = range.cloneRange();\n const shadowCaret = ctx.document.createTextNode('|');\n clonedRange.insertNode(shadowCaret);\n clonedRange.selectNode(shadowCaret);\n const rect = clonedRange.getBoundingClientRect();\n offset = {\n height: rect.height,\n left: rect.left,\n top: rect.top,\n };\n shadowCaret.parentNode.removeChild(shadowCaret);\n clonedRange.detach();\n }\n\n if (offset) {\n const doc = ctx.document.documentElement;\n offset.top += ctx.window.pageYOffset - (doc.clientTop || 0);\n offset.left += ctx.window.pageXOffset - (doc.clientLeft || 0);\n }\n\n return offset;\n };\n\n /**\n * Get the position\n *\n * @return {object} The position\n */\n const getPosition = () => {\n const offset = getOffset();\n const pos = getPos();\n const rect = element.getBoundingClientRect();\n const inputOffset = {\n top: rect.top + ctx.document.body.scrollTop,\n left: rect.left + ctx.document.body.scrollLeft\n };\n offset.left -= inputOffset.left;\n offset.top -= inputOffset.top;\n offset.pos = pos;\n\n return offset;\n };\n\n /**\n * Get the range\n *\n * @return {Range|null}\n */\n const getRange = () => {\n if (!ctx.window.getSelection) {\n return;\n }\n const sel = ctx.window.getSelection();\n\n return sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n };\n\n /**\n * Get the caret position\n *\n * @return {int} The position\n */\n const getPos = () => {\n const range = getRange();\n const clonedRange = range.cloneRange();\n clonedRange.selectNodeContents(element);\n clonedRange.setEnd(range.endContainer, range.endOffset);\n const pos = clonedRange.toString().length;\n clonedRange.detach();\n\n return pos;\n };\n\n return {\n getPos,\n setPos,\n getPosition,\n getOffset,\n getRange,\n };\n};\n\nexport default createEditableCaret;\n","import createInputCaret from './input';\nimport createEditableCaret from './editable';\nimport {\n isContentEditable,\n getContext,\n isObject,\n} from './utils';\n\nexport { getOffset } from './utils';\n\nconst createCaret = (element, ctx) => {\n if (isContentEditable(element)) {\n return createEditableCaret(element, ctx);\n }\n\n return createInputCaret(element, ctx);\n};\n\nexport const position = (element, value, settings = {}) => {\n let options = settings;\n if (isObject(value)) {\n options = value;\n value = null;\n }\n const ctx = getContext(options);\n const caret = createCaret(element, ctx);\n\n if (value || value === 0) {\n return caret.setPos(value);\n }\n\n return caret.getPosition();\n};\n\n/**\n *\n * @param {Element} element The DOM element\n * @param {number|undefined} value The value to set\n * @param {object} settings Any settings for context\n */\nexport const offset = (element, value, settings = {}) => {\n let options = settings;\n if (isObject(value)) {\n options = value;\n value = null;\n }\n\n const ctx = getContext(options);\n const caret = createCaret(element, ctx);\n return caret.getOffset(value);\n};\n","import * as DataEvent from '../events/DataEvent';\nimport DateUtils from '../utilities/DateUtils';\nimport\n{\n position,\n offset\n}\nfrom 'caret-pos';\nimport EventEmitter from '../events/EventEmitter';\nimport * as EditorEvent from '../events/EditorEvent';\nclass TextEditor extends EventEmitter\n{\n /**\n * Text Editor UI Component\n * @constructor\n * @param {object} textEditor - Text area that will edit text\n * @param {number} scrollLimit - YPos where editor position will become fixed\n */\n //--------------------------\n // constructor\n //--------------------------\n constructor(textEditor, scrollLimit)\n {\n super();\n hljs.initHighlightingOnLoad();\n this.dateUtils = new DateUtils();\n this.textEditor = textEditor;\n this.fixLimit = scrollLimit;\n this.caretPos = null;\n this.url = '';\n let self = this;\n this.setInputs();\n window.addEventListener(\"scroll\", f =>\n {\n var fixLimit = this.fixLimit;\n if (window.pageYOffset >= fixLimit)\n {\n document.getElementById('edit-control').style.position = \"fixed\"\n }\n else\n {\n document.getElementById('edit-control').style.position = \"relative\"\n }\n });\n this.refresh();\n }\n //--------------------------\n // methods\n //--------------------------\n setInputs()\n {\n let self = this;\n var editorButtons = document.querySelectorAll('.editor-button');\n for (var i = 0, length = editorButtons.length; i < length; i++)\n {\n editorButtons[i].addEventListener('click', e => this.handleEditorOption(e), false);\n }\n this.textEditor.addEventListener('input', f =>\n {\n if (f.inputType == \"insertParagraph\")\n {\n var caret = position(self.textEditor).pos + 1;\n var spiffed = hljs.highlight('markdown', self.textEditor.innerText).value;\n var temp = document.createElement(\"div\");\n temp.innerText = spiffed;\n self.textEditor.innerHTML = temp.innerText;\n position(self.textEditor, caret)\n }\n else\n {\n self.refresh()\n }\n })\n }\n refresh()\n {\n var caret = position(this.textEditor).pos;\n var spiffed = hljs.highlight('markdown', this.textEditor.innerText).value;\n spiffed = spiffed.replace(new RegExp('\\r?\\n','g'), '
');\n var temp = document.createElement(\"div\");\n temp.innerText = spiffed;\n this.textEditor.innerHTML = temp.innerText;\n position(this.textEditor, caret)\n this.textEditor.style.maxWidth = '900px';\n }\n notify(type, data)\n {\n switch (type)\n {\n case DataEvent.POST_UPDATED:\n document.getElementById('submit-update').classList.add('icon-hide');\n document.getElementById('submit-good').classList.remove('icon-hide');\n document.getElementById('edit-update').classList.remove('submit-start');\n document.getElementById('edit-update').classList.add('submit-cool');\n setTimeout(f =>\n {\n document.getElementById('submit-update').classList.remove('icon-hide');\n document.getElementById('submit-good').classList.add('icon-hide');\n document.getElementById('edit-update').classList.add('submit-start');\n document.getElementById('edit-update').classList.remove('submit-cool');\n }, 2000);\n break;\n case DataEvent.POST_ADDED:\n // do nothing\n break;\n case EditorEvent.EDITOR_UPLOAD_POST_IMAGE:\n position(this.textEditor, this.caretPos);\n var sel, range, pulled;\n sel = window.getSelection(); //console.log(sel)\n //console.log(note.message)\n if (sel.rangeCount)\n {\n range = sel.getRangeAt(0);\n pulled = sel.getRangeAt(0).toString();\n range.deleteContents();\n range.insertNode(document.createTextNode(\"![image alt text](\" + data + \" 'image title')\"));\n }\n this.refresh();\n break;\n }\n }\n //--------------------------\n // event handlers\n //--------------------------\n handleEditorOption(e)\n {\n e.preventDefault();\n var self = this;\n var sel, range, pulled;\n sel = window.getSelection(); //console.log(sel)\n if (sel.rangeCount)\n {\n range = sel.getRangeAt(0);\n pulled = sel.getRangeAt(0).toString();\n range.deleteContents();\n switch (e.target.id)\n {\n case \"edit-bold\":\n range.insertNode(document.createTextNode(\"**\" + pulled + \"**\"));\n break;\n case \"edit-italic\":\n range.insertNode(document.createTextNode(\"*\" + pulled + \"*\"));\n break;\n case \"edit-strikethrough\":\n range.insertNode(document.createTextNode(\"\" + pulled + \"\"));\n break;\n case \"edit-header1\":\n range.insertNode(document.createTextNode(\"# \" + pulled));\n break;\n case \"edit-header2\":\n range.insertNode(document.createTextNode(\"## \" + pulled));\n break;\n case \"edit-header3\":\n range.insertNode(document.createTextNode(\"### \" + pulled));\n break;\n case \"edit-image\":\n this.caretPos = position(this.textEditor).pos;\n this.emitEvent(EditorEvent.EDITOR_UPLOAD_POST_IMAGE);\n break;\n case \"submit-save\":\n case \"edit-save\":\n this.emitEvent(EditorEvent.EDITOR_SAVE);\n break;\n case \"submit-update\":\n case \"edit-update\":\n this.emitEvent(EditorEvent.EDITOR_UPDATE);\n break\n case \"edit-link\":\n range.insertNode(document.createTextNode(\"[\" + pulled + \"](PASTE URL HERE)\"));\n break;\n case \"edit-delete\":\n this.emitEvent(EditorEvent.EDITOR_DELETE);\n break\n default:\n //range.insertNode(document.createTextNode(\"[\" + self.url + \"](PASTE URL HERE)\"));\n break;\n }\n }\n this.refresh()\n }\n}\nexport default TextEditor","//TOOLS\nimport DataUtils,\n{\n REQUEST_TYPE_GET,\n REQUEST_TYPE_PUT,\n REQUEST_TYPE_POST,\n REQUEST_TYPE_DELETE,\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_FORM\n}\nfrom '../../../../../brain/tools/utilities/DataUtils';\nimport * as DataEvent from '../../../../../brain/tools/events/DataEvent';\nimport PostActions from '../actions/PostActions';\nimport * as EditorEvent from '../../../../../brain/tools/events/EditorEvent';\nimport TinyDatePicker from 'tiny-date-picker';\nimport DateUtils from '../../../../../brain/tools/utilities/DateUtils';\nimport TextEditor from '../../../../../brain/tools/ui/TextEditor';\nimport DBUtils,\n{\n FINAL_KEY\n}\nfrom '../../../../../brain/tools/utilities/DBUtils';\nexport default class PostEditor\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n let self = this;\n this.dataUtils = new DataUtils();\n this.dateUtils = new DateUtils();\n this.urlPieces = document.URL.split(\"/\");\n this.dbUtils = new DBUtils();\n this.post = [];\n this.postID = null;\n if (document.getElementById('post-edit-index').getAttribute('data-index'))\n {\n this.postID = document.getElementById('post-edit-index').getAttribute('data-index');\n this.dbUtils.getPost(this.postID).then(body =>\n {\n self.post = body.post;\n this.start()\n }).catch(err =>\n {\n //console.log(err)\n })\n }\n else\n {\n this.start()\n }\n if (document.getElementById('edit-post-text'))\n {\n this.editor = new TextEditor(document.getElementById('edit-post-text'), document.getElementById('header').offsetHeight + document.getElementById('post-header').offsetHeight + document.getElementById('post-feature').offsetHeight);\n this.editor.addListener(EditorEvent.EDITOR_DELETE, f => this.handleEditorOptions(EditorEvent.EDITOR_DELETE), false)\n this.editor.addListener(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, f => this.handleEditorOptions(EditorEvent.EDITOR_UPLOAD_POST_IMAGE), false)\n this.editor.addListener(EditorEvent.EDITOR_UPDATE, f => this.handleEditorOptions(EditorEvent.EDITOR_UPDATE), false)\n this.editor.addListener(EditorEvent.EDITOR_SAVE, f => this.handleEditorOptions(EditorEvent.EDITOR_SAVE), false)\n document.getElementById('post-image-upload').addEventListener('change', e =>\n {\n self.handleImageUpload(e.target.id, e.target.files);\n }, false);\n TinyDatePicker(document.getElementById('post-date'),\n {\n mode: 'dp-below',\n format(date)\n {\n //return date;\n return self.dateUtils.getDate('origin', date);\n }\n });\n }\n }\n //--------------------------\n // methods\n //--------------------------\n start()\n {\n let self = this;\n if (document.getElementById('featured-image-drop'))\n {\n document.getElementById('featured-image-drop').addEventListener('dragover', this.handleImageActions, false);\n document.getElementById('featured-image-drop').addEventListener('drop', this.handleImageActions, false);\n document.getElementById('featured-image-upload').addEventListener('change', e => this.handleImageActions(e), false);\n if (document.getElementById('new-feature-upload'))\n {\n document.getElementById('new-feature-upload').addEventListener('click', e =>\n {\n document.getElementById('featured-image-upload').click();\n })\n }\n var optionButtons = document.querySelectorAll('.post-option-btn');\n for (var i = 0, length = optionButtons.length; i < length; i++)\n {\n optionButtons[i].addEventListener('click', e => this.handlePostOptions(e), false);\n }\n }\n }\n //--------------------------\n // event handlers\n //--------------------------\n handlePostOptions(e)\n {\n let currentOption;\n switch (e.target.id)\n {\n case \"option-page-icon\":\n case \"option-page\":\n currentOption = document.getElementById('option-page');\n break;\n case \"option-feature-icon\":\n case \"option-feature\":\n currentOption = document.getElementById('option-feature');\n break;\n case \"option-published-icon\":\n case \"option-published\":\n currentOption = document.getElementById('option-published');\n break;\n }\n let active = currentOption.getAttribute('data-active');\n (active == 'false') ? currentOption.setAttribute('data-active', 'true'): currentOption.setAttribute('data-active', 'false')\n }\n handleEditorOptions(e)\n {\n let self = this;\n switch (e)\n {\n case EditorEvent.EDITOR_SAVE:\n new PostActions().update(this.postID, this.post, PostEditor.uploadFiles, FINAL_KEY).then(response =>\n {\n setTimeout(f =>\n {\n self.dbUtils.getPost(Number(response.response.newPost)).then(r =>\n {\n window.location = \"/@/dashboard/posts/edit/\" + r.post.uuid;\n })\n }, 100);\n }).catch(err =>\n {\n //console.log(\"ERROR\", err)\n })\n break\n case EditorEvent.EDITOR_UPDATE:\n new PostActions().update(this.postID, this.post, PostEditor.uploadFiles, FINAL_KEY).then(response =>\n {\n this.editor.notify(DataEvent.POST_UPDATED, this.postID);\n }).catch(err =>\n {\n //console.log(\"ERRORZ\", err)\n })\n break;\n case EditorEvent.EDITOR_DELETE:\n if (confirm('Aye! You know you\\'re deleting this post, right?'))\n {\n new PostActions().deletePost(this.postID, this.post).then((response) =>\n {\n setTimeout(f =>\n {\n window.location = \"/@/dashboard/posts/\"\n }, 100);\n }).catch((err) =>\n {\n console.log(err)\n });\n }\n else\n {\n // Do nothing!\n }\n break;\n case EditorEvent.EDITOR_UPLOAD_POST_IMAGE:\n document.getElementById('post-image-upload').click();\n break;\n }\n }\n handleImageActions(e)\n {\n e.stopPropagation();\n e.preventDefault();\n var self = this;\n switch (e.type)\n {\n case \"dragover\":\n e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.\n break;\n case \"change\":\n case \"drop\":\n (e.type == \"drop\") ? PostEditor.uploadFiles = e.dataTransfer.files: PostEditor.uploadFiles = e.target.files;\n for (var i = 0, f; f = PostEditor.uploadFiles[i]; i++)\n {\n // Only process image files.\n if (!f.type.match('image.*'))\n {\n continue;\n }\n var reader = new FileReader();\n // Closure to capture the file information.\n reader.onload = (function(theFile)\n {\n return function(f)\n {\n // Render thumbnail.\n var image = document.createElement('img');\n image.src = f.target.result;\n image.title = escape(theFile.name);\n var span = document.createElement('div');\n span.innerHTML = [''\n ].join('');\n //document.getElementById('featured-image-drop').insertBefore(span, null);\n document.getElementById('featured-image-drop').innerHTML = '';\n document.getElementById('featured-image-drop').appendChild(image);\n };\n })(f);\n // Read in the image file as a data URL.\n reader.readAsDataURL(f);\n }\n if (e.target.id == \"featured-image-upload\") this.handleImageUpload(e.target.id, PostEditor.uploadFiles);\n break;\n }\n }\n handleImageUpload(type, files)\n {\n let url = \"\"\n let eventType = \"\";\n let self = this;\n (type == \"featured-image-upload\") ? url = \"/api/post/add-feature-image\": url = \"/api/post/add-post-image\";\n (type == \"featured-image-upload\") ? eventType = DataEvent.FEATURE_IMAGE_ADDED: eventType = DataEvent.POST_IMAGE_ADDED\n var imageData = new FormData();\n for (var i = 0; i < files.length; i++)\n {\n var file = files[i];\n // Check the file type.\n if (!file.type.match('image.*'))\n {\n continue;\n }\n (type == \"featured-image-upload\") ? imageData.append('feature_image', file, file.name): imageData.append('post_image', file, file.name);\n }\n this.dataUtils.request(url, eventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData).then((response) =>\n {\n let r = JSON.parse(response.request['response']);\n if (r.message == DataEvent.POST_IMAGE_ADDED) self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, r.url);\n }).catch((err) =>\n {\n //console.log(err)\n })\n }\n}\nPostEditor.uploadFiles = [];","import EventEmitter from '../events/EventEmitter';\n\nclass Animate extends EventEmitter {\n //--------------------------\n // constructor\n //--------------------------\n constructor() {\n super();\n }\n //--------------------------\n // methods\n //--------------------------\n object(properties) {\n var animation = anime(\n properties\n );\n //animation.start(properties);\n }\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default Animate\n","import Animate from '../../../../../brain/tools/effects/Animate';\nimport PostEditor from './PostEditor';\nexport default class PostIndex\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor(page)\n {\n this.currentPage = null;\n this.choosePage(page);\n this.start();\n }\n //--------------------------\n // methods\n //--------------------------\n start()\n {\n let self = this;\n }\n choosePage(page)\n {\n this.currentPage = '';\n switch (page)\n {\n case \"edit\":\n case \"add\":\n this.currentPage = new PostEditor();\n break;\n default:\n //just chill\n break;\n }\n }\n //--------------------------\n // event handlers\n //--------------------------\n}","import PostEditor from './PostEditor';\nimport Animate from '../../../../../brain/tools/effects/Animate';\nimport PostIndex from './PostIndex';\n\nexport default class DashManager {\n //--------------------------\n // constructor\n //--------------------------\n constructor() {\n this.currentDisplay = '';\n this.urlPieces = document.URL.split(\"/\");\n this.chooseDisplay(this.urlPieces[5], this.urlPieces[6]);\n }\n //--------------------------\n // methods\n //--------------------------\n start() {\n let self = this;\n \n }\n\n chooseDisplay(section, page) {\n this.currentDisplay = '';\n switch (section) {\n case 'posts':\n this.currentDisplay = new PostIndex(page);\n break;\n \n default:\n // just chill\n break;\n }\n this.start();\n\n }\n //--------------------------\n // event handlers\n //--------------------------\n\n}","import DataUtils,\n{\n REQUEST_TYPE_GET,\n REQUEST_TYPE_PUT,\n REQUEST_TYPE_POST,\n REQUEST_TYPE_DELETE,\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_FORM\n}\nfrom '../../../../brain/tools/utilities/DataUtils';\nimport * as DataEvent from '../../../../brain/tools/events/DataEvent';\nimport DashManager from './controllers/DashManager';\nimport DBUtils from '../../../../brain/tools/utilities/DBUtils';\nexport default class Base\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n var self = this;\n this.dashManager = [];\n this.dataUtils = new DataUtils();\n this.dbUtils = new DBUtils();\n this.settings = [];\n //this.cacheAssets();\n this.storeLocalData();\n }\n start()\n {\n this.dashManager = new DashManager();\n }\n //--------------------------\n // methods\n //--------------------------\n storeLocalData()\n {\n var self = this;\n this.dataUtils.request('/api/post/json', DataEvent.SETTINGS_LOADED).then((response) =>\n {\n let posts = JSON.parse(response.request['response']);\n\n let list = [];\n for (let index = 0; index < posts.length; index++) {\n list.push({id:posts[index].id ,post:posts[index].post});\n }\n self.dbUtils.syncLocal(list).then(r=>{\n self.start();\n }).catch(err=>{\n console.log(err);\n });\n }).catch((err) =>\n {\n console.log(err);\n });\n }\n\n cacheAssets()\n {\n if ('serviceWorker' in navigator)\n {\n window.addEventListener('load', function()\n {\n navigator.serviceWorker.register('https://fipamo.local/tim-duncan.js?'+Math.round(new Date().getTime()/1000)).then(function(registration)\n {\n //console.log('Service worker successfully registered on scope', registration.scope);\n }).catch(function(error)\n {\n //console.log('Service worker failed to register');\n });\n });\n }\n else\n {\n //console.log(\"NOPE\")\n }\n }\n //--------------------------\n // event handlers\n //--------------------------\n}","import Base from './Base'\n\ndocument.addEventListener('DOMContentLoaded', function() {\n\n var base = new Base();\n}, false);\n"]} \ No newline at end of file +{"version":3,"sources":["../../../../brain/tools/events/EventEmitter.js","../../../../brain/tools/events/DataEvent.js","../../../../brain/tools/utilities/DataUtils.js","../../../../brain/tools/utilities/StringUtils.js","../../../../brain/tools/utilities/DateUtils.js","../src/utils.js","../src/debug.js","../src/errors.js","../src/chaining-functions.js","../src/Promise.js","../src/Events.js","../src/Dexie.js","../../../../brain/tools/utilities/DBUtils.js","../../../../node_modules/uuid/lib/rng-browser.js","../../../../node_modules/uuid/lib/bytesToUuid.js","../../../../node_modules/uuid/v4.js","actions/PostActions.js","../../../../brain/tools/events/EditorEvent.js","../../../../node_modules/tiny-date-picker/dist/tiny-date-picker.js","../../src/mirror.js","../../src/utils.js","../../src/input.js","../../src/editable.js","../../src/main.js","../../../../brain/tools/ui/TextEditor.js","controllers/PostEditor.js","controllers/PostIndex.js","controllers/DashManager.js","Base.js","Start.js"],"names":["EventEmitter","listeners","Map","label","callback","has","set","get","push","isFunction","obj","index","length","reduce","i","listener","splice","args","forEach","REQUEST_GOOD","REQUEST_LAME","IMG_REQUEST_GOOD","IMG_REQUEST_LAME","SETTINGS_LOADED","HTML_LOADED","ARCHIVES_JSON_LOADED","ARCHIVES_PAGE_LOADED","ARCHIVES_ENTRY_LOADED","PROJECT_UPDATED","PROJECT_ADDED","PROJECTS_SORTED","POST_IMAGE_ADDED","FEATURE_IMAGE_ADDED","POST_ERROR","POST_ADDED","POST_UPDATED","POST_DELETED","POSTS_SYNCED","LOCAL_DB_READY","DataEvent","REQUEST_TYPE_POST","REQUEST_TYPE_GET","REQUEST_TYPE_PUT","REQUEST_TYPE_DELETE","CONTENT_TYPE_JSON","CONTENT_TYPE_FORM","DataUtils","self","requestURL","eventType","requestType","contentType","requestData","Promise","resolve","reject","request","XMLHttpRequest","upload","onprogress","handleLoadProgress","open","onload","e","status","setRequestHeader","send","JSON","stringify","url","responseType","response","Error","statusText","onerror","src","body","document","querySelector","myImage","Image","crossOrigin","imgLoad","then","imageURL","window","URL","createObjectURL","percentComplete","Math","ceil","loaded","total","StringUtils","string","clean","replace","toLowerCase","quote_style","optTemp","noquotes","toString","OPTS","concat","ENT_HTML_QUOTE_SINGLE","DateUtils","time","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getTime","seconds","date","type","rawdate","day","String","getUTCDate","month","getUTCMonth","year","getUTCFullYear","hour","getUTCHours","minute","getUTCMinutes","getUTCSeconds","millisecond","getUTCMilliseconds","offset","getTimezoneOffset","asap","props","Debug.setDebug","Debug.debug","Debug.getErrorWithStack","keys","Debug.deprecated","COUNT","FINAL_KEY","DBUtils","dataUtils","db","Dexie","version","stores","postList","toArray","array","id","postData","freshID","put","fresh","catch","err","message","error","update","Number","post","updated","syncRemote","clear","result","bulkAdd","key","event","BulkError","newPostId","bounce","newPost","archive","deleted","console","log","uuidv4","require","PostActions","dateUtils","dbUtils","data","files","lastKey","freshData","txt","createElement","innerHTML","getElementById","html","value","title","slug","cleanString","plaintext","created","tags","page","getAttribute","featured","published","file","match","feature","name","uuid","author","modify","archivePost","EDITOR_DELETE","EDITOR_UPLOAD_POST_IMAGE","EDITOR_SAVE","EDITOR_UPDATE","EditorEvent","attributes","createMirror","element","mirror","mirrorCss","css","tagName","attr","getComputedStyle","initialize","styles","style","parentNode","insertBefore","nextSibling","rect","marker","ownerDocument","boundingRect","offsetLeft","offsetTop","offsetHeight","removeChild","isContentEditable","contentEditable","getContext","settings","customPos","iframe","noShadowCaret","contentWindow","contentDocument","getOffset","ctx","win","doc","getBoundingClientRect","docEl","documentElement","scrollLeft","pageXOffset","scrollTop","pageYOffset","top","left","isObject","createInputCaret","getPos","selectionStart","setPos","pos","setSelectionRange","elementOffset","position","getPosition","height","format","val","undefined","startRange","slice","endRange","createEditableCaret","sel","getSelection","found","find","parent","childNodes","node","nodeType","range","createRange","setStart","removeAllRanges","addRange","getRange","hasCustomPos","endOffset","endContainer","clonedRange","cloneRange","fixedPosition","setEnd","width","detach","shadowCaret","createTextNode","insertNode","selectNode","clientTop","clientLeft","inputOffset","rangeCount","getRangeAt","selectNodeContents","createCaret","options","caret","TextEditor","textEditor","scrollLimit","hljs","initHighlightingOnLoad","fixLimit","caretPos","setInputs","addEventListener","f","refresh","editorButtons","querySelectorAll","handleEditorOption","inputType","spiffed","highlight","innerText","temp","RegExp","maxWidth","classList","add","remove","setTimeout","pulled","deleteContents","preventDefault","target","emitEvent","PostEditor","urlPieces","split","postID","getPost","start","editor","addListener","handleEditorOptions","handleImageUpload","mode","handleImageActions","click","optionButtons","handlePostOptions","currentOption","active","setAttribute","uploadFiles","r","location","notify","confirm","deletePost","stopPropagation","dataTransfer","dropEffect","reader","FileReader","theFile","image","escape","span","join","appendChild","readAsDataURL","imageData","FormData","append","parse","PostIndex","currentPage","choosePage","DashManager","currentDisplay","chooseDisplay","section","Base","dashManager","storeLocalData","posts","list","syncLocal","base"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAMA;;;AAGF;AACA;AACA;AACA,0BACA;AAAA;;AACI,SAAKC,SAAL,GAAiB,IAAIC,GAAJ,EAAjB;AACH,IACD;AACA;AACA;;;;;gCACYC,OAAOC,UAAU;AACzB,WAAKH,SAAL,CAAeI,GAAf,CAAmBF,KAAnB,KAA6B,KAAK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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACjrCA,IAAMC,UAAAA,GAAa,CACjB,mBADiB,EAEjB,iBAFiB,EAGjB,kBAHiB,EAIjB,gBAJiB,EAKjB,kBALiB,EAMjB,mBANiB,EAOjB,iBAPiB,EAQjB,gBARiB,EASjB,WATiB,EAUjB,YAViB,EAWjB,UAXiB,EAYjB,YAZiB,EAajB,QAbiB,EAcjB,eAdiB,EAejB,YAfiB,EAgBjB,cAhBiB,EAiBjB,YAjBiB,EAkBjB,aAlBiB,EAmBjB,WAnBiB,EAoBjB,cApBiB,EAqBjB,UArBiB,EAsBjB,WAtBiB,EAuBjB,WAvBiB,EAwBjB,eAxBiB,EAyBjB,aAzBiB,EA0BjB,cA1BiB,EA2BjB,YA3BiB,EA4BjB,WA5BiB,EA6BjB,cA7BiB,EA8BjB,eA9BiB,EA+BjB,YA/BiB,EAgCjB,WAhCiB,EAiCjB,UAjCiB,CAAnB;;;;;;;;;;AA4CA,IAAMC,YAAAA,GAAe,SAAfA,YAAe,CAACC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AAC+T,KAAL,CAAW3T,QAAQ,CAACf,OAAT,CAAiB,UAAjB,CAAX,CAAZ;AAEA,YAAIsV,IAAI,GAAG,EAAX;;AACA,aAAK,IAAInY,KAAK,GAAG,CAAjB,EAAoBA,KAAK,GAAGkY,KAAK,CAACjY,MAAlC,EAA0CD,KAAK,EAA/C,EAAmD;AAC/CmY,UAAAA,IAAI,CAACtY,IAAL,CAAU;AAACiJ,YAAAA,EAAE,EAACoP,KAAK,CAAClY,KAAD,CAAL,CAAa8I,EAAjB;AAAqBW,YAAAA,IAAI,EAACyO,KAAK,CAAClY,KAAD,CAAL,CAAayJ;AAAvC,WAAV;AACH;;AACDrH,QAAAA,IAAI,CAACyI,OAAL,CAAauN,SAAb,CAAuBD,IAAvB,EAA6B3T,IAA7B,CAAkC,UAAA2R,CAAC,EAAE;AACjC/T,UAAAA,IAAI,CAACiT,KAAL;AACH,SAFD,EAEGlM,KAFH,CAES,UAAAC,GAAG,EAAE;AACVmB,UAAAA,OAAO,CAACC,GAAR,CAAYpB,GAAZ;AACH,SAJD;AAKH,OAbD,EAaGD,KAbH,CAaS,UAACC,GAAD,EACT;AACImB,QAAAA,OAAO,CAACC,GAAR,CAAYpB,GAAZ;AACH,OAhBD;AAiBH,MACD;AACA;AACA;;;;;;;;;;;ACzDJ;;;;AAEAlF,QAAQ,CAACwP,gBAAT,CAA0B,kBAA1B,EAA8C,YAAW;AAErD,MAAI2E,IAAI,GAAG,IAAIN,aAAJ,EAAX;AACH,CAHD,EAGG,KAHH","file":"dash.min.map","sourceRoot":"../../src/com","sourcesContent":["class EventEmitter\n{\n\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n this.listeners = new Map();\n }\n //--------------------------\n // methods\n //--------------------------\n addListener(label, callback) {\n this.listeners.has(label) || this.listeners.set(label, []);\n this.listeners.get(label).push(callback);\n }\n\n removeListener(label, callback) {\n var isFunction = function(obj) {\n return typeof obj == 'function' || false;\n };\n\n var listeners = this.listeners.get(label),\n index;\n\n if (listeners && listeners.length) {\n index = listeners.reduce((i, listener, index) => {\n return (isFunction(listener) && listener === callback)\n ? i = index\n : i;\n }, -1);\n\n if (index > -1) {\n listeners.splice(index, 1);\n this.listeners.set(label, listeners);\n return true;\n }\n }\n return false;\n }\n\n emitEvent(label, ...args) {\n var listeners = this.listeners.get(label);\n if (listeners && listeners.length) {\n listeners.forEach((listener) => {\n listener(...args);\n });\n return true;\n }\n return false;\n }\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default EventEmitter\n","export const REQUEST_GOOD = 'requestGood';\nexport const REQUEST_LAME = 'requestLame';\nexport const IMG_REQUEST_GOOD = 'imgRequestGood';\nexport const IMG_REQUEST_LAME = 'imgRequestLame';\nexport const SETTINGS_LOADED = 'dataLoaded';\nexport const HTML_LOADED = 'htmlLoaded';\nexport const ARCHIVES_JSON_LOADED = 'archivesJSONLoaded';\nexport const ARCHIVES_PAGE_LOADED = 'archivesPAGELoaded';\nexport const ARCHIVES_ENTRY_LOADED = 'archivesEntryLoaded';\nexport const PROJECT_UPDATED = 'projectUpdated';\nexport const PROJECT_ADDED = 'projectAdded';\nexport const PROJECTS_SORTED = 'projectsSorted';\nexport const POST_IMAGE_ADDED = 'postImageAdded';\nexport const FEATURE_IMAGE_ADDED = 'featureImageAdded';\nexport const POST_ERROR = 'postError';\nexport const POST_ADDED = 'postAdded';\nexport const POST_UPDATED = 'postUpdated';\nexport const POST_DELETED = 'postImageAdded';\nexport const POSTS_SYNCED = 'postsSynced';\nexport const LOCAL_DB_READY = 'localDBReady';\n\nclass DataEvent\n{\n\n //--------------------------\n // methods\n //--------------------------\n\n\n\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default new DataEvent\n","export const REQUEST_TYPE_POST = \"POST\";\nexport const REQUEST_TYPE_GET = \"GET\";\nexport const REQUEST_TYPE_PUT = \"PUT\";\nexport const REQUEST_TYPE_DELETE = \"DELETE\";\nexport const CONTENT_TYPE_JSON = 'json';\nexport const CONTENT_TYPE_FORM = 'x-www-form-urlencoded';\nimport EventEmitter from '../events/EventEmitter';\nimport * as DataEvent from '../events/DataEvent';\nclass DataUtils extends EventEmitter\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n super();\n var self = this;\n }\n //--------------------------\n // methods\n //--------------------------\n request(requestURL, eventType, requestType = REQUEST_TYPE_GET, contentType = CONTENT_TYPE_JSON, requestData = null)\n {\n var self = this;\n return new Promise(function(resolve, reject)\n {\n var request = new XMLHttpRequest();\n request.upload.onprogress = self.handleLoadProgress;\n request.open(requestType, requestURL, true);\n request.onload = function(e)\n {\n if (request.status == 200)\n {\n resolve(\n {\n request,\n eventType\n });\n }\n else\n {\n reject(\n {\n request,\n eventType\n });\n };\n };\n if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST)\n {\n switch (contentType)\n {\n case CONTENT_TYPE_JSON:\n request.setRequestHeader(\"Content-type\", \"application/\" + contentType);\n request.send(JSON.stringify(requestData));\n break;\n case CONTENT_TYPE_FORM:\n request.send(requestData);\n break;\n }\n }\n else\n {\n request.send();\n }\n })\n }\n imgLoad(url)\n {\n 'use strict';\n // Create new promise with the Promise() constructor;\n // This has as its argument a function with two parameters, resolve and reject\n return new Promise(function(resolve, reject)\n {\n // Standard XHR to load an image\n var request = new XMLHttpRequest();\n request.open('GET', url);\n request.responseType = 'blob';\n // When the request loads, check whether it was successful\n request.onload = function()\n {\n if (request.status === 200)\n {\n // If successful, resolve the promise by passing back the request response\n resolve(request.response);\n }\n else\n {\n // If it fails, reject the promise with a error message\n reject(new Error('Image didn\\'t load successfully; error code:' + request.statusText));\n }\n };\n request.onerror = function()\n {\n // Also deal with the case when the entire request fails to begin with\n // This is probably a network error, so reject the promise with an appropriate message\n reject(new Error('There was a network error.'));\n };\n // Send the request\n request.send();\n });\n }\n loadImage(src)\n {\n 'use strict';\n let self = this;\n return new Promise(function(resolve, reject)\n {\n // Get a reference to the body element, and create a new image object\n var body = document.querySelector('body'),\n myImage = new Image();\n myImage.crossOrigin = \"\"; // or \"anonymous\"\n // Call the function with the URL we want to load, but then chain the\n // promise then() method on to the end of it. This contains two callbacks\n self.imgLoad(src).then(function(response)\n {\n // The first runs when the promise resolves, with the request.reponse specified within the resolve() method.\n var imageURL = window.URL.createObjectURL(response);\n resolve(imageURL);\n //$('background-content').setStyle('background-image', 'url('+imageURL+')') //myImage.src = imageURL;\n //console.log(imageURL);\n //body.appendChild(myImage);\n // The second runs when the promise is rejected, and logs the Error specified with the reject() method.\n }, function(Error)\n {\n reject(Error)\n });\n });\n }\n //--------------------------\n // event handlers\n //--------------------------\n handleLoadProgress(e)\n {\n var percentComplete = Math.ceil((e.loaded / e.total) * 100);\n //console.log(percentComplete);\n }\n}\nexport default DataUtils;","class StringUtils\n{\n\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {}\n //--------------------------\n // methods\n //--------------------------\n cleanString(string)\n {\n var clean = string.replace(/(^\\-+|[^a-zA-Z0-9\\/_| -]+|\\-+$)/g, '').toLowerCase().replace(/[\\/_| -]+/g, '-');\n return clean;\n }\n\n decodeHTML(string, quote_style) {\n var optTemp = 0,\n i = 0,\n noquotes = false;\n if (typeof quote_style === 'undefined') {\n quote_style = 2;\n }\n string = string.toString().replace(/</g, '<').replace(/>/g, '>');\n var OPTS = {\n 'ENT_NOQUOTES': 0,\n 'ENT_HTML_QUOTE_SINGLE': 1,\n 'ENT_HTML_QUOTE_DOUBLE': 2,\n 'ENT_COMPAT': 2,\n 'ENT_QUOTES': 3,\n 'ENT_IGNORE': 4\n };\n if (quote_style === 0) {\n noquotes = true;\n }\n if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags\n quote_style = [].concat(quote_style);\n for (i = 0; i < quote_style.length; i++) {\n // Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4\n if (OPTS[quote_style[i]] === 0) {\n noquotes = true;\n } else if (OPTS[quote_style[i]]) {\n optTemp = optTemp | OPTS[quote_style[i]];\n }\n }\n quote_style = optTemp;\n }\n if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {\n string = string.replace(/�*39;/g, \"'\"); // PHP doesn't currently escape if more than one 0, but it should\n // string = string.replace(/'|�*27;/g, \"'\"); // This would also be useful here, but not a part of PHP\n }\n if (!noquotes) {\n string = string.replace(/"/g, '\"');\n }\n // Put this in last place to avoid escape being double-decoded\n string = string.replace(/&/g, '&');\n return string;\n }\n\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default StringUtils\n","class DateUtils {\n\n //--------------------------\n // constructor\n //--------------------------\n constructor() {}\n\n //--------------------------\n // methods\n //--------------------------\n getMKtime() {\n var time = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), new Date().getHours(), new Date().getMinutes(), new Date().getSeconds(), 0).getTime() / 1000;\n return time;\n }\n\n convertMKtime(seconds) {\n var date = new Date(seconds * 1000);\n return date;\n }\n\n getDate(type, rawdate) {\n var day = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCDate()) : String(new Date().getUTCDate()));\n var month = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCMonth() + 1) : String(new Date().getUTCMonth() + 1));\n var year = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCFullYear()) : String(new Date().getUTCFullYear()));\n var hour = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCHours()) : String(new Date().getUTCHours()));\n var minute = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCMinutes()) : String(new Date().getUTCMinutes()));\n var seconds = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCSeconds()) : String(new Date().getUTCSeconds()));\n var millisecond = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getUTCMilliseconds()) : String(new Date().getUTCMilliseconds()));\n var offset = ((rawdate != null || rawdate != '') ? String(new Date(rawdate).getTimezoneOffset()) : String(new Date().getTimezoneOffset()));\n if (day.length == 1)\n day = String(\"0\" + day);\n if (month.length == 1)\n month = String(\"0\" + month);\n offset = String(offset / 60);\n if (offset.length == 1)\n offset = String(\"0\" + offset);\n switch (type) {\n case \"day\":\n return day;\n break;\n case \"month\":\n return month;\n break;\n case \"year\":\n return year;\n break;\n case \"stamp\":\n return String(year + \"-\" + month + \"-\" + day + \" \" + hour + \":\" + minute + \":\" + seconds + \".\" + millisecond + \"-\" + (offset));\n break\n default:\n return String(year + \"-\" + month + \"-\" + day);\n break;\n }\n }\n\n //--------------------------\n // event handlers\n //--------------------------\n}\n\nexport default DateUtils","export var keys = Object.keys;\nexport var isArray = Array.isArray;\nexport var _global =\n typeof self !== 'undefined' ? self :\n typeof window !== 'undefined' ? window :\n global;\n\nexport function extend(obj, extension) {\n if (typeof extension !== 'object') return obj;\n keys(extension).forEach(function (key) {\n obj[key] = extension[key];\n });\n return obj;\n}\n\nexport const getProto = Object.getPrototypeOf;\nexport const _hasOwn = {}.hasOwnProperty;\nexport function hasOwn(obj, prop) {\n return _hasOwn.call(obj, prop);\n}\n\nexport function props (proto, extension) {\n if (typeof extension === 'function') extension = extension(getProto(proto));\n keys(extension).forEach(key => {\n setProp(proto, key, extension[key]);\n });\n}\n\nexport const defineProperty = Object.defineProperty;\n\nexport function setProp(obj, prop, functionOrGetSet, options) {\n defineProperty(obj, prop, extend(functionOrGetSet && hasOwn(functionOrGetSet, \"get\") && typeof functionOrGetSet.get === 'function' ?\n {get: functionOrGetSet.get, set: functionOrGetSet.set, configurable: true} :\n {value: functionOrGetSet, configurable: true, writable: true}, options));\n}\n\nexport function derive(Child) {\n return {\n from: function (Parent) {\n Child.prototype = Object.create(Parent.prototype);\n setProp(Child.prototype, \"constructor\", Child);\n return {\n extend: props.bind(null, Child.prototype)\n };\n }\n };\n}\n\nexport const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\nexport function getPropertyDescriptor(obj, prop) {\n var pd = getOwnPropertyDescriptor(obj, prop),\n proto;\n return pd || (proto = getProto(obj)) && getPropertyDescriptor (proto, prop);\n}\n\nvar _slice = [].slice;\nexport function slice(args, start, end) {\n return _slice.call(args, start, end);\n}\n\nexport function override(origFunc, overridedFactory) {\n return overridedFactory(origFunc);\n}\n\nexport function assert (b) {\n if (!b) throw new Error(\"Assertion Failed\");\n}\n\nexport function asap(fn) {\n if (_global.setImmediate) setImmediate(fn); else setTimeout(fn, 0);\n}\n\nexport function getUniqueArray(a) {\n return a.filter((value, index, self) => self.indexOf(value) === index);\n}\n\n/** Generate an object (hash map) based on given array.\n * @param extractor Function taking an array item and its index and returning an array of 2 items ([key, value]) to\n * instert on the resulting object for each item in the array. If this function returns a falsy value, the\n * current item wont affect the resulting object.\n */\nexport function arrayToObject (array, extractor) {\n return array.reduce((result, item, i) => {\n var nameAndValue = extractor(item, i);\n if (nameAndValue) result[nameAndValue[0]] = nameAndValue[1];\n return result;\n }, {});\n}\n\nexport function trycatcher(fn, reject) {\n return function () {\n try {\n fn.apply(this, arguments);\n } catch (e) {\n reject(e);\n }\n };\n}\n\nexport function tryCatch(fn, onerror, args) {\n try {\n fn.apply(null, args);\n } catch (ex) {\n onerror && onerror(ex);\n }\n}\n\nexport function getByKeyPath(obj, keyPath) {\n // http://www.w3.org/TR/IndexedDB/#steps-for-extracting-a-key-from-a-value-using-a-key-path\n if (hasOwn(obj, keyPath)) return obj[keyPath]; // This line is moved from last to first for optimization purpose.\n if (!keyPath) return obj;\n if (typeof keyPath !== 'string') {\n var rv = [];\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n var val = getByKeyPath(obj, keyPath[i]);\n rv.push(val);\n }\n return rv;\n }\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var innerObj = obj[keyPath.substr(0, period)];\n return innerObj === undefined ? undefined : getByKeyPath(innerObj, keyPath.substr(period + 1));\n }\n return undefined;\n}\n\nexport function setByKeyPath(obj, keyPath, value) {\n if (!obj || keyPath === undefined) return;\n if ('isFrozen' in Object && Object.isFrozen(obj)) return;\n if (typeof keyPath !== 'string' && 'length' in keyPath) {\n assert(typeof value !== 'string' && 'length' in value);\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n setByKeyPath(obj, keyPath[i], value[i]);\n }\n } else {\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var currentKeyPath = keyPath.substr(0, period);\n var remainingKeyPath = keyPath.substr(period + 1);\n if (remainingKeyPath === \"\")\n if (value === undefined) delete obj[currentKeyPath]; else obj[currentKeyPath] = value;\n else {\n var innerObj = obj[currentKeyPath];\n if (!innerObj) innerObj = (obj[currentKeyPath] = {});\n setByKeyPath(innerObj, remainingKeyPath, value);\n }\n } else {\n if (value === undefined) delete obj[keyPath]; else obj[keyPath] = value;\n }\n }\n}\n\nexport function delByKeyPath(obj, keyPath) {\n if (typeof keyPath === 'string')\n setByKeyPath(obj, keyPath, undefined);\n else if ('length' in keyPath)\n [].map.call(keyPath, function(kp) {\n setByKeyPath(obj, kp, undefined);\n });\n}\n\nexport function shallowClone(obj) {\n var rv = {};\n for (var m in obj) {\n if (hasOwn(obj, m)) rv[m] = obj[m];\n }\n return rv;\n}\n\nconst concat = [].concat;\nexport function flatten (a) {\n return concat.apply([], a);\n}\n\n//https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\nvar intrinsicTypes =\n \"Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set\"\n .split(',').concat(\n flatten([8,16,32,64].map(num=>[\"Int\",\"Uint\",\"Float\"].map(t=>t+num+\"Array\")))\n ).filter(t=>_global[t]).map(t=>_global[t])\n\nexport function deepClone(any) {\n if (!any || typeof any !== 'object') return any;\n var rv;\n if (isArray(any)) {\n rv = [];\n for (var i = 0, l = any.length; i < l; ++i) {\n rv.push(deepClone(any[i]));\n }\n } else if (intrinsicTypes.indexOf(any.constructor) >= 0) {\n rv = any;\n } else {\n rv = any.constructor ? Object.create(any.constructor.prototype) : {};\n for (var prop in any) {\n if (hasOwn(any, prop)) {\n rv[prop] = deepClone(any[prop]);\n }\n }\n }\n return rv;\n}\n\nexport function getObjectDiff(a, b, rv, prfx) {\n // Compares objects a and b and produces a diff object.\n rv = rv || {};\n prfx = prfx || '';\n keys(a).forEach(prop => {\n if (!hasOwn(b, prop))\n rv[prfx+prop] = undefined; // Property removed\n else {\n var ap = a[prop],\n bp = b[prop];\n if (typeof ap === 'object' && typeof bp === 'object' &&\n ap && bp &&\n // Now compare constructors are same (not equal because wont work in Safari)\n (''+ap.constructor) === (''+bp.constructor))\n // Same type of object but its properties may have changed\n getObjectDiff (ap, bp, rv, prfx + prop + \".\");\n else if (ap !== bp)\n rv[prfx + prop] = b[prop];// Primitive value changed\n }\n });\n keys(b).forEach(prop => {\n if (!hasOwn(a, prop)) {\n rv[prfx+prop] = b[prop]; // Property added\n }\n });\n return rv;\n}\n\n// If first argument is iterable or array-like, return it as an array\nexport const iteratorSymbol = typeof Symbol !== 'undefined' && Symbol.iterator;\nexport const getIteratorOf = iteratorSymbol ? function(x) {\n var i;\n return x != null && (i = x[iteratorSymbol]) && i.apply(x);\n} : function () { return null; };\n\nexport const NO_CHAR_ARRAY = {};\n// Takes one or several arguments and returns an array based on the following criteras:\n// * If several arguments provided, return arguments converted to an array in a way that\n// still allows javascript engine to optimize the code.\n// * If single argument is an array, return a clone of it.\n// * If this-pointer equals NO_CHAR_ARRAY, don't accept strings as valid iterables as a special\n// case to the two bullets below.\n// * If single argument is an iterable, convert it to an array and return the resulting array.\n// * If single argument is array-like (has length of type number), convert it to an array.\nexport function getArrayOf (arrayLike) {\n var i, a, x, it;\n if (arguments.length === 1) {\n if (isArray(arrayLike)) return arrayLike.slice();\n if (this === NO_CHAR_ARRAY && typeof arrayLike === 'string') return [arrayLike];\n if ((it = getIteratorOf(arrayLike))) {\n a = [];\n while ((x = it.next()), !x.done) a.push(x.value);\n return a;\n }\n if (arrayLike == null) return [arrayLike];\n i = arrayLike.length;\n if (typeof i === 'number') {\n a = new Array(i);\n while (i--) a[i] = arrayLike[i];\n return a;\n }\n return [arrayLike];\n }\n i = arguments.length;\n a = new Array(i);\n while (i--) a[i] = arguments[i];\n return a;\n}\n","// By default, debug will be true only if platform is a web platform and its page is served from localhost.\n// When debug = true, error's stacks will contain asyncronic long stacks.\nexport var debug = typeof location !== 'undefined' &&\n // By default, use debug mode if served from localhost.\n /^(http|https):\\/\\/(localhost|127\\.0\\.0\\.1)/.test(location.href);\n\nexport function setDebug(value, filter) {\n debug = value;\n libraryFilter = filter;\n}\n\nexport var libraryFilter = () => true;\n\nexport const NEEDS_THROW_FOR_STACK = !new Error(\"\").stack;\n\nexport function getErrorWithStack() {\n \"use strict\";\n if (NEEDS_THROW_FOR_STACK) try {\n // Doing something naughty in strict mode here to trigger a specific error\n // that can be explicitely ignored in debugger's exception settings.\n // If we'd just throw new Error() here, IE's debugger's exception settings\n // will just consider it as \"exception thrown by javascript code\" which is\n // something you wouldn't want it to ignore.\n getErrorWithStack.arguments;\n throw new Error(); // Fallback if above line don't throw.\n } catch(e) {\n return e;\n }\n return new Error();\n}\n\nexport function prettyStack(exception, numIgnoredFrames) {\n var stack = exception.stack;\n if (!stack) return \"\";\n numIgnoredFrames = (numIgnoredFrames || 0);\n if (stack.indexOf(exception.name) === 0)\n numIgnoredFrames += (exception.name + exception.message).split('\\n').length;\n return stack.split('\\n')\n .slice(numIgnoredFrames)\n .filter(libraryFilter)\n .map(frame => \"\\n\" + frame)\n .join('');\n}\n\nexport function deprecated (what, fn) {\n return function () {\n console.warn(`${what} is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. ${prettyStack(getErrorWithStack(), 1)}`);\n return fn.apply(this, arguments);\n }\n}\n","import { derive, setProp } from './utils';\nimport { getErrorWithStack, prettyStack } from './debug';\n\nvar dexieErrorNames = [\n 'Modify',\n 'Bulk',\n 'OpenFailed',\n 'VersionChange',\n 'Schema',\n 'Upgrade',\n 'InvalidTable',\n 'MissingAPI',\n 'NoSuchDatabase',\n 'InvalidArgument',\n 'SubTransaction',\n 'Unsupported',\n 'Internal',\n 'DatabaseClosed',\n 'PrematureCommit',\n 'ForeignAwait'\n];\n\nvar idbDomErrorNames = [\n 'Unknown',\n 'Constraint',\n 'Data',\n 'TransactionInactive',\n 'ReadOnly',\n 'Version',\n 'NotFound',\n 'InvalidState',\n 'InvalidAccess',\n 'Abort',\n 'Timeout',\n 'QuotaExceeded',\n 'Syntax',\n 'DataClone'\n];\n\nvar errorList = dexieErrorNames.concat(idbDomErrorNames);\n\nvar defaultTexts = {\n VersionChanged: \"Database version changed by other database connection\",\n DatabaseClosed: \"Database has been closed\",\n Abort: \"Transaction aborted\",\n TransactionInactive: \"Transaction has already completed or failed\"\n};\n\n//\n// DexieError - base class of all out exceptions.\n//\nexport function DexieError (name, msg) {\n // Reason we don't use ES6 classes is because:\n // 1. It bloats transpiled code and increases size of minified code.\n // 2. It doesn't give us much in this case.\n // 3. It would require sub classes to call super(), which\n // is not needed when deriving from Error.\n this._e = getErrorWithStack();\n this.name = name;\n this.message = msg;\n}\n\nderive(DexieError).from(Error).extend({\n stack: {\n get: function() {\n return this._stack ||\n (this._stack = this.name + \": \" + this.message + prettyStack(this._e, 2));\n }\n },\n toString: function(){ return this.name + \": \" + this.message; }\n});\n\nfunction getMultiErrorMessage (msg, failures) {\n return msg + \". Errors: \" + failures\n .map(f=>f.toString())\n .filter((v,i,s)=>s.indexOf(v) === i) // Only unique error strings\n .join('\\n');\n}\n\n//\n// ModifyError - thrown in Collection.modify()\n// Specific constructor because it contains members failures and failedKeys.\n//\nexport function ModifyError (msg, failures, successCount, failedKeys) {\n this._e = getErrorWithStack();\n this.failures = failures;\n this.failedKeys = failedKeys;\n this.successCount = successCount;\n}\nderive(ModifyError).from(DexieError);\n\nexport function BulkError (msg, failures) {\n this._e = getErrorWithStack();\n this.name = \"BulkError\";\n this.failures = failures;\n this.message = getMultiErrorMessage(msg, failures);\n}\nderive(BulkError).from(DexieError);\n\n//\n//\n// Dynamically generate error names and exception classes based\n// on the names in errorList.\n//\n//\n\n// Map of {ErrorName -> ErrorName + \"Error\"}\nexport var errnames = errorList.reduce((obj,name)=>(obj[name]=name+\"Error\",obj),{});\n\n// Need an alias for DexieError because we're gonna create subclasses with the same name.\nconst BaseException = DexieError;\n// Map of {ErrorName -> exception constructor}\nexport var exceptions = errorList.reduce((obj,name)=>{\n // Let the name be \"DexieError\" because this name may\n // be shown in call stack and when debugging. DexieError is\n // the most true name because it derives from DexieError,\n // and we cannot change Function.name programatically without\n // dynamically create a Function object, which would be considered\n // 'eval-evil'.\n var fullName = name + \"Error\";\n function DexieError (msgOrInner, inner){\n this._e = getErrorWithStack();\n this.name = fullName;\n if (!msgOrInner) {\n this.message = defaultTexts[name] || fullName;\n this.inner = null;\n } else if (typeof msgOrInner === 'string') {\n this.message = msgOrInner;\n this.inner = inner || null;\n } else if (typeof msgOrInner === 'object') {\n this.message = `${msgOrInner.name} ${msgOrInner.message}`;\n this.inner = msgOrInner;\n }\n }\n derive(DexieError).from(BaseException);\n obj[name]=DexieError;\n return obj;\n},{});\n\n// Use ECMASCRIPT standard exceptions where applicable:\nexceptions.Syntax = SyntaxError;\nexceptions.Type = TypeError;\nexceptions.Range = RangeError;\n\nexport var exceptionMap = idbDomErrorNames.reduce((obj, name)=>{\n obj[name + \"Error\"] = exceptions[name];\n return obj;\n}, {});\n\nexport function mapError (domError, message) {\n if (!domError || domError instanceof DexieError || domError instanceof TypeError || domError instanceof SyntaxError || !domError.name || !exceptionMap[domError.name])\n return domError;\n var rv = new exceptionMap[domError.name](message || domError.message, domError);\n if (\"stack\" in domError) {\n // Derive stack from inner exception if it has a stack\n setProp(rv, \"stack\", {get: function(){\n return this.inner.stack;\n }});\n }\n return rv;\n}\n\nexport var fullNameExceptions = errorList.reduce((obj, name)=>{\n if ([\"Syntax\",\"Type\",\"Range\"].indexOf(name) === -1)\n obj[name + \"Error\"] = exceptions[name];\n return obj;\n}, {});\n\nfullNameExceptions.ModifyError = ModifyError;\nfullNameExceptions.DexieError = DexieError;\nfullNameExceptions.BulkError = BulkError;\n","import {extend} from './utils';\n\nexport function nop() { }\nexport function mirror(val) { return val; }\nexport function pureFunctionChain(f1, f2) {\n // Enables chained events that takes ONE argument and returns it to the next function in chain.\n // This pattern is used in the hook(\"reading\") event.\n if (f1 == null || f1 === mirror) return f2;\n return function (val) {\n return f2(f1(val));\n };\n}\n\nexport function callBoth(on1, on2) {\n return function () {\n on1.apply(this, arguments);\n on2.apply(this, arguments);\n };\n}\n\nexport function hookCreatingChain(f1, f2) {\n // Enables chained events that takes several arguments and may modify first argument by making a modification and then returning the same instance.\n // This pattern is used in the hook(\"creating\") event.\n if (f1 === nop) return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res !== undefined) arguments[0] = res;\n var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess\n onerror = this.onerror; // In case event listener has set this.onerror\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res2 !== undefined ? res2 : res;\n };\n}\n\nexport function hookDeletingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n f1.apply(this, arguments);\n var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess\n onerror = this.onerror; // In case event listener has set this.onerror\n this.onsuccess = this.onerror = null;\n f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n };\n}\n\nexport function hookUpdatingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function (modifications) {\n var res = f1.apply(this, arguments);\n extend(modifications, res); // If f1 returns new modifications, extend caller's modifications with the result before calling next in chain.\n var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess\n onerror = this.onerror; // In case event listener has set this.onerror\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res === undefined ?\n (res2 === undefined ? undefined : res2) :\n (extend(res, res2));\n };\n}\n\nexport function reverseStoppableEventChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n if (f2.apply(this, arguments) === false) return false;\n return f1.apply(this, arguments);\n };\n}\n\nexport function nonStoppableEventChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n f1.apply(this, arguments);\n f2.apply(this, arguments);\n };\n}\n\nexport function promisableChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res && typeof res.then === 'function') {\n var thiz = this,\n i = arguments.length,\n args = new Array(i);\n while (i--) args[i] = arguments[i];\n return res.then(function () {\n return f2.apply(thiz, args);\n });\n }\n return f2.apply(this, arguments);\n };\n}\n","/*\n * Copyright (c) 2014-2017 David Fahlander\n * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/LICENSE-2.0\n */\nimport {tryCatch, props, setProp, _global,\n getPropertyDescriptor, getArrayOf, extend} from './utils';\nimport {nop, callBoth, mirror} from './chaining-functions';\nimport {debug, prettyStack, getErrorWithStack} from './debug';\nimport {exceptions} from './errors';\n\n//\n// Promise and Zone (PSD) for Dexie library\n//\n// I started out writing this Promise class by copying promise-light (https://github.com/taylorhakes/promise-light) by\n// https://github.com/taylorhakes - an A+ and ECMASCRIPT 6 compliant Promise implementation.\n//\n// In previous versions this was fixed by not calling setTimeout when knowing that the resolve() or reject() came from another\n// tick. In Dexie v1.4.0, I've rewritten the Promise class entirely. Just some fragments of promise-light is left. I use\n// another strategy now that simplifies everything a lot: to always execute callbacks in a new micro-task, but have an own micro-task\n// engine that is indexedDB compliant across all browsers.\n// Promise class has also been optimized a lot with inspiration from bluebird - to avoid closures as much as possible.\n// Also with inspiration from bluebird, asyncronic stacks in debug mode.\n//\n// Specific non-standard features of this Promise class:\n// * Custom zone support (a.k.a. PSD) with ability to keep zones also when using native promises as well as\n// native async / await.\n// * Promise.follow() method built upon the custom zone engine, that allows user to track all promises created from current stack frame\n// and below + all promises that those promises creates or awaits.\n// * Detect any unhandled promise in a PSD-scope (PSD.onunhandled). \n//\n// David Fahlander, https://github.com/dfahlander\n//\n\n// Just a pointer that only this module knows about.\n// Used in Promise constructor to emulate a private constructor.\nvar INTERNAL = {};\n\n// Async stacks (long stacks) must not grow infinitely.\nconst\n LONG_STACKS_CLIP_LIMIT = 100,\n // When calling error.stack or promise.stack, limit the number of asyncronic stacks to print out. \n MAX_LONG_STACKS = 20,\n ZONE_ECHO_LIMIT = 7,\n nativePromiseInstanceAndProto = (()=>{\n try {\n // Be able to patch native async functions\n return new Function(`let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];`)();\n } catch(e) {\n var P = _global.Promise;\n return P ?\n [P.resolve(), P.prototype, P.resolve()] :\n []; \n }\n })(),\n resolvedNativePromise = nativePromiseInstanceAndProto[0],\n nativePromiseProto = nativePromiseInstanceAndProto[1],\n resolvedGlobalPromise = nativePromiseInstanceAndProto[2],\n nativePromiseThen = nativePromiseProto && nativePromiseProto.then;\n\nexport const NativePromise = resolvedNativePromise && resolvedNativePromise.constructor;\nexport const AsyncFunction = nativePromiseInstanceAndProto[3];\nconst patchGlobalPromise = !!resolvedGlobalPromise;\n\nvar stack_being_generated = false;\n\n/* The default function used only for the very first promise in a promise chain.\n As soon as then promise is resolved or rejected, all next tasks will be executed in micro ticks\n emulated in this module. For indexedDB compatibility, this means that every method needs to \n execute at least one promise before doing an indexedDB operation. Dexie will always call \n db.ready().then() for every operation to make sure the indexedDB event is started in an\n indexedDB-compatible emulated micro task loop.\n*/\nvar schedulePhysicalTick = resolvedGlobalPromise ?\n () => {resolvedGlobalPromise.then(physicalTick);}\n :\n _global.setImmediate ? \n // setImmediate supported. Those modern platforms also supports Function.bind().\n setImmediate.bind(null, physicalTick) :\n _global.MutationObserver ?\n // MutationObserver supported\n () => {\n var hiddenDiv = document.createElement(\"div\");\n (new MutationObserver(() => {\n physicalTick();\n hiddenDiv = null;\n })).observe(hiddenDiv, { attributes: true });\n hiddenDiv.setAttribute('i', '1');\n } :\n // No support for setImmediate or MutationObserver. No worry, setTimeout is only called\n // once time. Every tick that follows will be our emulated micro tick.\n // Could have uses setTimeout.bind(null, 0, physicalTick) if it wasnt for that FF13 and below has a bug \n ()=>{setTimeout(physicalTick,0);};\n\n// Configurable through Promise.scheduler.\n// Don't export because it would be unsafe to let unknown\n// code call it unless they do try..catch within their callback.\n// This function can be retrieved through getter of Promise.scheduler though,\n// but users must not do Promise.scheduler = myFuncThatThrowsException\nvar asap = function (callback, args) {\n microtickQueue.push([callback, args]);\n if (needsNewPhysicalTick) {\n schedulePhysicalTick();\n needsNewPhysicalTick = false;\n }\n};\n\nvar isOutsideMicroTick = true, // True when NOT in a virtual microTick.\n needsNewPhysicalTick = true, // True when a push to microtickQueue must also schedulePhysicalTick()\n unhandledErrors = [], // Rejected promises that has occured. Used for triggering 'unhandledrejection'.\n rejectingErrors = [], // Tracks if errors are being re-rejected during onRejected callback.\n currentFulfiller = null,\n rejectionMapper = mirror; // Remove in next major when removing error mapping of DOMErrors and DOMExceptions\n \nexport var globalPSD = {\n id: 'global',\n global: true,\n ref: 0,\n unhandleds: [],\n onunhandled: globalError,\n pgp: false,\n env: {},\n finalize: function () {\n this.unhandleds.forEach(uh => {\n try {\n globalError(uh[0], uh[1]);\n } catch (e) {}\n });\n }\n};\n\nexport var PSD = globalPSD;\n\nexport var microtickQueue = []; // Callbacks to call in this or next physical tick.\nexport var numScheduledCalls = 0; // Number of listener-calls left to do in this physical tick.\nexport var tickFinalizers = []; // Finalizers to call when there are no more async calls scheduled within current physical tick.\n\nexport default function Promise(fn) {\n if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new'); \n this._listeners = [];\n this.onuncatched = nop; // Deprecate in next major. Not needed. Better to use global error handler.\n \n // A library may set `promise._lib = true;` after promise is created to make resolve() or reject()\n // execute the microtask engine implicitely within the call to resolve() or reject().\n // To remain A+ compliant, a library must only set `_lib=true` if it can guarantee that the stack\n // only contains library code when calling resolve() or reject().\n // RULE OF THUMB: ONLY set _lib = true for promises explicitely resolving/rejecting directly from\n // global scope (event handler, timer etc)!\n this._lib = false;\n // Current async scope\n var psd = (this._PSD = PSD);\n\n if (debug) {\n this._stackHolder = getErrorWithStack();\n this._prev = null;\n this._numPrev = 0; // Number of previous promises (for long stacks)\n }\n \n if (typeof fn !== 'function') {\n if (fn !== INTERNAL) throw new TypeError('Not a function');\n // Private constructor (INTERNAL, state, value).\n // Used internally by Promise.resolve() and Promise.reject().\n this._state = arguments[1];\n this._value = arguments[2];\n if (this._state === false)\n handleRejection(this, this._value); // Map error, set stack and addPossiblyUnhandledError().\n return;\n }\n \n this._state = null; // null (=pending), false (=rejected) or true (=resolved)\n this._value = null; // error or result\n ++psd.ref; // Refcounting current scope\n executePromiseTask(this, fn);\n}\n\n// Prepare a property descriptor to put onto Promise.prototype.then\nconst thenProp = {\n get: function() {\n var psd = PSD, microTaskId = totalEchoes;\n\n function then (onFulfilled, onRejected) {\n var possibleAwait = !psd.global && (psd !== PSD || microTaskId !== totalEchoes);\n if (possibleAwait) decrementExpectedAwaits();\n var rv = new Promise((resolve, reject) => {\n propagateToListener(this, new Listener(\n nativeAwaitCompatibleWrap(onFulfilled, psd, possibleAwait),\n nativeAwaitCompatibleWrap(onRejected, psd, possibleAwait),\n resolve,\n reject,\n psd));\n });\n debug && linkToPreviousPromise(rv, this);\n return rv;\n }\n\n then.prototype = INTERNAL; // For idempotense, see setter below.\n\n return then;\n },\n // Be idempotent and allow another framework (such as zone.js or another instance of a Dexie.Promise module) to replace Promise.prototype.then\n // and when that framework wants to restore the original property, we must identify that and restore the original property descriptor.\n set: function (value) {\n setProp (this, 'then', value && value.prototype === INTERNAL ?\n thenProp : // Restore to original property descriptor.\n {\n get: function(){\n return value; // Getter returning provided value (behaves like value is just changed)\n },\n set: thenProp.set // Keep a setter that is prepared to restore original.\n }\n );\n }\n};\n\nprops(Promise.prototype, {\n then: thenProp, // Defined above.\n _then: function (onFulfilled, onRejected) {\n // A little tinier version of then() that don't have to create a resulting promise.\n propagateToListener(this, new Listener(null, null, onFulfilled, onRejected, PSD)); \n },\n\n catch: function (onRejected) {\n if (arguments.length === 1) return this.then(null, onRejected);\n // First argument is the Error type to catch\n var type = arguments[0],\n handler = arguments[1];\n return typeof type === 'function' ? this.then(null, err =>\n // Catching errors by its constructor type (similar to java / c++ / c#)\n // Sample: promise.catch(TypeError, function (e) { ... });\n err instanceof type ? handler(err) : PromiseReject(err))\n : this.then(null, err =>\n // Catching errors by the error.name property. Makes sense for indexedDB where error type\n // is always DOMError but where e.name tells the actual error type.\n // Sample: promise.catch('ConstraintError', function (e) { ... });\n err && err.name === type ? handler(err) : PromiseReject(err));\n },\n\n finally: function (onFinally) {\n return this.then(value => {\n onFinally();\n return value;\n }, err => {\n onFinally();\n return PromiseReject(err);\n });\n },\n \n stack: {\n get: function() {\n if (this._stack) return this._stack;\n try {\n stack_being_generated = true;\n var stacks = getStack (this, [], MAX_LONG_STACKS);\n var stack = stacks.join(\"\\nFrom previous: \");\n if (this._state !== null) this._stack = stack; // Stack may be updated on reject.\n return stack;\n } finally {\n stack_being_generated = false;\n }\n }\n },\n\n timeout: function (ms, msg) {\n return ms < Infinity ?\n new Promise((resolve, reject) => {\n var handle = setTimeout(() => reject(new exceptions.Timeout(msg)), ms);\n this.then(resolve, reject).finally(clearTimeout.bind(null, handle));\n }) : this;\n }\n});\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag)\n setProp(Promise.prototype, Symbol.toStringTag, 'Promise');\n\n// Now that Promise.prototype is defined, we have all it takes to set globalPSD.env.\n// Environment globals snapshotted on leaving global zone\nglobalPSD.env = snapShot();\n\nfunction Listener(onFulfilled, onRejected, resolve, reject, zone) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.resolve = resolve;\n this.reject = reject;\n this.psd = zone;\n}\n\n// Promise Static Properties\nprops (Promise, {\n all: function () {\n var values = getArrayOf.apply(null, arguments) // Supports iterables, implicit arguments and array-like.\n .map(onPossibleParallellAsync); // Handle parallell async/awaits \n return new Promise(function (resolve, reject) {\n if (values.length === 0) resolve([]);\n var remaining = values.length;\n values.forEach((a,i) => Promise.resolve(a).then(x => {\n values[i] = x;\n if (!--remaining) resolve(values);\n }, reject));\n });\n },\n \n resolve: value => {\n if (value instanceof Promise) return value;\n if (value && typeof value.then === 'function') return new Promise((resolve, reject)=>{\n value.then(resolve, reject);\n });\n var rv = new Promise(INTERNAL, true, value);\n linkToPreviousPromise(rv, currentFulfiller);\n return rv;\n },\n \n reject: PromiseReject,\n \n race: function () {\n var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new Promise((resolve, reject) => {\n values.map(value => Promise.resolve(value).then(resolve, reject));\n });\n },\n\n PSD: {\n get: ()=>PSD,\n set: value => PSD = value\n },\n\n //totalEchoes: {get: ()=>totalEchoes},\n\n //task: {get: ()=>task},\n \n newPSD: newScope,\n \n usePSD: usePSD,\n \n scheduler: {\n get: () => asap,\n set: value => {asap = value}\n },\n \n rejectionMapper: {\n get: () => rejectionMapper,\n set: value => {rejectionMapper = value;} // Map reject failures\n },\n \n follow: (fn, zoneProps) => {\n return new Promise((resolve, reject) => {\n return newScope((resolve, reject) => {\n var psd = PSD;\n psd.unhandleds = []; // For unhandled standard- or 3rd party Promises. Checked at psd.finalize()\n psd.onunhandled = reject; // Triggered directly on unhandled promises of this library.\n psd.finalize = callBoth(function () {\n // Unhandled standard or 3rd part promises are put in PSD.unhandleds and\n // examined upon scope completion while unhandled rejections in this Promise\n // will trigger directly through psd.onunhandled\n run_at_end_of_this_or_next_physical_tick(()=>{\n this.unhandleds.length === 0 ? resolve() : reject(this.unhandleds[0]);\n });\n }, psd.finalize);\n fn();\n }, zoneProps, resolve, reject);\n });\n }\n});\n\n/**\n* Take a potentially misbehaving resolver function and make sure\n* onFulfilled and onRejected are only called once.\n*\n* Makes no guarantees about asynchrony.\n*/\nfunction executePromiseTask (promise, fn) {\n // Promise Resolution Procedure:\n // https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n try {\n fn(value => {\n if (promise._state !== null) return; // Already settled\n if (value === promise) throw new TypeError('A promise cannot be resolved with itself.');\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n if (value && typeof value.then === 'function') {\n executePromiseTask(promise, (resolve, reject) => {\n value instanceof Promise ?\n value._then(resolve, reject) :\n value.then(resolve, reject);\n });\n } else {\n promise._state = true;\n promise._value = value;\n propagateAllListeners(promise);\n }\n if (shouldExecuteTick) endMicroTickScope();\n }, handleRejection.bind(null, promise)); // If Function.bind is not supported. Exception is handled in catch below\n } catch (ex) {\n handleRejection(promise, ex);\n }\n}\n\nfunction handleRejection (promise, reason) {\n rejectingErrors.push(reason);\n if (promise._state !== null) return;\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n reason = rejectionMapper(reason);\n promise._state = false;\n promise._value = reason;\n debug && reason !== null && typeof reason === 'object' && !reason._promise && tryCatch(()=>{\n var origProp = getPropertyDescriptor(reason, \"stack\"); \n reason._promise = promise; \n setProp(reason, \"stack\", {\n get: () =>\n stack_being_generated ?\n origProp && (origProp.get ?\n origProp.get.apply(reason) :\n origProp.value) :\n promise.stack\n });\n });\n // Add the failure to a list of possibly uncaught errors\n addPossiblyUnhandledError(promise);\n propagateAllListeners(promise);\n if (shouldExecuteTick) endMicroTickScope();\n}\n\nfunction propagateAllListeners (promise) {\n //debug && linkToPreviousPromise(promise);\n var listeners = promise._listeners;\n promise._listeners = [];\n for (var i = 0, len = listeners.length; i < len; ++i) {\n propagateToListener(promise, listeners[i]);\n }\n var psd = promise._PSD;\n --psd.ref || psd.finalize(); // if psd.ref reaches zero, call psd.finalize();\n if (numScheduledCalls === 0) {\n // If numScheduledCalls is 0, it means that our stack is not in a callback of a scheduled call,\n // and that no deferreds where listening to this rejection or success.\n // Since there is a risk that our stack can contain application code that may\n // do stuff after this code is finished that may generate new calls, we cannot\n // call finalizers here.\n ++numScheduledCalls;\n asap(()=>{\n if (--numScheduledCalls === 0) finalizePhysicalTick(); // Will detect unhandled errors\n }, []);\n }\n}\n\nfunction propagateToListener(promise, listener) {\n if (promise._state === null) {\n promise._listeners.push(listener);\n return;\n }\n\n var cb = promise._state ? listener.onFulfilled : listener.onRejected;\n if (cb === null) {\n // This Listener doesnt have a listener for the event being triggered (onFulfilled or onReject) so lets forward the event to any eventual listeners on the Promise instance returned by then() or catch()\n return (promise._state ? listener.resolve : listener.reject) (promise._value);\n }\n ++listener.psd.ref;\n ++numScheduledCalls;\n asap (callListener, [cb, promise, listener]);\n}\n\nfunction callListener (cb, promise, listener) {\n try {\n // Set static variable currentFulfiller to the promise that is being fullfilled,\n // so that we connect the chain of promises (for long stacks support)\n currentFulfiller = promise;\n \n // Call callback and resolve our listener with it's return value.\n var ret, value = promise._value;\n \n if (promise._state) {\n // cb is onResolved\n ret = cb (value);\n } else {\n // cb is onRejected\n if (rejectingErrors.length) rejectingErrors = [];\n ret = cb(value);\n if (rejectingErrors.indexOf(value) === -1)\n markErrorAsHandled(promise); // Callback didnt do Promise.reject(err) nor reject(err) onto another promise.\n }\n listener.resolve(ret);\n } catch (e) {\n // Exception thrown in callback. Reject our listener.\n listener.reject(e);\n } finally {\n // Restore env and currentFulfiller.\n currentFulfiller = null;\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n --listener.psd.ref || listener.psd.finalize();\n }\n}\n\nfunction getStack (promise, stacks, limit) {\n if (stacks.length === limit) return stacks;\n var stack = \"\";\n if (promise._state === false) {\n var failure = promise._value,\n errorName,\n message;\n \n if (failure != null) {\n errorName = failure.name || \"Error\";\n message = failure.message || failure;\n stack = prettyStack(failure, 0);\n } else {\n errorName = failure; // If error is undefined or null, show that.\n message = \"\";\n }\n stacks.push(errorName + (message ? \": \" + message : \"\") + stack);\n }\n if (debug) {\n stack = prettyStack(promise._stackHolder, 2);\n if (stack && stacks.indexOf(stack) === -1) stacks.push(stack);\n if (promise._prev) getStack(promise._prev, stacks, limit);\n }\n return stacks;\n}\n\nfunction linkToPreviousPromise(promise, prev) {\n // Support long stacks by linking to previous completed promise.\n var numPrev = prev ? prev._numPrev + 1 : 0;\n if (numPrev < LONG_STACKS_CLIP_LIMIT) { // Prohibit infinite Promise loops to get an infinite long memory consuming \"tail\".\n promise._prev = prev;\n promise._numPrev = numPrev;\n }\n}\n\n/* The callback to schedule with setImmediate() or setTimeout().\n It runs a virtual microtick and executes any callback registered in microtickQueue.\n */\nfunction physicalTick() {\n beginMicroTickScope() && endMicroTickScope();\n}\n\nfunction beginMicroTickScope() {\n var wasRootExec = isOutsideMicroTick;\n isOutsideMicroTick = false;\n needsNewPhysicalTick = false;\n return wasRootExec;\n}\n\n/* Executes micro-ticks without doing try..catch.\n This can be possible because we only use this internally and\n the registered functions are exception-safe (they do try..catch\n internally before calling any external method). If registering\n functions in the microtickQueue that are not exception-safe, this\n would destroy the framework and make it instable. So we don't export\n our asap method.\n*/\nfunction endMicroTickScope() {\n var callbacks, i, l;\n do {\n while (microtickQueue.length > 0) {\n callbacks = microtickQueue;\n microtickQueue = [];\n l = callbacks.length;\n for (i = 0; i < l; ++i) {\n var item = callbacks[i];\n item[0].apply(null, item[1]);\n }\n }\n } while (microtickQueue.length > 0);\n isOutsideMicroTick = true;\n needsNewPhysicalTick = true;\n}\n\nfunction finalizePhysicalTick() {\n var unhandledErrs = unhandledErrors;\n unhandledErrors = [];\n unhandledErrs.forEach(p => {\n p._PSD.onunhandled.call(null, p._value, p);\n });\n var finalizers = tickFinalizers.slice(0); // Clone first because finalizer may remove itself from list.\n var i = finalizers.length;\n while (i) finalizers[--i](); \n}\n\nfunction run_at_end_of_this_or_next_physical_tick (fn) {\n function finalizer() {\n fn();\n tickFinalizers.splice(tickFinalizers.indexOf(finalizer), 1);\n }\n tickFinalizers.push(finalizer);\n ++numScheduledCalls;\n asap(()=>{\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n }, []);\n}\n\nfunction addPossiblyUnhandledError(promise) {\n // Only add to unhandledErrors if not already there. The first one to add to this list\n // will be upon the first rejection so that the root cause (first promise in the\n // rejection chain) is the one listed.\n if (!unhandledErrors.some(p => p._value === promise._value))\n unhandledErrors.push(promise);\n}\n\nfunction markErrorAsHandled(promise) {\n // Called when a reject handled is actually being called.\n // Search in unhandledErrors for any promise whos _value is this promise_value (list\n // contains only rejected promises, and only one item per error)\n var i = unhandledErrors.length;\n while (i) if (unhandledErrors[--i]._value === promise._value) {\n // Found a promise that failed with this same error object pointer,\n // Remove that since there is a listener that actually takes care of it.\n unhandledErrors.splice(i, 1);\n return;\n }\n}\n\nfunction PromiseReject (reason) {\n return new Promise(INTERNAL, false, reason);\n}\n\nexport function wrap (fn, errorCatcher) {\n var psd = PSD;\n return function() {\n var wasRootExec = beginMicroTickScope(),\n outerScope = PSD;\n\n try {\n switchToZone(psd, true);\n return fn.apply(this, arguments);\n } catch (e) {\n errorCatcher && errorCatcher(e);\n } finally {\n switchToZone(outerScope, false);\n if (wasRootExec) endMicroTickScope();\n }\n };\n}\n\n\n//\n// variables used for native await support\n//\nconst task = { awaits: 0, echoes: 0, id: 0}; // The ongoing macro-task when using zone-echoing.\nvar taskCounter = 0; // ID counter for macro tasks.\nvar zoneStack = []; // Stack of left zones to restore asynchronically.\nvar zoneEchoes = 0; // zoneEchoes is a must in order to persist zones between native await expressions.\nvar totalEchoes = 0; // ID counter for micro-tasks. Used to detect possible native await in our Promise.prototype.then.\n\n\nvar zone_id_counter = 0;\nexport function newScope (fn, props, a1, a2) {\n var parent = PSD,\n psd = Object.create(parent);\n psd.parent = parent;\n psd.ref = 0;\n psd.global = false;\n psd.id = ++zone_id_counter;\n // Prepare for promise patching (done in usePSD):\n var globalEnv = globalPSD.env;\n psd.env = patchGlobalPromise ? {\n Promise: Promise, // Changing window.Promise could be omitted for Chrome and Edge, where IDB+Promise plays well!\n PromiseProp: {value: Promise, configurable: true, writable: true},\n all: Promise.all,\n race: Promise.race,\n resolve: Promise.resolve,\n reject: Promise.reject,\n nthen: getPatchedPromiseThen (globalEnv.nthen, psd), // native then\n gthen: getPatchedPromiseThen (globalEnv.gthen, psd) // global then\n } : {};\n if (props) extend(psd, props);\n \n // unhandleds and onunhandled should not be specifically set here.\n // Leave them on parent prototype.\n // unhandleds.push(err) will push to parent's prototype\n // onunhandled() will call parents onunhandled (with this scope's this-pointer though!)\n ++parent.ref;\n psd.finalize = function () {\n --this.parent.ref || this.parent.finalize();\n }\n var rv = usePSD (psd, fn, a1, a2);\n if (psd.ref === 0) psd.finalize();\n return rv;\n}\n\n// Function to call if scopeFunc returns NativePromise\n// Also for each NativePromise in the arguments to Promise.all()\nexport function incrementExpectedAwaits() {\n if (!task.id) task.id = ++taskCounter;\n ++task.awaits;\n task.echoes += ZONE_ECHO_LIMIT;\n return task.id;\n}\n// Function to call when 'then' calls back on a native promise where onAwaitExpected() had been called.\n// Also call this when a native await calls then method on a promise. In that case, don't supply\n// sourceTaskId because we already know it refers to current task.\nexport function decrementExpectedAwaits(sourceTaskId) {\n if (!task.awaits || (sourceTaskId && sourceTaskId !== task.id)) return;\n if (--task.awaits === 0) task.id = 0;\n task.echoes = task.awaits * ZONE_ECHO_LIMIT; // Will reset echoes to 0 if awaits is 0.\n}\n\n// Call from Promise.all() and Promise.race()\nexport function onPossibleParallellAsync (possiblePromise) {\n if (task.echoes && possiblePromise && possiblePromise.constructor === NativePromise) {\n incrementExpectedAwaits(); \n return possiblePromise.then(x => {\n decrementExpectedAwaits();\n return x;\n }, e => {\n decrementExpectedAwaits();\n return rejection(e);\n });\n }\n return possiblePromise;\n}\n\nfunction zoneEnterEcho(targetZone) {\n ++totalEchoes;\n if (!task.echoes || --task.echoes === 0) {\n task.echoes = task.id = 0; // Cancel zone echoing.\n }\n\n zoneStack.push(PSD);\n switchToZone(targetZone, true);\n}\n\nfunction zoneLeaveEcho() {\n var zone = zoneStack[zoneStack.length-1];\n zoneStack.pop();\n switchToZone(zone, false);\n}\n\nfunction switchToZone (targetZone, bEnteringZone) {\n var currentZone = PSD;\n if (bEnteringZone ? task.echoes && (!zoneEchoes++ || targetZone !== PSD) : zoneEchoes && (!--zoneEchoes || targetZone !== PSD)) {\n // Enter or leave zone asynchronically as well, so that tasks initiated during current tick\n // will be surrounded by the zone when they are invoked.\n enqueueNativeMicroTask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);\n }\n if (targetZone === PSD) return;\n\n PSD = targetZone; // The actual zone switch occurs at this line.\n\n // Snapshot on every leave from global zone.\n if (currentZone === globalPSD) globalPSD.env = snapShot();\n\n if (patchGlobalPromise) {\n // Let's patch the global and native Promises (may be same or may be different)\n var GlobalPromise = globalPSD.env.Promise;\n // Swich environments (may be PSD-zone or the global zone. Both apply.)\n var targetEnv = targetZone.env;\n\n // Change Promise.prototype.then for native and global Promise (they MAY differ on polyfilled environments, but both can be accessed)\n // Must be done on each zone change because the patched method contains targetZone in its closure.\n nativePromiseProto.then = targetEnv.nthen;\n GlobalPromise.prototype.then = targetEnv.gthen;\n\n if (currentZone.global || targetZone.global) {\n // Leaving or entering global zone. It's time to patch / restore global Promise.\n\n // Set this Promise to window.Promise so that transiled async functions will work on Firefox, Safari and IE, as well as with Zonejs and angular.\n Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp);\n\n // Support Promise.all() etc to work indexedDB-safe also when people are including es6-promise as a module (they might\n // not be accessing global.Promise but a local reference to it)\n GlobalPromise.all = targetEnv.all;\n GlobalPromise.race = targetEnv.race;\n GlobalPromise.resolve = targetEnv.resolve;\n GlobalPromise.reject = targetEnv.reject;\n }\n }\n}\n\nfunction snapShot () {\n var GlobalPromise = _global.Promise;\n return patchGlobalPromise ? {\n Promise: GlobalPromise,\n PromiseProp: Object.getOwnPropertyDescriptor(_global, \"Promise\"),\n all: GlobalPromise.all,\n race: GlobalPromise.race,\n resolve: GlobalPromise.resolve,\n reject: GlobalPromise.reject,\n nthen: nativePromiseProto.then,\n gthen: GlobalPromise.prototype.then\n } : {};\n}\n\nexport function usePSD (psd, fn, a1, a2, a3) {\n var outerScope = PSD;\n try {\n switchToZone(psd, true);\n return fn(a1, a2, a3);\n } finally {\n switchToZone(outerScope, false);\n }\n}\n\nfunction enqueueNativeMicroTask (job) {\n //\n // Precondition: nativePromiseThen !== undefined\n //\n nativePromiseThen.call(resolvedNativePromise, job);\n}\n\nfunction nativeAwaitCompatibleWrap(fn, zone, possibleAwait) {\n return typeof fn !== 'function' ? fn : function () {\n var outerZone = PSD;\n if (possibleAwait) incrementExpectedAwaits();\n switchToZone(zone, true);\n try {\n return fn.apply(this, arguments);\n } finally {\n switchToZone(outerZone, false);\n }\n };\n}\n\nfunction getPatchedPromiseThen (origThen, zone) {\n return function (onResolved, onRejected) {\n return origThen.call(this,\n nativeAwaitCompatibleWrap(onResolved, zone, false),\n nativeAwaitCompatibleWrap(onRejected, zone, false));\n };\n}\n\nconst UNHANDLEDREJECTION = \"unhandledrejection\";\n\nfunction globalError(err, promise) {\n var rv;\n try {\n rv = promise.onuncatched(err);\n } catch (e) {}\n if (rv !== false) try {\n var event, eventData = {promise: promise, reason: err};\n if (_global.document && document.createEvent) {\n event = document.createEvent('Event');\n event.initEvent(UNHANDLEDREJECTION, true, true);\n extend(event, eventData);\n } else if (_global.CustomEvent) {\n event = new CustomEvent(UNHANDLEDREJECTION, {detail: eventData});\n extend(event, eventData);\n }\n if (event && _global.dispatchEvent) {\n dispatchEvent(event);\n if (!_global.PromiseRejectionEvent && _global.onunhandledrejection)\n // No native support for PromiseRejectionEvent but user has set window.onunhandledrejection. Manually call it.\n try {_global.onunhandledrejection(event);} catch (_) {}\n }\n if (!event.defaultPrevented) {\n console.warn(`Unhandled rejection: ${err.stack || err}`);\n }\n } catch (e) {}\n}\n\nexport var rejection = Promise.reject;\n","import {keys, isArray, asap} from './utils';\nimport {nop, mirror, reverseStoppableEventChain} from './chaining-functions';\nimport {exceptions} from './errors';\n\nexport default function Events(ctx) {\n var evs = {};\n var rv = function (eventName, subscriber) {\n if (subscriber) {\n // Subscribe. If additional arguments than just the subscriber was provided, forward them as well.\n var i = arguments.length, args = new Array(i - 1);\n while (--i) args[i - 1] = arguments[i];\n evs[eventName].subscribe.apply(null, args);\n return ctx;\n } else if (typeof (eventName) === 'string') {\n // Return interface allowing to fire or unsubscribe from event\n return evs[eventName];\n }\n };\n rv.addEventType = add;\n \n for (var i = 1, l = arguments.length; i < l; ++i) {\n add(arguments[i]);\n }\n \n return rv;\n\n function add(eventName, chainFunction, defaultFunction) {\n if (typeof eventName === 'object') return addConfiguredEvents(eventName);\n if (!chainFunction) chainFunction = reverseStoppableEventChain;\n if (!defaultFunction) defaultFunction = nop;\n\n var context = {\n subscribers: [],\n fire: defaultFunction,\n subscribe: function (cb) {\n if (context.subscribers.indexOf(cb) === -1) {\n context.subscribers.push(cb);\n context.fire = chainFunction(context.fire, cb);\n }\n },\n unsubscribe: function (cb) {\n context.subscribers = context.subscribers.filter(function (fn) { return fn !== cb; });\n context.fire = context.subscribers.reduce(chainFunction, defaultFunction);\n }\n };\n evs[eventName] = rv[eventName] = context;\n return context;\n }\n\n function addConfiguredEvents(cfg) {\n // events(this, {reading: [functionChain, nop]});\n keys(cfg).forEach(function (eventName) {\n var args = cfg[eventName];\n if (isArray(args)) {\n add(eventName, cfg[eventName][0], cfg[eventName][1]);\n } else if (args === 'asap') {\n // Rather than approaching event subscription using a functional approach, we here do it in a for-loop where subscriber is executed in its own stack\n // enabling that any exception that occur wont disturb the initiator and also not nescessary be catched and forgotten.\n var context = add(eventName, mirror, function fire() {\n // Optimazation-safe cloning of arguments into args.\n var i = arguments.length, args = new Array(i);\n while (i--) args[i] = arguments[i];\n // All each subscriber:\n context.subscribers.forEach(function (fn) {\n asap(function fireEvent() {\n fn.apply(null, args);\n });\n });\n });\n } else throw new exceptions.InvalidArgument(\"Invalid event config\");\n });\n }\n}\n","/*\n * Dexie.js - a minimalistic wrapper for IndexedDB\n * ===============================================\n *\n * Copyright (c) 2014-2017 David Fahlander\n *\n * Version {version}, {date}\n *\n * http://dexie.org\n * \n * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/LICENSE-2.0\n * \n */\n\nimport {\n keys,\n setProp,\n isArray,\n extend,\n props,\n derive,\n slice,\n override,\n _global,\n asap,\n trycatcher,\n tryCatch,\n getByKeyPath,\n setByKeyPath,\n delByKeyPath,\n shallowClone,\n deepClone,\n getObjectDiff,\n assert,\n NO_CHAR_ARRAY,\n getArrayOf,\n arrayToObject,\n hasOwn,\n flatten\n} from './utils';\nimport { ModifyError, BulkError, errnames, exceptions, fullNameExceptions, mapError } from './errors';\nimport Promise, {wrap, PSD, newScope, usePSD, rejection, NativePromise,\n incrementExpectedAwaits, decrementExpectedAwaits, AsyncFunction} from './Promise';\nimport Events from './Events';\nimport {\n nop,\n mirror,\n pureFunctionChain,\n hookCreatingChain,\n hookUpdatingChain,\n hookDeletingChain,\n promisableChain\n} from './chaining-functions';\nimport * as Debug from './debug';\n\nvar DEXIE_VERSION = '{version}',\n maxString = String.fromCharCode(65535),\n // maxKey is an Array if indexedDB implementations supports array keys (not supported by IE,Edge or Safari at the moment)\n // Otherwise maxKey is maxString. This is handy when needing an open upper border without limit.\n maxKey = (function(){try {IDBKeyRange.only([[]]);return [[]];}catch(e){return maxString;}})(),\n minKey = -Infinity,\n INVALID_KEY_ARGUMENT = \"Invalid key provided. Keys must be of type string, number, Date or Array.\",\n STRING_EXPECTED = \"String expected.\",\n connections = [],\n isIEOrEdge = typeof navigator !== 'undefined' && /(MSIE|Trident|Edge)/.test(navigator.userAgent),\n hasIEDeleteObjectStoreBug = isIEOrEdge,\n hangsOnDeleteLargeKeyRange = isIEOrEdge,\n dexieStackFrameFilter = frame => !/(dexie\\.js|dexie\\.min\\.js)/.test(frame),\n dbNamesDB;// Global database for backing Dexie.getDatabaseNames() on browser without indexedDB.webkitGetDatabaseNames() \n\n// Init debug\nDebug.setDebug(Debug.debug, dexieStackFrameFilter);\n\nexport default function Dexie(dbName, options) {\n /// Specify only if you wich to control which addons that should run on this instance\n var deps = Dexie.dependencies;\n var opts = extend({\n // Default Options\n addons: Dexie.addons, // Pick statically registered addons by default\n autoOpen: true, // Don't require db.open() explicitely.\n indexedDB: deps.indexedDB, // Backend IndexedDB api. Default to browser env.\n IDBKeyRange: deps.IDBKeyRange // Backend IDBKeyRange api. Default to browser env.\n }, options);\n var addons = opts.addons,\n autoOpen = opts.autoOpen,\n indexedDB = opts.indexedDB,\n IDBKeyRange = opts.IDBKeyRange;\n\n var globalSchema = this._dbSchema = {};\n var versions = [];\n var dbStoreNames = [];\n var allTables = {};\n ///\n var idbdb = null; // Instance of IDBDatabase\n var dbOpenError = null;\n var isBeingOpened = false;\n var onReadyBeingFired = null;\n var openComplete = false;\n var READONLY = \"readonly\", READWRITE = \"readwrite\";\n var db = this;\n var dbReadyResolve,\n dbReadyPromise = new Promise(resolve => {\n dbReadyResolve = resolve;\n }),\n cancelOpen,\n openCanceller = new Promise((_, reject) => {\n cancelOpen = reject;\n });\n var autoSchema = true;\n var hasNativeGetDatabaseNames = !!getNativeGetDatabaseNamesFn(indexedDB),\n hasGetAll;\n\n function init() {\n // Default subscribers to \"versionchange\" and \"blocked\".\n // Can be overridden by custom handlers. If custom handlers return false, these default\n // behaviours will be prevented.\n db.on(\"versionchange\", function (ev) {\n // Default behavior for versionchange event is to close database connection.\n // Caller can override this behavior by doing db.on(\"versionchange\", function(){ return false; });\n // Let's not block the other window from making it's delete() or open() call.\n // NOTE! This event is never fired in IE,Edge or Safari.\n if (ev.newVersion > 0)\n console.warn(`Another connection wants to upgrade database '${db.name}'. Closing db now to resume the upgrade.`);\n else\n console.warn(`Another connection wants to delete database '${db.name}'. Closing db now to resume the delete request.`);\n db.close();\n // In many web applications, it would be recommended to force window.reload()\n // when this event occurs. To do that, subscribe to the versionchange event\n // and call window.location.reload(true) if ev.newVersion > 0 (not a deletion)\n // The reason for this is that your current web app obviously has old schema code that needs\n // to be updated. Another window got a newer version of the app and needs to upgrade DB but\n // your window is blocking it unless we close it here.\n });\n db.on(\"blocked\", ev => {\n if (!ev.newVersion || ev.newVersion < ev.oldVersion)\n console.warn(`Dexie.delete('${db.name}') was blocked`);\n else\n console.warn(`Upgrade '${db.name}' blocked by other connection holding version ${ev.oldVersion/10}`);\n });\n }\n\n //\n //\n //\n // ------------------------- Versioning Framework---------------------------\n //\n //\n //\n\n this.version = function (versionNumber) {\n /// \n /// \n if (idbdb || isBeingOpened) throw new exceptions.Schema(\"Cannot add version when database is open\");\n this.verno = Math.max(this.verno, versionNumber);\n var versionInstance = versions.filter(function (v) { return v._cfg.version === versionNumber; })[0];\n if (versionInstance) return versionInstance;\n versionInstance = new Version(versionNumber);\n versions.push(versionInstance);\n versions.sort(lowerVersionFirst);\n // Disable autoschema mode, as at least one version is specified.\n autoSchema = false;\n return versionInstance;\n };\n\n function Version(versionNumber) {\n this._cfg = {\n version: versionNumber,\n storesSource: null,\n dbschema: {},\n tables: {},\n contentUpgrade: null\n };\n this.stores({}); // Derive earlier schemas by default.\n }\n\n extend(Version.prototype, {\n stores: function (stores) {\n /// \n /// Defines the schema for a particular version\n /// \n /// \n /// Example:
\n /// {users: \"id++,first,last,&username,*email\",
\n /// passwords: \"id++,&username\"}
\n ///
\n /// Syntax: {Table: \"[primaryKey][++],[&][*]index1,[&][*]index2,...\"}

\n /// Special characters:
\n /// \"&\" means unique key,
\n /// \"*\" means value is multiEntry,
\n /// \"++\" means auto-increment and only applicable for primary key
\n /// \n this._cfg.storesSource = this._cfg.storesSource ? extend(this._cfg.storesSource, stores) : stores;\n\n // Derive stores from earlier versions if they are not explicitely specified as null or a new syntax.\n var storesSpec = {};\n versions.forEach(function (version) { // 'versions' is always sorted by lowest version first.\n extend(storesSpec, version._cfg.storesSource);\n });\n\n var dbschema = (this._cfg.dbschema = {});\n this._parseStoresSpec(storesSpec, dbschema);\n // Update the latest schema to this version\n // Update API\n globalSchema = db._dbSchema = dbschema;\n removeTablesApi([allTables, db, Transaction.prototype]); // Keep Transaction.prototype even though it should be depr.\n setApiOnPlace([allTables, db, Transaction.prototype, this._cfg.tables], keys(dbschema), dbschema);\n dbStoreNames = keys(dbschema);\n return this;\n },\n upgrade: function (upgradeFunction) {\n this._cfg.contentUpgrade = upgradeFunction;\n return this;\n },\n _parseStoresSpec: function (stores, outSchema) {\n keys(stores).forEach(function (tableName) {\n if (stores[tableName] !== null) {\n var instanceTemplate = {};\n var indexes = parseIndexSyntax(stores[tableName]);\n var primKey = indexes.shift();\n if (primKey.multi) throw new exceptions.Schema(\"Primary key cannot be multi-valued\");\n if (primKey.keyPath) setByKeyPath(instanceTemplate, primKey.keyPath, primKey.auto ? 0 : primKey.keyPath);\n indexes.forEach(function (idx) {\n if (idx.auto) throw new exceptions.Schema(\"Only primary key can be marked as autoIncrement (++)\");\n if (!idx.keyPath) throw new exceptions.Schema(\"Index must have a name and cannot be an empty string\");\n setByKeyPath(instanceTemplate, idx.keyPath, idx.compound ? idx.keyPath.map(function () { return \"\"; }) : \"\");\n });\n outSchema[tableName] = new TableSchema(tableName, primKey, indexes, instanceTemplate);\n }\n });\n }\n });\n \n function runUpgraders (oldVersion, idbtrans, reject) {\n var trans = db._createTransaction(READWRITE, dbStoreNames, globalSchema);\n trans.create(idbtrans);\n trans._completion.catch(reject);\n var rejectTransaction = trans._reject.bind(trans);\n newScope(function () {\n PSD.trans = trans;\n if (oldVersion === 0) {\n // Create tables:\n keys(globalSchema).forEach(function (tableName) {\n createTable(idbtrans, tableName, globalSchema[tableName].primKey, globalSchema[tableName].indexes);\n });\n Promise.follow(()=>db.on.populate.fire(trans)).catch(rejectTransaction);\n } else\n updateTablesAndIndexes(oldVersion, trans, idbtrans).catch(rejectTransaction);\n });\n }\n\n function updateTablesAndIndexes (oldVersion, trans, idbtrans) {\n // Upgrade version to version, step-by-step from oldest to newest version.\n // Each transaction object will contain the table set that was current in that version (but also not-yet-deleted tables from its previous version)\n var queue = [];\n var oldVersionStruct = versions.filter(version => version._cfg.version === oldVersion)[0];\n if (!oldVersionStruct) throw new exceptions.Upgrade(\"Dexie specification of currently installed DB version is missing\");\n globalSchema = db._dbSchema = oldVersionStruct._cfg.dbschema;\n var anyContentUpgraderHasRun = false;\n\n var versToRun = versions.filter(v => v._cfg.version > oldVersion);\n versToRun.forEach(function (version) {\n /// \n queue.push(()=>{\n var oldSchema = globalSchema;\n var newSchema = version._cfg.dbschema;\n adjustToExistingIndexNames(oldSchema, idbtrans);\n adjustToExistingIndexNames(newSchema, idbtrans);\n globalSchema = db._dbSchema = newSchema;\n var diff = getSchemaDiff(oldSchema, newSchema); \n // Add tables \n diff.add.forEach(function (tuple) {\n createTable(idbtrans, tuple[0], tuple[1].primKey, tuple[1].indexes);\n });\n // Change tables\n diff.change.forEach(function (change) {\n if (change.recreate) {\n throw new exceptions.Upgrade(\"Not yet support for changing primary key\");\n } else {\n var store = idbtrans.objectStore(change.name);\n // Add indexes\n change.add.forEach(function (idx) {\n addIndex(store, idx);\n });\n // Update indexes\n change.change.forEach(function (idx) {\n store.deleteIndex(idx.name);\n addIndex(store, idx);\n });\n // Delete indexes\n change.del.forEach(function (idxName) {\n store.deleteIndex(idxName);\n });\n }\n });\n if (version._cfg.contentUpgrade) {\n anyContentUpgraderHasRun = true;\n return Promise.follow(()=>{\n version._cfg.contentUpgrade(trans);\n });\n }\n });\n queue.push(function (idbtrans) {\n if (!anyContentUpgraderHasRun || !hasIEDeleteObjectStoreBug) { // Dont delete old tables if ieBug is present and a content upgrader has run. Let tables be left in DB so far. This needs to be taken care of.\n var newSchema = version._cfg.dbschema;\n // Delete old tables\n deleteRemovedTables(newSchema, idbtrans);\n }\n });\n });\n\n // Now, create a queue execution engine\n function runQueue () {\n return queue.length ? Promise.resolve(queue.shift()(trans.idbtrans)).then(runQueue) :\n Promise.resolve();\n }\n \n return runQueue().then(()=>{\n createMissingTables(globalSchema, idbtrans); // At last, make sure to create any missing tables. (Needed by addons that add stores to DB without specifying version)\n });\n }\n\n function getSchemaDiff(oldSchema, newSchema) {\n var diff = {\n del: [], // Array of table names\n add: [], // Array of [tableName, newDefinition]\n change: [] // Array of {name: tableName, recreate: newDefinition, del: delIndexNames, add: newIndexDefs, change: changedIndexDefs}\n };\n for (var table in oldSchema) {\n if (!newSchema[table]) diff.del.push(table);\n }\n for (table in newSchema) {\n var oldDef = oldSchema[table],\n newDef = newSchema[table];\n if (!oldDef) {\n diff.add.push([table, newDef]);\n } else {\n var change = {\n name: table,\n def: newDef,\n recreate: false,\n del: [],\n add: [],\n change: []\n };\n if (oldDef.primKey.src !== newDef.primKey.src) {\n // Primary key has changed. Remove and re-add table.\n change.recreate = true;\n diff.change.push(change);\n } else {\n // Same primary key. Just find out what differs:\n var oldIndexes = oldDef.idxByName;\n var newIndexes = newDef.idxByName;\n for (var idxName in oldIndexes) {\n if (!newIndexes[idxName]) change.del.push(idxName);\n }\n for (idxName in newIndexes) {\n var oldIdx = oldIndexes[idxName],\n newIdx = newIndexes[idxName];\n if (!oldIdx) change.add.push(newIdx);\n else if (oldIdx.src !== newIdx.src) change.change.push(newIdx);\n }\n if (change.del.length > 0 || change.add.length > 0 || change.change.length > 0) {\n diff.change.push(change);\n }\n }\n }\n }\n return diff;\n }\n\n function createTable(idbtrans, tableName, primKey, indexes) {\n /// \n var store = idbtrans.db.createObjectStore(tableName, primKey.keyPath ? { keyPath: primKey.keyPath, autoIncrement: primKey.auto } : { autoIncrement: primKey.auto });\n indexes.forEach(function (idx) { addIndex(store, idx); });\n return store;\n }\n\n function createMissingTables(newSchema, idbtrans) {\n keys(newSchema).forEach(function (tableName) {\n if (!idbtrans.db.objectStoreNames.contains(tableName)) {\n createTable(idbtrans, tableName, newSchema[tableName].primKey, newSchema[tableName].indexes);\n }\n });\n }\n\n function deleteRemovedTables(newSchema, idbtrans) {\n for (var i = 0; i < idbtrans.db.objectStoreNames.length; ++i) {\n var storeName = idbtrans.db.objectStoreNames[i];\n if (newSchema[storeName] == null) {\n idbtrans.db.deleteObjectStore(storeName);\n }\n }\n }\n\n function addIndex(store, idx) {\n store.createIndex(idx.name, idx.keyPath, { unique: idx.unique, multiEntry: idx.multi });\n }\n\n //\n //\n // Dexie Protected API\n //\n //\n\n this._allTables = allTables;\n\n this._createTransaction = function (mode, storeNames, dbschema, parentTransaction) {\n return new Transaction(mode, storeNames, dbschema, parentTransaction);\n };\n\n /* Generate a temporary transaction when db operations are done outside a transaction scope.\n */\n function tempTransaction(mode, storeNames, fn) { // Last argument is \"writeLocked\". But this doesnt apply to oneshot direct db operations, so we ignore it.\n if (!openComplete && (!PSD.letThrough)) {\n if (!isBeingOpened) {\n if (!autoOpen)\n return rejection (new exceptions.DatabaseClosed());\n db.open().catch(nop); // Open in background. If if fails, it will be catched by the final promise anyway.\n }\n return dbReadyPromise.then(()=>tempTransaction(mode, storeNames, fn));\n } else {\n var trans = db._createTransaction(mode, storeNames, globalSchema);\n try { trans.create(); } catch (ex) { return rejection(ex); }\n return trans._promise(mode, function (resolve, reject) {\n return newScope(function () { // OPTIMIZATION POSSIBLE? newScope() not needed because it's already done in _promise.\n PSD.trans = trans;\n return fn(resolve, reject, trans);\n });\n }).then(result => {\n // Instead of resolving value directly, wait with resolving it until transaction has completed.\n // Otherwise the data would not be in the DB if requesting it in the then() operation.\n // Specifically, to ensure that the following expression will work:\n //\n // db.friends.put({name: \"Arne\"}).then(function () {\n // db.friends.where(\"name\").equals(\"Arne\").count(function(count) {\n // assert (count === 1);\n // });\n // });\n //\n return trans._completion.then(()=>result);\n });/*.catch(err => { // Don't do this as of now. If would affect bulk- and modify methods in a way that could be more intuitive. But wait! Maybe change in next major.\n trans._reject(err);\n return rejection(err);\n });*/\n }\n }\n\n this._whenReady = function (fn) {\n return openComplete || PSD.letThrough ? fn() : new Promise ((resolve, reject) => {\n if (!isBeingOpened) {\n if (!autoOpen) {\n reject(new exceptions.DatabaseClosed());\n return;\n }\n db.open().catch(nop); // Open in background. If if fails, it will be catched by the final promise anyway.\n }\n dbReadyPromise.then(resolve, reject);\n }).then(fn);\n };\n \n //\n //\n //\n //\n // Dexie API\n //\n //\n //\n\n this.verno = 0;\n\n this.open = function () {\n if (isBeingOpened || idbdb)\n return dbReadyPromise.then(()=> dbOpenError ? rejection (dbOpenError) : db);\n Debug.debug && (openCanceller._stackHolder = Debug.getErrorWithStack()); // Let stacks point to when open() was called rather than where new Dexie() was called.\n isBeingOpened = true;\n dbOpenError = null;\n openComplete = false;\n \n // Function pointers to call when the core opening process completes.\n var resolveDbReady = dbReadyResolve,\n // upgradeTransaction to abort on failure.\n upgradeTransaction = null;\n \n return Promise.race([openCanceller, new Promise((resolve, reject) => {\n // Multiply db.verno with 10 will be needed to workaround upgrading bug in IE:\n // IE fails when deleting objectStore after reading from it.\n // A future version of Dexie.js will stopover an intermediate version to workaround this.\n // At that point, we want to be backward compatible. Could have been multiplied with 2, but by using 10, it is easier to map the number to the real version number.\n \n // If no API, throw!\n if (!indexedDB) throw new exceptions.MissingAPI(\n \"indexedDB API not found. If using IE10+, make sure to run your code on a server URL \"+\n \"(not locally). If using old Safari versions, make sure to include indexedDB polyfill.\");\n \n var req = autoSchema ? indexedDB.open(dbName) : indexedDB.open(dbName, Math.round(db.verno * 10));\n if (!req) throw new exceptions.MissingAPI(\"IndexedDB API not available\"); // May happen in Safari private mode, see https://github.com/dfahlander/Dexie.js/issues/134\n req.onerror = eventRejectHandler(reject);\n req.onblocked = wrap(fireOnBlocked);\n req.onupgradeneeded = wrap (function (e) {\n upgradeTransaction = req.transaction;\n if (autoSchema && !db._allowEmptyDB) { // Unless an addon has specified db._allowEmptyDB, lets make the call fail.\n // Caller did not specify a version or schema. Doing that is only acceptable for opening alread existing databases.\n // If onupgradeneeded is called it means database did not exist. Reject the open() promise and make sure that we\n // do not create a new database by accident here.\n req.onerror = preventDefault; // Prohibit onabort error from firing before we're done!\n upgradeTransaction.abort(); // Abort transaction (would hope that this would make DB disappear but it doesnt.)\n // Close database and delete it.\n req.result.close();\n var delreq = indexedDB.deleteDatabase(dbName); // The upgrade transaction is atomic, and javascript is single threaded - meaning that there is no risk that we delete someone elses database here!\n delreq.onsuccess = delreq.onerror = wrap(function () {\n reject (new exceptions.NoSuchDatabase(`Database ${dbName} doesnt exist`));\n });\n } else {\n upgradeTransaction.onerror = eventRejectHandler(reject);\n var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion; // Safari 8 fix.\n runUpgraders(oldVer / 10, upgradeTransaction, reject, req);\n }\n }, reject);\n \n req.onsuccess = wrap (function () {\n // Core opening procedure complete. Now let's just record some stuff.\n upgradeTransaction = null;\n idbdb = req.result;\n connections.push(db); // Used for emulating versionchange event on IE/Edge/Safari.\n\n if (autoSchema) readGlobalSchema();\n else if (idbdb.objectStoreNames.length > 0) {\n try {\n adjustToExistingIndexNames(globalSchema, idbdb.transaction(safariMultiStoreFix(idbdb.objectStoreNames), READONLY));\n } catch (e) {\n // Safari may bail out if > 1 store names. However, this shouldnt be a showstopper. Issue #120.\n }\n }\n \n idbdb.onversionchange = wrap(ev => {\n db._vcFired = true; // detect implementations that not support versionchange (IE/Edge/Safari)\n db.on(\"versionchange\").fire(ev);\n });\n \n if (!hasNativeGetDatabaseNames && dbName !== '__dbnames') {\n dbNamesDB.dbnames.put({name: dbName}).catch(nop);\n }\n\n resolve();\n\n }, reject);\n })]).then(() => {\n // Before finally resolving the dbReadyPromise and this promise,\n // call and await all on('ready') subscribers:\n // Dexie.vip() makes subscribers able to use the database while being opened.\n // This is a must since these subscribers take part of the opening procedure.\n onReadyBeingFired = [];\n return Promise.resolve(Dexie.vip(db.on.ready.fire)).then(function fireRemainders() {\n if (onReadyBeingFired.length > 0) {\n // In case additional subscribers to db.on('ready') were added during the time db.on.ready.fire was executed.\n let remainders = onReadyBeingFired.reduce(promisableChain, nop);\n onReadyBeingFired = [];\n return Promise.resolve(Dexie.vip(remainders)).then(fireRemainders)\n }\n });\n }).finally(()=>{\n onReadyBeingFired = null;\n }).then(()=>{\n // Resolve the db.open() with the db instance.\n isBeingOpened = false;\n return db;\n }).catch(err => {\n try {\n // Did we fail within onupgradeneeded? Make sure to abort the upgrade transaction so it doesnt commit.\n upgradeTransaction && upgradeTransaction.abort();\n } catch (e) { }\n isBeingOpened = false; // Set before calling db.close() so that it doesnt reject openCanceller again (leads to unhandled rejection event).\n db.close(); // Closes and resets idbdb, removes connections, resets dbReadyPromise and openCanceller so that a later db.open() is fresh.\n // A call to db.close() may have made on-ready subscribers fail. Use dbOpenError if set, since err could be a follow-up error on that.\n dbOpenError = err; // Record the error. It will be used to reject further promises of db operations.\n return rejection (dbOpenError);\n }).finally(()=>{\n openComplete = true;\n resolveDbReady(); // dbReadyPromise is resolved no matter if open() rejects or resolved. It's just to wake up waiters.\n });\n };\n \n this.close = function () {\n var idx = connections.indexOf(db);\n if (idx >= 0) connections.splice(idx, 1); \n if (idbdb) {\n try {idbdb.close();} catch(e){}\n idbdb = null;\n }\n autoOpen = false;\n dbOpenError = new exceptions.DatabaseClosed();\n if (isBeingOpened)\n cancelOpen(dbOpenError);\n // Reset dbReadyPromise promise:\n dbReadyPromise = new Promise(resolve => {\n dbReadyResolve = resolve;\n });\n openCanceller = new Promise((_, reject) => {\n cancelOpen = reject;\n });\n };\n \n this.delete = function () {\n var hasArguments = arguments.length > 0;\n return new Promise(function (resolve, reject) {\n if (hasArguments) throw new exceptions.InvalidArgument(\"Arguments not allowed in db.delete()\");\n if (isBeingOpened) {\n dbReadyPromise.then(doDelete);\n } else {\n doDelete();\n }\n function doDelete() {\n db.close();\n var req = indexedDB.deleteDatabase(dbName);\n req.onsuccess = wrap(function () {\n if (!hasNativeGetDatabaseNames) {\n dbNamesDB.dbnames.delete(dbName).catch(nop);\n }\n resolve();\n });\n req.onerror = eventRejectHandler(reject);\n req.onblocked = fireOnBlocked;\n }\n });\n };\n\n this.backendDB = function () {\n return idbdb;\n };\n\n this.isOpen = function () {\n return idbdb !== null;\n };\n this.hasBeenClosed = function () {\n return dbOpenError && (dbOpenError instanceof exceptions.DatabaseClosed);\n }\n this.hasFailed = function () {\n return dbOpenError !== null;\n };\n this.dynamicallyOpened = function() {\n return autoSchema;\n };\n\n //\n // Properties\n //\n this.name = dbName;\n\n // db.tables - an array of all Table instances.\n props(this, {\n tables: {\n get () {\n /// \n return keys(allTables).map(function (name) { return allTables[name]; });\n }\n }\n });\n\n //\n // Events\n //\n this.on = Events(this, \"populate\", \"blocked\", \"versionchange\", {ready: [promisableChain, nop]});\n\n this.on.ready.subscribe = override (this.on.ready.subscribe, function (subscribe) {\n return (subscriber, bSticky) => {\n Dexie.vip(()=>{\n if (openComplete) {\n // Database already open. Call subscriber asap.\n if (!dbOpenError) Promise.resolve().then(subscriber);\n // bSticky: Also subscribe to future open sucesses (after close / reopen) \n if (bSticky) subscribe(subscriber);\n } else if (onReadyBeingFired) {\n // db.on('ready') subscribers are currently being executed and have not yet resolved or rejected\n onReadyBeingFired.push(subscriber);\n if (bSticky) subscribe(subscriber);\n } else {\n // Database not yet open. Subscribe to it.\n subscribe(subscriber);\n // If bSticky is falsy, make sure to unsubscribe subscriber when fired once.\n if (!bSticky) subscribe(function unsubscribe() {\n db.on.ready.unsubscribe(subscriber);\n db.on.ready.unsubscribe(unsubscribe);\n });\n }\n });\n }\n });\n\n this.transaction = function () {\n /// \n ///\n /// \n /// \"r\" for readonly, or \"rw\" for readwrite\n /// Table instance, Array of Table instances, String or String Array of object stores to include in the transaction\n /// Function to execute with transaction\n\n var args = extractTransactionArgs.apply(this, arguments);\n return this._transaction.apply(this, args);\n }\n \n function extractTransactionArgs (mode, _tableArgs_, scopeFunc) {\n // Let table arguments be all arguments between mode and last argument.\n var i = arguments.length;\n if (i < 2) throw new exceptions.InvalidArgument(\"Too few arguments\");\n // Prevent optimzation killer (https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments)\n // and clone arguments except the first one into local var 'args'.\n var args = new Array(i - 1);\n while (--i) args[i-1] = arguments[i];\n // Let scopeFunc be the last argument and pop it so that args now only contain the table arguments.\n scopeFunc = args.pop();\n var tables = flatten(args); // Support using array as middle argument, or a mix of arrays and non-arrays.\n return [mode, tables, scopeFunc];\n }\n\n this._transaction = function (mode, tables, scopeFunc) {\n var parentTransaction = PSD.trans;\n // Check if parent transactions is bound to this db instance, and if caller wants to reuse it\n if (!parentTransaction || parentTransaction.db !== db || mode.indexOf('!') !== -1) parentTransaction = null;\n var onlyIfCompatible = mode.indexOf('?') !== -1;\n mode = mode.replace('!', '').replace('?', ''); // Ok. Will change arguments[0] as well but we wont touch arguments henceforth.\n \n try {\n //\n // Get storeNames from arguments. Either through given table instances, or through given table names.\n //\n var storeNames = tables.map(table => {\n var storeName = table instanceof Table ? table.name : table;\n if (typeof storeName !== 'string') throw new TypeError(\"Invalid table argument to Dexie.transaction(). Only Table or String are allowed\");\n return storeName;\n });\n\n //\n // Resolve mode. Allow shortcuts \"r\" and \"rw\".\n //\n if (mode == \"r\" || mode == READONLY)\n mode = READONLY;\n else if (mode == \"rw\" || mode == READWRITE)\n mode = READWRITE;\n else\n throw new exceptions.InvalidArgument(\"Invalid transaction mode: \" + mode);\n\n if (parentTransaction) {\n // Basic checks\n if (parentTransaction.mode === READONLY && mode === READWRITE) {\n if (onlyIfCompatible) {\n // Spawn new transaction instead.\n parentTransaction = null; \n }\n else throw new exceptions.SubTransaction(\"Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY\");\n }\n if (parentTransaction) {\n storeNames.forEach(function (storeName) {\n if (parentTransaction && parentTransaction.storeNames.indexOf(storeName) === -1) {\n if (onlyIfCompatible) {\n // Spawn new transaction instead.\n parentTransaction = null; \n }\n else throw new exceptions.SubTransaction(\"Table \" + storeName +\n \" not included in parent transaction.\");\n }\n });\n }\n if (onlyIfCompatible && parentTransaction && !parentTransaction.active) {\n // '?' mode should not keep using an inactive transaction.\n parentTransaction = null;\n }\n }\n } catch (e) {\n return parentTransaction ?\n parentTransaction._promise(null, (_, reject) => {reject(e);}) :\n rejection (e);\n }\n // If this is a sub-transaction, lock the parent and then launch the sub-transaction.\n return (parentTransaction ?\n parentTransaction._promise(mode, enterTransactionScope, \"lock\") :\n PSD.trans ?\n // no parent transaction despite PSD.trans exists. Make sure also\n // that the zone we create is not a sub-zone of current, because\n // Promise.follow() should not wait for it if so.\n usePSD(PSD.transless, ()=>db._whenReady(enterTransactionScope)) :\n db._whenReady (enterTransactionScope));\n \n function enterTransactionScope() {\n return Promise.resolve().then(()=>{\n // Keep a pointer to last non-transactional PSD to use if someone calls Dexie.ignoreTransaction().\n var transless = PSD.transless || PSD;\n // Our transaction.\n //return new Promise((resolve, reject) => {\n var trans = db._createTransaction(mode, storeNames, globalSchema, parentTransaction);\n // Let the transaction instance be part of a Promise-specific data (PSD) value.\n var zoneProps = {\n trans: trans,\n transless: transless\n };\n\n if (parentTransaction) {\n // Emulate transaction commit awareness for inner transaction (must 'commit' when the inner transaction has no more operations ongoing)\n trans.idbtrans = parentTransaction.idbtrans;\n } else {\n trans.create(); // Create the backend transaction so that complete() or error() will trigger even if no operation is made upon it.\n }\n\n // Support for native async await.\n if (scopeFunc.constructor === AsyncFunction) {\n incrementExpectedAwaits();\n }\n\n var returnValue;\n var promiseFollowed = Promise.follow(()=>{\n // Finally, call the scope function with our table and transaction arguments.\n returnValue = scopeFunc.call(trans, trans);\n if (returnValue) {\n if (returnValue.constructor === NativePromise) {\n var decrementor = decrementExpectedAwaits.bind(null, null);\n returnValue.then(decrementor, decrementor);\n } else if (typeof returnValue.next === 'function' && typeof returnValue.throw === 'function') {\n // scopeFunc returned an iterator with throw-support. Handle yield as await.\n returnValue = awaitIterator(returnValue);\n }\n }\n }, zoneProps);\n return (returnValue && typeof returnValue.then === 'function' ?\n // Promise returned. User uses promise-style transactions.\n Promise.resolve(returnValue).then(x => trans.active ?\n x // Transaction still active. Continue.\n : rejection(new exceptions.PrematureCommit(\n \"Transaction committed too early. See http://bit.ly/2kdckMn\")))\n // No promise returned. Wait for all outstanding promises before continuing. \n : promiseFollowed.then(()=>returnValue)\n ).then(x => {\n // sub transactions don't react to idbtrans.oncomplete. We must trigger a completion:\n if (parentTransaction) trans._resolve();\n // wait for trans._completion\n // (if root transaction, this means 'complete' event. If sub-transaction, we've just fired it ourselves)\n return trans._completion.then(()=>x);\n }).catch (e => {\n trans._reject(e); // Yes, above then-handler were maybe not called because of an unhandled rejection in scopeFunc!\n return rejection(e);\n });\n });\n }\n };\n\n this.table = function (tableName) {\n /// \n if (!hasOwn(allTables, tableName)) { throw new exceptions.InvalidTable(`Table ${tableName} does not exist`); }\n return allTables[tableName];\n };\n\n //\n //\n //\n // Table Class\n //\n //\n //\n function Table(name, tableSchema, optionalTrans) {\n /// \n this.name = name;\n this.schema = tableSchema;\n this._tx = optionalTrans;\n this.hook = allTables[name] ? allTables[name].hook : Events(null, {\n \"creating\": [hookCreatingChain, nop],\n \"reading\": [pureFunctionChain, mirror],\n \"updating\": [hookUpdatingChain, nop],\n \"deleting\": [hookDeletingChain, nop]\n });\n }\n\n function BulkErrorHandlerCatchAll(errorList, done, supportHooks) {\n return (supportHooks ? hookedEventRejectHandler : eventRejectHandler)(e => {\n errorList.push(e);\n done && done();\n });\n }\n\n function bulkDelete(idbstore, trans, keysOrTuples, hasDeleteHook, deletingHook) {\n // If hasDeleteHook, keysOrTuples must be an array of tuples: [[key1, value2],[key2,value2],...],\n // else keysOrTuples must be just an array of keys: [key1, key2, ...].\n return new Promise((resolve, reject)=>{\n var len = keysOrTuples.length,\n lastItem = len - 1;\n if (len === 0) return resolve();\n if (!hasDeleteHook) {\n for (var i=0; i < len; ++i) {\n var req = idbstore.delete(keysOrTuples[i]);\n req.onerror = eventRejectHandler(reject);\n if (i === lastItem) req.onsuccess = wrap(()=>resolve());\n }\n } else {\n var hookCtx,\n errorHandler = hookedEventRejectHandler(reject),\n successHandler = hookedEventSuccessHandler(null);\n tryCatch(()=> {\n for (var i = 0; i < len; ++i) {\n hookCtx = {onsuccess: null, onerror: null};\n var tuple = keysOrTuples[i];\n deletingHook.call(hookCtx, tuple[0], tuple[1], trans);\n var req = idbstore.delete(tuple[0]);\n req._hookCtx = hookCtx;\n req.onerror = errorHandler;\n if (i === lastItem)\n req.onsuccess = hookedEventSuccessHandler(resolve);\n else\n req.onsuccess = successHandler;\n }\n }, err=>{\n hookCtx.onerror && hookCtx.onerror(err);\n throw err;\n });\n }\n });\n } \n\n props(Table.prototype, {\n\n //\n // Table Protected Methods\n //\n\n _trans: function getTransaction(mode, fn, writeLocked) {\n var trans = this._tx || PSD.trans;\n return trans && trans.db === db ?\n trans === PSD.trans ?\n trans._promise (mode, fn, writeLocked) :\n newScope(()=>trans._promise(mode, fn, writeLocked), {trans: trans, transless: PSD.transless || PSD}) :\n tempTransaction (mode, [this.name], fn);\n },\n _idbstore: function getIDBObjectStore(mode, fn, writeLocked) {\n var tableName = this.name;\n function supplyIdbStore (resolve, reject, trans) {\n if (trans.storeNames.indexOf(tableName) === -1)\n throw new exceptions.NotFound(\"Table\" + tableName + \" not part of transaction\");\n return fn(resolve, reject, trans.idbtrans.objectStore(tableName), trans);\n }\n return this._trans(mode, supplyIdbStore, writeLocked);\n },\n\n //\n // Table Public Methods\n //\n get: function (keyOrCrit, cb) {\n if (keyOrCrit && keyOrCrit.constructor === Object)\n return this.where(keyOrCrit).first(cb);\n var self = this;\n return this._idbstore(READONLY, function (resolve, reject, idbstore) {\n var req = idbstore.get(keyOrCrit);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function () {\n resolve(self.hook.reading.fire(req.result));\n }, reject);\n }).then(cb);\n },\n where: function (indexOrCrit) {\n if (typeof indexOrCrit === 'string')\n return new WhereClause(this, indexOrCrit);\n if (isArray(indexOrCrit))\n return new WhereClause(this, `[${indexOrCrit.join('+')}]`);\n // indexOrCrit is an object map of {[keyPath]:value} \n var keyPaths = keys(indexOrCrit);\n if (keyPaths.length === 1)\n // Only one critera. This was the easy case:\n return this\n .where(keyPaths[0])\n .equals(indexOrCrit[keyPaths[0]]);\n \n // Multiple criterias.\n // Let's try finding a compound index that matches all keyPaths in\n // arbritary order:\n var compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(ix =>\n ix.compound &&\n keyPaths.every(keyPath => ix.keyPath.indexOf(keyPath) >= 0) &&\n ix.keyPath.every(keyPath => keyPaths.indexOf(keyPath) >= 0))[0];\n\n if (compoundIndex && maxKey !== maxString)\n // Cool! We found such compound index\n // and this browser supports compound indexes (maxKey !== maxString)!\n return this\n .where(compoundIndex.name)\n .equals(compoundIndex.keyPath.map(kp => indexOrCrit[kp]));\n\n if (!compoundIndex) console.warn(\n `The query ${JSON.stringify(indexOrCrit)} on ${this.name} would benefit of a ` +\n `compound index [${keyPaths.join('+')}]`);\n \n // Ok, now let's fallback to finding at least one matching index\n // and filter the rest.\n var idxByName = this.schema.idxByName;\n var simpleIndex = keyPaths.reduce((r,keyPath)=>[\n r[0] || idxByName[keyPath],\n r[0] || !idxByName[keyPath] ?\n combine(\n r[1],\n x =>''+getByKeyPath(x, keyPath) ==\n ''+indexOrCrit[keyPath])\n : r[1]\n ], [null, null]);\n \n var idx = simpleIndex[0];\n return idx ?\n this.where(idx.name).equals(indexOrCrit[idx.keyPath])\n .filter(simpleIndex[1]) :\n compoundIndex ?\n this.filter(simpleIndex[1]) : // Has compound but browser bad. Allow filter.\n this.where(keyPaths).equals(''); // No index at all. Fail lazily.\n },\n count: function (cb) {\n return this.toCollection().count(cb);\n },\n offset: function (offset) {\n return this.toCollection().offset(offset);\n },\n limit: function (numRows) {\n return this.toCollection().limit(numRows);\n },\n reverse: function () {\n return this.toCollection().reverse();\n },\n filter: function (filterFunction) {\n return this.toCollection().and(filterFunction);\n },\n each: function (fn) {\n return this.toCollection().each(fn);\n },\n toArray: function (cb) {\n return this.toCollection().toArray(cb);\n },\n orderBy: function (index) {\n return new Collection(\n new WhereClause(this, isArray(index) ?\n `[${index.join('+')}]` :\n index));\n },\n\n toCollection: function () {\n return new Collection(new WhereClause(this));\n },\n\n mapToClass: function (constructor, structure) {\n /// \n /// Map table to a javascript constructor function. Objects returned from the database will be instances of this class, making\n /// it possible to the instanceOf operator as well as extending the class using constructor.prototype.method = function(){...}.\n /// \n /// Constructor function representing the class.\n /// Helps IDE code completion by knowing the members that objects contain and not just the indexes. Also\n /// know what type each member has. Example: {name: String, emailAddresses: [String], password}\n this.schema.mappedClass = constructor;\n var instanceTemplate = Object.create(constructor.prototype);\n if (structure) {\n // structure and instanceTemplate is for IDE code competion only while constructor.prototype is for actual inheritance.\n applyStructure(instanceTemplate, structure);\n }\n this.schema.instanceTemplate = instanceTemplate;\n\n // Now, subscribe to the when(\"reading\") event to make all objects that come out from this table inherit from given class\n // no matter which method to use for reading (Table.get() or Table.where(...)... )\n var readHook = function (obj) {\n if (!obj) return obj; // No valid object. (Value is null). Return as is.\n // Create a new object that derives from constructor:\n var res = Object.create(constructor.prototype);\n // Clone members:\n for (var m in obj) if (hasOwn(obj, m)) try {res[m] = obj[m];} catch(_){}\n return res;\n };\n\n if (this.schema.readHook) {\n this.hook.reading.unsubscribe(this.schema.readHook);\n }\n this.schema.readHook = readHook;\n this.hook(\"reading\", readHook);\n return constructor;\n },\n defineClass: function (structure) {\n /// \n /// Define all members of the class that represents the table. This will help code completion of when objects are read from the database\n /// as well as making it possible to extend the prototype of the returned constructor function.\n /// \n /// Helps IDE code completion by knowing the members that objects contain and not just the indexes. Also\n /// know what type each member has. Example: {name: String, emailAddresses: [String], properties: {shoeSize: Number}}\n return this.mapToClass(Dexie.defineClass(structure), structure);\n },\n\n bulkDelete: function (keys) {\n if (this.hook.deleting.fire === nop) {\n return this._idbstore(READWRITE, (resolve, reject, idbstore, trans) => {\n resolve (bulkDelete(idbstore, trans, keys, false, nop));\n });\n } else {\n return this\n .where(':id')\n .anyOf(keys)\n .delete()\n .then(()=>{}); // Resolve with undefined.\n }\n },\n bulkPut: function(objects, keys) {\n return this._idbstore(READWRITE, (resolve, reject, idbstore) => {\n if (!idbstore.keyPath && !this.schema.primKey.auto && !keys)\n throw new exceptions.InvalidArgument(\"bulkPut() with non-inbound keys requires keys array in second argument\");\n if (idbstore.keyPath && keys)\n throw new exceptions.InvalidArgument(\"bulkPut(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length)\n throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n if (objects.length === 0) return resolve(); // Caller provided empty list.\n const done = result => {\n if (errorList.length === 0) resolve(result);\n else reject(new BulkError(`${this.name}.bulkPut(): ${errorList.length} of ${numObjs} operations failed`, errorList));\n };\n var req,\n errorList = [],\n errorHandler,\n numObjs = objects.length,\n table = this;\n if (this.hook.creating.fire === nop && this.hook.updating.fire === nop) {\n //\n // Standard Bulk (no 'creating' or 'updating' hooks to care about)\n //\n errorHandler = BulkErrorHandlerCatchAll(errorList);\n for (var i = 0, l = objects.length; i < l; ++i) {\n req = keys ? idbstore.put(objects[i], keys[i]) : idbstore.put(objects[i]);\n req.onerror = errorHandler;\n }\n // Only need to catch success or error on the last operation\n // according to the IDB spec.\n req.onerror = BulkErrorHandlerCatchAll(errorList, done);\n req.onsuccess = eventSuccessHandler(done);\n } else {\n var effectiveKeys = keys || idbstore.keyPath && objects.map(o=>getByKeyPath(o, idbstore.keyPath));\n // Generate map of {[key]: object}\n var objectLookup = effectiveKeys && arrayToObject(effectiveKeys, (key, i) => key != null && [key, objects[i]]); \n var promise = !effectiveKeys ?\n\n // Auto-incremented key-less objects only without any keys argument.\n table.bulkAdd(objects) :\n\n // Keys provided. Either as inbound in provided objects, or as a keys argument.\n // Begin with updating those that exists in DB:\n table.where(':id').anyOf(effectiveKeys.filter(key => key != null)).modify(function () {\n this.value = objectLookup[this.primKey];\n objectLookup[this.primKey] = null; // Mark as \"don't add this\"\n }).catch(ModifyError, e => {\n errorList = e.failures; // No need to concat here. These are the first errors added.\n }).then(()=> {\n // Now, let's examine which items didnt exist so we can add them:\n var objsToAdd = [],\n keysToAdd = keys && [];\n // Iterate backwards. Why? Because if same key was used twice, just add the last one.\n for (var i=effectiveKeys.length-1; i>=0; --i) {\n var key = effectiveKeys[i];\n if (key == null || objectLookup[key]) {\n objsToAdd.push(objects[i]);\n keys && keysToAdd.push(key);\n if (key != null) objectLookup[key] = null; // Mark as \"dont add again\"\n }\n }\n // The items are in reverse order so reverse them before adding.\n // Could be important in order to get auto-incremented keys the way the caller\n // would expect. Could have used unshift instead of push()/reverse(),\n // but: http://jsperf.com/unshift-vs-reverse\n objsToAdd.reverse();\n keys && keysToAdd.reverse();\n return table.bulkAdd(objsToAdd, keysToAdd);\n }).then(lastAddedKey => {\n // Resolve with key of the last object in given arguments to bulkPut():\n var lastEffectiveKey = effectiveKeys[effectiveKeys.length - 1]; // Key was provided.\n return lastEffectiveKey != null ? lastEffectiveKey : lastAddedKey;\n });\n\n promise.then(done).catch(BulkError, e => {\n // Concat failure from ModifyError and reject using our 'done' method.\n errorList = errorList.concat(e.failures);\n done();\n }).catch(reject);\n }\n }, \"locked\"); // If called from transaction scope, lock transaction til all steps are done.\n },\n bulkAdd: function(objects, keys) {\n var self = this,\n creatingHook = this.hook.creating.fire;\n return this._idbstore(READWRITE, function (resolve, reject, idbstore, trans) {\n if (!idbstore.keyPath && !self.schema.primKey.auto && !keys)\n throw new exceptions.InvalidArgument(\"bulkAdd() with non-inbound keys requires keys array in second argument\");\n if (idbstore.keyPath && keys)\n throw new exceptions.InvalidArgument(\"bulkAdd(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length)\n throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n if (objects.length === 0) return resolve(); // Caller provided empty list.\n function done(result) {\n if (errorList.length === 0) resolve(result);\n else reject(new BulkError(`${self.name}.bulkAdd(): ${errorList.length} of ${numObjs} operations failed`, errorList));\n }\n var req,\n errorList = [],\n errorHandler,\n successHandler,\n numObjs = objects.length;\n if (creatingHook !== nop) {\n //\n // There are subscribers to hook('creating')\n // Must behave as documented.\n //\n var keyPath = idbstore.keyPath,\n hookCtx;\n errorHandler = BulkErrorHandlerCatchAll(errorList, null, true);\n successHandler = hookedEventSuccessHandler(null);\n\n tryCatch(() => {\n for (var i=0, l = objects.length; i < l; ++i) {\n hookCtx = { onerror: null, onsuccess: null };\n var key = keys && keys[i];\n var obj = objects[i],\n effectiveKey = keys ? key : keyPath ? getByKeyPath(obj, keyPath) : undefined,\n keyToUse = creatingHook.call(hookCtx, effectiveKey, obj, trans);\n if (effectiveKey == null && keyToUse != null) {\n if (keyPath) {\n obj = deepClone(obj);\n setByKeyPath(obj, keyPath, keyToUse);\n } else {\n key = keyToUse;\n }\n }\n req = key != null ? idbstore.add(obj, key) : idbstore.add(obj);\n req._hookCtx = hookCtx;\n if (i < l - 1) {\n req.onerror = errorHandler;\n if (hookCtx.onsuccess)\n req.onsuccess = successHandler;\n }\n }\n }, err => {\n hookCtx.onerror && hookCtx.onerror(err);\n throw err;\n });\n\n req.onerror = BulkErrorHandlerCatchAll(errorList, done, true);\n req.onsuccess = hookedEventSuccessHandler(done);\n } else {\n //\n // Standard Bulk (no 'creating' hook to care about)\n //\n errorHandler = BulkErrorHandlerCatchAll(errorList);\n for (var i = 0, l = objects.length; i < l; ++i) {\n req = keys ? idbstore.add(objects[i], keys[i]) : idbstore.add(objects[i]);\n req.onerror = errorHandler;\n }\n // Only need to catch success or error on the last operation\n // according to the IDB spec.\n req.onerror = BulkErrorHandlerCatchAll(errorList, done);\n req.onsuccess = eventSuccessHandler(done);\n }\n });\n },\n add: function (obj, key) {\n /// \n /// Add an object to the database. In case an object with same primary key already exists, the object will not be added.\n /// \n /// A javascript object to insert\n /// Primary key\n var creatingHook = this.hook.creating.fire;\n return this._idbstore(READWRITE, function (resolve, reject, idbstore, trans) {\n var hookCtx = {onsuccess: null, onerror: null};\n if (creatingHook !== nop) {\n var effectiveKey = (key != null) ? key : (idbstore.keyPath ? getByKeyPath(obj, idbstore.keyPath) : undefined);\n var keyToUse = creatingHook.call(hookCtx, effectiveKey, obj, trans); // Allow subscribers to when(\"creating\") to generate the key.\n if (effectiveKey == null && keyToUse != null) { // Using \"==\" and \"!=\" to check for either null or undefined!\n if (idbstore.keyPath)\n setByKeyPath(obj, idbstore.keyPath, keyToUse);\n else\n key = keyToUse;\n }\n }\n try {\n var req = key != null ? idbstore.add(obj, key) : idbstore.add(obj);\n req._hookCtx = hookCtx;\n req.onerror = hookedEventRejectHandler(reject);\n req.onsuccess = hookedEventSuccessHandler(function (result) {\n // TODO: Remove these two lines in next major release (2.0?)\n // It's no good practice to have side effects on provided parameters\n var keyPath = idbstore.keyPath;\n if (keyPath) setByKeyPath(obj, keyPath, result);\n resolve(result);\n });\n } catch (e) {\n if (hookCtx.onerror) hookCtx.onerror(e);\n throw e;\n }\n });\n },\n\n put: function (obj, key) {\n /// \n /// Add an object to the database but in case an object with same primary key alread exists, the existing one will get updated.\n /// \n /// A javascript object to insert or update\n /// Primary key\n var creatingHook = this.hook.creating.fire,\n updatingHook = this.hook.updating.fire;\n if (creatingHook !== nop || updatingHook !== nop) {\n //\n // People listens to when(\"creating\") or when(\"updating\") events!\n // We must know whether the put operation results in an CREATE or UPDATE.\n //\n var keyPath = this.schema.primKey.keyPath;\n var effectiveKey = (key !== undefined) ? key : (keyPath && getByKeyPath(obj, keyPath));\n if (effectiveKey == null) // \"== null\" means checking for either null or undefined.\n return this.add(obj);\n \n // Since key is optional, make sure we get it from obj if not provided\n \n // Primary key exist. Lock transaction and try modifying existing. If nothing modified, call add().\n // clone obj before this async call. If caller modifies obj the line after put(), the IDB spec requires that it should not affect operation.\n obj = deepClone(obj);\n return this._trans(READWRITE, () =>\n this.where(\":id\").equals(effectiveKey).modify(function () {\n // Replace extisting value with our object\n // CRUD event firing handled in Collection.modify()\n this.value = obj;\n }).then(count => count === 0 ? this.add(obj, key) : effectiveKey),\n \"locked\"); // Lock needed because operation is splitted into modify() and add().\n } else {\n // Use the standard IDB put() method.\n return this._idbstore(READWRITE, function (resolve, reject, idbstore) {\n var req = key !== undefined ? idbstore.put(obj, key) : idbstore.put(obj);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function (ev) {\n var keyPath = idbstore.keyPath;\n if (keyPath) setByKeyPath(obj, keyPath, ev.target.result);\n resolve(req.result);\n });\n });\n }\n },\n\n 'delete': function (key) {\n /// Primary key of the object to delete\n if (this.hook.deleting.subscribers.length) {\n // People listens to when(\"deleting\") event. Must implement delete using Collection.delete() that will\n // call the CRUD event. Only Collection.delete() will know whether an object was actually deleted.\n return this.where(\":id\").equals(key).delete();\n } else {\n // No one listens. Use standard IDB delete() method.\n return this._idbstore(READWRITE, function (resolve, reject, idbstore) {\n var req = idbstore.delete(key);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function () {\n resolve(req.result);\n });\n });\n }\n },\n\n clear: function () {\n if (this.hook.deleting.subscribers.length) {\n // People listens to when(\"deleting\") event. Must implement delete using Collection.delete() that will\n // call the CRUD event. Only Collection.delete() will knows which objects that are actually deleted.\n return this.toCollection().delete();\n } else {\n return this._idbstore(READWRITE, function (resolve, reject, idbstore) {\n var req = idbstore.clear();\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function () {\n resolve(req.result);\n });\n });\n }\n },\n\n update: function (keyOrObject, modifications) {\n if (typeof modifications !== 'object' || isArray(modifications))\n throw new exceptions.InvalidArgument(\"Modifications must be an object.\");\n if (typeof keyOrObject === 'object' && !isArray(keyOrObject)) {\n // object to modify. Also modify given object with the modifications:\n keys(modifications).forEach(function (keyPath) {\n setByKeyPath(keyOrObject, keyPath, modifications[keyPath]);\n });\n var key = getByKeyPath(keyOrObject, this.schema.primKey.keyPath);\n if (key === undefined) return rejection (new exceptions.InvalidArgument(\n \"Given object does not contain its primary key\"));\n return this.where(\":id\").equals(key).modify(modifications);\n } else {\n // key to modify\n return this.where(\":id\").equals(keyOrObject).modify(modifications);\n }\n }\n });\n \n //\n //\n //\n // Transaction Class\n //\n //\n //\n function Transaction(mode, storeNames, dbschema, parent) {\n /// \n /// Transaction class. Represents a database transaction. All operations on db goes through a Transaction.\n /// \n /// Any of \"readwrite\" or \"readonly\"\n /// Array of table names to operate on\n this.db = db;\n this.mode = mode;\n this.storeNames = storeNames;\n this.idbtrans = null;\n this.on = Events(this, \"complete\", \"error\", \"abort\");\n this.parent = parent || null;\n this.active = true;\n this._reculock = 0;\n this._blockedFuncs = [];\n this._resolve = null;\n this._reject = null;\n this._waitingFor = null;\n this._waitingQueue = null;\n this._spinCount = 0; // Just for debugging waitFor()\n this._completion = new Promise ((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n \n this._completion.then(\n ()=> {\n this.active = false;\n this.on.complete.fire();\n },\n e => {\n var wasActive = this.active;\n this.active = false;\n this.on.error.fire(e);\n this.parent ?\n this.parent._reject(e) :\n wasActive && this.idbtrans && this.idbtrans.abort();\n return rejection(e); // Indicate we actually DO NOT catch this error.\n });\n }\n\n props(Transaction.prototype, {\n //\n // Transaction Protected Methods (not required by API users, but needed internally and eventually by dexie extensions)\n //\n _lock: function () {\n assert (!PSD.global); // Locking and unlocking reuires to be within a PSD scope.\n // Temporary set all requests into a pending queue if they are called before database is ready.\n ++this._reculock; // Recursive read/write lock pattern using PSD (Promise Specific Data) instead of TLS (Thread Local Storage)\n if (this._reculock === 1 && !PSD.global) PSD.lockOwnerFor = this;\n return this;\n },\n _unlock: function () {\n assert (!PSD.global); // Locking and unlocking reuires to be within a PSD scope.\n if (--this._reculock === 0) {\n if (!PSD.global) PSD.lockOwnerFor = null;\n while (this._blockedFuncs.length > 0 && !this._locked()) {\n var fnAndPSD = this._blockedFuncs.shift();\n try { usePSD(fnAndPSD[1], fnAndPSD[0]); } catch (e) { }\n }\n }\n return this;\n },\n _locked: function () {\n // Checks if any write-lock is applied on this transaction.\n // To simplify the Dexie API for extension implementations, we support recursive locks.\n // This is accomplished by using \"Promise Specific Data\" (PSD).\n // PSD data is bound to a Promise and any child Promise emitted through then() or resolve( new Promise() ).\n // PSD is local to code executing on top of the call stacks of any of any code executed by Promise():\n // * callback given to the Promise() constructor (function (resolve, reject){...})\n // * callbacks given to then()/catch()/finally() methods (function (value){...})\n // If creating a new independant Promise instance from within a Promise call stack, the new Promise will derive the PSD from the call stack of the parent Promise.\n // Derivation is done so that the inner PSD __proto__ points to the outer PSD.\n // PSD.lockOwnerFor will point to current transaction object if the currently executing PSD scope owns the lock.\n return this._reculock && PSD.lockOwnerFor !== this;\n },\n create: function (idbtrans) {\n if (!this.mode) return this;\n assert(!this.idbtrans);\n if (!idbtrans && !idbdb) {\n switch (dbOpenError && dbOpenError.name) {\n case \"DatabaseClosedError\":\n // Errors where it is no difference whether it was caused by the user operation or an earlier call to db.open()\n throw new exceptions.DatabaseClosed(dbOpenError);\n case \"MissingAPIError\":\n // Errors where it is no difference whether it was caused by the user operation or an earlier call to db.open()\n throw new exceptions.MissingAPI(dbOpenError.message, dbOpenError);\n default:\n // Make it clear that the user operation was not what caused the error - the error had occurred earlier on db.open()!\n throw new exceptions.OpenFailed(dbOpenError);\n }\n }\n if (!this.active) throw new exceptions.TransactionInactive();\n assert(this._completion._state === null);\n\n idbtrans = this.idbtrans = idbtrans || idbdb.transaction(safariMultiStoreFix(this.storeNames), this.mode);\n idbtrans.onerror = wrap(ev => {\n preventDefault(ev);// Prohibit default bubbling to window.error\n this._reject(idbtrans.error);\n });\n idbtrans.onabort = wrap(ev => {\n preventDefault(ev);\n this.active && this._reject(new exceptions.Abort(idbtrans.error));\n this.active = false;\n this.on(\"abort\").fire(ev);\n });\n idbtrans.oncomplete = wrap(() => {\n this.active = false;\n this._resolve();\n });\n return this;\n },\n _promise: function (mode, fn, bWriteLock) {\n\n if (mode === READWRITE && this.mode !== READWRITE)\n return rejection (new exceptions.ReadOnly(\"Transaction is readonly\"));\n\n if (!this.active)\n return rejection (new exceptions.TransactionInactive());\n\n if (this._locked()) {\n return new Promise((resolve, reject) => {\n this._blockedFuncs.push([() => {\n this._promise(mode, fn, bWriteLock).then(resolve, reject);\n }, PSD]);\n });\n\n } else if (bWriteLock) {\n return newScope(()=>{\n var p = new Promise((resolve, reject) => {\n this._lock();\n var rv = fn(resolve, reject, this);\n if (rv && rv.then) rv.then(resolve, reject);\n });\n p.finally(()=>this._unlock());\n p._lib = true;\n return p;\n });\n\n } else {\n var p = new Promise((resolve, reject) => {\n var rv = fn(resolve, reject, this);\n if (rv && rv.then) rv.then(resolve, reject);\n });\n p._lib = true;\n return p;\n }\n },\n\n _root: function () {\n return this.parent ? this.parent._root() : this;\n },\n\n waitFor (promise) {\n // Always operate on the root transaction (in case this is a sub stransaction)\n var root = this._root();\n // For stability reasons, convert parameter to promise no matter what type is passed to waitFor().\n // (We must be able to call .then() on it.)\n promise = Promise.resolve(promise);\n if (root._waitingFor) {\n // Already called waitFor(). Wait for both to complete.\n root._waitingFor = root._waitingFor.then(()=>promise);\n } else {\n // We're not in waiting state. Start waiting state.\n root._waitingFor = promise;\n root._waitingQueue = [];\n // Start interacting with indexedDB until promise completes:\n var store = root.idbtrans.objectStore(root.storeNames[0]);\n (function spin(){\n ++root._spinCount; // For debugging only\n while (root._waitingQueue.length) (root._waitingQueue.shift())();\n if (root._waitingFor) store.get(-Infinity).onsuccess = spin;\n }());\n }\n var currentWaitPromise = root._waitingFor;\n return new Promise ((resolve, reject) => {\n promise.then (\n res => root._waitingQueue.push(wrap(resolve.bind(null, res))),\n err => root._waitingQueue.push(wrap(reject.bind(null, err)))\n ).finally(() => {\n if (root._waitingFor === currentWaitPromise) {\n // No one added a wait after us. Safe to stop the spinning.\n root._waitingFor = null;\n }\n });\n });\n },\n\n //\n // Transaction Public Properties and Methods\n //\n abort: function () {\n this.active && this._reject(new exceptions.Abort());\n this.active = false;\n },\n\n tables: {\n get: Debug.deprecated (\"Transaction.tables\", ()=>allTables)\n },\n\n table: function (name) {\n var table = db.table(name); // Don't check that table is part of transaction. It must fail lazily!\n return new Table(name, table.schema, this);\n }\n });\n\n //\n //\n //\n // WhereClause\n //\n //\n //\n function WhereClause(table, index, orCollection) {\n /// \n /// \n /// \n this._ctx = {\n table: table,\n index: index === \":id\" ? null : index,\n or: orCollection\n };\n }\n\n props(WhereClause.prototype, function () {\n\n // WhereClause private methods\n\n function fail(collectionOrWhereClause, err, T) {\n var collection = collectionOrWhereClause instanceof WhereClause ?\n new Collection (collectionOrWhereClause) :\n collectionOrWhereClause;\n \n collection._ctx.error = T ? new T(err) : new TypeError(err);\n return collection;\n }\n\n function emptyCollection(whereClause) {\n return new Collection (whereClause, function() { return IDBKeyRange.only(\"\"); }).limit(0);\n }\n\n function upperFactory(dir) {\n return dir === \"next\" ? function (s) { return s.toUpperCase(); } : function (s) { return s.toLowerCase(); };\n }\n function lowerFactory(dir) {\n return dir === \"next\" ? function (s) { return s.toLowerCase(); } : function (s) { return s.toUpperCase(); };\n }\n function nextCasing(key, lowerKey, upperNeedle, lowerNeedle, cmp, dir) {\n var length = Math.min(key.length, lowerNeedle.length);\n var llp = -1;\n for (var i = 0; i < length; ++i) {\n var lwrKeyChar = lowerKey[i];\n if (lwrKeyChar !== lowerNeedle[i]) {\n if (cmp(key[i], upperNeedle[i]) < 0) return key.substr(0, i) + upperNeedle[i] + upperNeedle.substr(i + 1);\n if (cmp(key[i], lowerNeedle[i]) < 0) return key.substr(0, i) + lowerNeedle[i] + upperNeedle.substr(i + 1);\n if (llp >= 0) return key.substr(0, llp) + lowerKey[llp] + upperNeedle.substr(llp + 1);\n return null;\n }\n if (cmp(key[i], lwrKeyChar) < 0) llp = i;\n }\n if (length < lowerNeedle.length && dir === \"next\") return key + upperNeedle.substr(key.length);\n if (length < key.length && dir === \"prev\") return key.substr(0, upperNeedle.length);\n return (llp < 0 ? null : key.substr(0, llp) + lowerNeedle[llp] + upperNeedle.substr(llp + 1));\n }\n\n function addIgnoreCaseAlgorithm(whereClause, match, needles, suffix) {\n /// \n var upper, lower, compare, upperNeedles, lowerNeedles, direction, nextKeySuffix,\n needlesLen = needles.length;\n if (!needles.every(s => typeof s === 'string')) {\n return fail(whereClause, STRING_EXPECTED);\n }\n function initDirection(dir) {\n upper = upperFactory(dir);\n lower = lowerFactory(dir);\n compare = (dir === \"next\" ? simpleCompare : simpleCompareReverse);\n var needleBounds = needles.map(function (needle){\n return {lower: lower(needle), upper: upper(needle)};\n }).sort(function(a,b) {\n return compare(a.lower, b.lower);\n });\n upperNeedles = needleBounds.map(function (nb){ return nb.upper; });\n lowerNeedles = needleBounds.map(function (nb){ return nb.lower; });\n direction = dir;\n nextKeySuffix = (dir === \"next\" ? \"\" : suffix);\n }\n initDirection(\"next\");\n\n var c = new Collection (whereClause, function() {\n return IDBKeyRange.bound(upperNeedles[0], lowerNeedles[needlesLen-1] + suffix);\n });\n\n c._ondirectionchange = function (direction) {\n // This event onlys occur before filter is called the first time.\n initDirection(direction);\n };\n\n var firstPossibleNeedle = 0;\n\n c._addAlgorithm(function (cursor, advance, resolve) {\n /// \n /// \n /// \n var key = cursor.key;\n if (typeof key !== 'string') return false;\n var lowerKey = lower(key);\n if (match(lowerKey, lowerNeedles, firstPossibleNeedle)) {\n return true;\n } else {\n var lowestPossibleCasing = null;\n for (var i=firstPossibleNeedle; i 0) {\n lowestPossibleCasing = casing;\n }\n }\n if (lowestPossibleCasing !== null) {\n advance(function () { cursor.continue(lowestPossibleCasing + nextKeySuffix); });\n } else {\n advance(resolve);\n }\n return false;\n }\n });\n return c;\n }\n\n //\n // WhereClause public methods\n //\n return {\n between: function (lower, upper, includeLower, includeUpper) {\n /// \n /// Filter out records whose where-field lays between given lower and upper values. Applies to Strings, Numbers and Dates.\n /// \n /// \n /// \n /// Whether items that equals lower should be included. Default true.\n /// Whether items that equals upper should be included. Default false.\n /// \n includeLower = includeLower !== false; // Default to true\n includeUpper = includeUpper === true; // Default to false\n try {\n if ((cmp(lower, upper) > 0) ||\n (cmp(lower, upper) === 0 && (includeLower || includeUpper) && !(includeLower && includeUpper)))\n return emptyCollection(this); // Workaround for idiotic W3C Specification that DataError must be thrown if lower > upper. The natural result would be to return an empty collection.\n return new Collection (this, function() { return IDBKeyRange.bound(lower, upper, !includeLower, !includeUpper); });\n } catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n },\n equals: function (value) {\n return new Collection (this, function() { return IDBKeyRange.only(value); });\n },\n above: function (value) {\n return new Collection (this, function() { return IDBKeyRange.lowerBound(value, true); });\n },\n aboveOrEqual: function (value) {\n return new Collection (this, function() { return IDBKeyRange.lowerBound(value); });\n },\n below: function (value) {\n return new Collection (this, function() { return IDBKeyRange.upperBound(value, true); });\n },\n belowOrEqual: function (value) {\n return new Collection (this, function() { return IDBKeyRange.upperBound(value); });\n },\n startsWith: function (str) {\n /// \n if (typeof str !== 'string') return fail(this, STRING_EXPECTED);\n return this.between(str, str + maxString, true, true);\n },\n startsWithIgnoreCase: function (str) {\n /// \n if (str === \"\") return this.startsWith(str);\n return addIgnoreCaseAlgorithm(this, function (x, a) { return x.indexOf(a[0]) === 0; }, [str], maxString);\n },\n equalsIgnoreCase: function (str) {\n /// \n return addIgnoreCaseAlgorithm(this, function (x, a) { return x === a[0]; }, [str], \"\");\n },\n anyOfIgnoreCase: function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, function (x, a) { return a.indexOf(x) !== -1; }, set, \"\");\n },\n startsWithAnyOfIgnoreCase: function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, function (x, a) {\n return a.some(function(n){\n return x.indexOf(n) === 0;\n });}, set, maxString);\n },\n anyOf: function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n var compare = ascending;\n try { set.sort(compare); } catch(e) { return fail(this, INVALID_KEY_ARGUMENT); }\n if (set.length === 0) return emptyCollection(this);\n var c = new Collection (this, function () { return IDBKeyRange.bound(set[0], set[set.length - 1]); });\n\n c._ondirectionchange = function (direction) {\n compare = (direction === \"next\" ? ascending : descending);\n set.sort(compare);\n };\n var i = 0;\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n while (compare(key, set[i]) > 0) {\n // The cursor has passed beyond this key. Check next.\n ++i;\n if (i === set.length) {\n // There is no next. Stop searching.\n advance(resolve);\n return false;\n }\n }\n if (compare(key, set[i]) === 0) {\n // The current cursor value should be included and we should continue a single step in case next item has the same key or possibly our next key in set.\n return true;\n } else {\n // cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.\n advance(function () { cursor.continue(set[i]); });\n return false;\n }\n });\n return c;\n },\n\n notEqual: function(value) {\n return this.inAnyRange([[minKey, value],[value, maxKey]], {includeLowers: false, includeUppers: false});\n },\n\n noneOf: function() {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return new Collection (this); // Return entire collection.\n try { set.sort(ascending); } catch(e) { return fail(this, INVALID_KEY_ARGUMENT);}\n // Transform [\"a\",\"b\",\"c\"] to a set of ranges for between/above/below: [[minKey,\"a\"], [\"a\",\"b\"], [\"b\",\"c\"], [\"c\",maxKey]]\n var ranges = set.reduce(function (res, val) { return res ? res.concat([[res[res.length - 1][1], val]]) : [[minKey, val]]; }, null);\n ranges.push([set[set.length - 1], maxKey]);\n return this.inAnyRange(ranges, {includeLowers: false, includeUppers: false});\n },\n\n /** Filter out values withing given set of ranges.\n * Example, give children and elders a rebate of 50%:\n *\n * db.friends.where('age').inAnyRange([[0,18],[65,Infinity]]).modify({Rebate: 1/2});\n *\n * @param {(string|number|Date|Array)[][]} ranges\n * @param {{includeLowers: boolean, includeUppers: boolean}} options\n */\n inAnyRange: function (ranges, options) {\n if (ranges.length === 0) return emptyCollection(this);\n if (!ranges.every(function (range) { return range[0] !== undefined && range[1] !== undefined && ascending(range[0], range[1]) <= 0;})) {\n return fail(this, \"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower\", exceptions.InvalidArgument);\n }\n var includeLowers = !options || options.includeLowers !== false; // Default to true\n var includeUppers = options && options.includeUppers === true; // Default to false\n\n function addRange (ranges, newRange) {\n for (var i=0,l=ranges.length;i 0) {\n range[0] = min(range[0], newRange[0]);\n range[1] = max(range[1], newRange[1]);\n break;\n }\n }\n if (i === l)\n ranges.push(newRange);\n return ranges;\n }\n\n var sortDirection = ascending;\n function rangeSorter(a,b) { return sortDirection(a[0], b[0]);}\n\n // Join overlapping ranges\n var set;\n try {\n set = ranges.reduce(addRange, []);\n set.sort(rangeSorter);\n } catch(ex) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n\n var i = 0;\n var keyIsBeyondCurrentEntry = includeUppers ?\n function(key) { return ascending(key, set[i][1]) > 0; } :\n function(key) { return ascending(key, set[i][1]) >= 0; };\n\n var keyIsBeforeCurrentEntry = includeLowers ?\n function(key) { return descending(key, set[i][0]) > 0; } :\n function(key) { return descending(key, set[i][0]) >= 0; };\n\n function keyWithinCurrentRange (key) {\n return !keyIsBeyondCurrentEntry(key) && !keyIsBeforeCurrentEntry(key);\n }\n\n var checkKey = keyIsBeyondCurrentEntry;\n\n var c = new Collection (this, function () {\n return IDBKeyRange.bound(set[0][0], set[set.length - 1][1], !includeLowers, !includeUppers);\n });\n\n c._ondirectionchange = function (direction) {\n if (direction === \"next\") {\n checkKey = keyIsBeyondCurrentEntry;\n sortDirection = ascending;\n } else {\n checkKey = keyIsBeforeCurrentEntry;\n sortDirection = descending;\n }\n set.sort(rangeSorter);\n };\n\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n while (checkKey(key)) {\n // The cursor has passed beyond this key. Check next.\n ++i;\n if (i === set.length) {\n // There is no next. Stop searching.\n advance(resolve);\n return false;\n }\n }\n if (keyWithinCurrentRange(key)) {\n // The current cursor value should be included and we should continue a single step in case next item has the same key or possibly our next key in set.\n return true;\n } else if (cmp(key,set[i][1]) === 0 || cmp(key,set[i][0]) === 0) {\n // includeUpper or includeLower is false so keyWithinCurrentRange() returns false even though we are at range border.\n // Continue to next key but don't include this one.\n return false;\n } else {\n // cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.\n advance(function() {\n if (sortDirection === ascending) cursor.continue(set[i][0]);\n else cursor.continue(set[i][1]);\n });\n return false;\n }\n });\n return c;\n },\n startsWithAnyOf: function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n\n if (!set.every(function (s) { return typeof s === 'string'; })) {\n return fail(this, \"startsWithAnyOf() only works with strings\");\n }\n if (set.length === 0) return emptyCollection(this);\n\n return this.inAnyRange(set.map(function(str) {\n return [str, str + maxString];\n }));\n }\n };\n });\n\n\n\n\n //\n //\n //\n // Collection Class\n //\n //\n //\n function Collection(whereClause, keyRangeGenerator) {\n /// \n ///\n /// \n /// Where clause instance\n /// \n var keyRange = null, error = null;\n if (keyRangeGenerator) try {\n keyRange = keyRangeGenerator();\n } catch (ex) {\n error = ex;\n }\n\n var whereCtx = whereClause._ctx,\n table = whereCtx.table;\n this._ctx = {\n table: table,\n index: whereCtx.index,\n isPrimKey: (!whereCtx.index || (table.schema.primKey.keyPath && whereCtx.index === table.schema.primKey.name)),\n range: keyRange,\n keysOnly: false,\n dir: \"next\",\n unique: \"\",\n algorithm: null,\n filter: null,\n replayFilter: null,\n justLimit: true, // True if a replayFilter is just a filter that performs a \"limit\" operation (or none at all)\n isMatch: null,\n offset: 0,\n limit: Infinity,\n error: error, // If set, any promise must be rejected with this error\n or: whereCtx.or,\n valueMapper: table.hook.reading.fire\n };\n }\n \n function isPlainKeyRange (ctx, ignoreLimitFilter) {\n return !(ctx.filter || ctx.algorithm || ctx.or) &&\n (ignoreLimitFilter ? ctx.justLimit : !ctx.replayFilter);\n } \n\n props(Collection.prototype, function () {\n\n //\n // Collection Private Functions\n //\n\n function addFilter(ctx, fn) {\n ctx.filter = combine(ctx.filter, fn);\n }\n\n function addReplayFilter (ctx, factory, isLimitFilter) {\n var curr = ctx.replayFilter;\n ctx.replayFilter = curr ? ()=>combine(curr(), factory()) : factory;\n ctx.justLimit = isLimitFilter && !curr;\n }\n\n function addMatchFilter(ctx, fn) {\n ctx.isMatch = combine(ctx.isMatch, fn);\n }\n\n /** @param ctx {\n * isPrimKey: boolean,\n * table: Table,\n * index: string\n * }\n * @param store IDBObjectStore\n **/\n function getIndexOrStore(ctx, store) {\n if (ctx.isPrimKey) return store;\n var indexSpec = ctx.table.schema.idxByName[ctx.index];\n if (!indexSpec) throw new exceptions.Schema(\"KeyPath \" + ctx.index + \" on object store \" + store.name + \" is not indexed\");\n return store.index(indexSpec.name);\n }\n\n /** @param ctx {\n * isPrimKey: boolean,\n * table: Table,\n * index: string,\n * keysOnly: boolean,\n * range?: IDBKeyRange,\n * dir: \"next\" | \"prev\"\n * }\n */\n function openCursor(ctx, store) {\n var idxOrStore = getIndexOrStore(ctx, store);\n return ctx.keysOnly && 'openKeyCursor' in idxOrStore ?\n idxOrStore.openKeyCursor(ctx.range || null, ctx.dir + ctx.unique) :\n idxOrStore.openCursor(ctx.range || null, ctx.dir + ctx.unique);\n }\n\n function iter(ctx, fn, resolve, reject, idbstore) {\n var filter = ctx.replayFilter ? combine(ctx.filter, ctx.replayFilter()) : ctx.filter;\n if (!ctx.or) {\n iterate(openCursor(ctx, idbstore), combine(ctx.algorithm, filter), fn, resolve, reject, !ctx.keysOnly && ctx.valueMapper);\n } else (()=>{\n var set = {};\n var resolved = 0;\n\n function resolveboth() {\n if (++resolved === 2) resolve(); // Seems like we just support or btwn max 2 expressions, but there are no limit because we do recursion.\n }\n\n function union(item, cursor, advance) {\n if (!filter || filter(cursor, advance, resolveboth, reject)) {\n var primaryKey = cursor.primaryKey;\n var key = '' + primaryKey;\n if (key === '[object ArrayBuffer]') key = '' + new Uint8Array(primaryKey);\n if (!hasOwn(set, key)) {\n set[key] = true;\n fn(item, cursor, advance);\n }\n }\n }\n\n ctx.or._iterate(union, resolveboth, reject, idbstore);\n iterate(openCursor(ctx, idbstore), ctx.algorithm, union, resolveboth, reject, !ctx.keysOnly && ctx.valueMapper);\n })();\n }\n \n return {\n\n //\n // Collection Protected Functions\n //\n\n _read: function (fn, cb) {\n var ctx = this._ctx;\n return ctx.error ?\n ctx.table._trans(null, rejection.bind(null, ctx.error)) :\n ctx.table._idbstore(READONLY, fn).then(cb);\n },\n _write: function (fn) {\n var ctx = this._ctx;\n return ctx.error ?\n ctx.table._trans(null, rejection.bind(null, ctx.error)) :\n ctx.table._idbstore(READWRITE, fn, \"locked\"); // When doing write operations on collections, always lock the operation so that upcoming operations gets queued.\n },\n _addAlgorithm: function (fn) {\n var ctx = this._ctx;\n ctx.algorithm = combine(ctx.algorithm, fn);\n },\n\n _iterate: function (fn, resolve, reject, idbstore) {\n return iter(this._ctx, fn, resolve, reject, idbstore);\n },\n\n clone: function (props) {\n var rv = Object.create(this.constructor.prototype),\n ctx = Object.create(this._ctx);\n if (props) extend(ctx, props);\n rv._ctx = ctx;\n return rv;\n },\n\n raw: function () {\n this._ctx.valueMapper = null;\n return this;\n },\n\n //\n // Collection Public methods\n //\n\n each: function (fn) {\n var ctx = this._ctx;\n\n return this._read(function (resolve, reject, idbstore) {\n iter(ctx, fn, resolve, reject, idbstore);\n });\n },\n\n count: function (cb) {\n var ctx = this._ctx;\n\n if (isPlainKeyRange(ctx, true)) {\n // This is a plain key range. We can use the count() method if the index.\n return this._read(function (resolve, reject, idbstore) {\n var idx = getIndexOrStore(ctx, idbstore);\n var req = (ctx.range ? idx.count(ctx.range) : idx.count());\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = function (e) {\n resolve(Math.min(e.target.result, ctx.limit));\n };\n }, cb);\n } else {\n // Algorithms, filters or expressions are applied. Need to count manually.\n var count = 0;\n return this._read(function (resolve, reject, idbstore) {\n iter(ctx, function () { ++count; return false; }, function () { resolve(count); }, reject, idbstore);\n }, cb);\n }\n },\n\n sortBy: function (keyPath, cb) {\n /// \n var parts = keyPath.split('.').reverse(),\n lastPart = parts[0],\n lastIndex = parts.length - 1;\n function getval(obj, i) {\n if (i) return getval(obj[parts[i]], i - 1);\n return obj[lastPart];\n }\n var order = this._ctx.dir === \"next\" ? 1 : -1;\n\n function sorter(a, b) {\n var aVal = getval(a, lastIndex),\n bVal = getval(b, lastIndex);\n return aVal < bVal ? -order : aVal > bVal ? order : 0;\n }\n return this.toArray(function (a) {\n return a.sort(sorter);\n }).then(cb);\n },\n\n toArray: function (cb) {\n var ctx = this._ctx;\n return this._read(function (resolve, reject, idbstore) {\n if (hasGetAll && ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n // Special optimation if we could use IDBObjectStore.getAll() or\n // IDBKeyRange.getAll():\n var readingHook = ctx.table.hook.reading.fire;\n var idxOrStore = getIndexOrStore(ctx, idbstore);\n var req = ctx.limit < Infinity ?\n idxOrStore.getAll(ctx.range, ctx.limit) :\n idxOrStore.getAll(ctx.range);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = readingHook === mirror ?\n eventSuccessHandler(resolve) :\n eventSuccessHandler(res => {\n try {resolve (res.map(readingHook));} catch(e) {reject(e);}\n });\n } else {\n // Getting array through a cursor.\n var a = [];\n iter(ctx, function (item) { a.push(item); }, function arrayComplete() {\n resolve(a);\n }, reject, idbstore);\n }\n }, cb);\n },\n\n offset: function (offset) {\n var ctx = this._ctx;\n if (offset <= 0) return this;\n ctx.offset += offset; // For count()\n if (isPlainKeyRange(ctx)) {\n addReplayFilter(ctx, ()=> {\n var offsetLeft = offset;\n return (cursor, advance) => {\n if (offsetLeft === 0) return true;\n if (offsetLeft === 1) { --offsetLeft; return false; }\n advance(()=> {\n cursor.advance(offsetLeft);\n offsetLeft = 0;\n });\n return false;\n };\n });\n } else {\n addReplayFilter(ctx, ()=> {\n var offsetLeft = offset;\n return () => (--offsetLeft < 0);\n });\n }\n return this;\n },\n\n limit: function (numRows) {\n this._ctx.limit = Math.min(this._ctx.limit, numRows); // For count()\n addReplayFilter(this._ctx, ()=> {\n var rowsLeft = numRows;\n return function (cursor, advance, resolve) {\n if (--rowsLeft <= 0) advance(resolve); // Stop after this item has been included\n return rowsLeft >= 0; // If numRows is already below 0, return false because then 0 was passed to numRows initially. Otherwise we wouldnt come here.\n };\n }, true);\n return this;\n },\n\n until: function (filterFunction, bIncludeStopEntry) {\n addFilter(this._ctx, function (cursor, advance, resolve) {\n if (filterFunction(cursor.value)) {\n advance(resolve);\n return bIncludeStopEntry;\n } else {\n return true;\n }\n });\n return this;\n },\n\n first: function (cb) {\n return this.limit(1).toArray(function (a) { return a[0]; }).then(cb);\n },\n\n last: function (cb) {\n return this.reverse().first(cb);\n },\n\n filter: function (filterFunction) {\n /// function(val){return true/false}\n addFilter(this._ctx, function (cursor) {\n return filterFunction(cursor.value);\n });\n // match filters not used in Dexie.js but can be used by 3rd part libraries to test a\n // collection for a match without querying DB. Used by Dexie.Observable.\n addMatchFilter(this._ctx, filterFunction); \n return this;\n },\n \n and: function (filterFunction) {\n return this.filter(filterFunction);\n },\n\n or: function (indexName) {\n return new WhereClause(this._ctx.table, indexName, this);\n },\n\n reverse: function () {\n this._ctx.dir = (this._ctx.dir === \"prev\" ? \"next\" : \"prev\");\n if (this._ondirectionchange) this._ondirectionchange(this._ctx.dir);\n return this;\n },\n\n desc: function () {\n return this.reverse();\n },\n\n eachKey: function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) { cb(cursor.key, cursor); });\n },\n\n eachUniqueKey: function (cb) {\n this._ctx.unique = \"unique\";\n return this.eachKey(cb);\n },\n \n eachPrimaryKey: function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) { cb(cursor.primaryKey, cursor); });\n },\n\n keys: function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.key);\n }).then(function () {\n return a;\n }).then(cb);\n },\n \n primaryKeys: function (cb) {\n var ctx = this._ctx;\n if (hasGetAll && ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n // Special optimation if we could use IDBObjectStore.getAllKeys() or\n // IDBKeyRange.getAllKeys():\n return this._read((resolve, reject, idbstore) =>{\n var idxOrStore = getIndexOrStore(ctx, idbstore);\n var req = ctx.limit < Infinity ?\n idxOrStore.getAllKeys(ctx.range, ctx.limit) :\n idxOrStore.getAllKeys(ctx.range);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = eventSuccessHandler(resolve);\n }).then(cb);\n }\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.primaryKey);\n }).then(function () {\n return a;\n }).then(cb);\n },\n\n uniqueKeys: function (cb) {\n this._ctx.unique = \"unique\";\n return this.keys(cb);\n },\n\n firstKey: function (cb) {\n return this.limit(1).keys(function (a) { return a[0]; }).then(cb);\n },\n\n lastKey: function (cb) {\n return this.reverse().firstKey(cb);\n },\n\n distinct: function () {\n var ctx = this._ctx,\n idx = ctx.index && ctx.table.schema.idxByName[ctx.index];\n if (!idx || !idx.multi) return this; // distinct() only makes differencies on multiEntry indexes.\n var set = {};\n addFilter(this._ctx, function (cursor) {\n var strKey = cursor.primaryKey.toString(); // Converts any Date to String, String to String, Number to String and Array to comma-separated string\n var found = hasOwn(set, strKey);\n set[strKey] = true;\n return !found;\n });\n return this;\n },\n\n //\n // Methods that mutate storage\n //\n\n modify: function (changes) {\n var self = this,\n ctx = this._ctx,\n hook = ctx.table.hook,\n updatingHook = hook.updating.fire,\n deletingHook = hook.deleting.fire;\n\n return this._write(function (resolve, reject, idbstore, trans) {\n var modifyer;\n if (typeof changes === 'function') {\n // Changes is a function that may update, add or delete propterties or even require a deletion the object itself (delete this.item)\n if (updatingHook === nop && deletingHook === nop) {\n // Noone cares about what is being changed. Just let the modifier function be the given argument as is.\n modifyer = changes;\n } else {\n // People want to know exactly what is being modified or deleted.\n // Let modifyer be a proxy function that finds out what changes the caller is actually doing\n // and call the hooks accordingly!\n modifyer = function (item) {\n var origItem = deepClone(item); // Clone the item first so we can compare laters.\n if (changes.call(this, item, this) === false) return false; // Call the real modifyer function (If it returns false explicitely, it means it dont want to modify anyting on this object)\n if (!hasOwn(this, \"value\")) {\n // The real modifyer function requests a deletion of the object. Inform the deletingHook that a deletion is taking place.\n deletingHook.call(this, this.primKey, item, trans);\n } else {\n // No deletion. Check what was changed\n var objectDiff = getObjectDiff(origItem, this.value);\n var additionalChanges = updatingHook.call(this, objectDiff, this.primKey, origItem, trans);\n if (additionalChanges) {\n // Hook want to apply additional modifications. Make sure to fullfill the will of the hook.\n item = this.value;\n keys(additionalChanges).forEach(function (keyPath) {\n setByKeyPath(item, keyPath, additionalChanges[keyPath]); // Adding {keyPath: undefined} means that the keyPath should be deleted. Handled by setByKeyPath\n });\n }\n }\n };\n }\n } else if (updatingHook === nop) {\n // changes is a set of {keyPath: value} and no one is listening to the updating hook.\n var keyPaths = keys(changes);\n var numKeys = keyPaths.length;\n modifyer = function (item) {\n var anythingModified = false;\n for (var i = 0; i < numKeys; ++i) {\n var keyPath = keyPaths[i], val = changes[keyPath];\n if (getByKeyPath(item, keyPath) !== val) {\n setByKeyPath(item, keyPath, val); // Adding {keyPath: undefined} means that the keyPath should be deleted. Handled by setByKeyPath\n anythingModified = true;\n }\n }\n return anythingModified;\n };\n } else {\n // changes is a set of {keyPath: value} and people are listening to the updating hook so we need to call it and\n // allow it to add additional modifications to make.\n var origChanges = changes;\n changes = shallowClone(origChanges); // Let's work with a clone of the changes keyPath/value set so that we can restore it in case a hook extends it.\n modifyer = function (item) {\n var anythingModified = false;\n var additionalChanges = updatingHook.call(this, changes, this.primKey, deepClone(item), trans);\n if (additionalChanges) extend(changes, additionalChanges);\n keys(changes).forEach(function (keyPath) {\n var val = changes[keyPath];\n if (getByKeyPath(item, keyPath) !== val) {\n setByKeyPath(item, keyPath, val);\n anythingModified = true;\n }\n });\n if (additionalChanges) changes = shallowClone(origChanges); // Restore original changes for next iteration\n return anythingModified;\n };\n }\n\n var count = 0;\n var successCount = 0;\n var iterationComplete = false;\n var failures = [];\n var failKeys = [];\n var currentKey = null;\n\n function modifyItem(item, cursor) {\n currentKey = cursor.primaryKey;\n var thisContext = {\n primKey: cursor.primaryKey,\n value: item,\n onsuccess: null,\n onerror: null\n };\n\n function onerror(e) {\n failures.push(e);\n failKeys.push(thisContext.primKey);\n checkFinished();\n return true; // Catch these errors and let a final rejection decide whether or not to abort entire transaction\n }\n\n if (modifyer.call(thisContext, item, thisContext) !== false) { // If a callback explicitely returns false, do not perform the update!\n var bDelete = !hasOwn(thisContext, \"value\");\n ++count;\n tryCatch(function () {\n var req = (bDelete ? cursor.delete() : cursor.update(thisContext.value));\n req._hookCtx = thisContext;\n req.onerror = hookedEventRejectHandler(onerror);\n req.onsuccess = hookedEventSuccessHandler(function () {\n ++successCount;\n checkFinished();\n });\n }, onerror);\n } else if (thisContext.onsuccess) {\n // Hook will expect either onerror or onsuccess to always be called!\n thisContext.onsuccess(thisContext.value);\n }\n }\n\n function doReject(e) {\n if (e) {\n failures.push(e);\n failKeys.push(currentKey);\n }\n return reject(new ModifyError(\"Error modifying one or more objects\", failures, successCount, failKeys));\n }\n\n function checkFinished() {\n if (iterationComplete && successCount + failures.length === count) {\n if (failures.length > 0)\n doReject();\n else\n resolve(successCount);\n }\n }\n self.clone().raw()._iterate(modifyItem, function () {\n iterationComplete = true;\n checkFinished();\n }, doReject, idbstore);\n });\n },\n\n 'delete': function () {\n var ctx = this._ctx,\n range = ctx.range,\n deletingHook = ctx.table.hook.deleting.fire,\n hasDeleteHook = deletingHook !== nop;\n if (!hasDeleteHook &&\n isPlainKeyRange(ctx) &&\n ((ctx.isPrimKey && !hangsOnDeleteLargeKeyRange) || !range)) // if no range, we'll use clear().\n {\n // May use IDBObjectStore.delete(IDBKeyRange) in this case (Issue #208)\n // For chromium, this is the way most optimized version.\n // For IE/Edge, this could hang the indexedDB engine and make operating system instable\n // (https://gist.github.com/dfahlander/5a39328f029de18222cf2125d56c38f7)\n return this._write((resolve, reject, idbstore) => {\n // Our API contract is to return a count of deleted items, so we have to count() before delete().\n var onerror = eventRejectHandler(reject),\n countReq = (range ? idbstore.count(range) : idbstore.count());\n countReq.onerror = onerror;\n countReq.onsuccess = () => {\n var count = countReq.result;\n tryCatch(()=> {\n var delReq = (range ? idbstore.delete(range) : idbstore.clear());\n delReq.onerror = onerror;\n delReq.onsuccess = () => resolve(count);\n }, err => reject(err));\n };\n });\n }\n\n // Default version to use when collection is not a vanilla IDBKeyRange on the primary key.\n // Divide into chunks to not starve RAM.\n // If has delete hook, we will have to collect not just keys but also objects, so it will use\n // more memory and need lower chunk size.\n const CHUNKSIZE = hasDeleteHook ? 2000 : 10000;\n\n return this._write((resolve, reject, idbstore, trans) => {\n var totalCount = 0;\n // Clone collection and change its table and set a limit of CHUNKSIZE on the cloned Collection instance.\n var collection = this\n .clone({\n keysOnly: !ctx.isMatch && !hasDeleteHook}) // load just keys (unless filter() or and() or deleteHook has subscribers)\n .distinct() // In case multiEntry is used, never delete same key twice because resulting count\n // would become larger than actual delete count.\n .limit(CHUNKSIZE)\n .raw(); // Don't filter through reading-hooks (like mapped classes etc)\n\n var keysOrTuples = [];\n\n // We're gonna do things on as many chunks that are needed.\n // Use recursion of nextChunk function:\n const nextChunk = () => collection.each(hasDeleteHook ? (val, cursor) => {\n // Somebody subscribes to hook('deleting'). Collect all primary keys and their values,\n // so that the hook can be called with its values in bulkDelete().\n keysOrTuples.push([cursor.primaryKey, cursor.value]);\n } : (val, cursor) => {\n // No one subscribes to hook('deleting'). Collect only primary keys:\n keysOrTuples.push(cursor.primaryKey);\n }).then(() => {\n // Chromium deletes faster when doing it in sort order.\n hasDeleteHook ?\n keysOrTuples.sort((a, b)=>ascending(a[0], b[0])) :\n keysOrTuples.sort(ascending);\n return bulkDelete(idbstore, trans, keysOrTuples, hasDeleteHook, deletingHook);\n\n }).then(()=> {\n var count = keysOrTuples.length;\n totalCount += count;\n keysOrTuples = [];\n return count < CHUNKSIZE ? totalCount : nextChunk();\n });\n\n resolve (nextChunk());\n });\n }\n };\n });\n\n\n //\n //\n //\n // ------------------------- Help functions ---------------------------\n //\n //\n //\n\n function lowerVersionFirst(a, b) {\n return a._cfg.version - b._cfg.version;\n }\n\n function setApiOnPlace(objs, tableNames, dbschema) {\n tableNames.forEach(function (tableName) {\n var schema = dbschema[tableName];\n objs.forEach(obj => {\n if (!(tableName in obj)) {\n if (obj === Transaction.prototype || obj instanceof Transaction) {\n // obj is a Transaction prototype (or prototype of a subclass to Transaction)\n // Make the API a getter that returns this.table(tableName)\n setProp(obj, tableName, {get() { return this.table(tableName); }});\n } else {\n // Table will not be bound to a transaction (will use Dexie.currentTransaction)\n obj[tableName] = new Table(tableName, schema);\n }\n }\n });\n });\n }\n\n function removeTablesApi(objs) {\n objs.forEach(function (obj) {\n for (var key in obj) {\n if (obj[key] instanceof Table) delete obj[key];\n }\n });\n }\n\n function iterate(req, filter, fn, resolve, reject, valueMapper) {\n \n // Apply valueMapper (hook('reading') or mappped class)\n var mappedFn = valueMapper ? (x,c,a) => fn(valueMapper(x),c,a) : fn;\n // Wrap fn with PSD and microtick stuff from Promise.\n var wrappedFn = wrap(mappedFn, reject);\n \n if (!req.onerror) req.onerror = eventRejectHandler(reject);\n if (filter) {\n req.onsuccess = trycatcher(function filter_record() {\n var cursor = req.result;\n if (cursor) {\n var c = function () { cursor.continue(); };\n if (filter(cursor, function (advancer) { c = advancer; }, resolve, reject))\n wrappedFn(cursor.value, cursor, function (advancer) { c = advancer; });\n c();\n } else {\n resolve();\n }\n }, reject);\n } else {\n req.onsuccess = trycatcher(function filter_record() {\n var cursor = req.result;\n if (cursor) {\n var c = function () { cursor.continue(); };\n wrappedFn(cursor.value, cursor, function (advancer) { c = advancer; });\n c();\n } else {\n resolve();\n }\n }, reject);\n }\n }\n\n function parseIndexSyntax(indexes) {\n /// \n /// \n var rv = [];\n indexes.split(',').forEach(function (index) {\n index = index.trim();\n var name = index.replace(/([&*]|\\+\\+)/g, \"\"); // Remove \"&\", \"++\" and \"*\"\n // Let keyPath of \"[a+b]\" be [\"a\",\"b\"]:\n var keyPath = /^\\[/.test(name) ? name.match(/^\\[(.*)\\]$/)[1].split('+') : name;\n\n rv.push(new IndexSpec(\n name,\n keyPath || null,\n /\\&/.test(index),\n /\\*/.test(index),\n /\\+\\+/.test(index),\n isArray(keyPath),\n /\\./.test(index)\n ));\n });\n return rv;\n }\n\n function cmp(key1, key2) {\n return indexedDB.cmp(key1, key2);\n }\n\n function min(a, b) {\n return cmp(a, b) < 0 ? a : b;\n }\n\n function max(a, b) {\n return cmp(a, b) > 0 ? a : b;\n }\n\n function ascending(a,b) {\n return indexedDB.cmp(a,b);\n }\n\n function descending(a, b) {\n return indexedDB.cmp(b,a);\n }\n\n function simpleCompare(a, b) {\n return a < b ? -1 : a === b ? 0 : 1;\n }\n\n function simpleCompareReverse(a, b) {\n return a > b ? -1 : a === b ? 0 : 1;\n }\n\n function combine(filter1, filter2) {\n return filter1 ?\n filter2 ?\n function () { return filter1.apply(this, arguments) && filter2.apply(this, arguments); } :\n filter1 :\n filter2;\n }\n\n function readGlobalSchema() {\n db.verno = idbdb.version / 10;\n db._dbSchema = globalSchema = {};\n dbStoreNames = slice(idbdb.objectStoreNames, 0);\n if (dbStoreNames.length === 0) return; // Database contains no stores.\n var trans = idbdb.transaction(safariMultiStoreFix(dbStoreNames), 'readonly');\n dbStoreNames.forEach(function (storeName) {\n var store = trans.objectStore(storeName),\n keyPath = store.keyPath,\n dotted = keyPath && typeof keyPath === 'string' && keyPath.indexOf('.') !== -1;\n var primKey = new IndexSpec(keyPath, keyPath || \"\", false, false, !!store.autoIncrement, keyPath && typeof keyPath !== 'string', dotted);\n var indexes = [];\n for (var j = 0; j < store.indexNames.length; ++j) {\n var idbindex = store.index(store.indexNames[j]);\n keyPath = idbindex.keyPath;\n dotted = keyPath && typeof keyPath === 'string' && keyPath.indexOf('.') !== -1;\n var index = new IndexSpec(idbindex.name, keyPath, !!idbindex.unique, !!idbindex.multiEntry, false, keyPath && typeof keyPath !== 'string', dotted);\n indexes.push(index);\n }\n globalSchema[storeName] = new TableSchema(storeName, primKey, indexes, {});\n });\n setApiOnPlace([allTables], keys(globalSchema), globalSchema);\n }\n\n function adjustToExistingIndexNames(schema, idbtrans) {\n /// \n /// Issue #30 Problem with existing db - adjust to existing index names when migrating from non-dexie db\n /// \n /// Map between name and TableSchema\n /// \n var storeNames = idbtrans.db.objectStoreNames;\n\n for (var i = 0; i < storeNames.length; ++i) {\n var storeName = storeNames[i];\n var store = idbtrans.objectStore(storeName);\n hasGetAll = 'getAll' in store;\n \n for (var j = 0; j < store.indexNames.length; ++j) {\n var indexName = store.indexNames[j];\n var keyPath = store.index(indexName).keyPath;\n var dexieName = typeof keyPath === 'string' ? keyPath : \"[\" + slice(keyPath).join('+') + \"]\";\n if (schema[storeName]) {\n var indexSpec = schema[storeName].idxByName[dexieName];\n if (indexSpec) indexSpec.name = indexName;\n }\n }\n }\n\n // Bug with getAll() on Safari ver<604 on Workers only, see discussion following PR #579\n if (/Safari/.test(navigator.userAgent) &&\n !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) &&\n _global.WorkerGlobalScope && _global instanceof _global.WorkerGlobalScope &&\n [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604)\n {\n hasGetAll = false;\n } \n }\n\n function fireOnBlocked(ev) {\n db.on(\"blocked\").fire(ev);\n // Workaround (not fully*) for missing \"versionchange\" event in IE,Edge and Safari:\n connections\n .filter(c=>c.name === db.name && c !== db && !c._vcFired)\n .map(c => c.on(\"versionchange\").fire(ev));\n }\n\n extend(this, {\n Collection: Collection,\n Table: Table,\n Transaction: Transaction,\n Version: Version,\n WhereClause: WhereClause\n });\n\n init();\n\n addons.forEach(function (fn) {\n fn(db);\n });\n}\n\nfunction parseType(type) {\n if (typeof type === 'function') {\n return new type();\n } else if (isArray(type)) {\n return [parseType(type[0])];\n } else if (type && typeof type === 'object') {\n var rv = {};\n applyStructure(rv, type);\n return rv;\n } else {\n return type;\n }\n}\n\nfunction applyStructure(obj, structure) {\n keys(structure).forEach(function (member) {\n var value = parseType(structure[member]);\n obj[member] = value;\n });\n return obj;\n}\n\nfunction hookedEventSuccessHandler(resolve) {\n // wrap() is needed when calling hooks because the rare scenario of:\n // * hook does a db operation that fails immediately (IDB throws exception)\n // For calling db operations on correct transaction, wrap makes sure to set PSD correctly.\n // wrap() will also execute in a virtual tick.\n // * If not wrapped in a virtual tick, direct exception will launch a new physical tick.\n // * If this was the last event in the bulk, the promise will resolve after a physical tick\n // and the transaction will have committed already.\n // If no hook, the virtual tick will be executed in the reject()/resolve of the final promise,\n // because it is always marked with _lib = true when created using Transaction._promise().\n return wrap(function(event) {\n var req = event.target,\n ctx = req._hookCtx,// Contains the hook error handler. Put here instead of closure to boost performance.\n result = ctx.value || req.result, // Pass the object value on updates. The result from IDB is the primary key.\n hookSuccessHandler = ctx && ctx.onsuccess;\n hookSuccessHandler && hookSuccessHandler(result);\n resolve && resolve(result);\n }, resolve);\n}\n\nfunction eventRejectHandler(reject) {\n return wrap(function (event) {\n preventDefault(event);\n reject (event.target.error);\n return false;\n });\n}\n\nfunction eventSuccessHandler (resolve) {\n return wrap(function (event){\n resolve(event.target.result);\n });\n}\n\nfunction hookedEventRejectHandler (reject) {\n return wrap(function (event) {\n // See comment on hookedEventSuccessHandler() why wrap() is needed only when supporting hooks.\n \n var req = event.target,\n err = req.error,\n ctx = req._hookCtx,// Contains the hook error handler. Put here instead of closure to boost performance.\n hookErrorHandler = ctx && ctx.onerror;\n hookErrorHandler && hookErrorHandler(err);\n preventDefault(event);\n reject (err);\n return false;\n });\n}\n\nfunction preventDefault(event) {\n if (event.stopPropagation) // IndexedDBShim doesnt support this on Safari 8 and below.\n event.stopPropagation();\n if (event.preventDefault) // IndexedDBShim doesnt support this on Safari 8 and below.\n event.preventDefault();\n}\n\nfunction awaitIterator (iterator) {\n var callNext = result => iterator.next(result),\n doThrow = error => iterator.throw(error),\n onSuccess = step(callNext),\n onError = step(doThrow);\n\n function step(getNext) {\n return val => {\n var next = getNext(val),\n value = next.value;\n\n return next.done ? value :\n (!value || typeof value.then !== 'function' ?\n isArray(value) ? Promise.all(value).then(onSuccess, onError) : onSuccess(value) :\n value.then(onSuccess, onError));\n };\n }\n\n return step(callNext)();\n}\n\n//\n// IndexSpec struct\n//\nfunction IndexSpec(name, keyPath, unique, multi, auto, compound, dotted) {\n /// \n /// \n /// \n /// \n /// \n /// \n /// \n this.name = name;\n this.keyPath = keyPath;\n this.unique = unique;\n this.multi = multi;\n this.auto = auto;\n this.compound = compound;\n this.dotted = dotted;\n var keyPathSrc = typeof keyPath === 'string' ? keyPath : keyPath && ('[' + [].join.call(keyPath, '+') + ']');\n this.src = (unique ? '&' : '') + (multi ? '*' : '') + (auto ? \"++\" : \"\") + keyPathSrc;\n}\n\n//\n// TableSchema struct\n//\nfunction TableSchema(name, primKey, indexes, instanceTemplate) {\n /// \n /// \n /// \n /// \n this.name = name;\n this.primKey = primKey || new IndexSpec();\n this.indexes = indexes || [new IndexSpec()];\n this.instanceTemplate = instanceTemplate;\n this.mappedClass = null;\n this.idxByName = arrayToObject(indexes, index => [index.name, index]);\n}\n\nfunction safariMultiStoreFix(storeNames) {\n return storeNames.length === 1 ? storeNames[0] : storeNames;\n}\n\nfunction getNativeGetDatabaseNamesFn(indexedDB) {\n var fn = indexedDB && (indexedDB.getDatabaseNames || indexedDB.webkitGetDatabaseNames);\n return fn && fn.bind(indexedDB);\n}\n\n// Export Error classes\nprops(Dexie, fullNameExceptions); // Dexie.XXXError = class XXXError {...};\n\n//\n// Static methods and properties\n// \nprops(Dexie, {\n \n //\n // Static delete() method.\n //\n delete: function (databaseName) {\n var db = new Dexie(databaseName),\n promise = db.delete();\n promise.onblocked = function (fn) {\n db.on(\"blocked\", fn);\n return this;\n };\n return promise;\n },\n \n //\n // Static exists() method.\n //\n exists: function(name) {\n return new Dexie(name).open().then(db=>{\n db.close();\n return true;\n }).catch(Dexie.NoSuchDatabaseError, () => false);\n },\n \n //\n // Static method for retrieving a list of all existing databases at current host.\n //\n getDatabaseNames: function (cb) {\n var getDatabaseNames = getNativeGetDatabaseNamesFn(Dexie.dependencies.indexedDB);\n return getDatabaseNames ? new Promise((resolve, reject) => {\n var req = getDatabaseNames();\n req.onsuccess = function (event) {\n resolve(slice(event.target.result, 0)); // Converst DOMStringList to Array\n };\n req.onerror = eventRejectHandler(reject);\n }).then(cb) : dbNamesDB.dbnames.toCollection().primaryKeys(cb);\n },\n \n defineClass: function () {\n // Default constructor able to copy given properties into this object.\n function Class(properties) {\n /// Properties to initialize object with.\n /// \n if (properties) extend(this, properties);\n }\n return Class;\n },\n \n applyStructure: applyStructure,\n \n ignoreTransaction: function (scopeFunc) {\n // In case caller is within a transaction but needs to create a separate transaction.\n // Example of usage:\n //\n // Let's say we have a logger function in our app. Other application-logic should be unaware of the\n // logger function and not need to include the 'logentries' table in all transaction it performs.\n // The logging should always be done in a separate transaction and not be dependant on the current\n // running transaction context. Then you could use Dexie.ignoreTransaction() to run code that starts a new transaction.\n //\n // Dexie.ignoreTransaction(function() {\n // db.logentries.add(newLogEntry);\n // });\n //\n // Unless using Dexie.ignoreTransaction(), the above example would try to reuse the current transaction\n // in current Promise-scope.\n //\n // An alternative to Dexie.ignoreTransaction() would be setImmediate() or setTimeout(). The reason we still provide an\n // API for this because\n // 1) The intention of writing the statement could be unclear if using setImmediate() or setTimeout().\n // 2) setTimeout() would wait unnescessary until firing. This is however not the case with setImmediate().\n // 3) setImmediate() is not supported in the ES standard.\n // 4) You might want to keep other PSD state that was set in a parent PSD, such as PSD.letThrough.\n return PSD.trans ?\n usePSD(PSD.transless, scopeFunc) : // Use the closest parent that was non-transactional.\n scopeFunc(); // No need to change scope because there is no ongoing transaction.\n },\n \n vip: function (fn) {\n // To be used by subscribers to the on('ready') event.\n // This will let caller through to access DB even when it is blocked while the db.ready() subscribers are firing.\n // This would have worked automatically if we were certain that the Provider was using Dexie.Promise for all asyncronic operations. The promise PSD\n // from the provider.connect() call would then be derived all the way to when provider would call localDatabase.applyChanges(). But since\n // the provider more likely is using non-promise async APIs or other thenable implementations, we cannot assume that.\n // Note that this method is only useful for on('ready') subscribers that is returning a Promise from the event. If not using vip()\n // the database could deadlock since it wont open until the returned Promise is resolved, and any non-VIPed operation started by\n // the caller will not resolve until database is opened.\n return newScope(function () {\n PSD.letThrough = true; // Make sure we are let through if still blocking db due to onready is firing.\n return fn();\n });\n },\n\n async: function (generatorFn) {\n return function () {\n try {\n var rv = awaitIterator(generatorFn.apply(this, arguments));\n if (!rv || typeof rv.then !== 'function')\n return Promise.resolve(rv);\n return rv;\n } catch (e) {\n return rejection (e);\n }\n };\n },\n\n spawn: function (generatorFn, args, thiz) {\n try {\n var rv = awaitIterator(generatorFn.apply(thiz, args || []));\n if (!rv || typeof rv.then !== 'function')\n return Promise.resolve(rv);\n return rv;\n } catch (e) {\n return rejection(e);\n }\n },\n \n // Dexie.currentTransaction property\n currentTransaction: {\n get: () => PSD.trans || null\n },\n\n waitFor: function (promiseOrFunction, optionalTimeout) {\n // If a function is provided, invoke it and pass the returning value to Transaction.waitFor()\n var promise = Promise.resolve(\n typeof promiseOrFunction === 'function' ? Dexie.ignoreTransaction(promiseOrFunction) : promiseOrFunction)\n .timeout(optionalTimeout || 60000); // Default the timeout to one minute. Caller may specify Infinity if required. \n\n // Run given promise on current transaction. If no current transaction, just return a Dexie promise based\n // on given value.\n return PSD.trans ? PSD.trans.waitFor(promise) : promise;\n },\n \n // Export our Promise implementation since it can be handy as a standalone Promise implementation\n Promise: Promise,\n \n // Dexie.debug proptery:\n // Dexie.debug = false\n // Dexie.debug = true\n // Dexie.debug = \"dexie\" - don't hide dexie's stack frames.\n debug: {\n get: () => Debug.debug,\n set: value => {\n Debug.setDebug(value, value === 'dexie' ? ()=>true : dexieStackFrameFilter);\n }\n },\n \n // Export our derive/extend/override methodology\n derive: derive,\n extend: extend,\n props: props,\n override: override,\n // Export our Events() function - can be handy as a toolkit\n Events: Events,\n // Utilities\n getByKeyPath: getByKeyPath,\n setByKeyPath: setByKeyPath,\n delByKeyPath: delByKeyPath,\n shallowClone: shallowClone,\n deepClone: deepClone,\n getObjectDiff: getObjectDiff,\n asap: asap,\n maxKey: maxKey,\n minKey: minKey,\n // Addon registry\n addons: [],\n // Global DB connection list\n connections: connections,\n \n MultiModifyError: exceptions.Modify, // Backward compatibility 0.9.8. Deprecate.\n errnames: errnames,\n \n // Export other static classes\n IndexSpec: IndexSpec,\n TableSchema: TableSchema,\n \n //\n // Dependencies\n //\n // These will automatically work in browsers with indexedDB support, or where an indexedDB polyfill has been included.\n //\n // In node.js, however, these properties must be set \"manually\" before instansiating a new Dexie().\n // For node.js, you need to require indexeddb-js or similar and then set these deps.\n //\n dependencies: (()=>{\n try {\n return {\n // Required:\n indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,\n IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange\n };\n } catch (e) {\n return {\n indexedDB: null,\n IDBKeyRange: null\n };\n }\n })(),\n \n // API Version Number: Type Number, make sure to always set a version number that can be comparable correctly. Example: 0.9, 0.91, 0.92, 1.0, 1.01, 1.1, 1.2, 1.21, etc.\n semVer: DEXIE_VERSION,\n version: DEXIE_VERSION.split('.')\n .map(n => parseInt(n))\n .reduce((p,c,i) => p + (c/Math.pow(10,i*2))),\n \n // https://github.com/dfahlander/Dexie.js/issues/186\n // typescript compiler tsc in mode ts-->es5 & commonJS, will expect require() to return\n // x.default. Workaround: Set Dexie.default = Dexie.\n default: Dexie,\n // Make it possible to import {Dexie} (non-default import)\n // Reason 1: May switch to that in future.\n // Reason 2: We declare it both default and named exported in d.ts to make it possible\n // to let addons extend the Dexie interface with Typescript 2.1 (works only when explicitely\n // exporting the symbol, not just default exporting)\n Dexie: Dexie\n});\n\n// Map DOMErrors and DOMExceptions to corresponding Dexie errors. May change in Dexie v2.0.\nPromise.rejectionMapper = mapError;\n\n// Initialize dbNamesDB (won't ever be opened on chromium browsers')\ndbNamesDB = new Dexie('__dbnames'); \ndbNamesDB.version(1).stores({dbnames: 'name'});\n\n(()=>{\n // Migrate from Dexie 1.x database names stored in localStorage:\n var DBNAMES = 'Dexie.DatabaseNames';\n try { // https://github.com/dfahlander/Dexie.js/issues/617\n if (typeof localStorage !== undefined && _global.document !== undefined) {\n // Have localStorage and is not executing in a worker. Lets migrate from Dexie 1.x.\n JSON.parse(localStorage.getItem(DBNAMES) || \"[]\")\n .forEach(name => dbNamesDB.dbnames.put({name: name}).catch(nop));\n localStorage.removeItem(DBNAMES);\n }\n } catch (_e) {}\n})();\n","\"use strict\";\nimport DataUtils,\n{\n REQUEST_TYPE_GET,\n REQUEST_TYPE_PUT,\n REQUEST_TYPE_POST,\n REQUEST_TYPE_DELETE,\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_FORM\n}\nfrom '../utilities/DataUtils';\nimport Dexie from 'dexie';\nimport * as DataEvent from '../events/DataEvent';\nexport var COUNT;\nexport var FINAL_KEY;\nexport default class DBUtils\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n this.dataUtils = new DataUtils();\n this.db = new Dexie(\"fipamo_posts\");\n this.db.version(1).stores(\n {\n postList: 'id,post'\n });\n this.db.postList.toArray(array =>\n {\n COUNT = array.length;\n FINAL_KEY = array[COUNT - 1].id;\n })\n }\n //--------------------------\n // methods\n //--------------------------\n modify(id, postData)\n {\n let self = this;\n let freshID;\n return new Promise(function(resolve, reject)\n {\n if (id == null)\n {\n self.db.postList.put(postData).then(fresh =>\n {\n freshID = fresh;\n }).catch(e =>\n {\n let err = {\n message: \"PUT ERROR\",\n error: e\n }\n });\n }\n else\n {\n self.db.postList.update(Number(id),\n {\n post: postData\n }).then(updated =>\n {}).catch(e =>\n {\n let err = {\n message: \"UPDATE ERROR\",\n error: e\n }\n });\n }\n self.db.postList.toArray(array =>\n {\n self.syncRemote(array, freshID).then(response =>\n {\n resolve(\n {\n response\n })\n }).catch(err =>\n {\n reject(\n {\n err\n });\n });\n })\n })\n }\n syncLocal(array)\n {\n let self = this;\n return new Promise(function(resolve, reject)\n {\n self.db.postList.clear().then(result =>\n {\n self.db.postList.bulkAdd(array).then(key =>\n {\n self.db.postList.toArray(array =>\n {\n let event = DataEvent.LOCAL_DB_READY\n resolve(\n {\n event\n })\n })\n }).catch(Dexie.BulkError, e =>\n {\n reject(\n {\n e\n })\n })\n })\n })\n }\n syncRemote(db, newPostId)\n {\n let self = this;\n return new Promise(function(resolve, reject)\n {\n self.dataUtils.request('/api/post/sync', DataEvent.POSTS_SYNCED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, db).then((response) =>\n {\n let bounce = {\n message: response,\n newPost: newPostId\n }\n resolve(bounce)\n }).catch((err) =>\n {\n reject(err);\n })\n })\n }\n getPost(id)\n {\n let self = this;\n if (id == null)\n {\n return new Promise(function(resolve, reject)\n {\n self.db.postList.toArray(array =>\n {\n resolve(array)\n }).catch(err =>\n {\n reject(err)\n })\n })\n }\n else\n {\n return new Promise(function(resolve, reject)\n {\n self.db.postList.get(Number(id)).then(obj =>\n {\n resolve(obj)\n }).catch(err =>\n {\n reject(err)\n })\n })\n }\n }\n archivePost(id, archive)\n {\n let self = this;\n return new Promise(function(resolve, reject)\n {\n self.db.postList.update(Number(id),\n {\n post: archive\n }).then(deleted =>\n {\n self.db.postList.toArray(array =>\n {\n self.syncRemote(array, null).then(response =>\n {\n resolve(\n {\n response\n })\n }).catch(err =>\n {\n reject(\n {\n err\n });\n });\n })\n }).catch(e =>\n {\n console.log(\"ERROR\", e)\n });\n })\n }\n //--------------------------\n // event handlers\n //--------------------------\n}","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([bth[buf[i++]], bth[buf[i++]], \n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]],\n\tbth[buf[i++]], bth[buf[i++]],\n\tbth[buf[i++]], bth[buf[i++]]]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","import DataUtils,\n{\n REQUEST_TYPE_GET,\n REQUEST_TYPE_PUT,\n REQUEST_TYPE_POST,\n REQUEST_TYPE_DELETE,\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_FORM\n}\nfrom '../../../../../brain//tools/utilities/DataUtils';\nimport StringUtils from '../../../../../brain//tools/utilities/StringUtils';\nimport DateUtils from '../../../../../brain/tools/utilities/DateUtils';\nimport DBUtils from '../../../../../brain/tools/utilities/DBUtils';\nvar uuidv4 = require('uuid/v4');\nexport default class PostActions\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n this.dataUtils = new DataUtils();\n this.dateUtils = new DateUtils();\n this.dbUtils = new DBUtils();\n }\n //--------------------------\n // methods\n //--------------------------\n update(id, data, files, lastKey)\n {\n let self = this;\n let freshData;\n return new Promise(function(resolve, reject)\n {\n let txt = document.createElement(\"textarea\");\n txt.innerHTML = document.getElementById('edit-post-text').innerHTML;\n let html = txt.value;\n html = html.replace(/<\\/?span[^>]*>/g, \"\"); //removes highightjs styling\n html = html.replace(/<\\/?br[^>]*>/g, \"\\n\"); //convert back to encoded line break for storage\n data.title = document.getElementById('post_title').value;\n data.slug = new StringUtils().cleanString(document.getElementById('post_title').value)\n data.plaintext = html;\n data.html = html;\n data.created = document.getElementById('post-date').value;\n data.tags = document.getElementById('post_tags').value;\n data.page = document.getElementById('option-page').getAttribute('data-active')\n data.featured = document.getElementById('option-feature').getAttribute('data-active')\n data.published = document.getElementById('option-published').getAttribute('data-active')\n if (files.length != 0)\n {\n for (var i = 0; i < files.length; i++)\n {\n var file = files[i];\n // Check the file type.\n if (!file.type.match('image.*'))\n {\n continue;\n }\n data.feature = \"/content/blog-images/\" + self.dateUtils.getDate('year', new Date()) + \"/\" + self.dateUtils.getDate('month', new Date()) + \"/\" + file.name;\n }\n }\n else\n {\n if (typeof data.feature == 'undefined') data.feature = \"\"\n }\n if (id == null)\n {\n freshData = {\n id: lastKey + 1,\n post:\n {\n uuid: uuidv4(),\n title: data.title,\n slug: data.slug,\n plaintext: data.plaintext,\n html: data.html,\n feature: data.feature,\n created: data.created,\n tags: data.tags,\n page: data.page,\n featured: data.featured,\n published: data.published,\n deleted: \"\",\n author: \"user\"\n }\n }\n }\n else\n {\n freshData = data;\n }\n self.dbUtils.modify(id, freshData).then((response) =>\n {\n resolve(response)\n }).catch((err) =>\n {\n reject(err)\n })\n })\n }\n deletePost(id, body)\n {\n let self = this;\n body.deleted = new Date().toString();\n return new Promise(function(resolve, reject)\n {\n self.dbUtils.archivePost(id, body).then(response =>\n {\n console.log(response)\n resolve(response)\n }).catch(err =>\n {\n console.log(err)\n reject(error)\n })\n })\n }\n //--------------------------\n // event handlers\n //--------------------------\n}","export const EDITOR_DELETE = 'editorDelete';\nexport const EDITOR_UPLOAD_POST_IMAGE = 'editorUploadImage';\nexport const EDITOR_SAVE = 'editorSave';\nexport const EDITOR_UPDATE = 'editorUpdate';\n\nclass EditorEvent\n{\n\n //--------------------------\n // methods\n //--------------------------\n\n\n\n //--------------------------\n // event handlers\n //--------------------------\n}\nexport default new EditorEvent\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.TinyDatePicker = factory());\n}(this, (function () { 'use strict';\n\n /**\n * @file A generic set of mutation-free date functions.\n */\n\n /**\n * now returns the current date without any time values\n *\n * @returns {Date}\n */\n function now() {\n var dt = new Date();\n dt.setHours(0, 0, 0, 0);\n return dt;\n }\n\n /**\n * dateEq compares two dates\n *\n * @param {Date} date1 the first date\n * @param {Date} date2 the second date\n * @returns {boolean}\n */\n function datesEq(date1, date2) {\n return (date1 && date1.toDateString()) === (date2 && date2.toDateString());\n }\n\n /**\n * shiftDay shifts the specified date by n days\n *\n * @param {Date} dt\n * @param {number} n\n * @returns {Date}\n */\n function shiftDay(dt, n) {\n dt = new Date(dt);\n dt.setDate(dt.getDate() + n);\n return dt;\n }\n\n /**\n * shiftMonth shifts the specified date by a specified number of months\n *\n * @param {Date} dt\n * @param {number} n\n * @param {boolean} wrap optional, if true, does not change year\n * value, defaults to false\n * @returns {Date}\n */\n function shiftMonth(dt, n, wrap) {\n dt = new Date(dt);\n\n var dayOfMonth = dt.getDate();\n var month = dt.getMonth() + n;\n\n dt.setDate(1);\n dt.setMonth(wrap ? (12 + month) % 12 : month);\n dt.setDate(dayOfMonth);\n\n // If dayOfMonth = 31, but the target month only has 30 or 29 or whatever...\n // head back to the max of the target month\n if (dt.getDate() < dayOfMonth) {\n dt.setDate(0);\n }\n\n return dt;\n }\n\n /**\n * shiftYear shifts the specified date by n years\n *\n * @param {Date} dt\n * @param {number} n\n * @returns {Date}\n */\n function shiftYear(dt, n) {\n dt = new Date(dt);\n dt.setFullYear(dt.getFullYear() + n);\n return dt;\n }\n\n /**\n * setYear changes the specified date to the specified year\n *\n * @param {Date} dt\n * @param {number} year\n */\n function setYear(dt, year) {\n dt = new Date(dt);\n dt.setFullYear(year);\n return dt;\n }\n\n /**\n * setMonth changes the specified date to the specified month\n *\n * @param {Date} dt\n * @param {number} month\n */\n function setMonth(dt, month) {\n return shiftMonth(dt, month - dt.getMonth());\n }\n\n /**\n * dateOrParse creates a function which, given a date or string, returns a date\n *\n * @param {function} parse the function used to parse strings\n * @returns {function}\n */\n function dateOrParse(parse) {\n return function (dt) {\n return dropTime(typeof dt === 'string' ? parse(dt) : dt);\n };\n }\n\n /**\n * constrainDate returns dt or min/max depending on whether dt is out of bounds (inclusive)\n *\n * @export\n * @param {Date} dt\n * @param {Date} min\n * @param {Date} max\n * @returns {Date}\n */\n function constrainDate(dt, min, max) {\n return (dt < min) ? min :\n (dt > max) ? max :\n dt;\n }\n\n function dropTime(dt) {\n dt = new Date(dt);\n dt.setHours(0, 0, 0, 0);\n return dt;\n }\n\n /**\n * @file Utility functions for function manipulation.\n */\n\n /**\n * bufferFn buffers calls to fn so they only happen every ms milliseconds\n *\n * @param {number} ms number of milliseconds\n * @param {function} fn the function to be buffered\n * @returns {function}\n */\n function bufferFn(ms, fn) {\n var timeout = undefined;\n return function () {\n clearTimeout(timeout);\n timeout = setTimeout(fn, ms);\n };\n }\n\n /**\n * noop is a function which does nothing at all.\n */\n function noop() { }\n\n /**\n * copy properties from object o2 to object o1.\n *\n * @params {Object} o1\n * @params {Object} o2\n * @returns {Object}\n */\n function cp() {\n var args = arguments;\n var o1 = args[0];\n for (var i = 1; i < args.length; ++i) {\n var o2 = args[i] || {};\n for (var key in o2) {\n o1[key] = o2[key];\n }\n }\n return o1;\n }\n\n /**\n * @file Responsible for sanitizing and creating date picker options.\n */\n\n var english = {\n days: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n today: 'Today',\n clear: 'Clear',\n close: 'Close',\n };\n\n /**\n * DatePickerOptions constructs a new date picker options object, overriding\n * default values with any values specified in opts.\n *\n * @param {DatePickerOptions} opts\n * @returns {DatePickerOptions}\n */\n function DatePickerOptions(opts) {\n opts = opts || {};\n opts = cp(defaults(), opts);\n var parse = dateOrParse(opts.parse);\n opts.lang = cp(english, opts.lang);\n opts.parse = parse;\n opts.inRange = makeInRangeFn(opts);\n opts.min = parse(opts.min || shiftYear(now(), -100));\n opts.max = parse(opts.max || shiftYear(now(), 100));\n opts.hilightedDate = opts.parse(opts.hilightedDate);\n\n return opts;\n }\n\n function defaults() {\n return {\n lang: english,\n\n // Possible values: dp-modal, dp-below, dp-permanent\n mode: 'dp-modal',\n\n // The date to hilight initially if the date picker has no\n // initial value.\n hilightedDate: now(),\n\n format: function (dt) {\n return (dt.getMonth() + 1) + '/' + dt.getDate() + '/' + dt.getFullYear();\n },\n\n parse: function (str) {\n var date = new Date(str);\n return isNaN(date) ? now() : date;\n },\n\n dateClass: function () { },\n\n inRange: function () {\n return true;\n }\n };\n }\n\n function makeInRangeFn(opts) {\n var inRange = opts.inRange; // Cache this version, and return a variant\n\n return function (dt, dp) {\n return inRange(dt, dp) && opts.min <= dt && opts.max >= dt;\n };\n }\n\n /**\n * @file Helper functions for dealing with dom elements.\n */\n\n var Key = {\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n enter: 13,\n esc: 27,\n };\n\n /**\n * on attaches an event handler to the specified element, and returns an\n * off function which can be used to remove the handler.\n *\n * @param {string} evt the name of the event to handle\n * @param {HTMLElement} el the element to attach to\n * @param {function} handler the event handler\n * @returns {function} the off function\n */\n function on(evt, el, handler) {\n el.addEventListener(evt, handler, true);\n\n return function () {\n el.removeEventListener(evt, handler, true);\n };\n }\n\n var CustomEvent = shimCustomEvent();\n\n function shimCustomEvent() {\n var CustomEvent = window.CustomEvent;\n\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function (event, params) {\n params = params || {bubbles: false, cancelable: false, detail: undefined};\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n }\n\n return CustomEvent;\n }\n\n /**\n * @file Manages the calendar / day-picker view.\n */\n\n var dayPicker = {\n onKeyDown: keyDown,\n onClick: {\n 'dp-day': selectDay,\n 'dp-next': gotoNextMonth,\n 'dp-prev': gotoPrevMonth,\n 'dp-today': selectToday,\n 'dp-clear': clear,\n 'dp-close': close,\n 'dp-cal-month': showMonthPicker,\n 'dp-cal-year': showYearPicker,\n },\n render: render\n };\n\n /**\n * view renders the calendar (day picker) as an HTML string.\n *\n * @param {DatePickerContext} context the date picker being rendered\n * @returns {string}\n */\n function render(dp) {\n var opts = dp.opts;\n var lang = opts.lang;\n var state = dp.state;\n var dayNames = lang.days;\n var dayOffset = opts.dayOffset || 0;\n var selectedDate = state.selectedDate;\n var hilightedDate = state.hilightedDate;\n var hilightedMonth = hilightedDate.getMonth();\n var today = now().getTime();\n\n return (\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '' +\n '
' +\n '
' +\n dayNames.map(function (name, i) {\n return (\n '' + dayNames[(i + dayOffset) % dayNames.length] + ''\n );\n }).join('') +\n mapDays(hilightedDate, dayOffset, function (date) {\n var isNotInMonth = date.getMonth() !== hilightedMonth;\n var isDisabled = !opts.inRange(date);\n var isToday = date.getTime() === today;\n var className = 'dp-day';\n className += (isNotInMonth ? ' dp-edge-day' : '');\n className += (datesEq(date, hilightedDate) ? ' dp-current' : '');\n className += (datesEq(date, selectedDate) ? ' dp-selected' : '');\n className += (isDisabled ? ' dp-day-disabled' : '');\n className += (isToday ? ' dp-day-today' : '');\n className += ' ' + opts.dateClass(date, dp);\n\n return (\n ''\n );\n }) +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n '
' +\n '
'\n );\n }\n\n /**\n * keyDown handles the key down event for the day-picker\n *\n * @param {Event} e\n * @param {DatePickerContext} dp\n */\n function keyDown(e, dp) {\n var key = e.keyCode;\n var shiftBy =\n (key === Key.left) ? -1 :\n (key === Key.right) ? 1 :\n (key === Key.up) ? -7 :\n (key === Key.down) ? 7 :\n 0;\n\n if (key === Key.esc) {\n dp.close();\n } else if (shiftBy) {\n e.preventDefault();\n dp.setState({\n hilightedDate: shiftDay(dp.state.hilightedDate, shiftBy)\n });\n }\n }\n\n function selectToday(e, dp) {\n dp.setState({\n selectedDate: now(),\n });\n }\n\n function clear(e, dp) {\n dp.setState({\n selectedDate: null,\n });\n }\n\n function close(e, dp) {\n dp.close();\n }\n\n function showMonthPicker(e, dp) {\n dp.setState({\n view: 'month'\n });\n }\n\n function showYearPicker(e, dp) {\n dp.setState({\n view: 'year'\n });\n }\n\n function gotoNextMonth(e, dp) {\n var hilightedDate = dp.state.hilightedDate;\n dp.setState({\n hilightedDate: shiftMonth(hilightedDate, 1)\n });\n }\n\n function gotoPrevMonth(e, dp) {\n var hilightedDate = dp.state.hilightedDate;\n dp.setState({\n hilightedDate: shiftMonth(hilightedDate, -1)\n });\n }\n\n function selectDay(e, dp) {\n dp.setState({\n selectedDate: new Date(parseInt(e.target.getAttribute('data-date'))),\n });\n }\n\n function mapDays(currentDate, dayOffset, fn) {\n var result = '';\n var iter = new Date(currentDate);\n iter.setDate(1);\n iter.setDate(1 - iter.getDay() + dayOffset);\n\n // If we are showing monday as the 1st of the week,\n // and the monday is the 2nd of the month, the sunday won't\n // show, so we need to shift backwards\n if (dayOffset && iter.getDate() === dayOffset + 1) {\n iter.setDate(dayOffset - 6);\n }\n\n // We are going to have 6 weeks always displayed to keep a consistent\n // calendar size\n for (var day = 0; day < (6 * 7); ++day) {\n result += fn(iter);\n iter.setDate(iter.getDate() + 1);\n }\n\n return result;\n }\n\n /**\n * @file Manages the month-picker view.\n */\n\n var monthPicker = {\n onKeyDown: keyDown$1,\n onClick: {\n 'dp-month': onChooseMonth\n },\n render: render$1\n };\n\n function onChooseMonth(e, dp) {\n dp.setState({\n hilightedDate: setMonth(dp.state.hilightedDate, parseInt(e.target.getAttribute('data-month'))),\n view: 'day',\n });\n }\n\n /**\n * render renders the month picker as an HTML string\n *\n * @param {DatePickerContext} dp the date picker context\n * @returns {string}\n */\n function render$1(dp) {\n var opts = dp.opts;\n var lang = opts.lang;\n var months = lang.months;\n var currentDate = dp.state.hilightedDate;\n var currentMonth = currentDate.getMonth();\n\n return (\n '
' +\n months.map(function (month, i) {\n var className = 'dp-month';\n className += (currentMonth === i ? ' dp-current' : '');\n\n return (\n ''\n );\n }).join('') +\n '
'\n );\n }\n\n /**\n * keyDown handles keydown events that occur in the month picker\n *\n * @param {Event} e\n * @param {DatePickerContext} dp\n */\n function keyDown$1(e, dp) {\n var key = e.keyCode;\n var shiftBy =\n (key === Key.left) ? -1 :\n (key === Key.right) ? 1 :\n (key === Key.up) ? -3 :\n (key === Key.down) ? 3 :\n 0;\n\n if (key === Key.esc) {\n dp.setState({\n view: 'day',\n });\n } else if (shiftBy) {\n e.preventDefault();\n dp.setState({\n hilightedDate: shiftMonth(dp.state.hilightedDate, shiftBy, true)\n });\n }\n }\n\n /**\n * @file Manages the year-picker view.\n */\n\n var yearPicker = {\n render: render$2,\n onKeyDown: keyDown$2,\n onClick: {\n 'dp-year': onChooseYear\n },\n };\n\n /**\n * view renders the year picker as an HTML string.\n *\n * @param {DatePickerContext} dp the date picker context\n * @returns {string}\n */\n function render$2(dp) {\n var state = dp.state;\n var currentYear = state.hilightedDate.getFullYear();\n var selectedYear = state.selectedDate.getFullYear();\n\n return (\n '
' +\n mapYears(dp, function (year) {\n var className = 'dp-year';\n className += (year === currentYear ? ' dp-current' : '');\n className += (year === selectedYear ? ' dp-selected' : '');\n\n return (\n ''\n );\n }) +\n '
'\n );\n }\n\n function onChooseYear(e, dp) {\n dp.setState({\n hilightedDate: setYear(dp.state.hilightedDate, parseInt(e.target.getAttribute('data-year'))),\n view: 'day',\n });\n }\n\n function keyDown$2(e, dp) {\n var key = e.keyCode;\n var opts = dp.opts;\n var shiftBy =\n (key === Key.left || key === Key.up) ? 1 :\n (key === Key.right || key === Key.down) ? -1 :\n 0;\n\n if (key === Key.esc) {\n dp.setState({\n view: 'day',\n });\n } else if (shiftBy) {\n e.preventDefault();\n var shiftedYear = shiftYear(dp.state.hilightedDate, shiftBy);\n\n dp.setState({\n hilightedDate: constrainDate(shiftedYear, opts.min, opts.max),\n });\n }\n }\n\n function mapYears(dp, fn) {\n var result = '';\n var max = dp.opts.max.getFullYear();\n\n for (var i = max; i >= dp.opts.min.getFullYear(); --i) {\n result += fn(i);\n }\n\n return result;\n }\n\n /**\n * @file Defines the base date picker behavior, overridden by various modes.\n */\n\n var views = {\n day: dayPicker,\n year: yearPicker,\n month: monthPicker\n };\n\n function BaseMode(input, emit, opts) {\n var detatchInputEvents; // A function that detaches all events from the input\n var closing = false; // A hack to prevent calendar from re-opening when closing.\n var selectedDate; // The currently selected date\n var dp = {\n // The root DOM element for the date picker, initialized on first open.\n el: undefined,\n opts: opts,\n shouldFocusOnBlur: true,\n shouldFocusOnRender: true,\n state: initialState(),\n adjustPosition: noop,\n containerHTML: '
',\n\n attachToDom: function () {\n document.body.appendChild(dp.el);\n },\n\n updateInput: function (selectedDate) {\n var e = new CustomEvent('change', {bubbles: true});\n e.simulated = true;\n input.value = selectedDate ? opts.format(selectedDate) : '';\n input.dispatchEvent(e);\n },\n\n computeSelectedDate: function () {\n return opts.parse(input.value);\n },\n\n currentView: function() {\n return views[dp.state.view];\n },\n\n open: function () {\n if (closing) {\n return;\n }\n\n if (!dp.el) {\n dp.el = createContainerElement(opts, dp.containerHTML);\n attachContainerEvents(dp);\n }\n\n selectedDate = constrainDate(dp.computeSelectedDate(), opts.min, opts.max);\n dp.state.hilightedDate = selectedDate || opts.hilightedDate;\n dp.state.view = 'day';\n\n dp.attachToDom();\n dp.render();\n\n emit('open');\n },\n\n isVisible: function () {\n return !!dp.el && !!dp.el.parentNode;\n },\n\n hasFocus: function () {\n var focused = document.activeElement;\n return dp.el &&\n dp.el.contains(focused) &&\n focused.className.indexOf('dp-focuser') < 0;\n },\n\n shouldHide: function () {\n return dp.isVisible();\n },\n\n close: function (becauseOfBlur) {\n var el = dp.el;\n\n if (!dp.isVisible()) {\n return;\n }\n\n if (el) {\n var parent = el.parentNode;\n parent && parent.removeChild(el);\n }\n\n closing = true;\n\n if (becauseOfBlur && dp.shouldFocusOnBlur) {\n focusInput(input);\n }\n\n // When we close, the input often gains refocus, which\n // can then launch the date picker again, so we buffer\n // a bit and don't show the date picker within N ms of closing\n setTimeout(function() {\n closing = false;\n }, 100);\n\n emit('close');\n },\n\n destroy: function () {\n dp.close();\n detatchInputEvents();\n },\n\n render: function () {\n if (!dp.el) {\n return;\n }\n\n var hadFocus = dp.hasFocus();\n var html = dp.currentView().render(dp);\n html && (dp.el.firstChild.innerHTML = html);\n\n dp.adjustPosition();\n\n if (hadFocus || dp.shouldFocusOnRender) {\n focusCurrent(dp);\n }\n },\n\n // Conceptually similar to setState in React, updates\n // the view state and re-renders.\n setState: function (state) {\n for (var key in state) {\n dp.state[key] = state[key];\n }\n\n emit('statechange');\n dp.render();\n },\n };\n\n detatchInputEvents = attachInputEvents(input, dp);\n\n // Builds the initial view state\n // selectedDate is a special case and causes changes to hilightedDate\n // hilightedDate is set on open, so remains undefined initially\n // view is the current view (day, month, year)\n function initialState() {\n return {\n get selectedDate() {\n return selectedDate;\n },\n set selectedDate(dt) {\n if (dt && !opts.inRange(dt)) {\n return;\n }\n\n if (dt) {\n selectedDate = new Date(dt);\n dp.state.hilightedDate = selectedDate;\n } else {\n selectedDate = dt;\n }\n\n dp.updateInput(selectedDate);\n emit('select');\n dp.close();\n },\n view: 'day',\n };\n }\n\n return dp;\n }\n\n function createContainerElement(opts, containerHTML) {\n var el = document.createElement('div');\n\n el.className = opts.mode;\n el.innerHTML = containerHTML;\n\n return el;\n }\n\n function attachInputEvents(input, dp) {\n var bufferShow = bufferFn(5, function () {\n if (dp.shouldHide()) {\n dp.close();\n } else {\n dp.open();\n }\n });\n\n var off = [\n on('blur', input, bufferFn(150, function () {\n if (!dp.hasFocus()) {\n dp.close(true);\n }\n })),\n\n on('mousedown', input, function () {\n if (input === document.activeElement) {\n bufferShow();\n }\n }),\n\n on('focus', input, bufferShow),\n\n on('input', input, function (e) {\n var date = dp.opts.parse(e.target.value);\n isNaN(date) || dp.setState({\n hilightedDate: date\n });\n }),\n ];\n\n // Unregister all events that were registered above.\n return function() {\n off.forEach(function (f) {\n f();\n });\n };\n }\n\n function focusCurrent(dp) {\n var current = dp.el.querySelector('.dp-current');\n return current && current.focus();\n }\n\n function attachContainerEvents(dp) {\n var el = dp.el;\n var calEl = el.querySelector('.dp');\n\n // Hack to get iOS to show active CSS states\n el.ontouchstart = noop;\n\n function onClick(e) {\n e.target.className.split(' ').forEach(function(evt) {\n var handler = dp.currentView().onClick[evt];\n handler && handler(e, dp);\n });\n }\n\n // The calender fires a blur event *every* time we redraw\n // this means we need to buffer the blur event to see if\n // it still has no focus after redrawing, and only then\n // do we return focus to the input. A possible other approach\n // would be to set context.redrawing = true on redraw and\n // set it to false in the blur event.\n on('blur', calEl, bufferFn(150, function () {\n if (!dp.hasFocus()) {\n dp.close(true);\n }\n }));\n\n on('keydown', el, function (e) {\n if (e.keyCode === Key.enter) {\n onClick(e);\n } else {\n dp.currentView().onKeyDown(e, dp);\n }\n });\n\n // If the user clicks in non-focusable space, but\n // still within the date picker, we don't want to\n // hide, so we need to hack some things...\n on('mousedown', calEl, function (e) {\n e.target.focus && e.target.focus(); // IE hack\n if (document.activeElement !== e.target) {\n e.preventDefault();\n focusCurrent(dp);\n }\n });\n\n on('click', el, onClick);\n }\n\n function focusInput(input) {\n // When the modal closes, we need to focus the original input so the\n // user can continue tabbing from where they left off.\n input.focus();\n\n // iOS zonks out if we don't blur the input, so...\n if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {\n input.blur();\n }\n }\n\n /**\n * @file Defines the modal date picker behavior.\n */\n\n function ModalMode(input, emit, opts) {\n var dp = BaseMode(input, emit, opts);\n\n // In modal mode, users really shouldn't be able to type in\n // the input, as all input is done via the calendar.\n input.readonly = true;\n\n // In modal mode, we need to know when the user has tabbed\n // off the end of the calendar, and set focus to the original\n // input. To do this, we add a special element to the DOM.\n // When the user tabs off the bottom of the calendar, they\n // will tab onto this element.\n dp.containerHTML += '.';\n\n return dp;\n }\n\n /**\n * @file Defines the dropdown date picker behavior.\n */\n\n function DropdownMode(input, emit, opts) {\n var dp = BaseMode(input, emit, opts);\n\n dp.shouldFocusOnBlur = false;\n\n Object.defineProperty(dp, 'shouldFocusOnRender', {\n get: function() {\n return input !== document.activeElement;\n }\n });\n\n dp.adjustPosition = function () {\n autoPosition(input, dp);\n };\n\n return dp;\n }\n\n function autoPosition(input, dp) {\n var inputPos = input.getBoundingClientRect();\n var win = window;\n\n adjustCalY(dp, inputPos, win);\n adjustCalX(dp, inputPos, win);\n\n dp.el.style.visibility = '';\n }\n\n function adjustCalX(dp, inputPos, win) {\n var cal = dp.el;\n var scrollLeft = win.pageXOffset;\n var inputLeft = inputPos.left + scrollLeft;\n var maxRight = win.innerWidth + scrollLeft;\n var offsetWidth = cal.offsetWidth;\n var calRight = inputLeft + offsetWidth;\n var shiftedLeft = maxRight - offsetWidth;\n var left = calRight > maxRight && shiftedLeft > 0 ? shiftedLeft : inputLeft;\n\n cal.style.left = left + 'px';\n }\n\n function adjustCalY(dp, inputPos, win) {\n var cal = dp.el;\n var scrollTop = win.pageYOffset;\n var inputTop = scrollTop + inputPos.top;\n var calHeight = cal.offsetHeight;\n var belowTop = inputTop + inputPos.height + 8;\n var aboveTop = inputTop - calHeight - 8;\n var isAbove = (aboveTop > 0 && belowTop + calHeight > scrollTop + win.innerHeight);\n var top = isAbove ? aboveTop : belowTop;\n\n if (cal.classList) {\n cal.classList.toggle('dp-is-above', isAbove);\n cal.classList.toggle('dp-is-below', !isAbove);\n }\n cal.style.top = top + 'px';\n }\n\n /**\n * @file Defines the permanent date picker behavior.\n */\n\n function PermanentMode(root, emit, opts) {\n var dp = BaseMode(root, emit, opts);\n\n dp.close = noop;\n dp.destroy = noop;\n dp.updateInput = noop;\n dp.shouldFocusOnRender = opts.shouldFocusOnRender;\n\n dp.computeSelectedDate = function () {\n return opts.hilightedDate;\n };\n\n dp.attachToDom = function () {\n root.appendChild(dp.el);\n };\n\n dp.open();\n\n return dp;\n }\n\n /**\n * @file Defines the various date picker modes (modal, dropdown, permanent)\n */\n\n function Mode(input, emit, opts) {\n input = input && input.tagName ? input : document.querySelector(input);\n\n if (opts.mode === 'dp-modal') {\n return ModalMode(input, emit, opts);\n }\n\n if (opts.mode === 'dp-below') {\n return DropdownMode(input, emit, opts);\n }\n\n if (opts.mode === 'dp-permanent') {\n return PermanentMode(input, emit, opts);\n }\n }\n\n /**\n * @file Defines simple event emitter behavior.\n */\n\n /**\n * Emitter constructs a new emitter object which has on/off methods.\n *\n * @returns {EventEmitter}\n */\n function Emitter() {\n var handlers = {};\n\n function onOne(name, handler) {\n (handlers[name] = (handlers[name] || [])).push(handler);\n }\n\n function onMany(fns) {\n for (var name in fns) {\n onOne(name, fns[name]);\n }\n }\n\n return {\n on: function (name, handler) {\n if (handler) {\n onOne(name, handler);\n } else {\n onMany(name);\n }\n\n return this;\n },\n\n emit: function (name, arg) {\n (handlers[name] || []).forEach(function (handler) {\n handler(name, arg);\n });\n },\n\n off: function (name, handler) {\n if (!name) {\n handlers = {};\n } else if (!handler) {\n handlers[name] = [];\n } else {\n handlers[name] = (handlers[name] || []).filter(function (h) {\n return h !== handler;\n });\n }\n\n return this;\n }\n };\n }\n\n /**\n * @file The root date picker file, defines public exports for the library.\n */\n\n /**\n * The date picker language configuration\n * @typedef {Object} LangOptions\n * @property {Array.} [days] - Days of the week\n * @property {Array.} [months] - Months of the year\n * @property {string} today - The label for the 'today' button\n * @property {string} close - The label for the 'close' button\n * @property {string} clear - The label for the 'clear' button\n */\n\n /**\n * The configuration options for a date picker.\n *\n * @typedef {Object} DatePickerOptions\n * @property {LangOptions} [lang] - Configures the label text, defaults to English\n * @property {('dp-modal'|'dp-below'|'dp-permanent')} [mode] - The date picker mode, defaults to 'dp-modal'\n * @property {(string|Date)} [hilightedDate] - The date to hilight if no date is selected\n * @property {function(string|Date):Date} [parse] - Parses a date, the complement of the \"format\" function\n * @property {function(Date):string} [format] - Formats a date for displaying to user\n * @property {function(Date):string} [dateClass] - Associates a custom CSS class with a date\n * @property {function(Date):boolean} [inRange] - Indicates whether or not a date is selectable\n * @property {(string|Date)} [min] - The minimum selectable date (inclusive, default 100 years ago)\n * @property {(string|Date)} [max] - The maximum selectable date (inclusive, default 100 years from now)\n */\n\n /**\n * The state values for the date picker\n *\n * @typedef {Object} DatePickerState\n * @property {string} view - The current view 'day' | 'month' | 'year'\n * @property {Date} selectedDate - The date which has been selected by the user\n * @property {Date} hilightedDate - The date which is currently hilighted / active\n */\n\n /**\n * An instance of TinyDatePicker\n *\n * @typedef {Object} DatePicker\n * @property {DatePickerState} state - The values currently displayed.\n * @property {function} on - Adds an event handler\n * @property {function} off - Removes an event handler\n * @property {function} setState - Changes the current state of the date picker\n * @property {function} open - Opens the date picker\n * @property {function} close - Closes the date picker\n * @property {function} destroy - Destroys the date picker (removing all handlers from the input, too)\n */\n\n /**\n * TinyDatePicker constructs a new date picker for the specified input\n *\n * @param {HTMLElement | string} input The input or CSS selector associated with the datepicker\n * @param {DatePickerOptions} opts The options for initializing the date picker\n * @returns {DatePicker}\n */\n function TinyDatePicker(input, opts) {\n var emitter = Emitter();\n var options = DatePickerOptions(opts);\n var mode = Mode(input, emit, options);\n var me = {\n get state() {\n return mode.state;\n },\n on: emitter.on,\n off: emitter.off,\n setState: mode.setState,\n open: mode.open,\n close: mode.close,\n destroy: mode.destroy,\n };\n\n function emit(evt) {\n emitter.emit(evt, me);\n }\n\n return me;\n }\n\n return TinyDatePicker;\n\n})));\n","const attributes = [\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderRightWidth',\n 'borderTopStyle',\n 'borderRightStyle',\n 'borderBottomStyle',\n 'borderLeftStyle',\n 'borderTopWidth',\n 'boxSizing',\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'height',\n 'letterSpacing',\n 'lineHeight',\n 'marginBottom',\n 'marginLeft',\n 'marginRight',\n 'marginTop',\n 'outlineWidth',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'textAlign',\n 'textOverflow',\n 'textTransform',\n 'whiteSpace',\n 'wordBreak',\n 'wordWrap',\n];\n\n/**\n * Create a mirror\n *\n * @param {Element} element The element\n * @param {string} html The html\n *\n * @return {object} The mirror object\n */\nconst createMirror = (element, html) => {\n\n /**\n * The mirror element\n */\n const mirror = document.createElement('div');\n\n /**\n * Create the CSS for the mirror object\n *\n * @return {object} The style object\n */\n const mirrorCss = () => {\n const css = {\n position: 'absolute',\n left: -9999,\n top: 0,\n zIndex: -2000\n };\n\n if (element.tagName === 'TEXTAREA') {\n attributes.push('width');\n }\n\n attributes.forEach((attr) => {\n css[attr] = getComputedStyle(element)[attr];\n });\n\n return css;\n };\n\n /**\n * Initialize the mirror\n *\n * @param {string} html The html\n *\n * @return {void}\n */\n const initialize = (html) => {\n const styles = mirrorCss();\n Object.keys(styles).forEach(key => {\n mirror.style[key] = styles[key];\n });\n mirror.innerHTML = html;\n element.parentNode.insertBefore(mirror, element.nextSibling);\n };\n\n /**\n * Get the rect\n *\n * @return {Rect} The bounding rect\n */\n const rect = () => {\n const marker = mirror.ownerDocument.getElementById('caret-position-marker');\n const boundingRect = {\n left: marker.offsetLeft,\n top: marker.offsetTop,\n height: marker.offsetHeight\n };\n mirror.parentNode.removeChild(mirror);\n\n return boundingRect;\n };\n\n initialize(html);\n\n return {\n rect,\n };\n};\n\nexport default createMirror;\n","/**\n * Check if a DOM Element is content editable\n *\n * @param {Element} element The DOM element\n *\n * @return {bool} If it is content editable\n */\nexport const isContentEditable = (element) => !!(\n element.contentEditable &&\n element.contentEditable === 'true'\n);\n\n/**\n * Get the context from settings passed in\n *\n * @param {object} settings The settings object\n *\n * @return {object} window and document\n */\nexport const getContext = (settings = {}) => {\n const { customPos, iframe, noShadowCaret } = settings;\n if (iframe) {\n return {\n iframe,\n window: iframe.contentWindow,\n document: iframe.contentDocument || iframe.contentWindow.document,\n noShadowCaret,\n customPos,\n };\n }\n\n return {\n window,\n document,\n noShadowCaret,\n customPos,\n };\n};\n\n/**\n * Get the offset of an element\n *\n * @param {Element} element The DOM element\n * @param {object} ctx The context\n *\n * @return {object} top and left\n */\nexport const getOffset = (element, ctx) => {\n const win = ctx && ctx.window || window;\n const doc = ctx && ctx.document || document;\n const rect = element.getBoundingClientRect();\n const docEl = doc.documentElement;\n const scrollLeft = win.pageXOffset || docEl.scrollLeft;\n const scrollTop = win.pageYOffset || docEl.scrollTop;\n\n return {\n top: rect.top + scrollTop,\n left: rect.left + scrollLeft\n };\n};\n\n/**\n * Check if a value is an object\n *\n * @param {any} value The value to check\n *\n * @return {bool} If it is an object\n */\nexport const isObject = (value) => typeof value === 'object' && value !== null;\n","import createMirror from './mirror';\nimport { getOffset as elementOffset } from './utils';\n\n/**\n * Create a Input caret object.\n *\n * @param {Element} element The element\n * @param {Object} ctx The context\n */\nconst createInputCaret = (element, ctx) => {\n\n /**\n * Get the current position\n *\n * @returns {int} The caret position\n */\n const getPos = () => {\n return element.selectionStart;\n };\n\n /**\n * Set the position\n *\n * @param {int} pos The position\n *\n * @return {Element} The element\n */\n const setPos = (pos) => {\n element.setSelectionRange(pos, pos);\n\n return element;\n };\n\n /**\n * The offset\n *\n * @param {int} pos The position\n *\n * @return {object} The offset\n */\n const getOffset = (pos) => {\n const rect = elementOffset(element);\n const position = getPosition(pos);\n\n return {\n top: rect.top + position.top + ctx.document.body.scrollTop,\n left: rect.left + position.left + ctx.document.body.scrollLeft,\n height: position.height,\n };\n };\n\n /**\n * Get the current position\n *\n * @param {int} pos The position\n *\n * @return {object} The position\n */\n const getPosition = (pos) => {\n const format = (val) => {\n let value = val.replace(/<|>|`|\"|&/g, '?')\n .replace(/\\r\\n|\\r|\\n/g,'
');\n return value;\n };\n\n if (ctx.customPos || ctx.customPos === 0) {\n pos = ctx.customPos;\n }\n\n const position = pos === undefined ? getPos() : pos;\n const startRange = element.value.slice(0, position);\n const endRange = element.value.slice(position);\n let html = `${format(startRange)}`;\n html += '|';\n html += `${format(endRange)}`;\n\n const mirror = createMirror(element, html);\n const rect = mirror.rect();\n rect.pos = getPos();\n\n return rect;\n };\n\n return {\n getPos,\n setPos,\n getOffset,\n getPosition,\n };\n};\n\nexport default createInputCaret;\n","/**\n * Create an Editable Caret\n * @param {Element} element The editable element\n * @param {object|null} ctx The context\n *\n * @return {EditableCaret}\n */\nconst createEditableCaret = (element, ctx) => {\n\n /**\n * Set the caret position\n *\n * @param {int} pos The position to se\n *\n * @return {Element} The element\n */\n const setPos = (pos) => {\n const sel = ctx.window.getSelection();\n if (sel) {\n let offset = 0;\n let found = false;\n const find = (position, parent) => {\n for (let i = 0; i < parent.childNodes.length; i++) {\n const node = parent.childNodes[i];\n if (found) {\n break;\n }\n if (node.nodeType === 3) {\n if (offset + node.length >= position) {\n found = true;\n const range = ctx.document.createRange();\n range.setStart(node, position - offset);\n sel.removeAllRanges();\n sel.addRange(range);\n break;\n } else {\n offset += node.length;\n }\n } else {\n find(pos, node);\n }\n }\n };\n find(pos, element);\n }\n\n return element;\n };\n\n /**\n * Get the offset\n *\n * @return {object} The offset\n */\n const getOffset = () => {\n const range = getRange();\n let offset = {\n height: 0,\n left: 0,\n right: 0,\n };\n\n if (!range) {\n return offset;\n }\n\n const hasCustomPos = ctx.customPos || ctx.customPos === 0;\n\n // endContainer in Firefox would be the element at the start of\n // the line\n if ((range.endOffset - 1 > 0 && range.endContainer !== element) || hasCustomPos) {\n const clonedRange = range.cloneRange();\n const fixedPosition = hasCustomPos ? ctx.customPos : range.endOffset;\n clonedRange.setStart(range.endContainer, fixedPosition - 1 < 0 ? 0 : fixedPosition - 1);\n clonedRange.setEnd(range.endContainer, fixedPosition);\n const rect = clonedRange.getBoundingClientRect();\n offset = {\n height: rect.height,\n left: rect.left + rect.width,\n top: rect.top,\n };\n clonedRange.detach();\n }\n\n if ((!offset || (offset && offset.height === 0)) && !ctx.noShadowCaret) {\n const clonedRange = range.cloneRange();\n const shadowCaret = ctx.document.createTextNode('|');\n clonedRange.insertNode(shadowCaret);\n clonedRange.selectNode(shadowCaret);\n const rect = clonedRange.getBoundingClientRect();\n offset = {\n height: rect.height,\n left: rect.left,\n top: rect.top,\n };\n shadowCaret.parentNode.removeChild(shadowCaret);\n clonedRange.detach();\n }\n\n if (offset) {\n const doc = ctx.document.documentElement;\n offset.top += ctx.window.pageYOffset - (doc.clientTop || 0);\n offset.left += ctx.window.pageXOffset - (doc.clientLeft || 0);\n }\n\n return offset;\n };\n\n /**\n * Get the position\n *\n * @return {object} The position\n */\n const getPosition = () => {\n const offset = getOffset();\n const pos = getPos();\n const rect = element.getBoundingClientRect();\n const inputOffset = {\n top: rect.top + ctx.document.body.scrollTop,\n left: rect.left + ctx.document.body.scrollLeft\n };\n offset.left -= inputOffset.left;\n offset.top -= inputOffset.top;\n offset.pos = pos;\n\n return offset;\n };\n\n /**\n * Get the range\n *\n * @return {Range|null}\n */\n const getRange = () => {\n if (!ctx.window.getSelection) {\n return;\n }\n const sel = ctx.window.getSelection();\n\n return sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n };\n\n /**\n * Get the caret position\n *\n * @return {int} The position\n */\n const getPos = () => {\n const range = getRange();\n const clonedRange = range.cloneRange();\n clonedRange.selectNodeContents(element);\n clonedRange.setEnd(range.endContainer, range.endOffset);\n const pos = clonedRange.toString().length;\n clonedRange.detach();\n\n return pos;\n };\n\n return {\n getPos,\n setPos,\n getPosition,\n getOffset,\n getRange,\n };\n};\n\nexport default createEditableCaret;\n","import createInputCaret from './input';\nimport createEditableCaret from './editable';\nimport {\n isContentEditable,\n getContext,\n isObject,\n} from './utils';\n\nexport { getOffset } from './utils';\n\nconst createCaret = (element, ctx) => {\n if (isContentEditable(element)) {\n return createEditableCaret(element, ctx);\n }\n\n return createInputCaret(element, ctx);\n};\n\nexport const position = (element, value, settings = {}) => {\n let options = settings;\n if (isObject(value)) {\n options = value;\n value = null;\n }\n const ctx = getContext(options);\n const caret = createCaret(element, ctx);\n\n if (value || value === 0) {\n return caret.setPos(value);\n }\n\n return caret.getPosition();\n};\n\n/**\n *\n * @param {Element} element The DOM element\n * @param {number|undefined} value The value to set\n * @param {object} settings Any settings for context\n */\nexport const offset = (element, value, settings = {}) => {\n let options = settings;\n if (isObject(value)) {\n options = value;\n value = null;\n }\n\n const ctx = getContext(options);\n const caret = createCaret(element, ctx);\n return caret.getOffset(value);\n};\n","import * as DataEvent from '../events/DataEvent';\nimport DateUtils from '../utilities/DateUtils';\nimport\n{\n position,\n offset\n}\nfrom 'caret-pos';\nimport EventEmitter from '../events/EventEmitter';\nimport * as EditorEvent from '../events/EditorEvent';\nclass TextEditor extends EventEmitter\n{\n /**\n * Text Editor UI Component\n * @constructor\n * @param {object} textEditor - Text area that will edit text\n * @param {number} scrollLimit - YPos where editor position will become fixed\n */\n //--------------------------\n // constructor\n //--------------------------\n constructor(textEditor, scrollLimit)\n {\n super();\n hljs.initHighlightingOnLoad();\n this.dateUtils = new DateUtils();\n this.textEditor = textEditor;\n this.fixLimit = scrollLimit;\n this.caretPos = null;\n this.url = '';\n let self = this;\n this.setInputs();\n window.addEventListener(\"scroll\", f =>\n {\n var fixLimit = this.fixLimit;\n if (window.pageYOffset >= fixLimit)\n {\n document.getElementById('edit-control').style.position = \"fixed\"\n }\n else\n {\n document.getElementById('edit-control').style.position = \"relative\"\n }\n });\n this.refresh();\n }\n //--------------------------\n // methods\n //--------------------------\n setInputs()\n {\n let self = this;\n var editorButtons = document.querySelectorAll('.editor-button');\n for (var i = 0, length = editorButtons.length; i < length; i++)\n {\n editorButtons[i].addEventListener('click', e => this.handleEditorOption(e), false);\n }\n this.textEditor.addEventListener('input', f =>\n {\n if (f.inputType == \"insertParagraph\")\n {\n var caret = position(self.textEditor).pos + 1;\n var spiffed = hljs.highlight('markdown', self.textEditor.innerText).value;\n var temp = document.createElement(\"div\");\n temp.innerText = spiffed;\n self.textEditor.innerHTML = temp.innerText;\n position(self.textEditor, caret)\n }\n else\n {\n self.refresh()\n }\n })\n }\n refresh()\n {\n var caret = position(this.textEditor).pos;\n var spiffed = hljs.highlight('markdown', this.textEditor.innerText).value;\n spiffed = spiffed.replace(new RegExp('\\r?\\n','g'), '
');\n var temp = document.createElement(\"div\");\n temp.innerText = spiffed;\n this.textEditor.innerHTML = temp.innerText;\n position(this.textEditor, caret)\n this.textEditor.style.maxWidth = '900px';\n }\n notify(type, data)\n {\n switch (type)\n {\n case DataEvent.POST_UPDATED:\n document.getElementById('submit-update').classList.add('icon-hide');\n document.getElementById('submit-good').classList.remove('icon-hide');\n document.getElementById('edit-update').classList.remove('submit-start');\n document.getElementById('edit-update').classList.add('submit-cool');\n setTimeout(f =>\n {\n document.getElementById('submit-update').classList.remove('icon-hide');\n document.getElementById('submit-good').classList.add('icon-hide');\n document.getElementById('edit-update').classList.add('submit-start');\n document.getElementById('edit-update').classList.remove('submit-cool');\n }, 2000);\n break;\n case DataEvent.POST_ADDED:\n // do nothing\n break;\n case EditorEvent.EDITOR_UPLOAD_POST_IMAGE:\n position(this.textEditor, this.caretPos);\n var sel, range, pulled;\n sel = window.getSelection(); //console.log(sel)\n //console.log(note.message)\n if (sel.rangeCount)\n {\n range = sel.getRangeAt(0);\n pulled = sel.getRangeAt(0).toString();\n range.deleteContents();\n range.insertNode(document.createTextNode(\"![image alt text](\" + data + \" 'image title')\"));\n }\n this.refresh();\n break;\n }\n }\n //--------------------------\n // event handlers\n //--------------------------\n handleEditorOption(e)\n {\n e.preventDefault();\n var self = this;\n var sel, range, pulled;\n sel = window.getSelection(); //console.log(sel)\n if (sel.rangeCount)\n {\n range = sel.getRangeAt(0);\n pulled = sel.getRangeAt(0).toString();\n range.deleteContents();\n switch (e.target.id)\n {\n case \"edit-bold\":\n range.insertNode(document.createTextNode(\"**\" + pulled + \"**\"));\n break;\n case \"edit-italic\":\n range.insertNode(document.createTextNode(\"*\" + pulled + \"*\"));\n break;\n case \"edit-strikethrough\":\n range.insertNode(document.createTextNode(\"\" + pulled + \"\"));\n break;\n case \"edit-header1\":\n range.insertNode(document.createTextNode(\"# \" + pulled));\n break;\n case \"edit-header2\":\n range.insertNode(document.createTextNode(\"## \" + pulled));\n break;\n case \"edit-header3\":\n range.insertNode(document.createTextNode(\"### \" + pulled));\n break;\n case \"edit-image\":\n this.caretPos = position(this.textEditor).pos;\n this.emitEvent(EditorEvent.EDITOR_UPLOAD_POST_IMAGE);\n break;\n case \"submit-save\":\n case \"edit-save\":\n this.emitEvent(EditorEvent.EDITOR_SAVE);\n break;\n case \"submit-update\":\n case \"edit-update\":\n this.emitEvent(EditorEvent.EDITOR_UPDATE);\n break\n case \"edit-link\":\n range.insertNode(document.createTextNode(\"[\" + pulled + \"](PASTE URL HERE)\"));\n break;\n case \"edit-delete\":\n this.emitEvent(EditorEvent.EDITOR_DELETE);\n break\n default:\n //range.insertNode(document.createTextNode(\"[\" + self.url + \"](PASTE URL HERE)\"));\n break;\n }\n }\n this.refresh()\n }\n}\nexport default TextEditor","//TOOLS\nimport DataUtils,\n{\n REQUEST_TYPE_GET,\n REQUEST_TYPE_PUT,\n REQUEST_TYPE_POST,\n REQUEST_TYPE_DELETE,\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_FORM\n}\nfrom '../../../../../brain/tools/utilities/DataUtils';\nimport * as DataEvent from '../../../../../brain/tools/events/DataEvent';\nimport PostActions from '../actions/PostActions';\nimport * as EditorEvent from '../../../../../brain/tools/events/EditorEvent';\nimport TinyDatePicker from 'tiny-date-picker';\nimport DateUtils from '../../../../../brain/tools/utilities/DateUtils';\nimport TextEditor from '../../../../../brain/tools/ui/TextEditor';\nimport DBUtils,\n{\n FINAL_KEY\n}\nfrom '../../../../../brain/tools/utilities/DBUtils';\nexport default class PostEditor\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n let self = this;\n this.dataUtils = new DataUtils();\n this.dateUtils = new DateUtils();\n this.urlPieces = document.URL.split(\"/\");\n this.dbUtils = new DBUtils();\n this.post = [];\n this.postID = null;\n if (document.getElementById('post-edit-index').getAttribute('data-index'))\n {\n this.postID = document.getElementById('post-edit-index').getAttribute('data-index');\n this.dbUtils.getPost(this.postID).then(body =>\n {\n self.post = body.post;\n this.start()\n }).catch(err =>\n {\n //console.log(err)\n })\n }\n else\n {\n this.start()\n }\n if (document.getElementById('edit-post-text'))\n {\n this.editor = new TextEditor(document.getElementById('edit-post-text'), document.getElementById('header').offsetHeight + document.getElementById('post-header').offsetHeight + document.getElementById('post-feature').offsetHeight);\n this.editor.addListener(EditorEvent.EDITOR_DELETE, f => this.handleEditorOptions(EditorEvent.EDITOR_DELETE), false)\n this.editor.addListener(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, f => this.handleEditorOptions(EditorEvent.EDITOR_UPLOAD_POST_IMAGE), false)\n this.editor.addListener(EditorEvent.EDITOR_UPDATE, f => this.handleEditorOptions(EditorEvent.EDITOR_UPDATE), false)\n this.editor.addListener(EditorEvent.EDITOR_SAVE, f => this.handleEditorOptions(EditorEvent.EDITOR_SAVE), false)\n document.getElementById('post-image-upload').addEventListener('change', e =>\n {\n self.handleImageUpload(e.target.id, e.target.files);\n }, false);\n TinyDatePicker(document.getElementById('post-date'),\n {\n mode: 'dp-below',\n format(date)\n {\n //return date;\n return self.dateUtils.getDate('origin', date);\n }\n });\n }\n }\n //--------------------------\n // methods\n //--------------------------\n start()\n {\n let self = this;\n if (document.getElementById('featured-image-drop'))\n {\n document.getElementById('featured-image-drop').addEventListener('dragover', this.handleImageActions, false);\n document.getElementById('featured-image-drop').addEventListener('drop', this.handleImageActions, false);\n document.getElementById('featured-image-upload').addEventListener('change', e => this.handleImageActions(e), false);\n if (document.getElementById('new-feature-upload'))\n {\n document.getElementById('new-feature-upload').addEventListener('click', e =>\n {\n document.getElementById('featured-image-upload').click();\n })\n }\n var optionButtons = document.querySelectorAll('.post-option-btn');\n for (var i = 0, length = optionButtons.length; i < length; i++)\n {\n optionButtons[i].addEventListener('click', e => this.handlePostOptions(e), false);\n }\n }\n }\n //--------------------------\n // event handlers\n //--------------------------\n handlePostOptions(e)\n {\n let currentOption;\n switch (e.target.id)\n {\n case \"option-page-icon\":\n case \"option-page\":\n currentOption = document.getElementById('option-page');\n break;\n case \"option-feature-icon\":\n case \"option-feature\":\n currentOption = document.getElementById('option-feature');\n break;\n case \"option-published-icon\":\n case \"option-published\":\n currentOption = document.getElementById('option-published');\n break;\n }\n let active = currentOption.getAttribute('data-active');\n (active == 'false') ? currentOption.setAttribute('data-active', 'true'): currentOption.setAttribute('data-active', 'false')\n }\n handleEditorOptions(e)\n {\n let self = this;\n switch (e)\n {\n case EditorEvent.EDITOR_SAVE:\n new PostActions().update(this.postID, this.post, PostEditor.uploadFiles, FINAL_KEY).then(response =>\n {\n setTimeout(f =>\n {\n self.dbUtils.getPost(Number(response.response.newPost)).then(r =>\n {\n window.location = \"/@/dashboard/posts/edit/\" + r.post.uuid;\n })\n }, 100);\n }).catch(err =>\n {\n //console.log(\"ERROR\", err)\n })\n break\n case EditorEvent.EDITOR_UPDATE:\n new PostActions().update(this.postID, this.post, PostEditor.uploadFiles, FINAL_KEY).then(response =>\n {\n this.editor.notify(DataEvent.POST_UPDATED, this.postID);\n }).catch(err =>\n {\n //console.log(\"ERRORZ\", err)\n })\n break;\n case EditorEvent.EDITOR_DELETE:\n if (confirm('Aye! You know you\\'re deleting this post, right?'))\n {\n new PostActions().deletePost(this.postID, this.post).then((response) =>\n {\n setTimeout(f =>\n {\n window.location = \"/@/dashboard/posts/\"\n }, 100);\n }).catch((err) =>\n {\n console.log(err)\n });\n }\n else\n {\n // Do nothing!\n }\n break;\n case EditorEvent.EDITOR_UPLOAD_POST_IMAGE:\n document.getElementById('post-image-upload').click();\n break;\n }\n }\n handleImageActions(e)\n {\n e.stopPropagation();\n e.preventDefault();\n var self = this;\n switch (e.type)\n {\n case \"dragover\":\n e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.\n break;\n case \"change\":\n case \"drop\":\n (e.type == \"drop\") ? PostEditor.uploadFiles = e.dataTransfer.files: PostEditor.uploadFiles = e.target.files;\n for (var i = 0, f; f = PostEditor.uploadFiles[i]; i++)\n {\n // Only process image files.\n if (!f.type.match('image.*'))\n {\n continue;\n }\n var reader = new FileReader();\n // Closure to capture the file information.\n reader.onload = (function(theFile)\n {\n return function(f)\n {\n // Render thumbnail.\n var image = document.createElement('img');\n image.src = f.target.result;\n image.title = escape(theFile.name);\n var span = document.createElement('div');\n span.innerHTML = [''\n ].join('');\n //document.getElementById('featured-image-drop').insertBefore(span, null);\n document.getElementById('featured-image-drop').innerHTML = '';\n document.getElementById('featured-image-drop').appendChild(image);\n };\n })(f);\n // Read in the image file as a data URL.\n reader.readAsDataURL(f);\n }\n if (e.target.id == \"featured-image-upload\") this.handleImageUpload(e.target.id, PostEditor.uploadFiles);\n break;\n }\n }\n handleImageUpload(type, files)\n {\n let url = \"\"\n let eventType = \"\";\n let self = this;\n (type == \"featured-image-upload\") ? url = \"/api/post/add-feature-image\": url = \"/api/post/add-post-image\";\n (type == \"featured-image-upload\") ? eventType = DataEvent.FEATURE_IMAGE_ADDED: eventType = DataEvent.POST_IMAGE_ADDED\n var imageData = new FormData();\n for (var i = 0; i < files.length; i++)\n {\n var file = files[i];\n // Check the file type.\n if (!file.type.match('image.*'))\n {\n continue;\n }\n (type == \"featured-image-upload\") ? imageData.append('feature_image', file, file.name): imageData.append('post_image', file, file.name);\n }\n this.dataUtils.request(url, eventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData).then((response) =>\n {\n let r = JSON.parse(response.request['response']);\n if (r.message == DataEvent.POST_IMAGE_ADDED) self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, r.url);\n }).catch((err) =>\n {\n //console.log(err)\n })\n }\n}\nPostEditor.uploadFiles = [];","import PostEditor from './PostEditor';\nexport default class PostIndex\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor(page)\n {\n this.currentPage = null;\n this.choosePage(page);\n this.start();\n }\n //--------------------------\n // methods\n //--------------------------\n start()\n {\n let self = this;\n }\n choosePage(page)\n {\n this.currentPage = '';\n switch (page)\n {\n case \"edit\":\n case \"add\":\n this.currentPage = new PostEditor();\n break;\n default:\n //just chill\n break;\n }\n }\n //--------------------------\n // event handlers\n //--------------------------\n}","import PostIndex from './PostIndex';\n\nexport default class DashManager {\n //--------------------------\n // constructor\n //--------------------------\n constructor() {\n this.currentDisplay = '';\n this.urlPieces = document.URL.split(\"/\");\n this.chooseDisplay(this.urlPieces[5], this.urlPieces[6]);\n }\n //--------------------------\n // methods\n //--------------------------\n start() {\n let self = this;\n \n }\n\n chooseDisplay(section, page) {\n this.currentDisplay = '';\n switch (section) {\n case 'posts':\n this.currentDisplay = new PostIndex(page);\n break;\n \n default:\n // just chill\n break;\n }\n this.start();\n\n }\n //--------------------------\n // event handlers\n //--------------------------\n\n}","import DataUtils,\n{\n REQUEST_TYPE_GET,\n REQUEST_TYPE_PUT,\n REQUEST_TYPE_POST,\n REQUEST_TYPE_DELETE,\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_FORM\n}\nfrom '../../../../brain/tools/utilities/DataUtils';\nimport * as DataEvent from '../../../../brain/tools/events/DataEvent';\nimport DashManager from './controllers/DashManager';\nimport DBUtils from '../../../../brain/tools/utilities/DBUtils';\nexport default class Base\n{\n //--------------------------\n // constructor\n //--------------------------\n constructor()\n {\n var self = this;\n this.dashManager = [];\n this.dataUtils = new DataUtils();\n this.dbUtils = new DBUtils();\n this.settings = [];\n this.storeLocalData();\n }\n start()\n {\n this.dashManager = new DashManager();\n }\n //--------------------------\n // methods\n //--------------------------\n storeLocalData()\n {\n var self = this;\n this.dataUtils.request('/api/post/json', DataEvent.SETTINGS_LOADED).then((response) =>\n {\n let posts = JSON.parse(response.request['response']);\n\n let list = [];\n for (let index = 0; index < posts.length; index++) {\n list.push({id:posts[index].id ,post:posts[index].post});\n }\n self.dbUtils.syncLocal(list).then(r=>{\n self.start();\n }).catch(err=>{\n console.log(err);\n });\n }).catch((err) =>\n {\n console.log(err);\n });\n }\n //--------------------------\n // event handlers\n //--------------------------\n}","import Base from './Base'\n\ndocument.addEventListener('DOMContentLoaded', function() {\n\n var base = new Base();\n}, false);\n"]} \ No newline at end of file diff --git a/themes/dash/settings.pug b/themes/dash/settings.pug index 76133f2..5425709 100644 --- a/themes/dash/settings.pug +++ b/themes/dash/settings.pug @@ -2,5 +2,16 @@ extends frame block main-content #settings-index #settings-index-wrapper - h2 Settings + #member-avatar-drop + img(src="") + input(id="avatar-upload" type="file" name="avatar-image-upload") + input(type='text', name='handle' class='settings-handle', placeholder='handle', value=member.handle, autofocus) + input(type='text', name='email' class='settings-email', placeholder='email', value=member.email, autofocus) + br + input(type='text', name='base-url' class='settings-url', placeholder='url', value=settings.url, autofocus) + textarea(id="settings_desc" type='text', name='settings_desc' class='settings-dec', placeholder='description stuff', autofocus) + =settings.description + + br + button#privacy-toggle SITE IS PUBLIC diff --git a/themes/dash/src/styles/main/_colors.styl b/themes/dash/src/styles/main/_colors.styl index 6316be3..aab250e 100644 --- a/themes/dash/src/styles/main/_colors.styl +++ b/themes/dash/src/styles/main/_colors.styl @@ -1,4 +1,5 @@ $primary = #374857; +//$primary = #200317; deep purple $secondary = #b2cce5; $tertiary = #f5ab35; $highlight = #fc6399; diff --git a/themes/default/theme.json b/themes/default/theme.json new file mode 100644 index 0000000..8a07056 --- /dev/null +++ b/themes/default/theme.json @@ -0,0 +1,7 @@ +{ + "name": "default", + "display-name":"Fipama Oh Won", + "author": "Are0h", + "description": "The most dangerous default theme in the known universe.", + "version": "1.0.0" +} \ No newline at end of file diff --git a/themes/the-twelfth-house/theme.json b/themes/the-twelfth-house/theme.json new file mode 100644 index 0000000..ca2b803 --- /dev/null +++ b/themes/the-twelfth-house/theme.json @@ -0,0 +1,7 @@ +{ + "name": "the-twelfth-house", + "display-name":"The Twelfth House", + "author": "Are0h", + "description": "The official theme for the personal site of Ro, The Twelfth House", + "version": "3.0.0" +} \ No newline at end of file